From c7af3af835ff838d5d6dba15240d20bd4af68029 Mon Sep 17 00:00:00 2001 From: Wonkeun Oh Date: Tue, 24 Mar 2015 10:26:20 +0900 Subject: [PATCH] ecore-imf: Added the device information in the Ecore_IMF_Event structs Summary: Added the device information in the Ecore_IMF_Event structs. Applications may require to know actual source of key event to handle it differently depending on device. Even if key events are currently generated from different devices, application couldn't distinguish it. This patch will support device information for the Ecore-imf key events. Reviewers: jihoon Reviewed By: jihoon Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2214 --- src/lib/ecore_imf/Ecore_IMF.h | 34 +++++++++++++++++++++++++ src/lib/ecore_imf_evas/ecore_imf_evas.c | 6 +++++ 2 files changed, 40 insertions(+) diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h index 5a8b78194c..53f6b7a35f 100644 --- a/src/lib/ecore_imf/Ecore_IMF.h +++ b/src/lib/ecore_imf/Ecore_IMF.h @@ -378,6 +378,7 @@ enum ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NORMAL, /**< The normal password layout @since 1.12 */ ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD_VARIATION_NUMBERONLY /**< The password layout to allow only number @since 1.12 */ }; + /** * @typedef Ecore_IMF_BiDi_Direction * @brief Enumeration that defines the types of Ecore_IMF bidirectionality @@ -390,6 +391,33 @@ typedef enum ECORE_IMF_BIDI_DIRECTION_RTL /**< The Right to Left mode @since 1.12 */ } Ecore_IMF_BiDi_Direction; +typedef enum _Ecore_IMF_Device_Class +{ + ECORE_IMF_DEVICE_CLASS_NONE, /**< Not a device @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_SEAT, /**< The user/seat (the user themselves) @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_KEYBOARD, /**< A regular keyboard, numberpad or attached buttons @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_MOUSE, /**< A mouse, trackball or touchpad relative motion device @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_TOUCH, /**< A touchscreen with fingers or stylus @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_PEN, /**< A special pen device @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_POINTER, /**< A laser pointer, wii-style or "minority report" pointing device @since 1.14 */ + ECORE_IMF_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.14 */ +} Ecore_IMF_Device_Class; /**< A general class of device @since 1.14 */ + +typedef enum _Ecore_IMF_Device_Subclass +{ + ECORE_IMF_DEVICE_SUBCLASS_NONE, /**< Not a device @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_FINGER, /**< The normal flat of your finger @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_FINGERNAIL, /**< A fingernail @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_KNUCKLE, /**< A Knuckle @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_PALM, /**< The palm of a users hand @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_HAND_SIZE, /**< The side of your hand @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_HAND_FLAT, /**< The flat of your hand @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_PEN_TIP, /**< The tip of a pen @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_TRACKPAD, /**< A trackpad style mouse @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_TRACKPOINT, /**< A trackpoint style mouse @since 1.14 */ + ECORE_IMF_DEVICE_SUBCLASS_TRACKBALL, /**< A trackball style mouse @since 1.14 */ +} Ecore_IMF_Device_Subclass; /**< A general subclass of device @since 1.14 */ + /** * @struct _Ecore_IMF_Event_Preedit_Start * @brief The structure type used with the Preedit_Start Input Method event @@ -575,6 +603,9 @@ struct _Ecore_IMF_Event_Key_Down const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */ const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */ unsigned int timestamp; /**< The timestamp when the event occurred */ + const char *dev_name; /**< The device name of the key pressed */ + Ecore_IMF_Device_Class dev_class; /**< The device class of the key pressed */ + Ecore_IMF_Device_Subclass dev_subclass; /**< The device subclass of the key pressed */ }; /** @@ -590,6 +621,9 @@ struct _Ecore_IMF_Event_Key_Up const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */ const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */ unsigned int timestamp; /**< The timestamp when the event occurred */ + const char *dev_name; /**< The device name of the key released */ + Ecore_IMF_Device_Class dev_class; /**< The device class of the key released */ + Ecore_IMF_Device_Subclass dev_subclass; /**< The device subclass of the key released */ }; /** diff --git a/src/lib/ecore_imf_evas/ecore_imf_evas.c b/src/lib/ecore_imf_evas/ecore_imf_evas.c index 50339624e2..69de93d92f 100644 --- a/src/lib/ecore_imf_evas/ecore_imf_evas.c +++ b/src/lib/ecore_imf_evas/ecore_imf_evas.c @@ -184,6 +184,9 @@ ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty; imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty; imf_event->timestamp = evas_event->timestamp; + imf_event->dev_name = evas_device_name_get(evas_event->dev) ? evas_device_name_get(evas_event->dev) : _ecore_imf_evas_event_empty; + imf_event->dev_class = evas_device_class_get(evas_event->dev); + imf_event->dev_subclass = evas_device_subclass_get(evas_event->dev); _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); } @@ -209,6 +212,9 @@ ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty; imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty; imf_event->timestamp = evas_event->timestamp; + imf_event->dev_name = evas_device_name_get(evas_event->dev) ? evas_device_name_get(evas_event->dev) : _ecore_imf_evas_event_empty; + imf_event->dev_class = evas_device_class_get(evas_event->dev); + imf_event->dev_subclass = evas_device_subclass_get(evas_event->dev); _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); }