From b8abeaf74ee8296d4bc3164a5a253624f984a6d4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 7 Aug 2007 12:32:46 +0930 Subject: [PATCH] dix: get the paired keyboard for a passive grab (ProcGrabButton). Taking the VCK is only correct if no physical device is connected, and even then it's not really a good idea. --- dix/events.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dix/events.c b/dix/events.c index 7de8d2ea6..faf8eedd5 100644 --- a/dix/events.c +++ b/dix/events.c @@ -5326,6 +5326,7 @@ ProcGrabButton(ClientPtr client) REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; + DeviceIntPtr pointer, modifierDevice; int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); @@ -5381,11 +5382,15 @@ ProcGrabButton(ClientPtr client) } } + pointer = PickPointer(client); + modifierDevice = GetPairedKeyboard(pointer); + if (!modifierDevice) + modifierDevice = inputInfo.keyboard; - grab = CreateGrab(client->index, PickPointer(client), pWin, + grab = CreateGrab(client->index, pointer, pWin, (Mask)stuff->eventMask, (Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode, (Bool)stuff->pointerMode, - inputInfo.keyboard, stuff->modifiers, ButtonPress, + modifierDevice, stuff->modifiers, ButtonPress, stuff->button, confineTo, cursor); if (!grab) return BadAlloc;