diff options
author | Vincent Vanlaer <vincent.vanlaer@skynet.be> | 2019-02-15 18:29:47 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-02-16 21:46:19 +0100 |
commit | cfacf85755849997ae3b25d2fa241378e0ebf0b9 (patch) | |
tree | 63b2214cefa24031758ce765e293010ed602497a | |
parent | Merge pull request #3698 from yabirgb/master (diff) | |
download | sway-cfacf85755849997ae3b25d2fa241378e0ebf0b9.tar.gz sway-cfacf85755849997ae3b25d2fa241378e0ebf0b9.tar.zst sway-cfacf85755849997ae3b25d2fa241378e0ebf0b9.zip |
Check layout before getting pointer surface coords
This fixes issues of clients at the edge of the screen, like swaybar,
ignoring buttons.
-rw-r--r-- | sway/input/cursor.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 5ede6e74..170532be 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -425,11 +425,12 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) { | |||
425 | dx, dy, dx_unaccel, dy_unaccel); | 425 | dx, dy, dx_unaccel, dy_unaccel); |
426 | 426 | ||
427 | struct wlr_surface *surface = NULL; | 427 | struct wlr_surface *surface = NULL; |
428 | struct sway_node *node = NULL; | ||
428 | double sx, sy; | 429 | double sx, sy; |
429 | struct sway_node *node = node_at_coords(cursor->seat, | ||
430 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
431 | |||
432 | if (cursor->active_constraint) { | 430 | if (cursor->active_constraint) { |
431 | node = node_at_coords(cursor->seat, | ||
432 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
433 | |||
433 | if (cursor->active_constraint->surface != surface) { | 434 | if (cursor->active_constraint->surface != surface) { |
434 | return; | 435 | return; |
435 | } | 436 | } |
@@ -445,8 +446,13 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) { | |||
445 | } | 446 | } |
446 | 447 | ||
447 | wlr_cursor_move(cursor->cursor, event->device, dx, dy); | 448 | wlr_cursor_move(cursor->cursor, event->device, dx, dy); |
449 | |||
450 | // Recalculate pointer location after layout checks | ||
451 | node = node_at_coords(cursor->seat, | ||
452 | cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); | ||
453 | |||
448 | cursor_send_pointer_motion(cursor, event->time_msec, node, surface, | 454 | cursor_send_pointer_motion(cursor, event->time_msec, node, surface, |
449 | sx + dx, sy + dy); | 455 | sx, sy); |
450 | transaction_commit_dirty(); | 456 | transaction_commit_dirty(); |
451 | } | 457 | } |
452 | 458 | ||