From 97a5695ccb9bb0e33712ca51971bbb7c453f99a3 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Fri, 9 Jul 2021 22:29:48 +0100 Subject: [PATCH] cursor: do not pass _press_ to client when alt held --- src/cursor.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/cursor.c b/src/cursor.c index 20ccd070..0f85e4a7 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -299,12 +299,6 @@ cursor_button(struct wl_listener *listener, void *data) struct server *server = seat->server; struct wlr_event_pointer_button *event = data; - /* - * Notify the client with pointer focus that a button press has - * occurred. - */ - wlr_seat_pointer_notify_button(seat->seat, event->time_msec, - event->button, event->state); double sx, sy; struct wlr_surface *surface; int view_area; @@ -312,6 +306,19 @@ cursor_button(struct wl_listener *listener, void *data) struct view *view = desktop_view_at(server, server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy, &view_area); + /* handle alt + _press_ on view */ + struct wlr_input_device *device = seat->keyboard_group->input_device; + uint32_t modifiers = wlr_keyboard_get_modifiers(device->keyboard); + if (modifiers & XKB_KEY_Alt_L && event->state == WLR_BUTTON_PRESSED) { + handle_cursor_button_with_meta_key(view, event->button, + server->seat.cursor->x, server->seat.cursor->y); + return; + }; + + /* Notify client with pointer focus of button press */ + wlr_seat_pointer_notify_button(seat->seat, event->time_msec, + event->button, event->state); + /* handle _release_ */ if (event->state == WLR_BUTTON_RELEASED) { if (server->input_mode == LAB_INPUT_STATE_MENU) { @@ -336,15 +343,6 @@ cursor_button(struct wl_listener *listener, void *data) return; } - /* handle alt + _press_ on view */ - struct wlr_input_device *device = seat->keyboard_group->input_device; - uint32_t modifiers = wlr_keyboard_get_modifiers(device->keyboard); - if (modifiers & XKB_KEY_Alt_L) { - handle_cursor_button_with_meta_key(view, event->button, - server->seat.cursor->x, server->seat.cursor->y); - return; - }; - /* Handle _press_ on view */ desktop_focus_view(&server->seat, view); damage_all_outputs(server);