Commit 3cd9a70f authored by Rui Matos's avatar Rui Matos

device-manager-evdev: Stop using deprecated libevdev API

Fixes compiler warnings with libevdev >= 0.4 and makes use of a new
function to set the clock id instead of doing the ioctl directly.

https://bugzilla.gnome.org/show_bug.cgi?id=712816
parent 05e6bcc6
......@@ -40,7 +40,7 @@ When building the CEx100 backend, Clutter also depends on:
When building the evdev input backend, Clutter also depends on:
• xkbcommon
• libevdev
• libevdev ≥ @LIBEVDEV_REQ_VERSION@
If you are building the API reference you will also need:
......
......@@ -605,11 +605,11 @@ sync_source (ClutterEventSource *source)
const gchar *device_path;
/* We read a SYN_DROPPED, ignore it and sync the device */
err = libevdev_next_event (source->dev, LIBEVDEV_READ_SYNC, &ev);
err = libevdev_next_event (source->dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
while (err == 1)
{
dispatch_one_event (source, &ev);
err = libevdev_next_event (source->dev, LIBEVDEV_READ_SYNC, &ev);
err = libevdev_next_event (source->dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
}
if (err != -EAGAIN && CLUTTER_HAS_DEBUG (EVENT))
......@@ -664,7 +664,7 @@ clutter_event_dispatch (GSource *g_source,
if (clutter_events_pending ())
goto queue_event;
err = libevdev_next_event (source->dev, LIBEVDEV_READ_NORMAL, &ev);
err = libevdev_next_event (source->dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
while (err != -EAGAIN)
{
if (err == 1)
......@@ -677,7 +677,7 @@ clutter_event_dispatch (GSource *g_source,
goto out;
}
err = libevdev_next_event (source->dev, LIBEVDEV_READ_NORMAL, &ev);
err = libevdev_next_event (source->dev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
}
queue_event:
......@@ -725,7 +725,7 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
ClutterEventSource *event_source = (ClutterEventSource *) source;
const gchar *node_path;
gint fd, clkid;
gint fd;
GError *error;
ClutterInputDeviceType device_type;
......@@ -756,15 +756,13 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
}
}
/* Tell evdev to use the monotonic clock for its timestamps */
clkid = CLOCK_MONOTONIC;
ioctl (fd, EVIOCSCLOCKID, &clkid);
/* setup the source */
event_source->device = input_device;
event_source->event_poll_fd.fd = fd;
event_source->event_poll_fd.events = G_IO_IN;
libevdev_new_from_fd (fd, &event_source->dev);
libevdev_set_clock_id (event_source->dev, CLOCK_MONOTONIC);
device_type = clutter_input_device_get_device_type (CLUTTER_INPUT_DEVICE (input_device));
if (device_type == CLUTTER_TOUCHPAD_DEVICE)
......
......@@ -146,6 +146,7 @@ m4_define([uprof_req_version], [0.3])
m4_define([gtk_doc_req_version], [1.15])
m4_define([xcomposite_req_version], [0.4])
m4_define([gdk_req_version], [3.3.18])
m4_define([libevdev_req_version], [0.4])
AC_SUBST([GLIB_REQ_VERSION], [glib_req_version])
AC_SUBST([COGL_REQ_VERSION], [cogl_req_version])
......@@ -158,6 +159,7 @@ AC_SUBST([UPROF_REQ_VERSION], [uprof_req_version])
AC_SUBST([GTK_DOC_REQ_VERSION], [gtk_doc_req_version])
AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version])
AC_SUBST([GDK_REQ_VERSION], [gdk_req_version])
AC_SUBST([LIBEVDEV_REQ_VERSION], [libevdev_req_version])
# Checks for typedefs, structures, and compiler characteristics.
AM_PATH_GLIB_2_0([glib_req_version],
......@@ -478,7 +480,7 @@ AS_IF([test "x$enable_evdev" = "xyes"],
AS_IF([test "x$have_evdev" = "xyes"],
[
CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS evdev"
BACKEND_PC_FILES="$BACKEND_PC_FILES gudev-1.0 libevdev xkbcommon"
BACKEND_PC_FILES="$BACKEND_PC_FILES gudev-1.0 libevdev >= $LIBEVDEV_REQ_VERSION xkbcommon"
experimental_input_backend="yes"
AC_DEFINE([HAVE_EVDEV], [1], [Have evdev support for input handling])
SUPPORT_EVDEV=1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment