From: Stefan Schmidt Date: Thu, 12 Feb 2015 17:01:55 +0000 (+0100) Subject: ecore/drm: Add support for changed libinput API since 0.8 X-Git-Tag: upstream/1.13.1~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18262f89304dc130b2ff44f3b459d6edbb47b788;p=platform%2Fupstream%2Fefl.git 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 --- diff --git a/configure.ac b/configure.ac index c108b1b..bee3ace 100644 --- a/configure.ac +++ b/configure.ac @@ -3057,6 +3057,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 @@ -3080,6 +3081,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); }