summaryrefslogtreecommitdiff
path: root/mi/miglblt.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2025-03-20 10:37:53 +1000
committerOlivier Fourdan <ofourdan@redhat.com>2025-04-08 10:16:56 +0200
commita3a37c56998e85ac2ab98d3a3778c312fc0e8fad (patch)
tree87653ae08ade25fe7516535436dcdd53523e1374 /mi/miglblt.c
parent0249e717d4cbc40559d6072655d5a873320cb085 (diff)
dix: pick the right keyboard for focus FollowKeyboardserver-21.1-branch
This fixes a crash when we try to send focus events and dereference FollowKeyboardWin (0x3) as WindowPtr. A device set to XSetDeviceFocus(FollowKeyboard) is supposed to follow the focus of the corresponding master device. During ActivateKeyboard a slave device is detached from the master for the duration for the grab so we don't actually have a master to follow - leaving our oldWin set to the FollowKeyboardWin constant. This later crashes when we try to dereference it. Fix this by getting the current master (if any), or the saved master (if temporarily detached due to a grab). And if failing that, use the VCK as fallback device - that is technically wrong but it's such a niche use case that it shouldn't matter. Reproducer: window = XCreateSimpleWindow(...) deviceid = any device that is IsXExtensionKeyboard device XSetDeviceFocus(deviceid, FollowKeyboard, ...) XGrabDevice(deviceid, window, ...) Fixes: f01ee198ff0c ("dix: don't use inputInfo.keyboard to get the focus window in ActivateKbdGrab") Found-by: Olivier Fourdan <ofourdan@redhat.com> Acked-by: Olivier Fourdan <ofourdan@redhat.com> Tested-by: Olivier Fourdan <ofourdan@redhat.com> (cherry picked from commit cab9017485566da656b12b686e571d42b0f28afb) Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1894>
Diffstat (limited to 'mi/miglblt.c')
0 files changed, 0 insertions, 0 deletions