Check and re-set paired devices when initializing sprites.
If we don't do this, a device that is paired before a sprite has been initialized for the paired device will not actually get the right sprite and segfault the server on focus events. Happens for the VCK.
This commit is contained in:
parent
b043a18450
commit
325380adb2
|
@ -2158,6 +2158,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
|||
}
|
||||
|
||||
kbd->spriteInfo->sprite = ptr->spriteInfo->sprite;
|
||||
kbd->spriteInfo->paired = ptr;
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
16
dix/events.c
16
dix/events.c
|
@ -2528,9 +2528,25 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
|||
|
||||
if (!pDev->spriteInfo->sprite)
|
||||
{
|
||||
DeviceIntPtr it;
|
||||
|
||||
pDev->spriteInfo->sprite = (SpritePtr)xcalloc(1, sizeof(SpriteRec));
|
||||
if (!pDev->spriteInfo->sprite)
|
||||
FatalError("InitializeSprite: failed to allocate sprite struct");
|
||||
|
||||
/* We may have paired another device with this device before our
|
||||
* device had a actual sprite. We need to check for this and reset the
|
||||
* sprite field for all paired devices.
|
||||
*
|
||||
* The VCK is always paired with the VCP before the VCP has a sprite.
|
||||
*/
|
||||
for (it = inputInfo.devices; it; it = it->next)
|
||||
{
|
||||
if (it->spriteInfo->paired == pDev)
|
||||
it->spriteInfo->sprite = pDev->spriteInfo->sprite;
|
||||
}
|
||||
if (inputInfo.keyboard->spriteInfo->paired == pDev)
|
||||
inputInfo.keyboard->spriteInfo->sprite = pDev->spriteInfo->sprite;
|
||||
}
|
||||
|
||||
pSprite = pDev->spriteInfo->sprite;
|
||||
|
|
Loading…
Reference in New Issue
Block a user