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
|
/* Find the keyboard device that is paired with the given pointer. If none is
|
||||||
* found, return NULL.
|
* found, return the VCK.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
_X_EXPORT DeviceIntPtr
|
_X_EXPORT DeviceIntPtr
|
||||||
GetPairedKeyboard(DeviceIntPtr ptr)
|
GetPairedKeyboard(DeviceIntPtr ptr)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev = inputInfo.devices;
|
DeviceIntPtr dev = inputInfo.devices;
|
||||||
|
|
||||||
|
if (IsKeyboardDevice(ptr))
|
||||||
|
return ptr;
|
||||||
|
|
||||||
while(dev)
|
while(dev)
|
||||||
{
|
{
|
||||||
if (ptr != dev &&
|
if (ptr != dev &&
|
||||||
|
@ -2246,7 +2247,7 @@ GetPairedKeyboard(DeviceIntPtr ptr)
|
||||||
return dev;
|
return dev;
|
||||||
dev = dev->next;
|
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->device = device;
|
||||||
grab->modifierDevice = GetPairedKeyboard(device);
|
grab->modifierDevice = GetPairedKeyboard(device);
|
||||||
if (!grab->modifierDevice)
|
|
||||||
grab->modifierDevice = inputInfo.keyboard;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
|
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
|
||||||
|
@ -4052,8 +4050,7 @@ EnterLeaveEvent(
|
||||||
int mskidx;
|
int mskidx;
|
||||||
OtherInputMasks *inputMasks;
|
OtherInputMasks *inputMasks;
|
||||||
|
|
||||||
if (!(keybd = GetPairedKeyboard(mouse)))
|
keybd = GetPairedKeyboard(mouse);
|
||||||
keybd = inputInfo.keyboard;
|
|
||||||
|
|
||||||
if ((pWin == mouse->valuator->motionHintWindow) &&
|
if ((pWin == mouse->valuator->motionHintWindow) &&
|
||||||
(detail != NotifyInferior))
|
(detail != NotifyInferior))
|
||||||
|
@ -4572,11 +4569,7 @@ SetInputFocus(
|
||||||
if (IsKeyboardDevice(dev))
|
if (IsKeyboardDevice(dev))
|
||||||
keybd = dev;
|
keybd = dev;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
keybd = GetPairedKeyboard(dev);
|
keybd = GetPairedKeyboard(dev);
|
||||||
if (!keybd)
|
|
||||||
keybd = inputInfo.keyboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((focusID == None) || (focusID == PointerRoot))
|
if ((focusID == None) || (focusID == PointerRoot))
|
||||||
focusWin = (WindowPtr)(long)focusID;
|
focusWin = (WindowPtr)(long)focusID;
|
||||||
|
@ -5592,8 +5585,6 @@ ProcGrabButton(ClientPtr client)
|
||||||
|
|
||||||
pointer = PickPointer(client);
|
pointer = PickPointer(client);
|
||||||
modifierDevice = GetPairedKeyboard(pointer);
|
modifierDevice = GetPairedKeyboard(pointer);
|
||||||
if (!modifierDevice)
|
|
||||||
modifierDevice = inputInfo.keyboard;
|
|
||||||
|
|
||||||
grab = CreateGrab(client->index, pointer, pWin,
|
grab = CreateGrab(client->index, pointer, pWin,
|
||||||
(Mask)stuff->eventMask, (Bool)stuff->ownerEvents,
|
(Mask)stuff->eventMask, (Bool)stuff->ownerEvents,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user