aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Vanlaer <vincent.vanlaer@skynet.be>2019-02-15 18:29:47 +0100
committerDrew DeVault <sir@cmpwn.com>2019-02-18 15:11:48 -0500
commitc07d91ca96d9362f2dfe2757ddba31f3c812b63c (patch)
treecbf7d05a9cdb984fbe3f8bd55cae389a41356681
parentb02198a0d14d8d58a85d357d94c801bad4c56764 (diff)
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) {
dx, dy, dx_unaccel, dy_unaccel);
struct wlr_surface *surface = NULL;
+ struct sway_node *node = NULL;
double sx, sy;
- struct sway_node *node = node_at_coords(cursor->seat,
- cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
-
if (cursor->active_constraint) {
+ node = node_at_coords(cursor->seat,
+ cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
+
if (cursor->active_constraint->surface != surface) {
return;
}
@@ -445,8 +446,13 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) {
}
wlr_cursor_move(cursor->cursor, event->device, dx, dy);
+
+ // Recalculate pointer location after layout checks
+ node = node_at_coords(cursor->seat,
+ cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
+
cursor_send_pointer_motion(cursor, event->time_msec, node, surface,
- sx + dx, sy + dy);
+ sx, sy);
transaction_commit_dirty();
}