]> git.pld-linux.org Git - packages/weston.git/blob - libinput-0.9.patch
- complete ac/am rebuild
[packages/weston.git] / libinput-0.9.patch
1 From c54f23d8df4e758f097d127df4d44d7a00059cef Mon Sep 17 00:00:00 2001
2 From: Peter Hutterer <peter.hutterer@who-t.net>
3 Date: Tue, 13 Jan 2015 11:55:37 +1000
4 Subject: libinput-device: use the new merged scroll events
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 libinput now provides a single event for scroll events. Extract the axes from
10 that event and split them into the wl events.
11
12 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
13 Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
14
15 diff --git a/src/libinput-device.c b/src/libinput-device.c
16 index 8a48905..e68b54d 100644
17 --- a/src/libinput-device.c
18 +++ b/src/libinput-device.c
19 @@ -133,12 +133,27 @@ handle_pointer_axis(struct libinput_device *libinput_device,
20         struct evdev_device *device =
21                 libinput_device_get_user_data(libinput_device);
22         double value;
23 +       enum libinput_pointer_axis axis;
24 +
25 +       axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
26 +       if (libinput_event_pointer_has_axis(pointer_event, axis)) {
27 +               value = libinput_event_pointer_get_axis_value(pointer_event,
28 +                                                             axis);
29 +               notify_axis(device->seat,
30 +                           libinput_event_pointer_get_time(pointer_event),
31 +                           WL_POINTER_AXIS_VERTICAL_SCROLL,
32 +                           wl_fixed_from_double(value));
33 +       }
34  
35 -       value = libinput_event_pointer_get_axis_value(pointer_event);
36 -       notify_axis(device->seat,
37 -                   libinput_event_pointer_get_time(pointer_event),
38 -                   libinput_event_pointer_get_axis(pointer_event),
39 -                   wl_fixed_from_double(value));
40 +       axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
41 +       if (libinput_event_pointer_has_axis(pointer_event, axis)) {
42 +               value = libinput_event_pointer_get_axis_value(pointer_event,
43 +                                                             axis);
44 +               notify_axis(device->seat,
45 +                           libinput_event_pointer_get_time(pointer_event),
46 +                           WL_POINTER_AXIS_HORIZONTAL_SCROLL,
47 +                           wl_fixed_from_double(value));
48 +       }
49  }
50  
51  static void
52 -- 
53 cgit v0.10.2
54
55 From 5dddd411d6d8587267529d0478c5dc68e9521047 Mon Sep 17 00:00:00 2001
56 From: Peter Hutterer <peter.hutterer@who-t.net>
57 Date: Thu, 15 Jan 2015 13:14:43 +1000
58 Subject: libinput-device: use the discrete axis value for wheel events
59 MIME-Version: 1.0
60 Content-Type: text/plain; charset=UTF-8
61 Content-Transfer-Encoding: 8bit
62
63 libinput < 0.8 sent wheel click events with value 10. Since 0.8
64 the value is the angle of the click in degrees but it now provides
65 the click count as separate value. To keep backwards-compat with
66 existing clients, we just send multiples of the click count.
67
68 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
69 Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
70 Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
71
72 diff --git a/src/libinput-device.c b/src/libinput-device.c
73 index e68b54d..3ce74b8 100644
74 --- a/src/libinput-device.c
75 +++ b/src/libinput-device.c
76 @@ -126,6 +126,44 @@ handle_pointer_button(struct libinput_device *libinput_device,
77                       libinput_event_pointer_get_button_state(pointer_event));
78  }
79  
80 +static double
81 +normalize_scroll(struct libinput_event_pointer *pointer_event,
82 +                enum libinput_pointer_axis axis)
83 +{
84 +       static int warned;
85 +       enum libinput_pointer_axis_source source;
86 +       double value;
87 +
88 +       source = libinput_event_pointer_get_axis_source(pointer_event);
89 +       /* libinput < 0.8 sent wheel click events with value 10. Since 0.8
90 +          the value is the angle of the click in degrees. To keep
91 +          backwards-compat with existing clients, we just send multiples of
92 +          the click count.
93 +        */
94 +       switch (source) {
95 +       case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
96 +               value = 10 * libinput_event_pointer_get_axis_value_discrete(
97 +                                                                  pointer_event,
98 +                                                                  axis);
99 +               break;
100 +       case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
101 +       case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
102 +               value = libinput_event_pointer_get_axis_value(pointer_event,
103 +                                                             axis);
104 +               break;
105 +       default:
106 +               value = 0;
107 +               if (warned < 5) {
108 +                       weston_log("Unknown scroll source %d. Event discarded\n",
109 +                                  source);
110 +                       warned++;
111 +               }
112 +               break;
113 +       }
114 +
115 +       return value;
116 +}
117 +
118  static void
119  handle_pointer_axis(struct libinput_device *libinput_device,
120                     struct libinput_event_pointer *pointer_event)
121 @@ -137,8 +175,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
122  
123         axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
124         if (libinput_event_pointer_has_axis(pointer_event, axis)) {
125 -               value = libinput_event_pointer_get_axis_value(pointer_event,
126 -                                                             axis);
127 +               value = normalize_scroll(pointer_event, axis);
128                 notify_axis(device->seat,
129                             libinput_event_pointer_get_time(pointer_event),
130                             WL_POINTER_AXIS_VERTICAL_SCROLL,
131 @@ -147,8 +184,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
132  
133         axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
134         if (libinput_event_pointer_has_axis(pointer_event, axis)) {
135 -               value = libinput_event_pointer_get_axis_value(pointer_event,
136 -                                                             axis);
137 +               value = normalize_scroll(pointer_event, axis);
138                 notify_axis(device->seat,
139                             libinput_event_pointer_get_time(pointer_event),
140                             WL_POINTER_AXIS_HORIZONTAL_SCROLL,
141 -- 
142 cgit v0.10.2
143
144 --- weston-1.6.1/configure.ac~  2015-01-23 22:14:10.000000000 +0100
145 +++ weston-1.6.1/configure.ac   2015-02-01 15:11:40.242544080 +0100
146 @@ -160,7 +160,7 @@
147  AM_CONDITIONAL([ENABLE_LIBINPUT_BACKEND], [test x$enable_libinput_backend = xyes])
148  if test x$enable_libinput_backend = xyes; then
149    AC_DEFINE([BUILD_LIBINPUT_BACKEND], [1], [Build the libinput input device backend])
150 -  PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.6.0 libinput < 0.8.0])
151 +  PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.8.0])
152  fi
153  
154  
This page took 0.065191 seconds and 3 git commands to generate.