Update to and require libinput 0.8

main
Peter Hutterer 10 years ago
parent e483b076e8
commit 5c93bee385
  1. 93
      0001-libinput-device-use-the-discrete-axis-value-for-whee.patch
  2. 57
      0001-libinput-device-use-the-new-merged-scroll-events.patch
  3. 12
      weston.spec

@ -0,0 +1,93 @@
From 2c8d0999bc4b83a0f8326f5c2706dd3bd00a6e7f Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 15 Jan 2015 13:14:43 +1000
Subject: [PATCH weston] libinput-device: use the discrete axis value for wheel
events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
libinput < 0.8 sent wheel click events with value 10. Since 0.8
the value is the angle of the click in degrees but it now provides
the click count as separate value. To keep backwards-compat with
existing clients, we just send multiples of the click count.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
---
src/libinput-device.c | 44 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 6bb7a75..0cd215a 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -126,6 +126,44 @@ handle_pointer_button(struct libinput_device *libinput_device,
libinput_event_pointer_get_button_state(pointer_event));
}
+static double
+normalize_scroll(struct libinput_event_pointer *pointer_event,
+ enum libinput_pointer_axis axis)
+{
+ static int warned;
+ enum libinput_pointer_axis_source source;
+ double value;
+
+ source = libinput_event_pointer_get_axis_source(pointer_event);
+ /* libinput < 0.8 sent wheel click events with value 10. Since 0.8
+ the value is the angle of the click in degrees. To keep
+ backwards-compat with existing clients, we just send multiples of
+ the click count.
+ */
+ switch (source) {
+ case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
+ value = 10 * libinput_event_pointer_get_axis_value_discrete(
+ pointer_event,
+ axis);
+ break;
+ case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
+ case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
+ value = libinput_event_pointer_get_axis_value(pointer_event,
+ axis);
+ break;
+ default:
+ value = 0;
+ if (warned < 5) {
+ weston_log("Unknown scroll source %d. Event discarded\n",
+ source);
+ warned++;
+ }
+ break;
+ }
+
+ return value;
+}
+
static void
handle_pointer_axis(struct libinput_device *libinput_device,
struct libinput_event_pointer *pointer_event)
@@ -137,8 +175,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
if (libinput_event_pointer_has_axis(pointer_event, axis)) {
- value = libinput_event_pointer_get_axis_value(pointer_event,
- axis);
+ value = normalize_scroll(pointer_event, axis);
notify_axis(device->seat,
libinput_event_pointer_get_time(pointer_event),
WL_POINTER_AXIS_VERTICAL_SCROLL,
@@ -147,8 +184,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
if (libinput_event_pointer_has_axis(pointer_event, axis)) {
- value = libinput_event_pointer_get_axis_value(pointer_event,
- axis);
+ value = normalize_scroll(pointer_event, axis);
notify_axis(device->seat,
libinput_event_pointer_get_time(pointer_event),
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
--
2.1.0

@ -0,0 +1,57 @@
From 7a9318523c4dafdfb24f088af70fe84426368d3d Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 13 Jan 2015 11:55:37 +1000
Subject: [PATCH weston] libinput-device: use the new merged scroll events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
libinput now provides a single event for scroll events. Extract the axes from
that event and split them into the wl events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
---
src/libinput-device.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 0e3f46d..6bb7a75 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -133,12 +133,27 @@ handle_pointer_axis(struct libinput_device *libinput_device,
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
double value;
+ enum libinput_pointer_axis axis;
- value = libinput_event_pointer_get_axis_value(pointer_event);
- notify_axis(device->seat,
- libinput_event_pointer_get_time(pointer_event),
- libinput_event_pointer_get_axis(pointer_event),
- wl_fixed_from_double(value));
+ axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
+ if (libinput_event_pointer_has_axis(pointer_event, axis)) {
+ value = libinput_event_pointer_get_axis_value(pointer_event,
+ axis);
+ notify_axis(device->seat,
+ libinput_event_pointer_get_time(pointer_event),
+ WL_POINTER_AXIS_VERTICAL_SCROLL,
+ wl_fixed_from_double(value));
+ }
+
+ axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
+ if (libinput_event_pointer_has_axis(pointer_event, axis)) {
+ value = libinput_event_pointer_get_axis_value(pointer_event,
+ axis);
+ notify_axis(device->seat,
+ libinput_event_pointer_get_time(pointer_event),
+ WL_POINTER_AXIS_HORIZONTAL_SCROLL,
+ wl_fixed_from_double(value));
+ }
}
static void
--
2.1.0

@ -6,7 +6,7 @@
Name: weston
Version: 1.6.0
Release: 3%{?alphatag}%{?dist}
Release: 4%{?alphatag}%{?dist}
Summary: Reference compositor for Wayland
Group: User Interface/X
License: BSD and CC-BY-SA
@ -18,6 +18,9 @@ Source0: http://wayland.freedesktop.org/releases/%{name}-%{version}.tar.x
%endif
Source1: make-git-snapshot.sh
Patch01: 0001-libinput-device-use-the-new-merged-scroll-events.patch
Patch02: 0001-libinput-device-use-the-discrete-axis-value-for-whee.patch
BuildRequires: autoconf
BuildRequires: cairo-devel >= 1.10.0
BuildRequires: glib2-devel
@ -26,7 +29,7 @@ BuildRequires: libjpeg-turbo-devel
BuildRequires: libpng-devel
BuildRequires: librsvg2
BuildRequires: libtool
BuildRequires: libinput-devel
BuildRequires: libinput-devel >= 0.8
%if 0%{?fedora} < 18
BuildRequires: libudev-devel
%endif
@ -73,6 +76,8 @@ Common headers for weston
%prep
%setup -q -n %{name}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
%patch01 -p1
%patch02 -p1
%build
# temporary force to pick up configure.ac changes
@ -129,6 +134,9 @@ find $RPM_BUILD_ROOT -name \*.la | xargs rm -f
%{_libdir}/pkgconfig/weston.pc
%changelog
* Fri Jan 16 2015 Peter Hutterer <peter.hutterer@redhat.com> 1.6.0-4
- Update to and require libinput 0.8
* Fri Dec 19 2014 Kevin Fenzi <kevin@scrye.com> 1.6.0-3
- Rebuild for new freerdp

Loading…
Cancel
Save