From 697e850a6387cf1e0a0a35ca8c694804a6c2427f Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 11 Mar 2008 19:07:58 -0400 Subject: 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. --- src/evdev.c | 14 ++++++-------- 1 file 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; -- cgit v1.2.3