diff --git a/configure.ac b/configure.ac index 57c267a029..97b8828a61 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 8d6bbedce4..42b61f4b40 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); }