xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 5 09:14:05 UTC 2024
hw/xwayland/xwayland-input.c | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 386b54fbe95711e6ecb5c23cfdbf25a1571acf7b
Author: Ian Douglas Scott <idscott at system76.com>
Date: Thu May 9 15:02:06 2024 -0700
xwayland: Release keys on keyboard `enter` event if `leave` wasn't received
The code here assumed a `leave` event always occurs between two `enter`
events. On Sway (and presumably other compositors) this happens even if
the client has destroyed the `wl_surface`, but the client gets a null
`surface` here. (Which presumably on on the wire is the id of the
destroyed surface.)
This seems like a bad thing to rely on, and is easy to avoid. But if
this is correct to assume, the Wayland protocol should be explicit about
this.
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1527>
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index c078e6a5c..76b20f198 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1215,6 +1215,10 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
xwl_seat->xwl_screen->serial = serial;
xwl_seat->keyboard_focus = surface;
+ /* If `leave` wasn't sent (for a destroyed surface), release keys here. */
+ wl_array_for_each(k, &xwl_seat->keys)
+ QueueKeyboardEvents(xwl_seat->keyboard, LeaveNotify, *k + 8);
+
wl_array_copy(&xwl_seat->keys, keys);
wl_array_for_each(k, &xwl_seat->keys)
QueueKeyboardEvents(xwl_seat->keyboard, EnterNotify, *k + 8);
@@ -1229,6 +1233,7 @@ xwl_seat_leave_kbd(struct xwl_seat *xwl_seat)
wl_array_for_each(k, &xwl_seat->keys)
QueueKeyboardEvents(xwl_seat->keyboard, LeaveNotify, *k + 8);
+ xwl_seat->keys.size = 0;
xwl_seat->keyboard_focus = NULL;
More information about the xorg-commit
mailing list