stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=52c48cfc214a9fb36db90748cfdf8095fd23db30

commit 52c48cfc214a9fb36db90748cfdf8095fd23db30
Author: Stefan Schmidt <[email protected]>
Date:   Thu Feb 12 18:01:55 2015 +0100

    ecore/drm: Add support for changed libinput API since 0.8
    
    We check for libinput 06 or higher. In version 0.8 they got an API break
    (hopefully the last one before 1.0) which we did not support so far. I have
    seen libinput 0.9 used on gentoo and newer ubuntu systems so we should
    definitely support them.
    
    Adding a LIBINPUT_HIGHER_08 define to check for this. So far we have only 
one
    location where we need it. Once there is a libinput 1.0 we should remove the
    support for older versions.
    
    http://lists.freedesktop.org/archives/wayland-devel/2015-January/019383.html
---
 configure.ac                        | 15 +++++++++++++++
 src/lib/ecore_drm/ecore_drm_evdev.c | 15 ++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 57c267a..97b8828 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3058,6 +3058,7 @@ AM_CONDITIONAL([HAVE_EEZE_TIZEN], [test "x${want_tizen}" 
= "xyes"])
 
 
 #### Ecore_Drm
+have_libinput_new="no"
 EFL_LIB_START_OPTIONAL([Ecore_Drm], [test "${want_drm}" = "yes"])
 
 ### Additional options to configure
@@ -3081,6 +3082,20 @@ EFL_INTERNAL_DEPEND_PKG([ECORE_DRM], [eina])
 EFL_DEPEND_PKG([ECORE_DRM], [DRM], [libdrm >= 2.4 xkbcommon >= 0.3.0 gbm])
 EFL_DEPEND_PKG([ECORE_DRM], [LIBINPUT], [libinput >= 0.6.0])
 
+# API change from 0.7 to 0.8. So we define this to support both for now.
+PKG_CHECK_EXISTS([libinput >= 0.8.0],
+                 [have_libinput_new="yes"],
+                 [have_libinput_new="no"])
+AC_MSG_CHECKING([Use new libinput API (newer than 0.8.0)])
+AC_MSG_RESULT([${have_libinput_new}])
+if test "x${have_libinput_new}" = "xyes";then
+  AC_DEFINE_UNQUOTED([LIBINPUT_HIGHER_08], [1], [libinput version >= 0.8])
+fi
+if test "x${have_libinput_new}" = "xno";then
+  AC_DEFINE_UNQUOTED([LIBINPUT_HIGHER_08], [0], [libinput version >= 0.8])
+fi
+
+
 EFL_EVAL_PKGS([ECORE_DRM])
 
 ### Checks for header files
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c 
b/src/lib/ecore_drm/ecore_drm_evdev.c
index 8d6bbed..42b61f4 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -503,7 +503,6 @@ _device_handle_axis(struct libinput_device *device, struct 
libinput_event_pointe
 
    if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
 
-   axis = libinput_event_pointer_get_axis(event);
    timestamp = libinput_event_pointer_get_time(event);
 
    ev->window = (Ecore_Window)input->dev->window;
@@ -522,8 +521,22 @@ _device_handle_axis(struct libinput_device *device, struct 
libinput_event_pointe
    ev->root.x = ev->x;
    ev->root.y = ev->y;
 
+#ifdef LIBINPUT_HIGHER_08
+   axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
+   if (libinput_event_pointer_has_axis(event, axis)) {
+     ev->z = libinput_event_pointer_get_axis_value(event, axis);
+   }
+
+   axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
+   if (libinput_event_pointer_has_axis(event, axis)) {
+     ev->direction = 1;
+     ev->z = libinput_event_pointer_get_axis_value(event, axis);
+   }
+#else
+   axis = libinput_event_pointer_get_axis(event);
    if (axis == LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL) ev->direction = 1;
    ev->z = libinput_event_pointer_get_axis_value(event);
+#endif
 
    ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
 }

-- 


Reply via email to