xfree86: block signals between EnableDevice and first CheckMotion()

Devices usually enable SIGIO processing in EnableDevice. CheckMotion
initialises the pointer sprite, sends Enter/Leave events, etc. This leaves
us with a small window where events may be processed without the sprite or
pointer position (as seen from the protocol) is valid.
Block signals during this window.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Peter Hutterer 2011-03-03 14:15:55 +10:00
parent 1c008e7e78
commit 18413f5508

View File

@ -817,15 +817,18 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
/* Enable it if it's properly initialised and we're currently in the VT */ /* Enable it if it's properly initialised and we're currently in the VT */
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema) if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
{ {
OsBlockSignals();
EnableDevice(dev, TRUE); EnableDevice(dev, TRUE);
if (!dev->enabled) if (!dev->enabled)
{ {
OsReleaseSignals();
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name); xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
rval = BadMatch; rval = BadMatch;
goto unwind; goto unwind;
} }
/* send enter/leave event, update sprite window */ /* send enter/leave event, update sprite window */
CheckMotion(NULL, dev); CheckMotion(NULL, dev);
OsReleaseSignals();
} }
*pdev = dev; *pdev = dev;