diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-31 16:27:58 +1030 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-31 17:09:13 +1030 |
commit | eb014021c2b3604fc67daebd6860b5dc959fabb6 (patch) | |
tree | b4430be57c6072b97334e6f3a4128da2d9024023 /dix | |
parent | b6b26560d65d9468c89dd046396d9aeb14e1b227 (diff) |
dix: PairDevices() can be static, remove from input.
PairDevices() is only ever called in EnableDevice().
Diffstat (limited to 'dix')
-rw-r--r-- | dix/devices.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/dix/devices.c b/dix/devices.c index abefc2e33..d9541b2ea 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -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 |