From 10281cf2d125d3b553984234602000016b88e76a Mon Sep 17 00:00:00 2001 From: lkn Date: Sat, 6 Jun 2026 20:38:03 +0200 Subject: [PATCH] wayland: suppress client forwarding on modifier+click for move/resize When the WM modifier key (Alt by default, configurable via ModifierKey) is held during a button press over a client surface, do not forward the event to the client via wlr_seat_pointer_notify_button. The event has already been enqueued for the WM policy layer via W_WL_EnqueueEvent; frameMouseDown will call wMouseMoveWindow (LMB) or wMouseResizeWindow (RMB) as appropriate. Without this suppression the client application receives the Alt+click and may act on it instead of the WM. --- src/backend/wayland/wl_handlers.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/backend/wayland/wl_handlers.c b/src/backend/wayland/wl_handlers.c index 923d750..c95e088 100644 --- a/src/backend/wayland/wl_handlers.c +++ b/src/backend/wayland/wl_handlers.c @@ -329,8 +329,27 @@ handle_pointer_button(struct wl_listener *listener, void *data) * wlr_seat_pointer_notify_button to be a no-op. */ wl_update_pointer_focus(ev->time_msec); - wlr_seat_pointer_notify_button(wl_state.seat, ev->time_msec, - ev->button, ev->state); + /* Suppress forwarding to the client when the WM modifier key is held + * on a button press over a client surface. In this case frameMouseDown + * will handle the event (move or resize), and the app must not see it. */ + Bool forward_to_client = True; + if (ev->state == WLR_BUTTON_PRESSED && wl_state.seat) { + struct wlr_keyboard *_kb = wl_state.seat->keyboard_state.keyboard; + unsigned int _mods = _kb ? _kb->modifiers.depressed : 0; + if (_mods & wPreferences.modifier_mask) { + double _sx, _sy; + struct wl_toplevel_view *_tv = NULL; + struct wlr_surface *_surf = view_surface_at( + wl_state.pointer_x, wl_state.pointer_y, &_sx, &_sy, &_tv); + if (_surf && _tv) + forward_to_client = False; + } + } + + if (forward_to_client) { + wlr_seat_pointer_notify_button(wl_state.seat, ev->time_msec, + ev->button, ev->state); + } wlr_seat_pointer_notify_frame(wl_state.seat); }