Skip to content

Instantly share code, notes, and snippets.

@sheenobu
Created June 1, 2019 01:55
Show Gist options
  • Save sheenobu/42e9485f0ebacbc3c331c15e3fa700b3 to your computer and use it in GitHub Desktop.
Save sheenobu/42e9485f0ebacbc3c331c15e3fa700b3 to your computer and use it in GitHub Desktop.
gdb session. drag window to top of the screen
> gdb ./build/sway/sway
(gdb) run -c config
...
Thread 2 "sway:disk$0" received signal SIG33, Real-time event 33.
(gdb) list handle_cursor_motion_absolute
264 e->unaccel_dx, e->unaccel_dy);
265 transaction_commit_dirty();
266 }
267
268 static void handle_cursor_motion_absolute(
269 struct wl_listener *listener, void *data) {
270 struct sway_cursor *cursor =
271 wl_container_of(listener, cursor, motion_absolute);
272 struct wlr_event_pointer_motion_absolute *event = data;
273
(gdb)
274 double lx, ly;
275 wlr_cursor_absolute_to_layout_coords(cursor->cursor, event->device,
276 event->x, event->y, &lx, &ly);
277
278 double dx = lx - cursor->cursor->x;
279 double dy = ly - cursor->cursor->y;
280
281 cursor_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy);
282 transaction_commit_dirty();
283 }
(gdb) b 281
Breakpoint 1 at 0x42f50a: file ../sway/input/cursor.c, line 281.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>p cursor->cursor->x
>p cursor->cursor->y
>p lx
>p ly
>end
(gdb) c
281 cursor_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy);
$23351 = 1681
$23352 = 0
$23353 = 1681
$23354 = -26.000000000000004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment