dix: PairDevices() can be static, remove from input.

PairDevices() is only ever called in EnableDevice().
This commit is contained in:
Peter Hutterer 2008-10-31 16:27:58 +10:30
parent b6b26560d6
commit eb014021c2
2 changed files with 32 additions and 36 deletions

View File

@ -128,6 +128,38 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
return Success;
}
/* Pair the keyboard to the pointer device. Keyboard events will follow the
* pointer sprite. Only applicable for master devices.
* If the client is set, the request to pair comes from some client. In this
* case, we need to check for access. If the client is NULL, it's from an
* internal automatic pairing, we must always permit this.
*/
static int
PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
{
if (!ptr)
return BadDevice;
/* Don't allow pairing for slave devices */
if (!ptr->isMaster || !kbd->isMaster)
return BadDevice;
if (ptr->spriteInfo->paired)
return BadDevice;
if (kbd->spriteInfo->spriteOwner)
{
xfree(kbd->spriteInfo->sprite);
kbd->spriteInfo->sprite = NULL;
kbd->spriteInfo->spriteOwner = FALSE;
}
kbd->spriteInfo->sprite = ptr->spriteInfo->sprite;
kbd->spriteInfo->paired = ptr;
ptr->spriteInfo->paired = kbd;
return Success;
}
/**
@ -2462,38 +2494,6 @@ ProcQueryKeymap(ClientPtr client)
return Success;
}
/* Pair the keyboard to the pointer device. Keyboard events will follow the
* pointer sprite. Only applicable for master devices.
* If the client is set, the request to pair comes from some client. In this
* case, we need to check for access. If the client is NULL, it's from an
* internal automatic pairing, we must always permit this.
*/
int
PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
{
if (!ptr)
return BadDevice;
/* Don't allow pairing for slave devices */
if (!ptr->isMaster || !kbd->isMaster)
return BadDevice;
if (ptr->spriteInfo->paired)
return BadDevice;
if (kbd->spriteInfo->spriteOwner)
{
xfree(kbd->spriteInfo->sprite);
kbd->spriteInfo->sprite = NULL;
kbd->spriteInfo->spriteOwner = FALSE;
}
kbd->spriteInfo->sprite = ptr->spriteInfo->sprite;
kbd->spriteInfo->paired = ptr;
ptr->spriteInfo->paired = kbd;
return Success;
}
/**
* Attach device 'dev' to device 'master'.
* Client is set to the client that issued the request, or NULL if it comes

View File

@ -512,10 +512,6 @@ extern int GetMotionHistory(
extern void SwitchCorePointer(DeviceIntPtr pDev);
/* Pairing input devices */
extern int PairDevices(ClientPtr client,
DeviceIntPtr pointer,
DeviceIntPtr keyboard);
extern int AttachDevice(ClientPtr client,
DeviceIntPtr slave,
DeviceIntPtr master);