Author: krejzi
Date: Thu Jan 15 17:59:42 2015
New Revision: 3115

Log:
Fix some packages to work with latest libinput.

Added:
   trunk/clutter/clutter-1.12.0-libinput_fixes-1.patch
   trunk/kwin/
   trunk/kwin/kwin-5.1.95-libinput_fixes-1.patch
   trunk/weston/weston-1.6.0-libinput_fixes-1.patch

Added: trunk/clutter/clutter-1.12.0-libinput_fixes-1.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/clutter/clutter-1.12.0-libinput_fixes-1.patch Thu Jan 15 17:59:42 
2015        (r3115)
@@ -0,0 +1,68 @@
+Submitted By:            Armin K. <krejzi at email dot com>
+Date:                    2015-01-16
+Initial Package Version: 1.20.0
+Upstream Status:         Submitted
+Origin:                  Upstream Bugzilla
+Description:             Fixes building with libinput-0.8.0
+
+--- a/clutter/evdev/clutter-device-manager-evdev.c     2014-09-22 
12:01:08.000000000 +0200
++++ b/clutter/evdev/clutter-device-manager-evdev.c     2015-01-16 
01:13:27.966711273 +0100
+@@ -1174,30 +1174,42 @@
+ 
+     case LIBINPUT_EVENT_POINTER_AXIS:
+       {
+-        gdouble value, dx = 0.0, dy = 0.0;
++        gdouble dx = 0.0, dy = 0.0;
+         guint32 time;
++        gboolean wheel = FALSE;
+         enum libinput_pointer_axis axis;
++        enum libinput_pointer_axis_source source;
+         struct libinput_event_pointer *axis_event =
+           libinput_event_get_pointer_event (event);
++
+         device = libinput_device_get_user_data (libinput_device);
+ 
+         time = libinput_event_pointer_get_time (axis_event);
+-        value = libinput_event_pointer_get_axis_value (axis_event);
+-        axis = libinput_event_pointer_get_axis (axis_event);
+-
+-        switch (axis)
+-          {
+-          case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
+-            dx = 0;
+-            dy = value;
+-            break;
+-
+-          case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
+-            dx = value;
+-            dy = 0;
+-            break;
++        source = libinput_event_pointer_get_axis_source (axis_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. */
++
++        if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
++            wheel = TRUE;
++
++        axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
++        if (libinput_event_pointer_has_axis (axis_event, axis)) {
++          if (wheel)
++            dy = 10 * libinput_event_pointer_get_axis_value_discrete 
(axis_event, axis);
++          else
++            dy = libinput_event_pointer_get_axis_value (axis_event, axis);
++        }
++
++        axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
++        if (libinput_event_pointer_has_axis (axis_event, axis)) {
++          if (wheel)
++            dx = 10 * libinput_event_pointer_get_axis_value_discrete 
(axis_event, axis);
++          else
++            dx = libinput_event_pointer_get_axis_value (axis_event, axis);
++        }
+ 
+         notify_scroll (device, time, dx, dy);
+         break;

Added: trunk/kwin/kwin-5.1.95-libinput_fixes-1.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/kwin/kwin-5.1.95-libinput_fixes-1.patch       Thu Jan 15 17:59:42 
2015        (r3115)
@@ -0,0 +1,48 @@
+Submitted By:            Armin K. <krejzi at email dot com>
+Date:                    2015-01-15
+Initial Package Version: 5.1.95
+Upstream Status:         Submitted
+Origin:                  Self
+Description:             Fixes building with libinput-0.8.0
+
+--- a/libinput/events.cpp      2015-01-12 16:33:15.000000000 +0100
++++ b/libinput/events.cpp      2015-01-16 02:25:49.438516796 +0100
+@@ -146,19 +146,33 @@
+ InputRedirection::PointerAxis PointerEvent::axis() const
+ {
+     Q_ASSERT(type() == LIBINPUT_EVENT_POINTER_AXIS);
+-    switch (libinput_event_pointer_get_axis(m_pointerEvent)) {
+-    case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
++    if (libinput_event_pointer_has_axis(m_pointerEvent, 
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL))
+         return InputRedirection::PointerAxisHorizontal;
+-    case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
++
++    if (libinput_event_pointer_has_axis(m_pointerEvent, 
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL))
+         return InputRedirection::PointerAxisVertical;
+-    }
++
+     abort();
+ }
+ 
+ qreal PointerEvent::axisValue() const
+ {
+     Q_ASSERT(type() == LIBINPUT_EVENT_POINTER_AXIS);
+-    return libinput_event_pointer_get_axis_value(m_pointerEvent);
++
++    enum libinput_pointer_axis axis_scroll;
++
++    if (libinput_event_pointer_has_axis(m_pointerEvent, 
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL))
++      axis_scroll = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
++    else if (libinput_event_pointer_has_axis(m_pointerEvent, 
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL))
++      axis_scroll = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
++    else
++      abort();
++
++    if (libinput_event_pointer_get_axis_source(m_pointerEvent) ==  
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
++      return 10 * 
libinput_event_pointer_get_axis_value_discrete(m_pointerEvent, axis_scroll);
++    else
++      return libinput_event_pointer_get_axis_value(m_pointerEvent, 
axis_scroll);
++
+ }
+ 
+ }

Added: trunk/weston/weston-1.6.0-libinput_fixes-1.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/weston/weston-1.6.0-libinput_fixes-1.patch    Thu Jan 15 17:59:42 
2015        (r3115)
@@ -0,0 +1,85 @@
+Submitted By:            Armin K. <krejzi at email dot com>
+Date:                    2015-01-16
+Initial Package Version: 1.6.0
+Upstream Status:         Fixed
+Origin:                  Upstream
+Description:             Fixes building with libinput-0.8.0
+
+--- a/src/libinput-device.c    2014-09-17 15:41:56.000000000 +0200
++++ b/src/libinput-device.c    2015-01-16 02:43:31.425340998 +0100
+@@ -126,6 +126,44 @@
+                     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)
+@@ -133,12 +171,25 @@
+       struct evdev_device *device =
+               libinput_device_get_user_data(libinput_device);
+       double value;
++      enum libinput_pointer_axis axis;
++
++      axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
++      if (libinput_event_pointer_has_axis(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,
++                          wl_fixed_from_double(value));
++      }
+ 
+-      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_HORIZONTAL;
++      if (libinput_event_pointer_has_axis(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,
++                          wl_fixed_from_double(value));
++      }
+ }
+ 
+ static void
-- 
http://lists.linuxfromscratch.org/listinfo/patches
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to