mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
determine evdev device type using g_udev_device_has_property
http://bugzilla.clutter-project.org/show_bug.cgi?id=2631
This commit is contained in:
parent
aa4ff0b90f
commit
3d3ae619c6
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user