From 2f7602f2978ffef646e6c9de66bbcb4772f6c9c6 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 10 May 2016 17:04:18 +0200 Subject: [PATCH] clutter/evdev: Handle management of pad devices --- .../clutter/evdev/clutter-device-manager-evdev.c | 1 + .../clutter/evdev/clutter-input-device-evdev.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c index 9877da256..54aeccaa5 100644 --- a/clutter/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c @@ -183,6 +183,7 @@ static const char *device_type_str[] = { "pen", /* CLUTTER_PEN_DEVICE */ "eraser", /* CLUTTER_ERASER_DEVICE */ "cursor", /* CLUTTER_CURSOR_DEVICE */ + "pad", /* CLUTTER_PAD_DEVICE */ }; #endif /* CLUTTER_ENABLE_DEBUG */ diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.c b/clutter/clutter/evdev/clutter-input-device-evdev.c index 44b3ee85e..71f46ac23 100644 --- a/clutter/clutter/evdev/clutter-input-device-evdev.c +++ b/clutter/clutter/evdev/clutter-input-device-evdev.c @@ -141,13 +141,22 @@ _clutter_input_device_evdev_new (ClutterDeviceManager *manager, ClutterInputDeviceType type; ClutterDeviceManagerEvdev *manager_evdev; gchar *vendor, *product; - gint device_id; + gint device_id, n_rings = 0, n_strips = 0, n_groups = 1; type = _clutter_input_device_evdev_determine_type (libinput_device); vendor = g_strdup_printf ("%.4x", libinput_device_get_id_vendor (libinput_device)); product = g_strdup_printf ("%.4x", libinput_device_get_id_product (libinput_device)); manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (manager); device_id = _clutter_device_manager_evdev_acquire_device_id (manager_evdev); + + if (libinput_device_has_capability (libinput_device, + LIBINPUT_DEVICE_CAP_TABLET_PAD)) + { + n_rings = libinput_device_tablet_pad_get_num_rings (libinput_device); + n_strips = libinput_device_tablet_pad_get_num_strips (libinput_device); + n_groups = libinput_device_tablet_pad_get_num_mode_groups (libinput_device); + } + device = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_EVDEV, "id", device_id, "name", libinput_device_get_name (libinput_device), @@ -157,6 +166,9 @@ _clutter_input_device_evdev_new (ClutterDeviceManager *manager, "enabled", TRUE, "vendor-id", vendor, "product-id", product, + "n-rings", n_rings, + "n-strips", n_strips, + "n-mode-groups", n_groups, NULL); device->seat = seat; @@ -243,6 +255,8 @@ _clutter_input_device_evdev_determine_type (struct libinput_device *ldev) return CLUTTER_TOUCHPAD_DEVICE; else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) return CLUTTER_TABLET_DEVICE; + else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) + return CLUTTER_PAD_DEVICE; else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_POINTER)) return CLUTTER_POINTER_DEVICE; else if (libinput_device_has_capability (ldev, LIBINPUT_DEVICE_CAP_TOUCH))