dix: Move sprite initalization/pairing from ActivateDevice to
EnableDevice. zero out spriteTrace, otherwise GetCurrentRootWindow() may return invalid data. Evdev adds previously hotplugged devices on its own when rescanning, and ActivateDevice does not get called for those devices. Sprites need to be initialized or paired before the device gets started, so the safest place to do so is EnableDevice (which actually does get called by the evdev driver).
This commit is contained in:
parent
015d728bcd
commit
0acf993e28
|
@ -173,6 +173,11 @@ EnableDevice(DeviceIntPtr dev)
|
|||
dev->enabled = TRUE;
|
||||
*prev = dev->next;
|
||||
|
||||
if (IsPointerDevice(dev) && dev->isMPDev)
|
||||
InitializeSprite(dev, GetCurrentRootWindow());
|
||||
else
|
||||
PairDevices(NULL, inputInfo.pointer, dev);
|
||||
|
||||
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
|
||||
;
|
||||
*prev = dev;
|
||||
|
@ -221,11 +226,6 @@ ActivateDevice(DeviceIntPtr dev)
|
|||
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
|
||||
(xEvent *) &ev, 1);
|
||||
|
||||
if (IsPointerDevice(dev) && dev->isMPDev)
|
||||
InitializeSprite(dev, GetCurrentRootWindow());
|
||||
else
|
||||
PairDevices(NULL, inputInfo.pointer, dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,6 @@ InitAndStartDevices()
|
|||
PairDevices(NULL, GuessFreePointerDevice(), dev);
|
||||
}
|
||||
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -4290,6 +4290,11 @@ InitEvents()
|
|||
{
|
||||
spriteTraceSize = 32;
|
||||
spriteTrace = (WindowPtr *)xalloc(32*sizeof(WindowPtr));
|
||||
/* FIXME: spriteTrace[0] needs to be NULL, otherwise
|
||||
* GetCurrentRootWindow() in EnableDevice() may return a invalid
|
||||
* value. (whot)
|
||||
*/
|
||||
memset(spriteTrace, 0, 32 * sizeof(WindowPtr));
|
||||
if (!spriteTrace)
|
||||
FatalError("failed to allocate spriteTrace");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user