[clutter] determine evdev device type using g_udev_device_has_property



commit 3d3ae619c6a764e6276d37771c32aafef5d92a0e
Author: James Athey <james athey unleashbts com>
Date:   Tue Apr 12 11:33:58 2011 -0400

    determine evdev device type using g_udev_device_has_property
    
    http://bugzilla.clutter-project.org/show_bug.cgi?id=2631

 clutter/evdev/clutter-device-manager-evdev.c |   33 +++++++++++---------------
 1 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 8e66ef1..ee3512f 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -532,7 +532,6 @@ evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev,
   ClutterInputDevice *device;
   ClutterActor *stage;
   const gchar *device_file, *sysfs_path, *device_name;
-  const gchar * const *keys;
   guint i;
 
   device_file = g_udev_device_get_device_file (udev_device);
@@ -551,24 +550,20 @@ evdev_add_device (ClutterDeviceManagerEvdev *manager_evdev,
   if (!is_evdev (sysfs_path))
     return;
 
-  keys = g_udev_device_get_property_keys (udev_device);
-  for (i = 0; keys[i]; i++)
-    {
-      /* Clutter assumes that device types are exclusive in the
-       * ClutterInputDevice API */
-      if (strcmp (keys[i], "ID_INPUT_KEY") == 0)
-        type = CLUTTER_KEYBOARD_DEVICE;
-      else if (strcmp (keys[i], "ID_INPUT_MOUSE") == 0)
-        type = CLUTTER_POINTER_DEVICE;
-      else if (strcmp (keys[i], "ID_INPUT_JOYSTICK") == 0)
-        type = CLUTTER_JOYSTICK_DEVICE;
-      else if (strcmp (keys[i], "ID_INPUT_TABLET") == 0)
-        type = CLUTTER_TABLET_DEVICE;
-      else if (strcmp (keys[i], "ID_INPUT_TOUCHPAD") == 0)
-        type = CLUTTER_TOUCHPAD_DEVICE;
-      else if (strcmp (keys[i], "ID_INPUT_TOUCHSCREEN") == 0)
-        type = CLUTTER_TOUCHSCREEN_DEVICE;
-    }
+  /* Clutter assumes that device types are exclusive in the
+   * ClutterInputDevice API */
+  if (g_udev_device_has_property (udev_device, "ID_INPUT_KEYBOARD"))
+    type = CLUTTER_KEYBOARD_DEVICE;
+  else if (g_udev_device_has_property (udev_device, "ID_INPUT_MOUSE"))
+    type = CLUTTER_POINTER_DEVICE;
+  else if (g_udev_device_has_property (udev_device, "ID_INPUT_JOYSTICK"))
+    type = CLUTTER_JOYSTICK_DEVICE;
+  else if (g_udev_device_has_property (udev_device, "ID_INPUT_TABLET"))
+    type = CLUTTER_TABLET_DEVICE;
+  else if (g_udev_device_has_property (udev_device, "ID_INPUT_TOUCHPAD"))
+    type = CLUTTER_TOUCHPAD_DEVICE;
+  else if (g_udev_device_has_property (udev_device, "ID_INPUT_TOUCHSCREEN"))
+    type = CLUTTER_TOUCHSCREEN_DEVICE;
 
   device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_EVDEV,
                          "id", 0,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]