diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-10-14 08:00:06 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-10-16 12:05:09 +0930 |
commit | 9ecbbf198f4cec398897736e173e7e8c56bf6f94 (patch) | |
tree | 8de4a97b29e25a5c81ab6fca7f3ee094dfaebe5b | |
parent | 0c5f65ecd3ad11fbdb1cab3cb1d0eb4f33bb4e35 (diff) |
dix: adjust PickPointer and PickKeyboard to get the first master device.
Simplifies it a lot, since we always have at least one master device
available at all times, so less mucking around.
-rw-r--r-- | dix/events.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/dix/events.c b/dix/events.c index b84d18dee..58188c894 100644 --- a/dix/events.c +++ b/dix/events.c @@ -6117,34 +6117,22 @@ SetClientPointer(ClientPtr client, ClientPtr setter, DeviceIntPtr device) return TRUE; } -/* PickPointer will pick an appropriate pointer for the given client. - * - * If a client pointer is set, it will pick the client pointer, otherwise the - * first available pointer in the list. If no physical device is attached, it - * will pick the core pointer, but will not store it on the client. - */ +/* PickPointer will pick an appropriate pointer for the given client. */ _X_EXPORT DeviceIntPtr PickPointer(ClientPtr client) { if (!client->clientPtr) { - /* look if there is a real device attached */ DeviceIntPtr it = inputInfo.devices; while (it) { - if (it != inputInfo.pointer && it->spriteInfo->spriteOwner) + if (it->isMaster && it->spriteInfo->spriteOwner) { client->clientPtr = it; break; } it = it->next; } - - if (!it) - { - ErrorF("[dix] Picking VCP\n"); - return inputInfo.pointer; - } } return client->clientPtr; } @@ -6159,18 +6147,15 @@ _X_EXPORT DeviceIntPtr PickKeyboard(ClientPtr client) { DeviceIntPtr ptr = PickPointer(client); - DeviceIntPtr kbd = inputInfo.devices; + DeviceIntPtr kbd = ptr->spriteInfo->paired; - while(kbd) + if (!kbd) { - if (ptr != kbd && - IsKeyboardDevice(kbd) && - ptr->spriteInfo->sprite == kbd->spriteInfo->sprite) - return kbd; - kbd = kbd->next; + ErrorF("[dix] ClientPointer not paired with a keyboard. This " + "is a bug.\n"); } - return (kbd) ? kbd : inputInfo.keyboard; + return kbd; } /* A client that has one or more core grabs does not get core events from |