]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: do not pass _press_ to client when alt held
authorJohan Malm <jgm323@gmail.com>
Fri, 9 Jul 2021 21:29:48 +0000 (22:29 +0100)
committerJohan Malm <jgm323@gmail.com>
Fri, 9 Jul 2021 21:29:48 +0000 (22:29 +0100)
src/cursor.c

index 20ccd070f886214c66d5496abf5364b0c11198ed..0f85e4a7b10898d9ef91b5ddb335c09a1abc9ec4 100644 (file)
@@ -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);