diff -u src_orig/evdev.c src/evdev.c --- src_orig/evdev.c 2014-08-03 19:22:50.726954463 +0200 +++ src/evdev.c 2014-08-22 14:18:46.162798795 +0200 @@ -866,8 +866,7 @@ * Post the relative motion events. */ void -EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, - int v[MAX_VALUATORS]) +EvdevPostRelativeMotionEvents(InputInfoPtr pInfo) { EvdevPtr pEvdev = pInfo->private; @@ -880,8 +879,7 @@ * Post the absolute motion events. */ void -EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, - int v[MAX_VALUATORS]) +EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo) { EvdevPtr pEvdev = pInfo->private; @@ -900,8 +898,7 @@ } static void -EvdevPostProximityEvents(InputInfoPtr pInfo, int which, int num_v, int first_v, - int v[MAX_VALUATORS]) +EvdevPostProximityEvents(InputInfoPtr pInfo, int which) { int i; EvdevPtr pEvdev = pInfo->private; @@ -916,8 +913,7 @@ break; case EV_QUEUE_PROXIMITY: if (pEvdev->queue[i].val == which) - xf86PostProximityEventP(pInfo->dev, which, first_v, num_v, - v + first_v); + xf86PostProximityEvent(pInfo->dev, which, 0, 0); break; } } @@ -926,8 +922,7 @@ /** * Post the queued key/button events. */ -static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int num_v, int first_v, - int v[MAX_VALUATORS]) +static void EvdevPostQueuedEvents(InputInfoPtr pInfo) { int i; EvdevPtr pEvdev = pInfo->private; @@ -943,13 +938,19 @@ pEvdev->queue[i].detail.key, pEvdev->queue[i].val)) break; - - if (pEvdev->abs_queued && pEvdev->in_proximity) { - xf86PostButtonEventP(pInfo->dev, Absolute, pEvdev->queue[i].detail.key, - pEvdev->queue[i].val, first_v, num_v, - v + first_v); - +/* + * we try to report valuators with the button event, but only if + * a) the valuators are absolute (because sending several time a relative + * valuator would be akin to moving the cursor twice) + * b) we are in proximity (because we cannot trust position otherwise) + */ + if ((pEvdev->flags & EVDEV_ABSOLUTE_EVENTS) && + !(pEvdev->flags & EVDEV_RELATIVE_MODE) && + pEvdev->in_proximity && pEvdev->vals) { + xf86PostButtonEventM(pInfo->dev, Absolute, pEvdev->queue[i].detail.key, + pEvdev->queue[i].val, pEvdev->vals); } else +/* Either we are relative, or not in proximity */ xf86PostButtonEvent(pInfo->dev, Relative, pEvdev->queue[i].detail.key, pEvdev->queue[i].val, 0, 0); break; @@ -974,8 +975,6 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev) { int i; - int num_v = 0, first_v = 0; - int v[MAX_VALUATORS] = {}; EvdevPtr pEvdev = pInfo->private; EvdevProcessProximityState(pInfo); @@ -983,11 +982,11 @@ EvdevProcessValuators(pInfo); EvdevProcessTouch(pInfo); - EvdevPostProximityEvents(pInfo, TRUE, num_v, first_v, v); - EvdevPostRelativeMotionEvents(pInfo, num_v, first_v, v); - EvdevPostAbsoluteMotionEvents(pInfo, num_v, first_v, v); - EvdevPostQueuedEvents(pInfo, num_v, first_v, v); - EvdevPostProximityEvents(pInfo, FALSE, num_v, first_v, v); + EvdevPostProximityEvents(pInfo, TRUE); + EvdevPostRelativeMotionEvents(pInfo); + EvdevPostAbsoluteMotionEvents(pInfo); + EvdevPostQueuedEvents(pInfo); + EvdevPostProximityEvents(pInfo, FALSE); memset(pEvdev->delta, 0, sizeof(pEvdev->delta)); for (i = 0; i < ArrayLength(pEvdev->queue); i++) @@ -999,7 +998,10 @@ /* don't reset the touchMask */ } - if (pEvdev->vals) + /* do not reset pEvdev->vals if the device uses absolute events, + * as we always want to know the full position of the device */ + if (pEvdev->vals && + (pEvdev->flags & (EVDEV_RELATIVE_EVENTS|EVDEV_RELATIVE_MODE)) ) valuator_mask_zero(pEvdev->vals); pEvdev->num_queue = 0; pEvdev->abs_queued = 0; diff -u src_orig/evdev.h src/evdev.h --- src_orig/evdev.h 2014-08-03 19:22:50.726954463 +0200 +++ src/evdev.h 2014-08-22 11:30:31.236152942 +0200 @@ -263,10 +263,8 @@ #endif void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act); void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count); -void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, - int v[MAX_VALUATORS]); -void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v, - int v[MAX_VALUATORS]); +void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo); +void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo); unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code); /* Middle Button emulation */