summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-09-27 22:23:05 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-09-28 09:28:39 +0930
commitbe466d8df808c4e4067a7963617bc3f506768f2d (patch)
treee0e9aa1d5c7271de97e0e72b9e2f550d0a5f798b
parent53434edc3d306137d019d95189ecdf0dbff75205 (diff)
dix: GetPairedKeyboard() always returns a valid keyboard (VCK if necessary).
We need it unconditionally in a few places, and the rest checked for NULL and then set it to VCK anyway. So, fixing up all callers to appreciate the defined return value.
-rw-r--r--dix/devices.c9
-rw-r--r--dix/events.c11
2 files changed, 6 insertions, 14 deletions
diff --git a/dix/devices.c b/dix/devices.c
index 63d7ea4db..24eaa4b1d 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2229,15 +2229,16 @@ GetPairedPointer(DeviceIntPtr kbd)
}
/* Find the keyboard device that is paired with the given pointer. If none is
- * found, return NULL.
- * We also check if the paired device is a keyboard. If not (e.g. evdev brain)
- * we don't return it. This probably needs to be fixed.
+ * found, return the VCK.
*/
_X_EXPORT DeviceIntPtr
GetPairedKeyboard(DeviceIntPtr ptr)
{
DeviceIntPtr dev = inputInfo.devices;
+ if (IsKeyboardDevice(ptr))
+ return ptr;
+
while(dev)
{
if (ptr != dev &&
@@ -2246,7 +2247,7 @@ GetPairedKeyboard(DeviceIntPtr ptr)
return dev;
dev = dev->next;
}
- return dev;
+ return (dev) ? dev : inputInfo.keyboard;
}
/*
diff --git a/dix/events.c b/dix/events.c
index a80355011..45ff943fb 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3233,8 +3233,6 @@ CheckPassiveGrabsOnWindow(
{
grab->device = device;
grab->modifierDevice = GetPairedKeyboard(device);
- if (!grab->modifierDevice)
- grab->modifierDevice = inputInfo.keyboard;
}
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
@@ -4052,8 +4050,7 @@ EnterLeaveEvent(
int mskidx;
OtherInputMasks *inputMasks;
- if (!(keybd = GetPairedKeyboard(mouse)))
- keybd = inputInfo.keyboard;
+ keybd = GetPairedKeyboard(mouse);
if ((pWin == mouse->valuator->motionHintWindow) &&
(detail != NotifyInferior))
@@ -4572,11 +4569,7 @@ SetInputFocus(
if (IsKeyboardDevice(dev))
keybd = dev;
else
- {
keybd = GetPairedKeyboard(dev);
- if (!keybd)
- keybd = inputInfo.keyboard;
- }
if ((focusID == None) || (focusID == PointerRoot))
focusWin = (WindowPtr)(long)focusID;
@@ -5592,8 +5585,6 @@ ProcGrabButton(ClientPtr client)
pointer = PickPointer(client);
modifierDevice = GetPairedKeyboard(pointer);
- if (!modifierDevice)
- modifierDevice = inputInfo.keyboard;
grab = CreateGrab(client->index, pointer, pWin,
(Mask)stuff->eventMask, (Bool)stuff->ownerEvents,