From e34088d74e22ddc4bd41dcbd52db07015a29f9e0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 26 May 2017 16:34:10 -0400 Subject: [PATCH] elput: rename and make public Elput_Device_Caps enum --- src/lib/elput/Elput.h | 11 +++++++++++ src/lib/elput/elput_evdev.c | 24 ++++++++++++------------ src/lib/elput/elput_input.c | 10 +++++----- src/lib/elput/elput_private.h | 12 +----------- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h index f9e950c821..eefcd7b340 100644 --- a/src/lib/elput/Elput.h +++ b/src/lib/elput/Elput.h @@ -29,6 +29,17 @@ # ifdef EFL_BETA_API_SUPPORT + +typedef enum +{ + ELPUT_DEVICE_CAPS_POINTER = (1 << 0), + ELPUT_DEVICE_CAPS_KEYBOARD = (1 << 1), + ELPUT_DEVICE_CAPS_TOUCH = (1 << 2), + ELPUT_DEVICE_CAPS_TABLET_TOOL = (1 << 3), + ELPUT_DEVICE_CAPS_TABLET_PAD = (1 << 4), + ELPUT_DEVICE_CAPS_GESTURE = (1 << 5), +} Elput_Device_Caps; + /* opaque structure to represent an input manager */ typedef struct _Elput_Manager Elput_Manager; diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c index 46f8068f79..b4118fe82f 100644 --- a/src/lib/elput/elput_evdev.c +++ b/src/lib/elput/elput_evdev.c @@ -1563,27 +1563,27 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device) (libinput_device_keyboard_has_key(device, KEY_ENTER))) { _keyboard_init(seat, seat->manager->cached.keymap); - edev->caps |= EVDEV_SEAT_KEYBOARD; + edev->caps |= ELPUT_DEVICE_CAPS_KEYBOARD; } if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER) && (libinput_device_pointer_has_button(device, BTN_LEFT)))) - edev->caps |= EVDEV_SEAT_POINTER; + edev->caps |= ELPUT_DEVICE_CAPS_POINTER; if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) - edev->caps |= EVDEV_SEAT_POINTER | EVDEV_SEAT_TABLET_TOOL; + edev->caps |= ELPUT_DEVICE_CAPS_POINTER | ELPUT_DEVICE_CAPS_TABLET_TOOL; if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_PAD)) - edev->caps |= EVDEV_SEAT_POINTER | EVDEV_SEAT_TABLET_PAD; - if (edev->caps & EVDEV_SEAT_POINTER) + edev->caps |= ELPUT_DEVICE_CAPS_POINTER | ELPUT_DEVICE_CAPS_TABLET_PAD; + if (edev->caps & ELPUT_DEVICE_CAPS_POINTER) { _pointer_init(seat); - edev->caps |= EVDEV_SEAT_POINTER; + edev->caps |= ELPUT_DEVICE_CAPS_POINTER; } if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH)) - edev->caps |= EVDEV_SEAT_TOUCH; + edev->caps |= ELPUT_DEVICE_CAPS_TOUCH; if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_GESTURE)) - edev->caps |= EVDEV_SEAT_TOUCH | EVDEV_SEAT_GESTURE; - if (edev->caps & EVDEV_SEAT_TOUCH) + edev->caps |= ELPUT_DEVICE_CAPS_TOUCH | ELPUT_DEVICE_CAPS_GESTURE; + if (edev->caps & ELPUT_DEVICE_CAPS_TOUCH) _touch_init(seat); if (!edev->caps) goto err; @@ -1612,11 +1612,11 @@ _evdev_device_destroy(Elput_Device *edev) { if (!edev) return; - if (edev->caps & EVDEV_SEAT_POINTER) + if (edev->caps & ELPUT_DEVICE_CAPS_POINTER) _pointer_release(edev->seat); - if (edev->caps & EVDEV_SEAT_KEYBOARD) + if (edev->caps & ELPUT_DEVICE_CAPS_KEYBOARD) _keyboard_release(edev->seat); - if (edev->caps & EVDEV_SEAT_TOUCH) + if (edev->caps & ELPUT_DEVICE_CAPS_TOUCH) _touch_release(edev->seat); libinput_device_unref(edev->device); diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c index a5afe74fd9..ec38413bc9 100644 --- a/src/lib/elput/elput_input.c +++ b/src/lib/elput/elput_input.c @@ -205,11 +205,11 @@ _device_add(Elput_Manager *em, struct libinput_device *dev) eseat->devices = eina_list_append(eseat->devices, edev); DBG("Input Device Added: %s", libinput_device_get_name(dev)); - if (edev->caps & EVDEV_SEAT_KEYBOARD) + if (edev->caps & ELPUT_DEVICE_CAPS_KEYBOARD) DBG("\tDevice added as Keyboard device"); - if (edev->caps & EVDEV_SEAT_POINTER) + if (edev->caps & ELPUT_DEVICE_CAPS_POINTER) DBG("\tDevice added as Pointer device"); - if (edev->caps & EVDEV_SEAT_TOUCH) + if (edev->caps & ELPUT_DEVICE_CAPS_TOUCH) DBG("\tDevice added as Touch device"); _device_event_send(edev, ELPUT_DEVICE_ADDED); @@ -600,7 +600,7 @@ elput_input_key_remap_enable(Elput_Manager *manager, Eina_Bool enable) { EINA_LIST_FOREACH(eseat->devices, ll, edev) { - if (!(edev->caps & EVDEV_SEAT_KEYBOARD)) continue; + if (!(edev->caps & ELPUT_DEVICE_CAPS_KEYBOARD)) continue; edev->key_remap = enable; if ((!enable) && (edev->key_remap_hash)) @@ -631,7 +631,7 @@ elput_input_key_remap_set(Elput_Manager *manager, int *from_keys, int *to_keys, { EINA_LIST_FOREACH(eseat->devices, ll, edev) { - if (!(edev->caps & EVDEV_SEAT_KEYBOARD)) continue; + if (!(edev->caps & ELPUT_DEVICE_CAPS_KEYBOARD)) continue; if (!edev->key_remap) continue; if (!edev->key_remap_hash) diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h index 4c7881e0ef..25d820e48d 100644 --- a/src/lib/elput/elput_private.h +++ b/src/lib/elput/elput_private.h @@ -60,16 +60,6 @@ extern int _elput_log_dom; # endif # define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__) -typedef enum _Elput_Device_Capability -{ - EVDEV_SEAT_POINTER = (1 << 0), - EVDEV_SEAT_KEYBOARD = (1 << 1), - EVDEV_SEAT_TOUCH = (1 << 2), - EVDEV_SEAT_TABLET_TOOL = (1 << 3), - EVDEV_SEAT_TABLET_PAD = (1 << 4), - EVDEV_SEAT_GESTURE = (1 << 5), -} Elput_Device_Capability; - typedef struct _Elput_Interface { Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty); @@ -225,7 +215,7 @@ struct _Elput_Device const char *output_name; struct libinput_device *device; - Elput_Device_Capability caps; + Elput_Device_Caps caps; Eina_Hash *key_remap_hash;