--- xorg-x11-drv-mtev-0.1.13/src/multitouch.c.orig +++ xorg-x11-drv-mtev-0.1.13/src/multitouch.c @@ -21,6 +21,7 @@ **************************************************************************/ #define MODULEVENDORSTRING "Nokia" +/* #define NO_RIGHT_MOUSE_BUTTON_EMULATION */ #include "xorg-server.h" #include @@ -250,12 +251,19 @@ static int device_close(InputInfoPtr pInfo) return Success; } +#define BUTTON_1 (1L<<1) +#define BUTTON_2 (1L<<2) +#define BUTTON_3 (1L<<3) + static void process_state(InputInfoPtr pInfo, const struct mtev_mtouch *mt) { const struct mtev_touch_point *tp; static int pdown = 0; +#ifndef NO_RIGHT_MOUSE_BUTTON_EMULATION + static int buttons = 0; +#endif int valuators[MAX_VALUATORS]; int down; int valix; @@ -313,6 +321,7 @@ static void process_state(InputInfoPtr pInfo, xf86PostMotionEventP(pInfo->dev, TRUE, 0, down * MT_AXIS_PER_FINGER, valuators); +#ifdef NO_RIGHT_MOUSE_BUTTON_EMULATION if(down && pdown == 0) xf86PostButtonEventP(pInfo->dev, TRUE, 1, 1, @@ -321,6 +330,42 @@ static void process_state(InputInfoPtr pInfo, xf86PostButtonEvent(pInfo->dev, TRUE, 1, 0, 0, 0); pdown = !!down; +#else // Right Mouse Button Emulation + if(down > pdown) { + // Button Down + if(down == 1 && !(buttons & BUTTON_1)) { + buttons = BUTTON_1; + xf86PostButtonEventP(pInfo->dev, TRUE, + 1, 1, + 0, down * MT_AXIS_PER_FINGER, valuators); + } else if (down == 2 && !(buttons & BUTTON_3)) { + buttons |= BUTTON_3; + xf86PostButtonEventP(pInfo->dev, TRUE, + 3, 1, + 0, down * MT_AXIS_PER_FINGER, valuators); + } + } else if (down < pdown && down < 2) { + if(buttons & BUTTON_3) { + xf86PostButtonEventP(pInfo->dev, TRUE, + 3, 0, + 0, down * MT_AXIS_PER_FINGER, valuators); + buttons &= ~BUTTON_3; + } + /* if down == 0, left button handled below */ + } + + if(down == 0) { + if(buttons & BUTTON_3) + xf86PostButtonEventP(pInfo->dev, TRUE, + 3, 0, + 0, down * MT_AXIS_PER_FINGER, valuators); + if(buttons & BUTTON_1) + xf86PostButtonEvent(pInfo->dev, TRUE, 1, 0, 0, 0); + buttons = 0; + } + + pdown = down; +#endif // NO_RIGHT_MOUSE_BUTTON_EMULATION } /* called for each full received packet from the touchpad */ -- 1.7.7.4