aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Vincent Vanlaer <vincent.vanlaer@skynet.be>2019-02-15 18:29:47 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-18 15:11:48 -0500
commitc07d91ca96d9362f2dfe2757ddba31f3c812b63c (patch)
treecbf7d05a9cdb984fbe3f8bd55cae389a41356681
parentDisable unneeded wlroots subproject features (diff)
downloadsway-c07d91ca96d9362f2dfe2757ddba31f3c812b63c.tar.gz
sway-c07d91ca96d9362f2dfe2757ddba31f3c812b63c.tar.zst
sway-c07d91ca96d9362f2dfe2757ddba31f3c812b63c.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.c14
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