aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2019-01-15 18:09:34 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-15 14:06:48 -0500
commitf7309778a700972f7f4cdd529670ff3430da42dd (patch)
tree8a6bc4d3d5924ca0f14441104533a66154a46885 /sway/input/cursor.c
parentRemove wlr_xdg_surface_send_close. (diff)
downloadsway-f7309778a700972f7f4cdd529670ff3430da42dd.tar.gz
sway-f7309778a700972f7f4cdd529670ff3430da42dd.tar.zst
sway-f7309778a700972f7f4cdd529670ff3430da42dd.zip
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.c10
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) {
275 struct sway_cursor *cursor = data; 275 struct sway_cursor *cursor = data;
276 wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0); 276 wlr_cursor_set_image(cursor->cursor, NULL, 0, 0, 0, 0, 0, 0);
277 cursor->hidden = true; 277 cursor->hidden = true;
278 wlr_seat_pointer_clear_focus(cursor->seat->wlr_seat);
278 return 1; 279 return 1;
279} 280}
280 281
@@ -313,6 +314,7 @@ void cursor_unhide(struct sway_cursor *cursor) {
313 cursor->image = NULL; 314 cursor->image = NULL;
314 cursor_set_image(cursor, image, cursor->image_client); 315 cursor_set_image(cursor, image, cursor->image_client);
315 } 316 }
317 cursor_rebase(cursor);
316} 318}
317 319
318void cursor_send_pointer_motion(struct sway_cursor *cursor, 320void cursor_send_pointer_motion(struct sway_cursor *cursor,
@@ -388,10 +390,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor,
388static void handle_cursor_motion(struct wl_listener *listener, void *data) { 390static void handle_cursor_motion(struct wl_listener *listener, void *data) {
389 struct sway_cursor *cursor = wl_container_of(listener, cursor, motion); 391 struct sway_cursor *cursor = wl_container_of(listener, cursor, motion);
390 struct wlr_event_pointer_motion *event = data; 392 struct wlr_event_pointer_motion *event = data;
393 cursor_handle_activity(cursor);
391 wlr_cursor_move(cursor->cursor, event->device, 394 wlr_cursor_move(cursor->cursor, event->device,
392 event->delta_x, event->delta_y); 395 event->delta_x, event->delta_y);
393 cursor_send_pointer_motion(cursor, event->time_msec); 396 cursor_send_pointer_motion(cursor, event->time_msec);
394 cursor_handle_activity(cursor);
395 transaction_commit_dirty(); 397 transaction_commit_dirty();
396} 398}
397 399
@@ -400,9 +402,9 @@ static void handle_cursor_motion_absolute(
400 struct sway_cursor *cursor = 402 struct sway_cursor *cursor =
401 wl_container_of(listener, cursor, motion_absolute); 403 wl_container_of(listener, cursor, motion_absolute);
402 struct wlr_event_pointer_motion_absolute *event = data; 404 struct wlr_event_pointer_motion_absolute *event = data;
405 cursor_handle_activity(cursor);
403 wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y); 406 wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y);
404 cursor_send_pointer_motion(cursor, event->time_msec); 407 cursor_send_pointer_motion(cursor, event->time_msec);
405 cursor_handle_activity(cursor);
406 transaction_commit_dirty(); 408 transaction_commit_dirty();
407} 409}
408 410
@@ -698,9 +700,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
698static void handle_cursor_button(struct wl_listener *listener, void *data) { 700static void handle_cursor_button(struct wl_listener *listener, void *data) {
699 struct sway_cursor *cursor = wl_container_of(listener, cursor, button); 701 struct sway_cursor *cursor = wl_container_of(listener, cursor, button);
700 struct wlr_event_pointer_button *event = data; 702 struct wlr_event_pointer_button *event = data;
703 cursor_handle_activity(cursor);
701 dispatch_cursor_button(cursor, event->device, 704 dispatch_cursor_button(cursor, event->device,
702 event->time_msec, event->button, event->state); 705 event->time_msec, event->button, event->state);
703 cursor_handle_activity(cursor);
704 transaction_commit_dirty(); 706 transaction_commit_dirty();
705} 707}
706 708
@@ -814,8 +816,8 @@ void dispatch_cursor_axis(struct sway_cursor *cursor,
814static void handle_cursor_axis(struct wl_listener *listener, void *data) { 816static void handle_cursor_axis(struct wl_listener *listener, void *data) {
815 struct sway_cursor *cursor = wl_container_of(listener, cursor, axis); 817 struct sway_cursor *cursor = wl_container_of(listener, cursor, axis);
816 struct wlr_event_pointer_axis *event = data; 818 struct wlr_event_pointer_axis *event = data;
817 dispatch_cursor_axis(cursor, event);
818 cursor_handle_activity(cursor); 819 cursor_handle_activity(cursor);
820 dispatch_cursor_axis(cursor, event);
819 transaction_commit_dirty(); 821 transaction_commit_dirty();
820} 822}
821 823