mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-03-24 18:04:00 +00:00
Move EVDEV_RELATIVE_MODE logic earlier
When in EVDEV_RELATIVE_MODE, after converting the absolute valuators, the code unsets pEvdev->abs_queued. This is wrong if there are some absolute valuators which are not positions, such as a pressure valuators, because events on these valuators would be lost. This patch fixes the problem by doing the absolute->relative translation early. This way, abs_queued is not set and then unset when receiving absolute valuators representing positions. Other absolute events now set abs_queued and will be processed. Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
3dcf6f123c
commit
511498478b
49
src/evdev.c
49
src/evdev.c
@@ -447,39 +447,10 @@ EvdevProcessValuators(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
int deltaX = 0, deltaY = 0;
|
||||
|
||||
if (pEvdev->abs_queued) {
|
||||
/* convert to relative motion for touchpads */
|
||||
if (pEvdev->flags & EVDEV_RELATIVE_MODE) {
|
||||
if (valuator_mask_isset(pEvdev->abs_vals, 0))
|
||||
{
|
||||
if (valuator_mask_isset(pEvdev->old_vals, 0))
|
||||
deltaX = valuator_mask_get(pEvdev->abs_vals, 0) -
|
||||
valuator_mask_get(pEvdev->old_vals, 0);
|
||||
valuator_mask_set(pEvdev->old_vals, 0,
|
||||
valuator_mask_get(pEvdev->abs_vals, 0));
|
||||
}
|
||||
if (valuator_mask_isset(pEvdev->abs_vals, 1))
|
||||
{
|
||||
if (valuator_mask_isset(pEvdev->old_vals, 1))
|
||||
deltaY = valuator_mask_get(pEvdev->abs_vals, 1) -
|
||||
valuator_mask_get(pEvdev->old_vals, 1);
|
||||
valuator_mask_set(pEvdev->old_vals, 1,
|
||||
valuator_mask_get(pEvdev->abs_vals, 1));
|
||||
}
|
||||
valuator_mask_zero(pEvdev->abs_vals);
|
||||
pEvdev->abs_queued = 0;
|
||||
pEvdev->rel_queued = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Apply transformations on relative coordinates */
|
||||
if (pEvdev->rel_queued) {
|
||||
/* deltaX and deltaY may be non-zero if they got computed
|
||||
* because EVDEV_RELATIVE_MODE, but then we don't expect
|
||||
* pEvdev->rel_vals also to be set...
|
||||
*/
|
||||
int deltaX = 0, deltaY = 0;
|
||||
|
||||
if (valuator_mask_isset(pEvdev->rel_vals, REL_X))
|
||||
deltaX = valuator_mask_get(pEvdev->rel_vals, REL_X);
|
||||
if (valuator_mask_isset(pEvdev->rel_vals, REL_Y))
|
||||
@@ -824,8 +795,20 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
pEvdev->abs_queued = 1;
|
||||
} else if (!pEvdev->mt_mask) {
|
||||
map = pEvdev->abs_axis_map[ev->code];
|
||||
valuator_mask_set(pEvdev->abs_vals, map, value);
|
||||
pEvdev->abs_queued = 1;
|
||||
|
||||
/* check if the event must be translated into relative */
|
||||
if (map < 2 && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
|
||||
int oldval;
|
||||
if (valuator_mask_fetch(pEvdev->old_vals, map, &oldval)) {
|
||||
valuator_mask_set(pEvdev->rel_vals, map, value - oldval);
|
||||
pEvdev->rel_queued = 1;
|
||||
}
|
||||
valuator_mask_set(pEvdev->old_vals, map, value);
|
||||
} else {
|
||||
/* the normal case: just store the number. */
|
||||
valuator_mask_set(pEvdev->abs_vals, map, value);
|
||||
pEvdev->abs_queued = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user