diff options
author | Rouven Czerwinski <rouven@czerwinskis.de> | 2019-01-15 18:09:34 +0100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-15 14:06:48 -0500 |
commit | f7309778a700972f7f4cdd529670ff3430da42dd (patch) | |
tree | 8a6bc4d3d5924ca0f14441104533a66154a46885 /sway/input/cursor.c | |
parent | 023c92423e0ac1d538af25c6bcd6827f29527e10 (diff) |
cursor: send clear_focus on hide and enter event on unhide
Clear the focus when we hide the cursor and show it again during the unhide
action. The unhide function will rebase the cursor after the unhide.
Tested by looking at the WAYLAND_DEBUG=1 output of termite.
Also call cursor_handle_activity before sending pointer events to send the enter
events to the surface if the cursor was hidden before.
Fixes #3431
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 08222494..731e82ad 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -275,6 +275,7 @@ static int hide_notify(void *data) { struct sway_cursor *cursor = data; wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0); cursor->hidden = true; + wlr_seat_pointer_clear_focus(cursor->seat->wlr_seat); return 1; } @@ -313,6 +314,7 @@ void cursor_unhide(struct sway_cursor *cursor) { cursor->image = NULL; cursor_set_image(cursor, image, cursor->image_client); } + cursor_rebase(cursor); } void cursor_send_pointer_motion(struct sway_cursor *cursor, @@ -388,10 +390,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, static void handle_cursor_motion(struct wl_listener *listener, void *data) { struct sway_cursor *cursor = wl_container_of(listener, cursor, motion); struct wlr_event_pointer_motion *event = data; + cursor_handle_activity(cursor); wlr_cursor_move(cursor->cursor, event->device, event->delta_x, event->delta_y); cursor_send_pointer_motion(cursor, event->time_msec); - cursor_handle_activity(cursor); transaction_commit_dirty(); } @@ -400,9 +402,9 @@ static void handle_cursor_motion_absolute( struct sway_cursor *cursor = wl_container_of(listener, cursor, motion_absolute); struct wlr_event_pointer_motion_absolute *event = data; + cursor_handle_activity(cursor); wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y); cursor_send_pointer_motion(cursor, event->time_msec); - cursor_handle_activity(cursor); transaction_commit_dirty(); } @@ -698,9 +700,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor, static void handle_cursor_button(struct wl_listener *listener, void *data) { struct sway_cursor *cursor = wl_container_of(listener, cursor, button); struct wlr_event_pointer_button *event = data; + cursor_handle_activity(cursor); dispatch_cursor_button(cursor, event->device, event->time_msec, event->button, event->state); - cursor_handle_activity(cursor); transaction_commit_dirty(); } @@ -814,8 +816,8 @@ void dispatch_cursor_axis(struct sway_cursor *cursor, static void handle_cursor_axis(struct wl_listener *listener, void *data) { struct sway_cursor *cursor = wl_container_of(listener, cursor, axis); struct wlr_event_pointer_axis *event = data; - dispatch_cursor_axis(cursor, event); cursor_handle_activity(cursor); + dispatch_cursor_axis(cursor, event); transaction_commit_dirty(); } |