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.
This commit is contained in:
parent
53434edc3d
commit
be466d8df8
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
11
dix/events.c
11
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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user