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:
parent
fdb081b430
commit
8e97e5f942
33
Xext/xtest.c
33
Xext/xtest.c
|
@ -62,10 +62,6 @@ extern int DeviceValuator;
|
||||||
* other's memory */
|
* other's memory */
|
||||||
static EventListPtr xtest_evlist;
|
static EventListPtr xtest_evlist;
|
||||||
|
|
||||||
/* Used to store if a device is an XTest Virtual device */
|
|
||||||
static DevPrivateKeyRec XTestDevicePrivateKeyRec;
|
|
||||||
#define XTestDevicePrivateKey (&XTestDevicePrivateKeyRec)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xtestpointer
|
* xtestpointer
|
||||||
* is the virtual pointer for XTest. It is the first slave
|
* 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(SProcXTestGetVersion);
|
||||||
static DISPATCH_PROC(SProcXTestGrabControl);
|
static DISPATCH_PROC(SProcXTestGrabControl);
|
||||||
|
|
||||||
Bool
|
|
||||||
XTestInitPrivates(void)
|
|
||||||
{
|
|
||||||
return dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
XTestExtensionInit(INITARGS)
|
XTestExtensionInit(INITARGS)
|
||||||
{
|
{
|
||||||
if (!XTestInitPrivates())
|
|
||||||
return;
|
|
||||||
|
|
||||||
AddExtension(XTestExtensionName, 0, 0,
|
AddExtension(XTestExtensionName, 0, 0,
|
||||||
ProcXTestDispatch, SProcXTestDispatch,
|
ProcXTestDispatch, SProcXTestDispatch,
|
||||||
NULL, StandardMinorOpcode);
|
NULL, StandardMinorOpcode);
|
||||||
|
@ -654,8 +641,8 @@ int AllocXTestDevice (ClientPtr client, char* name,
|
||||||
|
|
||||||
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
|
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
|
||||||
if ( retval == Success ){
|
if ( retval == Success ){
|
||||||
dixSetPrivate(&((*ptr)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_ptr->id);
|
(*ptr)->xtest_master_id = master_ptr->id;
|
||||||
dixSetPrivate(&((*keybd)->devPrivates), XTestDevicePrivateKey, (void *)(intptr_t)master_keybd->id);
|
(*keybd)->xtest_master_id = master_keybd->id;
|
||||||
|
|
||||||
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||||
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
||||||
|
@ -683,23 +670,15 @@ int AllocXTestDevice (ClientPtr client, char* name,
|
||||||
BOOL
|
BOOL
|
||||||
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
|
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
{
|
{
|
||||||
int is_XTest = FALSE;
|
|
||||||
int mid;
|
|
||||||
void *tmp; /* shut up, gcc! */
|
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev))
|
||||||
return is_XTest;
|
return FALSE;
|
||||||
|
|
||||||
tmp = dixLookupPrivate(&dev->devPrivates, XTestDevicePrivateKey);
|
|
||||||
mid = (intptr_t)tmp;
|
|
||||||
|
|
||||||
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
|
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
|
||||||
* device */
|
* device */
|
||||||
if ((!master && mid) ||
|
if (master)
|
||||||
(master && mid == master->id))
|
return dev->xtest_master_id == master->id;
|
||||||
is_XTest = TRUE;
|
|
||||||
|
|
||||||
return is_XTest;
|
return dev->xtest_master_id != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -237,7 +237,6 @@ extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
|
||||||
|
|
||||||
extern void InitCoreDevices(void);
|
extern void InitCoreDevices(void);
|
||||||
extern void InitXTestDevices(void);
|
extern void InitXTestDevices(void);
|
||||||
extern Bool XTestInitPrivates(void);
|
|
||||||
|
|
||||||
extern _X_EXPORT DeviceIntPtr AddInputDevice(
|
extern _X_EXPORT DeviceIntPtr AddInputDevice(
|
||||||
ClientPtr /*client*/,
|
ClientPtr /*client*/,
|
||||||
|
|
|
@ -554,6 +554,9 @@ typedef struct _DeviceIntRec {
|
||||||
|
|
||||||
/* coordinate transformation matrix for absolute input devices */
|
/* coordinate transformation matrix for absolute input devices */
|
||||||
struct pixman_f_transform transform;
|
struct pixman_f_transform transform;
|
||||||
|
|
||||||
|
/* XTest related master device id */
|
||||||
|
int xtest_master_id;
|
||||||
} DeviceIntRec;
|
} DeviceIntRec;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -157,7 +157,6 @@ void init_simple(void)
|
||||||
dixResetPrivates();
|
dixResetPrivates();
|
||||||
InitAtoms();
|
InitAtoms();
|
||||||
XkbInitPrivates();
|
XkbInitPrivates();
|
||||||
XTestInitPrivates();
|
|
||||||
dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
|
dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
|
||||||
dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
|
dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
|
||||||
dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
|
dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
|
||||||
|
|
|
@ -61,7 +61,6 @@ static void xtest_init_devices(void)
|
||||||
InitAtoms();
|
InitAtoms();
|
||||||
|
|
||||||
XkbInitPrivates();
|
XkbInitPrivates();
|
||||||
XTestInitPrivates();
|
|
||||||
|
|
||||||
/* this also inits the xtest devices */
|
/* this also inits the xtest devices */
|
||||||
InitCoreDevices();
|
InitCoreDevices();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user