input: Propagate modifiers to clients with only pointer focus

When focus_follows_mouse is off, it is possible to hover and/or scroll
windows without giving them keyboard focus.  However, attempts to use
Ctrl+scroll on such clients will not work correctly because the keyboard
modifiers are not available.  This patch propagates modifier state to
the client with pointer focus before sending axis events.

This depends on https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4523.

https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/259
discusses permitting this behavior at the protocol level.
This commit is contained in:
Daniel De Graaf 2024-01-22 21:15:28 -05:00
parent e39b0b816b
commit 1c12934edd

View file

@ -795,6 +795,8 @@ static void handle_pointer_axis(struct sway_seat *seat,
free(dev_id); free(dev_id);
if (!handled) { if (!handled) {
wlr_seat_client_notify_modifiers(cursor->seat->wlr_seat,
cursor->seat->wlr_seat->pointer_state.focused_client);
wlr_seat_pointer_notify_axis(cursor->seat->wlr_seat, event->time_msec, wlr_seat_pointer_notify_axis(cursor->seat->wlr_seat, event->time_msec,
event->orientation, scroll_factor * event->delta, event->orientation, scroll_factor * event->delta,
roundf(scroll_factor * event->delta_discrete), event->source, roundf(scroll_factor * event->delta_discrete), event->source,