]> git.pld-linux.org Git - packages/xorg-driver-input-libinput.git/blob - 0001-Use-the-new-unaccelerated-valuator-ValuatorMask-feat.patch
b2dacb51e738b206c94fc8abf094799907c815f9
[packages/xorg-driver-input-libinput.git] / 0001-Use-the-new-unaccelerated-valuator-ValuatorMask-feat.patch
1 From 19c91044e44dd31deaeb638a919c64e9a9182448 Mon Sep 17 00:00:00 2001
2 From: Peter Hutterer <peter.hutterer@who-t.net>
3 Date: Tue, 5 May 2015 14:17:10 +1000
4 Subject: [PATCH xf86-input-libinput] Use the new unaccelerated valuator
5  ValuatorMask features
6
7 SDL Games like openarena rely on relative input that's handled by the DGA code
8 in the server. That code casts the driver's input data to int and sends it to
9 the client. libinput does pointer acceleration for us, so sending any deltas
10 of less than 1 (likely for slow movements) ends up being 0.
11
12 Use the new ValuatorMask accelerated/unaccelerated values to pass the
13 unaccelerated values along, the server can then decide what to do with it.
14
15 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
16 Reviewed-by: Hans de Goede <hdegoede@redhat.com>
17 ---
18  src/libinput.c | 27 ++++++++++++++++++++++++++-
19  1 file changed, 26 insertions(+), 1 deletion(-)
20
21 diff --git a/src/libinput.c b/src/libinput.c
22 index c8669fc..3cc4426 100644
23 --- a/src/libinput.c
24 +++ b/src/libinput.c
25 @@ -47,6 +47,12 @@
26  #define XI86_SERVER_FD 0x20
27  #endif
28  
29 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) * 1000 + GET_ABI_MINOR(ABI_XINPUT_VERSION) > 21000
30 +#define HAVE_VMASK_UNACCEL 1
31 +#else
32 +#undef HAVE_VMASK_UNACCEL
33 +#endif
34 +
35  #define TOUCHPAD_NUM_AXES 4 /* x, y, hscroll, vscroll */
36  #define TOUCH_MAX_SLOTS 15
37  #define XORG_KEYCODE_OFFSET 8
38 @@ -88,6 +94,7 @@ struct xf86libinput {
39         BOOL has_abs;
40  
41         ValuatorMask *valuators;
42 +       ValuatorMask *valuators_unaccelerated;
43  
44         struct options {
45                 BOOL tapping;
46 @@ -700,9 +707,21 @@ xf86libinput_handle_motion(InputInfoPtr pInfo, struct libinput_event_pointer *ev
47         y = libinput_event_pointer_get_dy(event);
48  
49         valuator_mask_zero(mask);
50 +
51 +#if HAVE_VMASK_UNACCEL
52 +       {
53 +               double ux, uy;
54 +
55 +               ux = libinput_event_pointer_get_dx_unaccelerated(event);
56 +               uy = libinput_event_pointer_get_dy_unaccelerated(event);
57 +
58 +               valuator_mask_set_unaccelerated(mask, 0, x, ux);
59 +               valuator_mask_set_unaccelerated(mask, 1, y, uy);
60 +       }
61 +#else
62         valuator_mask_set_double(mask, 0, x);
63         valuator_mask_set_double(mask, 1, y);
64 -
65 +#endif
66         xf86PostMotionEventM(dev, Relative, mask);
67  }
68  
69 @@ -1363,6 +1382,10 @@ xf86libinput_pre_init(InputDriverPtr drv,
70         if (!driver_data->valuators)
71                 goto fail;
72  
73 +       driver_data->valuators_unaccelerated = valuator_mask_new(2);
74 +       if (!driver_data->valuators_unaccelerated)
75 +               goto fail;
76 +
77         driver_data->scroll.vdist = 15;
78         driver_data->scroll.hdist = 15;
79  
80 @@ -1434,6 +1457,8 @@ fail:
81                 fd_pop(&driver_context, pInfo->fd);
82         if (driver_data->valuators)
83                 valuator_mask_free(&driver_data->valuators);
84 +       if (driver_data->valuators_unaccelerated)
85 +               valuator_mask_free(&driver_data->valuators_unaccelerated);
86         free(path);
87         free(driver_data);
88         return BadValue;
89 -- 
90 2.4.1
91
This page took 0.261548 seconds and 2 git commands to generate.