Commit 10de9e8e authored by Peter Hutterer's avatar Peter Hutterer

xfree86: dga needs to use the master keyboard state (#27573)

GetPairedDevice() may not always return the keyboard, resulting in a
null-pointer dereference when accessing the XKB state.
For floating devices, the GetMaster() returns the device itself.

X.Org Bug 27573 <http://bugs.freedesktop.org/show_bug.cgi?id=27573>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniel@fooishbar.org>
Tested-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 758b8614
......@@ -1088,13 +1088,15 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
ButtonClassPtr butc = mouse->button;
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
DeviceEvent ev;
DeviceIntPtr master = GetMaster(mouse, MASTER_KEYBOARD);
memset(&ev, 0, sizeof(ev));
ev.header = ET_Internal;
ev.length = sizeof(ev);
ev.type = event->subtype;
ev.corestate = butc->state;
ev.corestate |= XkbStateFieldFromRec(&GetPairedDevice(mouse)->key->xkbInfo->state);
if (master && master->key)
ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state);
UpdateDeviceState(mouse, &ev);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment