If XTest is always required, then eliminate the XTest devPrivate

The internals of XTest are used by Xi and Xkb, and both Xi and Xkb are
always required, so it makes little sense to have XTest place data in
a devPrivate, especially a devPrivate which is only available when the
XTest extension is enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Keith Packard 2010-06-07 14:23:47 -07:00
commit 8e97e5f942
5 changed files with 9 additions and 30 deletions

View file

@ -62,10 +62,6 @@ extern int DeviceValuator;
* other's memory */
static EventListPtr xtest_evlist;
/* Used to store if a device is an XTest Virtual device */
static DevPrivateKeyRec XTestDevicePrivateKeyRec;
#define XTestDevicePrivateKey (&XTestDevicePrivateKeyRec)
/**
* xtestpointer
* is the virtual pointer for XTest. It is the first slave
@ -99,18 +95,9 @@ static DISPATCH_PROC(SProcXTestFakeInput);
static DISPATCH_PROC(SProcXTestGetVersion);
static DISPATCH_PROC(SProcXTestGrabControl);
Bool
XTestInitPrivates(void)
{
return dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
}
void
XTestExtensionInit(INITARGS)
{
if (!XTestInitPrivates())
return;
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
NULL, StandardMinorOpcode);
@ -654,8 +641,8 @@ int AllocXTestDevice (ClientPtr client, char* name,
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
if ( retval == Success ){
dixSetPrivate(&((*ptr)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_ptr->id);
dixSetPrivate(&((*keybd)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_keybd->id);
(*ptr)->xtest_master_id = master_ptr->id;
(*keybd)->xtest_master_id = master_keybd->id;
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
@ -683,23 +670,15 @@ int AllocXTestDevice (ClientPtr client, char* name,
BOOL
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
{
int is_XTest = FALSE;
int mid;
void *tmp; /* shut up, gcc! */
if (IsMaster(dev))
return is_XTest;
tmp = dixLookupPrivate(&dev->devPrivates, XTestDevicePrivateKey);
mid = (intptr_t)tmp;
return FALSE;
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
* device */
if ((!master && mid) ||
(master && mid == master->id))
is_XTest = TRUE;
if (master)
return dev->xtest_master_id == master->id;
return is_XTest;
return dev->xtest_master_id != 0;
}
/**