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.
This commit is contained in:
parent
d17dc0d6ee
commit
10281cf2d1
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue