summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-03-11 19:07:58 -0400
committerAdam Jackson <ajax@redhat.com>2008-03-11 19:07:58 -0400
commit697e850a6387cf1e0a0a35ca8c694804a6c2427f (patch)
tree626faad9102a38fd063f3fc3d321acb848f208e8
parent87037b9953ebd47e9dbd99b3653050517aa490ff (diff)
Fix middle/right button munging.
Don't do this in the button map. That's writeable by clients, which means they have the chance to get it wrong. Just swap right and middle around in event dispatch before you get to the user's map.
-rw-r--r--src/evdev.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 89ff6a5..36fc231 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -252,11 +252,15 @@ EvdevReadInput(InputInfoPtr pInfo)
case EV_KEY:
switch (ev.code) {
+ /* swap here, pretend we're an X-conformant device. */
case BTN_LEFT:
+ xf86PostButtonEvent(pInfo->dev, 0, 1, value, 0, 0);
+ break;
case BTN_RIGHT:
+ xf86PostButtonEvent(pInfo->dev, 0, 3, value, 0, 0);
+ break;
case BTN_MIDDLE:
- xf86PostButtonEvent(pInfo->dev, 0, ev.code - BTN_LEFT + 1,
- value, 0, 0);
+ xf86PostButtonEvent(pInfo->dev, 0, 2, value, 0, 0);
break;
case BTN_SIDE:
@@ -799,15 +803,9 @@ EvdevAddButtonClass(DeviceIntPtr device)
pInfo = device->public.devicePrivate;
/* FIXME: count number of actual buttons */
-
for (i = 0; i < ArrayLength(map); i++)
map[i] = i;
- /* Linux reports BTN_LEFT, BTN_RIGHT, BTN_MIDDLE, which should map
- * to buttons 1, 2 and 3, so swap 2 and 3 in the map */
- map[2] = 3;
- map[3] = 2;
-
if (!InitButtonClassDeviceStruct(device, ArrayLength(map), map))
return !Success;