Xext: rename Xtst* to XTest*

This patch corrects a misnaming of XTest-related functions.

The extension itself announces itself as XTEST. Xtst is the library name
itself, but all library functions are prefixed by XTest. Same with the
naming in the server.

- Rename all *Xtst* functions to *XTest* for consistency with the library
  and in-server API.
- Rename the "Xtst device" property to "XTEST device" for consistency with
  the extension naming.
- Rename the device naming to "<master device name> XTEST device". The
  default xtest devices become "Virtual core XTEST pointer" and "Virtual
  core XTEST keyboard".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-08-24 09:48:00 +10:00
parent 8bfd23e144
commit 903c3db1d1
6 changed files with 83 additions and 83 deletions

View File

@ -63,20 +63,20 @@ extern int DeviceValuator;
static EventListPtr xtest_evlist; static EventListPtr xtest_evlist;
/* Used to store if a device is an XTest Virtual device */ /* Used to store if a device is an XTest Virtual device */
static int XTstDevicePrivateKeyIndex; static int XTestDevicePrivateKeyIndex;
DevPrivateKey XTstDevicePrivateKey = &XTstDevicePrivateKeyIndex; DevPrivateKey XTestDevicePrivateKey = &XTestDevicePrivateKeyIndex;
/** /**
* vxtstpointer * xtestpointer
* is the virtual pointer for XTest. It is the first slave * is the virtual pointer for XTest. It is the first slave
* device of the VCP. * device of the VCP.
* vxtstkeyboard * xtestkeyboard
* is the virtual keyboard for XTest. It is the first slave * is the virtual keyboard for XTest. It is the first slave
* device of the VCK * device of the VCK
* *
* Neither of these devices can be deleted. * Neither of these devices can be deleted.
*/ */
DeviceIntPtr vxtstpointer, vxtstkeyboard; DeviceIntPtr xtestpointer, xtestkeyboard;
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiX.h" #include "panoramiX.h"
@ -341,7 +341,7 @@ ProcXTestFakeInput(ClientPtr client)
return BadValue; return BadValue;
} }
dev = GetXtstDevice(dev); dev = GetXTestDevice(dev);
} }
/* If the event has a time set, wait for it to pass */ /* If the event has a time set, wait for it to pass */
@ -590,30 +590,30 @@ SProcXTestDispatch (ClientPtr client)
*/ */
void InitXTestDevices(void) void InitXTestDevices(void)
{ {
if(AllocXtstDevice(serverClient, "Virtual core", if(AllocXTestDevice(serverClient, "Virtual core",
&vxtstpointer, &vxtstkeyboard, &xtestpointer, &xtestkeyboard,
inputInfo.pointer, inputInfo.keyboard) != Success) inputInfo.pointer, inputInfo.keyboard) != Success)
FatalError("Failed to allocate XTst devices"); FatalError("Failed to allocate XTest devices");
if (ActivateDevice(vxtstpointer, TRUE) != Success || if (ActivateDevice(xtestpointer, TRUE) != Success ||
ActivateDevice(vxtstkeyboard, TRUE) != Success) ActivateDevice(xtestkeyboard, TRUE) != Success)
FatalError("Failed to activate xtst core devices."); FatalError("Failed to activate XTest core devices.");
if (!EnableDevice(vxtstpointer, TRUE) || if (!EnableDevice(xtestpointer, TRUE) ||
!EnableDevice(vxtstkeyboard, TRUE)) !EnableDevice(xtestkeyboard, TRUE))
FatalError("Failed to enable xtst core devices."); FatalError("Failed to enable XTest core devices.");
AttachDevice(NULL, vxtstpointer, inputInfo.pointer); AttachDevice(NULL, xtestpointer, inputInfo.pointer);
AttachDevice(NULL, vxtstkeyboard, inputInfo.keyboard); AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
} }
/** /**
* Don't allow changing the Xtst property. * Don't allow changing the XTest property.
*/ */
static int static int
DeviceSetXtstProperty(DeviceIntPtr dev, Atom property, DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
XIPropertyValuePtr prop, BOOL checkonly) XIPropertyValuePtr prop, BOOL checkonly)
{ {
if (property == XIGetKnownProperty(XI_PROP_XTST_DEVICE)) if (property == XIGetKnownProperty(XI_PROP_XTEST_DEVICE))
return BadAccess; return BadAccess;
return Success; return Success;
@ -626,36 +626,36 @@ DeviceSetXtstProperty(DeviceIntPtr dev, Atom property,
* This only creates the pair, Activate/Enable Device * This only creates the pair, Activate/Enable Device
* still need to be called. * still need to be called.
*/ */
int AllocXtstDevice (ClientPtr client, char* name, int AllocXTestDevice (ClientPtr client, char* name,
DeviceIntPtr* ptr, DeviceIntPtr* keybd, DeviceIntPtr* ptr, DeviceIntPtr* keybd,
DeviceIntPtr master_ptr, DeviceIntPtr master_keybd) DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
{ {
int retval; int retval;
int len = strlen(name); int len = strlen(name);
char *xtstname = xcalloc(len + 6, 1 ); char *xtestname = xcalloc(len + 7, 1 );
char dummy = 1; char dummy = 1;
strncpy( xtstname, name, len); strncpy( xtestname, name, len);
strncat( xtstname, " Xtst", 5 ); strncat( xtestname, " XTEST", 6 );
retval = AllocDevicePair( client, xtstname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE); retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
if ( retval == Success ){ if ( retval == Success ){
dixSetPrivate(&((*ptr)->devPrivates), XTstDevicePrivateKey, (void *)master_ptr->id); dixSetPrivate(&((*ptr)->devPrivates), XTestDevicePrivateKey, (void *)master_ptr->id);
dixSetPrivate(&((*keybd)->devPrivates), XTstDevicePrivateKey, (void *)master_keybd->id); dixSetPrivate(&((*keybd)->devPrivates), XTestDevicePrivateKey, (void *)master_keybd->id);
} }
xfree( xtstname ); xfree( xtestname );
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTST_DEVICE), XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy, XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE); FALSE);
XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTST_DEVICE), FALSE); XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
XIRegisterPropertyHandler(*ptr, DeviceSetXtstProperty, NULL, NULL); XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTST_DEVICE), XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
XA_INTEGER, 8, PropModeReplace, 1, &dummy, XA_INTEGER, 8, PropModeReplace, 1, &dummy,
FALSE); FALSE);
XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTST_DEVICE), FALSE); XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
XIRegisterPropertyHandler(*keybd, DeviceSetXtstProperty, NULL, NULL); XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
return retval; return retval;
} }
@ -667,38 +667,38 @@ int AllocXtstDevice (ClientPtr client, char* name,
* xtest device. * xtest device.
*/ */
BOOL BOOL
IsXtstDevice(DeviceIntPtr dev, DeviceIntPtr master) IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
{ {
int is_xtst = FALSE; int is_XTest = FALSE;
int mid; int mid;
void *tmp; /* shut up, gcc! */ void *tmp; /* shut up, gcc! */
if (IsMaster(dev)) if (IsMaster(dev))
return is_xtst; return is_XTest;
tmp = dixLookupPrivate(&dev->devPrivates, XTstDevicePrivateKey); tmp = dixLookupPrivate(&dev->devPrivates, XTestDevicePrivateKey);
mid = (int)tmp; mid = (int)tmp;
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means xtst /* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest
* device */ * device */
if ((!master && mid) || if ((!master && mid) ||
(master && mid == master->id)) (master && mid == master->id))
is_xtst = TRUE; is_XTest = TRUE;
return is_xtst; return is_XTest;
} }
/** /**
* @return The X Test virtual device for the given master. * @return The X Test virtual device for the given master.
*/ */
DeviceIntPtr DeviceIntPtr
GetXtstDevice(DeviceIntPtr master) GetXTestDevice(DeviceIntPtr master)
{ {
DeviceIntPtr it; DeviceIntPtr it;
for (it = inputInfo.devices; it; it = it->next) for (it = inputInfo.devices; it; it = it->next)
{ {
if (IsXtstDevice(it, master)) if (IsXTestDevice(it, master))
return it; return it;
} }

View File

@ -141,7 +141,7 @@ int SProcXIChangeHierarchy(ClientPtr client)
int int
ProcXIChangeHierarchy(ClientPtr client) ProcXIChangeHierarchy(ClientPtr client)
{ {
DeviceIntPtr ptr, keybd, xtstptr, xtstkeybd; DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
xXIAnyHierarchyChangeInfo *any; xXIAnyHierarchyChangeInfo *any;
int required_len = sizeof(xXIChangeHierarchyReq); int required_len = sizeof(xXIChangeHierarchyReq);
char n; char n;
@ -189,7 +189,7 @@ ProcXIChangeHierarchy(ClientPtr client)
ptr->coreEvents = keybd->coreEvents = FALSE; ptr->coreEvents = keybd->coreEvents = FALSE;
/* Allocate virtual slave devices for xtest events */ /* Allocate virtual slave devices for xtest events */
rc = AllocXtstDevice(client, name, &xtstptr, &xtstkeybd, rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd,
ptr, keybd); ptr, keybd);
if (rc != Success) if (rc != Success)
{ {
@ -203,10 +203,10 @@ ProcXIChangeHierarchy(ClientPtr client)
flags[ptr->id] |= XIMasterAdded; flags[ptr->id] |= XIMasterAdded;
flags[keybd->id] |= XIMasterAdded; flags[keybd->id] |= XIMasterAdded;
ActivateDevice(xtstptr, FALSE); ActivateDevice(XTestptr, FALSE);
ActivateDevice(xtstkeybd, FALSE); ActivateDevice(XTestkeybd, FALSE);
flags[xtstptr->id] |= XISlaveAdded; flags[XTestptr->id] |= XISlaveAdded;
flags[xtstkeybd->id] |= XISlaveAdded; flags[XTestkeybd->id] |= XISlaveAdded;
if (c->enable) if (c->enable)
{ {
@ -215,18 +215,18 @@ ProcXIChangeHierarchy(ClientPtr client)
flags[ptr->id] |= XIDeviceEnabled; flags[ptr->id] |= XIDeviceEnabled;
flags[keybd->id] |= XIDeviceEnabled; flags[keybd->id] |= XIDeviceEnabled;
EnableDevice(xtstptr, FALSE); EnableDevice(XTestptr, FALSE);
EnableDevice(xtstkeybd, FALSE); EnableDevice(XTestkeybd, FALSE);
flags[xtstptr->id] |= XIDeviceEnabled; flags[XTestptr->id] |= XIDeviceEnabled;
flags[xtstkeybd->id] |= XIDeviceEnabled; flags[XTestkeybd->id] |= XIDeviceEnabled;
} }
/* Attach the XTest virtual devices to the newly /* Attach the XTest virtual devices to the newly
created master device */ created master device */
AttachDevice(NULL, xtstptr, ptr); AttachDevice(NULL, XTestptr, ptr);
AttachDevice(NULL, xtstkeybd, keybd); AttachDevice(NULL, XTestkeybd, keybd);
flags[xtstptr->id] |= XISlaveAttached; flags[XTestptr->id] |= XISlaveAttached;
flags[xtstkeybd->id] |= XISlaveAttached; flags[XTestkeybd->id] |= XISlaveAttached;
xfree(name); xfree(name);
} }
@ -275,14 +275,14 @@ ProcXIChangeHierarchy(ClientPtr client)
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
xtstptr = GetXtstDevice(ptr); XTestptr = GetXTestDevice(ptr);
rc = dixLookupDevice(&xtstptr, xtstptr->id, client, rc = dixLookupDevice(&XTestptr, XTestptr->id, client,
DixDestroyAccess); DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
xtstkeybd = GetXtstDevice(keybd); XTestkeybd = GetXTestDevice(keybd);
rc = dixLookupDevice(&xtstkeybd, xtstkeybd->id, client, rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
DixDestroyAccess); DixDestroyAccess);
if (rc != Success) if (rc != Success)
goto unwind; goto unwind;
@ -341,26 +341,26 @@ ProcXIChangeHierarchy(ClientPtr client)
/* can't disable until we removed pairing */ /* can't disable until we removed pairing */
keybd->spriteInfo->paired = NULL; keybd->spriteInfo->paired = NULL;
ptr->spriteInfo->paired = NULL; ptr->spriteInfo->paired = NULL;
xtstptr->spriteInfo->paired = NULL; XTestptr->spriteInfo->paired = NULL;
xtstkeybd->spriteInfo->paired = NULL; XTestkeybd->spriteInfo->paired = NULL;
/* disable the remove the devices, xtst devices must be done first /* disable the remove the devices, XTest devices must be done first
else the sprites they rely on will be destroyed */ else the sprites they rely on will be destroyed */
DisableDevice(xtstptr, FALSE); DisableDevice(XTestptr, FALSE);
DisableDevice(xtstkeybd, FALSE); DisableDevice(XTestkeybd, FALSE);
DisableDevice(keybd, FALSE); DisableDevice(keybd, FALSE);
DisableDevice(ptr, FALSE); DisableDevice(ptr, FALSE);
flags[xtstptr->id] |= XIDeviceDisabled | XISlaveDetached; flags[XTestptr->id] |= XIDeviceDisabled | XISlaveDetached;
flags[xtstkeybd->id] |= XIDeviceDisabled | XISlaveDetached; flags[XTestkeybd->id] |= XIDeviceDisabled | XISlaveDetached;
flags[keybd->id] |= XIDeviceDisabled; flags[keybd->id] |= XIDeviceDisabled;
flags[ptr->id] |= XIDeviceDisabled; flags[ptr->id] |= XIDeviceDisabled;
RemoveDevice(xtstptr, FALSE); RemoveDevice(XTestptr, FALSE);
RemoveDevice(xtstkeybd, FALSE); RemoveDevice(XTestkeybd, FALSE);
RemoveDevice(keybd, FALSE); RemoveDevice(keybd, FALSE);
RemoveDevice(ptr, FALSE); RemoveDevice(ptr, FALSE);
flags[xtstptr->id] |= XISlaveRemoved; flags[XTestptr->id] |= XISlaveRemoved;
flags[xtstkeybd->id] |= XISlaveRemoved; flags[XTestkeybd->id] |= XISlaveRemoved;
flags[keybd->id] |= XIMasterRemoved; flags[keybd->id] |= XIMasterRemoved;
flags[ptr->id] |= XIMasterRemoved; flags[ptr->id] |= XIMasterRemoved;
} }
@ -381,8 +381,8 @@ ProcXIChangeHierarchy(ClientPtr client)
goto unwind; goto unwind;
} }
/* Don't allow changes to Xtst Devices, these are fixed */ /* Don't allow changes to XTest Devices, these are fixed */
if (IsXtstDevice(ptr, NULL)) if (IsXTestDevice(ptr, NULL))
{ {
client->errorValue = c->deviceid; client->errorValue = c->deviceid;
rc = BadDevice; rc = BadDevice;
@ -410,8 +410,8 @@ ProcXIChangeHierarchy(ClientPtr client)
goto unwind; goto unwind;
} }
/* Don't allow changes to Xtst Devices, these are fixed */ /* Don't allow changes to XTest Devices, these are fixed */
if (IsXtstDevice(ptr, NULL)) if (IsXTestDevice(ptr, NULL))
{ {
client->errorValue = c->deviceid; client->errorValue = c->deviceid;
rc = BadDevice; rc = BadDevice;

View File

@ -51,7 +51,7 @@ static struct dev_properties
char *name; char *name;
} dev_properties[] = { } dev_properties[] = {
{0, XI_PROP_ENABLED}, {0, XI_PROP_ENABLED},
{0, XI_PROP_XTST_DEVICE}, {0, XI_PROP_XTEST_DEVICE},
{0, XATOM_FLOAT}, {0, XATOM_FLOAT},
{0, ACCEL_PROP_PROFILE_NUMBER}, {0, ACCEL_PROP_PROFILE_NUMBER},
{0, ACCEL_PROP_CONSTANT_DECELERATION}, {0, ACCEL_PROP_CONSTANT_DECELERATION},

View File

@ -1200,7 +1200,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
dev->last.numValuators = numAxes; dev->last.numValuators = numAxes;
if (IsMaster(dev) || /* do not accelerate master or xtest devices */ if (IsMaster(dev) || /* do not accelerate master or xtest devices */
IsXtstDevice(dev, NULL)) IsXTestDevice(dev, NULL))
InitPointerAccelerationScheme(dev, PtrAccelNoOp); InitPointerAccelerationScheme(dev, PtrAccelNoOp);
else else
InitPointerAccelerationScheme(dev, PtrAccelDefault); InitPointerAccelerationScheme(dev, PtrAccelDefault);

View File

@ -495,14 +495,14 @@ extern int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
KeyCode **modkeymap, int *max_keys_per_mod); KeyCode **modkeymap, int *max_keys_per_mod);
extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
int max_keys_per_mod); int max_keys_per_mod);
extern int AllocXtstDevice(ClientPtr client, extern int AllocXTestDevice(ClientPtr client,
char* name, char* name,
DeviceIntPtr* ptr, DeviceIntPtr* ptr,
DeviceIntPtr* keybd, DeviceIntPtr* keybd,
DeviceIntPtr master_ptr, DeviceIntPtr master_ptr,
DeviceIntPtr master_keybd); DeviceIntPtr master_keybd);
extern BOOL IsXtstDevice(DeviceIntPtr dev, DeviceIntPtr master); extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
extern DeviceIntPtr GetXtstDevice(DeviceIntPtr master); extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
/* misc event helpers */ /* misc event helpers */
extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);

View File

@ -32,8 +32,8 @@
/* BOOL. 0 - device disabled, 1 - device enabled */ /* BOOL. 0 - device disabled, 1 - device enabled */
#define XI_PROP_ENABLED "Device Enabled" #define XI_PROP_ENABLED "Device Enabled"
/* BOOL. If present, device is a virtual Xtst device */ /* BOOL. If present, device is a virtual XTEST device */
#define XI_PROP_XTST_DEVICE "Xtst Device" #define XI_PROP_XTEST_DEVICE "XTEST Device"
/* Pointer acceleration properties */ /* Pointer acceleration properties */
/* INTEGER of any format */ /* INTEGER of any format */