[clutter/clutter-1.18] device-manager-evdev: Stop using deprecated libevdev API
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.18] device-manager-evdev: Stop using deprecated libevdev API
- Date: Fri, 22 Nov 2013 10:22:24 +0000 (UTC)
commit 3cd9a70fea1ccf795419a1726c7c279b0aaf237e
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Nov 19 17:02:58 2013 +0100
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
README.in | 2 +-
clutter/evdev/clutter-device-manager-evdev.c | 16 +++++++---------
configure.ac | 4 +++-
3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/README.in b/README.in
index 0018869..0e73a42 100644
--- a/README.in
+++ b/README.in
@@ -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:
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 38d707f..bc34c39 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -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)
diff --git a/configure.ac b/configure.ac
index 0448ee4..47fce79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]