lib/efl/interfaces/efl_image.eo \
lib/efl/interfaces/efl_image_animated.eo \
lib/efl/interfaces/efl_input_device.eo \
+ lib/efl/interfaces/efl_ecore_input_device.eo \
lib/efl/interfaces/efl_ui_draggable.eo \
lib/efl/interfaces/efl_ui_clickable.eo \
lib/efl/interfaces/efl_ui_scrollable.eo \
lib/efl/interfaces/efl_vpath_core.c \
lib/efl/interfaces/efl_vpath_file_core.c \
lib/efl/interfaces/efl_input_device.c \
+lib/efl/interfaces/efl_ecore_input_device.c \
lib/efl/interfaces/efl_io_closer.c \
lib/efl/interfaces/efl_io_positioner.c \
lib/efl/interfaces/efl_io_reader.c \
* @typedef Ecore_Device_Class
* An enum of Device Classes.
*/
-typedef enum _Ecore_Device_Class
- {
- ECORE_DEVICE_CLASS_NONE, /**< Not a device @since 1.18 */
- ECORE_DEVICE_CLASS_SEAT, /**< The user/seat (the user themselves) @since 1.18 */
- ECORE_DEVICE_CLASS_KEYBOARD, /**< A regular keyboard, numberpad or attached buttons @since 1.18 */
- ECORE_DEVICE_CLASS_MOUSE, /**< A mouse, trackball or touchpad relative motion device @since 1.18 */
- ECORE_DEVICE_CLASS_TOUCH, /**< A touchscreen with fingers or stylus @since 1.18 */
- ECORE_DEVICE_CLASS_PEN, /**< A special pen device @since 1.18 */
- ECORE_DEVICE_CLASS_POINTER, /**< A laser pointer, wii-style or 7"minority report" pointing device @since 1.18 */
- ECORE_DEVICE_CLASS_GAMEPAD /**< A gamepad controller or joystick @since 1.18 */
- } Ecore_Device_Class; /**< A general class of device @since 1.18 */
+typedef Efl_Ecore_Input_Device_Type Ecore_Device_Class;
+
+#define ECORE_DEVICE_CLASS_NONE EFL_ECORE_INPUT_DEVICE_TYPE_NONE /**< Not a device @since 1.8 */
+#define ECORE_DEVICE_CLASS_SEAT EFL_ECORE_INPUT_DEVICE_TYPE_SEAT /**< The user/seat (the user themselves) @since 1.8 */
+#define ECORE_DEVICE_CLASS_KEYBOARD EFL_ECORE_INPUT_DEVICE_TYPE_KEYBOARD /**< A regular keyboard, numberpad or attached buttons @since 1.8 */
+#define ECORE_DEVICE_CLASS_MOUSE EFL_ECORE_INPUT_DEVICE_TYPE_MOUSE /**< A mouse, trackball or touchpad relative motion device @since 1.8 */
+#define ECORE_DEVICE_CLASS_TOUCH EFL_ECORE_INPUT_DEVICE_TYPE_TOUCH /**< A touchscreen with fingers or stylus @since 1.8 */
+#define ECORE_DEVICE_CLASS_PEN EFL_ECORE_INPUT_DEVICE_TYPE_PEN /**< A special pen device @since 1.8 */
+#define ECORE_DEVICE_CLASS_POINTER EFL_ECORE_INPUT_DEVICE_TYPE_WAND /**< A laser pointer, wii-style or "minority report" pointing device @since 1.8 */
+#define ECORE_DEVICE_CLASS_WAND EFL_ECORE_INPUT_DEVICE_TYPE_WAND /**< A synonym for ECORE_DEVICE_CLASS_POINTER @since 1.18 */
+#define ECORE_DEVICE_CLASS_GAMEPAD EFL_ECORE_INPUT_DEVICE_TYPE_GAMEPAD /**< A gamepad controller or joystick @since 1.8 */
+
+
/**
* @typedef Ecore_Device_Subclass
* An enum of Device Subclasses.
*/
-typedef enum _Ecore_Device_Subclass
- {
- ECORE_DEVICE_SUBCLASS_NONE, /**< Not a device @since 1.18 */
- ECORE_DEVICE_SUBCLASS_FINGER, /**< The normal flat of your finger @since 1.18 */
- ECORE_DEVICE_SUBCLASS_FINGERNAIL, /**< A fingernail @since 1.18 */
- ECORE_DEVICE_SUBCLASS_KNUCKLE, /**< A Knuckle @since 1.18 */
- ECORE_DEVICE_SUBCLASS_PALM, /**< The palm of a users hand @since 1.18 */
- ECORE_DEVICE_SUBCLASS_HAND_SIZE, /**< The side of your hand @since 1.18 */
- ECORE_DEVICE_SUBCLASS_HAND_FLAT, /**< The flat of your hand @since 1.18 */
- ECORE_DEVICE_SUBCLASS_PEN_TIP, /**< The tip of a pen @since 1.18 */
- ECORE_DEVICE_SUBCLASS_TRACKPAD, /**< A trackpad style mouse @since 1.18 */
- ECORE_DEVICE_SUBCLASS_TRACKPOINT, /**< A trackpoint style mouse @since 1.18 */
- ECORE_DEVICE_SUBCLASS_TRACKBALL, /**< A trackball style mouse @since 1.18 */
- ECORE_DEVICE_SUBCLASS_REMOCON, /**< A remote controller @since_tizen 4.0 */
- ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD /**< A virtual keyboard @since_tizen 4.0*/
- } Ecore_Device_Subclass; /**< A general subclass of device @since 1.18 */
+typedef Efl_Ecore_Input_Device_Subtype Ecore_Device_Subclass;
+
+#define ECORE_DEVICE_SUBCLASS_NONE EFL_ECORE_INPUT_DEVICE_SUBTYPE_NONE /**< Not a device @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_FINGER EFL_ECORE_INPUT_DEVICE_SUBTYPE_FINGER /**< The normal flat of your finger @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_FINGERNAIL EFL_ECORE_INPUT_DEVICE_SUBTYPE_FINGERNAIL /**< A fingernail @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_KNUCKLE EFL_ECORE_INPUT_DEVICE_SUBTYPE_KNUCKLE /**< A Knuckle @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_PALM EFL_ECORE_INPUT_DEVICE_SUBTYPE_PALM /**< The palm of a users hand @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_HAND_SIZE EFL_ECORE_INPUT_DEVICE_SUBTYPE_HAND_SIZE /**< The side of your hand @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_HAND_FLAT EFL_ECORE_INPUT_DEVICE_SUBTYPE_HAND_FLAT /**< The flat of your hand @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_PEN_TIP EFL_ECORE_INPUT_DEVICE_SUBTYPE_PEN_TIP /**< The tip of a pen @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_TRACKPAD EFL_ECORE_INPUT_DEVICE_SUBTYPE_TRACKPAD /**< A trackpad style mouse @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_TRACKPOINT EFL_ECORE_INPUT_DEVICE_SUBTYPE_TRACKPOINT /**< A trackpoint style mouse @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_TRACKBALL EFL_ECORE_INPUT_DEVICE_SUBTYPE_TRACKBALL /**< A trackball style mouse @since 1.18 */
+#define ECORE_DEVICE_SUBCLASS_REMOCON EFL_ECORE_INPUT_DEVICE_SUBTYPE_REMOCON /**< A remote controller @since_tizen 4.0 */
+#define ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD EFL_ECORE_INPUT_DEVICE_SUBTYPE_VIRTUAL_KEYBOARD /**< A virtual keyboard @since_tizen 4.0*/
typedef struct _Ecore_Device_Event_Info Ecore_Device_Event_Info; /**< @since 1.18 */
#include "Ecore.h"
#include "ecore_private.h"
+#define EFL_INTERNAL_UNSTABLE
+#include "interfaces/efl_common_internal.h"
+
+/* WARNING: This API is not used across EFL, hard to test! */
+
+#ifdef DEBUG_UNTESTED_
+// booh
+#define SAFETY_CHECK(obj, klass, ...) \
+ do { MAGIC_CHECK(dev, Ecore_Device, 1); \
+ return __VA_ARGS__; \
+ MAGIC_CHECK_END(); \
+ } while (0)
+
+#else
+#define SAFETY_CHECK(obj, klass, ...) \
+ do { if (!obj) return __VA_ARGS__; } while (0)
+#endif
+
+#if 0
/**
* @struct _Ecore_Device
* Contains information about a device.
Ecore_Device_Class clas; /**<Device class */
Ecore_Device_Subclass subclas; /**< device subclass */
};
+#endif
+static Eina_List *_ecore_devices = NULL;
+static int devices_num;
EAPI Ecore_Device *
ecore_device_add()
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return NULL;
+ Ecore_Device *dev;
+ Efl_Ecore_Input_Device_Data *d;
+
+ dev = efl_add(EFL_ECORE_INPUT_DEVICE_CLASS, NULL,
+ efl_name_set(efl_added, NULL),
+ efl_comment_set(efl_added, NULL),
+ efl_ecore_input_device_type_set(efl_added, EFL_ECORE_INPUT_DEVICE_TYPE_NONE),
+ efl_ecore_input_device_source_set(efl_added, NULL));
+
+ d = efl_data_scope_get(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+ d->subclass = EFL_ECORE_INPUT_DEVICE_SUBTYPE_NONE;
+
+ _ecore_devices = eina_list_append(_ecore_devices, dev);
+ devices_num++;
+
+ return dev;
}
EAPI void
-ecore_device_del(Ecore_Device *dev EINA_UNUSED)
+ecore_device_del(Ecore_Device *dev)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
+ Eina_List *l, *l_next;
+ Ecore_Device *data;
+
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+
+ EINA_LIST_FOREACH_SAFE(_ecore_devices, l, l_next, data)
+ {
+ if (dev == data)
+ _ecore_devices = eina_list_remove_list(_ecore_devices, l);
+ }
+ devices_num--;
+
+ efl_del(dev);
return;
}
EAPI const Eina_List *
ecore_device_list(void)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return NULL;
+ return _ecore_devices;
}
EAPI void
-ecore_device_name_set(Ecore_Device *dev EINA_UNUSED, const char *name EINA_UNUSED)
+ecore_device_name_set(Ecore_Device *dev, const char *name)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+
+ efl_name_set(dev, name);
}
EAPI const char *
-ecore_device_name_get(const Ecore_Device *dev EINA_UNUSED)
+ecore_device_name_get(const Ecore_Device *dev)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return NULL;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS, NULL);
+
+ return efl_name_get(dev);
}
EAPI void
-ecore_device_description_set(Ecore_Device *dev EINA_UNUSED, const char *desc EINA_UNUSED)
+ecore_device_description_set(Ecore_Device *dev, const char *desc)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+
+ efl_comment_set(dev, desc);
}
EAPI const char *
-ecore_device_description_get(const Ecore_Device *dev EINA_UNUSED)
+ecore_device_description_get(const Ecore_Device *dev)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return NULL;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS, NULL);
+
+ return efl_comment_get(dev);
}
EAPI void
-ecore_device_identifier_set(Ecore_Device *dev EINA_UNUSED, const char *identifier EINA_UNUSED)
+ecore_device_identifier_set(Ecore_Device *dev, const char *identifier)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+
+ efl_comment_set(dev, identifier);
}
EAPI const char *
-ecore_device_identifier_get(const Ecore_Device *dev EINA_UNUSED)
+ecore_device_identifier_get(const Ecore_Device *dev)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return NULL;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS, NULL);
+
+ return efl_comment_get(dev);
}
EAPI void
-ecore_device_class_set(Ecore_Device *dev EINA_UNUSED, Ecore_Device_Class clas EINA_UNUSED)
+ecore_device_class_set(Ecore_Device *dev, Ecore_Device_Class clas)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+
+ efl_ecore_input_device_type_set(dev, clas);
}
EAPI Ecore_Device_Class
-ecore_device_class_get(const Ecore_Device *dev EINA_UNUSED)
+ecore_device_class_get(const Ecore_Device *dev)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return 0;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS, EFL_ECORE_INPUT_DEVICE_TYPE_NONE);
+
+ return efl_ecore_input_device_type_get(dev);
}
EAPI void
-ecore_device_subclass_set(Ecore_Device *dev EINA_UNUSED, Ecore_Device_Subclass subclas EINA_UNUSED)
+ecore_device_subclass_set(Ecore_Device *dev, Ecore_Device_Subclass subclas)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return;
+ Efl_Ecore_Input_Device_Data *d;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+
+ d = efl_data_scope_get(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+ if (!d) return;
+
+ d->subclass = subclas;
}
EAPI Ecore_Device_Subclass
-ecore_device_subclass_get(const Ecore_Device *dev EINA_UNUSED)
+ecore_device_subclass_get(const Ecore_Device *dev)
{
- WRN("ecore_device is deprecated in efl. Please use efl_device APIs instead\n");
- return 0;
+ Efl_Ecore_Input_Device_Data *d;
+ SAFETY_CHECK(dev, EFL_ECORE_INPUT_DEVICE_CLASS, EFL_ECORE_INPUT_DEVICE_SUBTYPE_NONE);
+
+ d = efl_data_scope_get(dev, EFL_ECORE_INPUT_DEVICE_CLASS);
+ if (!d) return 0;
+
+ return d->subclass;
}
//
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
ECORE_EVENT_DETENT_ROTATE = ecore_event_type_new();
//
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ ECORE_EVENT_DEVICE_ADD = ecore_event_type_new();
+ ECORE_EVENT_DEVICE_DEL = ecore_event_type_new();
+ //
//TIZEN_ONLY(20170307) Remove warning message
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
ECORE_EVENT_MOUSE_BUTTON_CANCEL,
ECORE_EVENT_JOYSTICK,
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- ECORE_EVENT_DETENT_ROTATE
+ ECORE_EVENT_DETENT_ROTATE,
+ //
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ ECORE_EVENT_DEVICE_ADD,
+ ECORE_EVENT_DEVICE_DEL
//
);
//TIZEN_ONLY(20170307) Remove warning message
return lookup;
}
+// TIZEN_ONLY(20180118): support a Ecore_Device
+Evas_Device *
+_ecore_event_evas_device_find(Evas *eo_e, Ecore_Device *ecore_dev)
+{
+ Eina_List *list, *l;
+ Evas_Device *evas_device;
+
+ list = (Eina_List *)evas_device_list(eo_e, NULL);
+ EINA_LIST_FOREACH(list, l, evas_device)
+ {
+ if ((evas_device_class_get(evas_device) == (Evas_Device_Class)ecore_device_class_get(ecore_dev)) &&
+ !strncmp(efl_name_get(evas_device), efl_name_get(ecore_dev), strlen(efl_name_get(evas_device))) &&
+ !strncmp(efl_comment_get(evas_device), efl_comment_get(ecore_dev), strlen(efl_comment_get(evas_device))))
+ {
+ return evas_device;
+ }
+ }
+ return NULL;
+}
+
+static void
+_ecore_event_device_check(Evas *eo_e, int type, void *ev, Eo *dev)
+{
+ Evas_Device *evas_device;
+ Eo *tmp_dev;
+
+ if (efl_class_get(dev) != EFL_ECORE_INPUT_DEVICE_CLASS) return;
+
+ evas_device = _ecore_event_evas_device_find(eo_e, dev);
+ if (!evas_device)
+ {
+ WRN("Failed to found evas device for %s (identifier: %s, class: %d)\n", efl_name_get(dev), efl_comment_get(dev), efl_ecore_input_device_type_get(dev));
+ if (type == ECORE_EVENT_KEY_DOWN || type == ECORE_EVENT_KEY_UP)
+ evas_device = evas_device_default_get(eo_e, EVAS_DEVICE_CLASS_KEYBOARD);
+ else
+ {
+ if (ecore_device_class_get(dev) == ECORE_DEVICE_CLASS_TOUCH)
+ evas_device = evas_device_default_get(eo_e, EVAS_DEVICE_CLASS_TOUCH);
+ else
+ evas_device = evas_device_default_get(eo_e, EVAS_DEVICE_CLASS_MOUSE);
+ }
+ }
+
+ if (evas_device)
+ {
+ if (type == ECORE_EVENT_KEY_DOWN ||
+ type == ECORE_EVENT_KEY_UP)
+ {
+ Ecore_Event_Key *e = (Ecore_Event_Key *)ev;
+
+ tmp_dev = e->dev;
+ e->dev = efl_ref(evas_device);
+ efl_unref(tmp_dev);
+ }
+ else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN ||
+ type == ECORE_EVENT_MOUSE_BUTTON_UP ||
+ type == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
+ {
+ Ecore_Event_Mouse_Button *e = (Ecore_Event_Mouse_Button *)ev;
+
+ tmp_dev = e->dev;
+ e->dev = efl_ref(evas_device);
+ efl_unref(tmp_dev);
+ }
+ else if (type == ECORE_EVENT_MOUSE_MOVE)
+ {
+ Ecore_Event_Mouse_Move *e = (Ecore_Event_Mouse_Move *)ev;
+
+ tmp_dev = e->dev;
+ e->dev = efl_ref(evas_device);
+ efl_unref(tmp_dev);
+ }
+ else if (type == ECORE_EVENT_MOUSE_IN ||
+ type == ECORE_EVENT_MOUSE_OUT)
+ {
+ Ecore_Event_Mouse_IO *e = (Ecore_Event_Mouse_IO *)ev;
+
+ tmp_dev = e->dev;
+ e->dev = efl_ref(evas_device);
+ efl_unref(tmp_dev);
+ }
+ else if (type == ECORE_EVENT_MOUSE_WHEEL)
+ {
+ Ecore_Event_Mouse_Wheel *e = (Ecore_Event_Mouse_Wheel *)ev;
+
+ tmp_dev = e->dev;
+ e->dev = efl_ref(evas_device);
+ efl_unref(tmp_dev);
+ }
+ else if (type == ECORE_EVENT_AXIS_UPDATE)
+ {
+ Ecore_Event_Axis_Update *e = (Ecore_Event_Axis_Update *)ev;
+
+ tmp_dev = e->dev;
+ e->dev = efl_ref(evas_device);
+ efl_unref(tmp_dev);
+ }
+ }
+}
+//
+
static Eina_Bool
_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
{
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ if (press == ECORE_DOWN)
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_KEY_DOWN, e, e->dev);
+ else
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_KEY_UP, e, e->dev);
+ //
seat = e->dev ? efl_input_device_seat_get(e->dev) : NULL;
ecore_event_evas_seat_modifier_lock_update(lookup->evas, e->modifiers, seat);
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_BUTTON_CANCEL, e, e->dev);
+ //
+
INF("ButtonEvent cancel, device(%d), button(%d)", e->multi.device, e->buttons);
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_MOUSE_BUTTON_CANCEL, e))
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ if (press == ECORE_DOWN)
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_BUTTON_DOWN, e, e->dev);
+ else
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_BUTTON_UP, e, e->dev);
+ //
if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
INF("\tButtonEvent:ecore_event_evas press(%d), device(%d), button(%d), fake(%d)", press, e->multi.device, e->buttons, faked);
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_MOVE, e, e->dev);
+ //
+
if (e->dev)
{
evas_device_push(lookup->evas, e->dev);
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ if (io == ECORE_IN)
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_IN, e, e->dev);
+ else
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_OUT, e, e->dev);
+ //
+
// TIZEN_ONLY ecore_input_evas: push an evas device if there is the device within an ecore input event
if (e->dev)
{
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_MOUSE_WHEEL, e, e->dev);
+ //
if (e->dev)
{
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
+ // TIZEN_ONLY(20180118): support a Ecore_Device
+ _ecore_event_device_check(lookup->evas, ECORE_EVENT_AXIS_UPDATE, e, e->dev);
+ //
if (!lookup->direct ||
!lookup->direct(lookup->window, ECORE_EVENT_AXIS_UPDATE, e))
{
return NULL;
}
-// TIZEN_ONLY(20180108): maintain a device list for each window
-static Eo *
-_ecore_wl2_tizen_devices_get(Ecore_Wl2_Tizen_Input_Device *tz_device, int window_id)
-{
- Ecore_Wl2_Tizen_Input_Eo_Device *tz_dev;
- Eina_List *l;
-
- if (tz_device) return NULL;
-
- EINA_LIST_FOREACH(tz_device->devices, l, tz_dev)
- {
- if (tz_dev->window_id == window_id)
- return tz_dev->eo_dev;
- }
-
- return NULL;
-}
-//
-
static Eo *
_ecore_wl2_mouse_dev_get(Ecore_Wl2_Input *input, int window_id)
{
Ecore_Wl2_Input_Devices *devices;
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- Eo *dev;
- if (input->devmgr.last_device_ptr)
+ if (input->devmgr.last_device_ptr && input->devmgr.last_device_ptr->device)
{
- dev = _ecore_wl2_tizen_devices_get(input->devmgr.last_device_ptr, window_id);
- if (dev) return efl_ref(dev);
+ return efl_ref(input->devmgr.last_device_ptr->device);
}
//
{
Ecore_Wl2_Input_Devices *devices;
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- Eo *dev;
- if (input->devmgr.last_device_touch)
+ if (input->devmgr.last_device_touch && input->devmgr.last_device_touch->device)
{
- dev = _ecore_wl2_tizen_devices_get(input->devmgr.last_device_touch, window_id);
- if (dev) return efl_ref(dev);
+ return efl_ref(input->devmgr.last_device_touch->device);
}
//
return NULL;
}
+//TIZEN_ONLY(20180118): support a Ecore_Device
static void
-_input_event_cb_free(void *data, void *event)
+_input_event_mouse_io_cb_free(void *data EINA_UNUSED, Ecore_Event_Mouse_IO *event)
{
- if (data)
- efl_unref(data);
+ if (event->dev)
+ efl_unref(event->dev);
+ free(event);
+}
+
+static void
+_input_event_mouse_move_cb_free(void *data EINA_UNUSED, Ecore_Event_Mouse_Move *event)
+{
+ if (event->dev)
+ efl_unref(event->dev);
+ free(event);
+}
+
+static void
+_input_event_mouse_wheel_cb_free(void *data EINA_UNUSED, Ecore_Event_Mouse_Wheel *event)
+{
+ if (event->dev)
+ efl_unref(event->dev);
free(event);
}
static void
+_input_event_mouse_button_cb_free(void *data EINA_UNUSED, Ecore_Event_Mouse_Button *event)
+{
+ if (event->dev)
+ efl_unref(event->dev);
+ free(event);
+}
+
+static void
+_input_event_key_cb_free(void *data EINA_UNUSED, Ecore_Event_Key *event)
+{
+ if (event->dev)
+ efl_unref(event->dev);
+ free(event);
+}
+//
+
+static void
_ecore_wl2_input_mouse_in_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window)
{
Ecore_Event_Mouse_IO *ev;
ev->modifiers = input->keyboard.modifiers;
ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
- ecore_event_add(ECORE_EVENT_MOUSE_IN, ev, _input_event_cb_free, ev->dev);
+ ecore_event_add(ECORE_EVENT_MOUSE_IN, ev, _input_event_mouse_io_cb_free, ev->dev);
}
static void
ev->modifiers = input->keyboard.modifiers;
ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
- ecore_event_add(ECORE_EVENT_MOUSE_OUT, ev, _input_event_cb_free, ev->dev);
+ ecore_event_add(ECORE_EVENT_MOUSE_OUT, ev, _input_event_mouse_io_cb_free, ev->dev);
}
static void
info->sy = input->pointer.sy;
}
- ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _input_event_cb_free, ev->dev);
+ ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _input_event_mouse_move_cb_free, ev->dev);
}
static void
ev->dev = _ecore_wl2_touch_dev_get(input, ev->window);
}
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _input_event_cb_free, ev->dev);
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _input_event_mouse_wheel_cb_free, ev->dev);
}
static void
}
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev,
- _input_event_cb_free, ev->dev);
+ _input_event_mouse_button_cb_free, ev->dev);
if ((info) && (!info->triple_click))
{
ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev,
- _input_event_cb_free, ev->dev);
+ _input_event_mouse_button_cb_free, ev->dev);
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
{
Ecore_Wl2_Input_Devices *devices;
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- Eo *dev;
- if (input->devmgr.last_device_kbd)
+ if (input->devmgr.last_device_kbd && input->devmgr.last_device_kbd->device)
{
- dev = _ecore_wl2_tizen_devices_get(input->devmgr.last_device_kbd, window_id);
- if (dev) return efl_ref(dev);
+ return efl_ref(input->devmgr.last_device_kbd->device);
}
//
/* DBG("Emitting Key event (%s,%s,%s,%s)\n", ev->keyname, ev->key, ev->compose, ev->string); */
if (state)
- ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, _input_event_cb_free, ev->dev);
+ ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, _input_event_key_cb_free, ev->dev);
else
- ecore_event_add(ECORE_EVENT_KEY_UP, ev, _input_event_cb_free, ev->dev);
+ ecore_event_add(ECORE_EVENT_KEY_UP, ev, _input_event_key_cb_free, ev->dev);
}
void
switch(dev->clas)
{
- case EFL_INPUT_DEVICE_TYPE_MOUSE:
+ case ECORE_DEVICE_CLASS_MOUSE:
input->devmgr.last_device_ptr = dev;
break;
- case EFL_INPUT_DEVICE_TYPE_KEYBOARD:
+ case ECORE_DEVICE_CLASS_KEYBOARD:
input->devmgr.last_device_kbd = dev;
break;
- case EFL_INPUT_DEVICE_TYPE_TOUCH:
+ case ECORE_DEVICE_CLASS_TOUCH:
input->devmgr.last_device_touch = dev;
break;
default:
switch(dev->clas)
{
- case EFL_INPUT_DEVICE_TYPE_MOUSE:
+ case ECORE_DEVICE_CLASS_MOUSE:
if (input->devmgr.last_device_ptr == dev)
input->devmgr.last_device_ptr = NULL;
break;
- case EFL_INPUT_DEVICE_TYPE_KEYBOARD:
+ case ECORE_DEVICE_CLASS_KEYBOARD:
if (input->devmgr.last_device_kbd == dev)
input->devmgr.last_device_kbd = NULL;
break;
- case EFL_INPUT_DEVICE_TYPE_TOUCH:
+ case ECORE_DEVICE_CLASS_TOUCH:
if (input->devmgr.last_device_touch == dev)
input->devmgr.last_device_touch = NULL;
break;
break;
}
}
-
-static Eina_Bool
-_ecore_wl2_cb_tizen_device_event(void *data, int type, void *event)
-{
- Ecore_Wl2_Tizen_Input_Device *devs, *dev = NULL;;
- Ecore_Wl2_Event_Tizen_Input_Device_Info *ev = event;
- Ecore_Wl2_Display *ewd = data;
- Ecore_Wl2_Input *input;
- Ecore_Wl2_Tizen_Input_Eo_Device *eo_dev;
- Eina_List *l, *l_next;
-
- input = ecore_wl2_input_default_input_get(ewd);
- EINA_SAFETY_ON_NULL_RETURN_VAL(input, ECORE_CALLBACK_PASS_ON);
-
- EINA_LIST_FOREACH(input->devmgr.devices, l, devs)
- {
- if (!strncmp(devs->identifier, ev->identifier, strlen(ev->identifier)))
- {
- dev = devs;
- break;
- }
- }
-
- if (type == ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED)
- {
- if (!dev) return ECORE_CALLBACK_PASS_ON;
- /* FIXME: If dev is not exist, this device is not originate from tizen_input_device.
- * How process this device? Ignore or Make a new device
- */
-
- EINA_LIST_FOREACH(dev->devices, l, eo_dev)
- {
- if (eo_dev->eo_dev == ev->dev)
- return ECORE_CALLBACK_PASS_ON;
- }
-
- eo_dev = (Ecore_Wl2_Tizen_Input_Eo_Device *)calloc(1, sizeof(Ecore_Wl2_Tizen_Input_Eo_Device));
- if (!eo_dev) return ECORE_CALLBACK_PASS_ON;
-
- eo_dev->eo_dev = efl_ref(ev->dev);
- eo_dev->window_id = ev->window_id;
-
- dev->devices = eina_list_append(dev->devices, eo_dev);
-
- return ECORE_CALLBACK_PASS_ON;
- }
- else if (type == ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED)
- {
- if (!dev) return ECORE_CALLBACK_PASS_ON;
-
- EINA_LIST_FOREACH_SAFE(dev->devices, l, l_next, eo_dev)
- {
- if (eo_dev->eo_dev == ev->dev)
- {
- efl_unref(eo_dev->eo_dev);
- eo_dev->eo_dev = NULL;
- dev->devices = eina_list_remove_list(dev->devices, l);
- free(eo_dev);
- break;
- }
- }
-
- if (eina_list_count(dev->devices) == 0)
- {
- _ecore_wl2_input_device_last_device_unset(dev);
-
- if (dev->tz_device) tizen_input_device_release(dev->tz_device);
- if (dev->name) eina_stringshare_del(dev->name);
- if (dev->identifier) eina_stringshare_del(dev->identifier);
- dev->seat = NULL;
-
- input->devmgr.devices = eina_list_remove(input->devmgr.devices, dev);
- free(dev);
- }
- }
-
- return ECORE_CALLBACK_PASS_ON;
-}
//
-
void
_ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int version)
{
ecore_event_handler_add(ECORE_WL2_EVENT_DEVICE_REMOVED,
_ecore_wl2_cb_device_event, input);
- // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- input->tzdev_add_handler =
- ecore_event_handler_add(ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED,
- _ecore_wl2_cb_tizen_device_event, display);
-
- input->tzdev_remove_handler =
- ecore_event_handler_add(ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED,
- _ecore_wl2_cb_tizen_device_event, display);
- //
-
if (!display->wl.data_device_manager) return;
input->data.device =
}
void
-_ecore_wl2_input_device_info_send(Ecore_Wl2_Display *dpy, const char *name, const char *identifier, Efl_Input_Device_Type clas, Efl_Input_Device_Subtype subclas, Eina_Bool flag)
+_ecore_wl2_input_device_info_send(Ecore_Wl2_Display *dpy, const char *name, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas, Eina_Bool flag)
{
Ecore_Wl2_Event_Tizen_Device_Info *e;
}
static void
-_ecore_wl2_input_device_info_broadcast(Ecore_Wl2_Input *input, const char *name, const char *identifier, Efl_Input_Device_Type clas, Efl_Input_Device_Subtype subclas, Eina_Bool flag)
+_ecore_wl2_input_device_ecore_device_add(Ecore_Wl2_Tizen_Input_Device *dev)
+{
+ Ecore_Device *ecdev;
+ Eina_List *l;
+ const char *ecdev_name;
+
+ if (!dev->identifier) return;
+
+ EINA_LIST_FOREACH(ecore_device_list(), l, ecdev)
+ {
+ ecdev_name = ecore_device_identifier_get(ecdev);
+ if (!ecdev_name) continue;
+ if ((ecore_device_class_get(ecdev) == dev->clas) && (!strcmp(ecdev_name, dev->identifier)))
+ return;
+ }
+
+ ecdev = ecore_device_add();
+ if (!ecdev)
+ {
+ ERR("Failed to add ecore device for name: %s (%s)\n", dev->name, dev->identifier);
+ return;
+ }
+ ecore_device_name_set(ecdev, dev->name);
+ ecore_device_identifier_set(ecdev, dev->identifier);
+ ecore_device_class_set(ecdev, dev->clas);
+ ecore_device_subclass_set(ecdev, dev->subclas);
+
+ dev->device = efl_ref(ecdev);
+}
+
+static void
+_ecore_wl2_input_device_ecore_device_remove(Ecore_Wl2_Tizen_Input_Device *dev)
{
- if (!name) return;
- if (!input || !input->display) return;
+ Ecore_Device *ecdev;
+ const Eina_List *l;
+ const char *ecdev_name;
- _ecore_wl2_input_device_info_send(input->display, name, identifier, clas, subclas, flag);
+ if (!dev->identifier) return;
+
+ EINA_LIST_FOREACH(ecore_device_list(), l, ecdev)
+ {
+ ecdev_name = ecore_device_identifier_get(ecdev);
+ if (!ecdev_name) continue;
+ if ((ecore_device_class_get(ecdev) == dev->clas) &&
+ (!strcmp(ecdev_name, dev->identifier)))
+ {
+ ecore_device_del(ecdev);
+ dev->device = NULL;
+ return;
+ }
+ }
+}
+
+static void
+_ecore_wl2_input_device_info_broadcast(Ecore_Wl2_Tizen_Input_Device *dev, Eina_Bool flag)
+{
+ if (!dev) return;
+ if (!dev->name) return;
+ if (!dev->input || !dev->input->display) return;
+
+ _ecore_wl2_input_device_info_send(dev->input->display, dev->name, dev->identifier, dev->clas, dev->subclas, flag);
+
+ if (flag)
+ _ecore_wl2_input_device_ecore_device_add(dev);
+ else
+ _ecore_wl2_input_device_ecore_device_remove(dev);
}
static void
Ecore_Wl2_Tizen_Input_Device *dev;
if (!(dev = data)) return;
- dev->clas = (Efl_Input_Device_Type)clas;
- dev->subclas = (Efl_Input_Device_Subtype)subclas;
+ dev->clas = (Ecore_Device_Class)clas;
+ dev->subclas = (Ecore_Device_Subclass)subclas;
dev->name = eina_stringshare_add(name);
- _ecore_wl2_input_device_info_broadcast(dev->input, dev->name, dev->identifier, dev->clas, dev->subclas, EINA_TRUE);
+ _ecore_wl2_input_device_info_broadcast(dev, EINA_TRUE);
}
static void
{
Ecore_Wl2_Display *ewd = (Ecore_Wl2_Display *)data;
Ecore_Wl2_Input *input;
- Eina_List *l;
+ Eina_List *l, *l_next;
Ecore_Wl2_Tizen_Input_Device *dev;
if (!ewd) return;
if (!input) return;
- EINA_LIST_FOREACH(input->devmgr.devices, l, dev)
+ EINA_LIST_FOREACH_SAFE(input->devmgr.devices, l, l_next, dev)
{
if (!dev->identifier) continue;
if ((!strcmp(dev->identifier, identifier)) && (seat == dev->seat) && (device == dev->tz_device))
{
- _ecore_wl2_input_device_info_broadcast(dev->input, dev->name, dev->identifier, dev->clas, dev->subclas, EINA_FALSE);
+ _ecore_wl2_input_device_info_broadcast(dev, EINA_FALSE);
+
+ _ecore_wl2_input_device_last_device_unset(dev);
+
+ if (dev->tz_device) tizen_input_device_release(dev->tz_device);
+ if (dev->name) eina_stringshare_del(dev->name);
+ if (dev->identifier) eina_stringshare_del(dev->identifier);
+ dev->seat = NULL;
+
+ input->devmgr.devices = eina_list_remove_list(input->devmgr.devices, l);
+
+ free(dev);
break;
}
}
Ecore_Wl2_Input *input;
const char *name;
const char *identifier;
- Efl_Input_Device_Type clas;
- Efl_Input_Device_Subtype subclas;
+ Ecore_Device_Class clas;
+ Ecore_Device_Subclass subclas;
struct wl_seat *seat;
- Eina_List *devices;
+ Ecore_Device *device;
};
typedef struct _Ecore_Wl2_Touch_Axis
interfaces/efl_image_animated.eo
interfaces/efl_image_load.eo
interfaces/efl_input_device.eo
+ interfaces/efl_ecore_input_device.eo
interfaces/efl_input_types.eot
interfaces/efl_io_buffer.eo
interfaces/efl_io_closer.eo
interfaces/efl_vpath_core.c
interfaces/efl_vpath_file_core.c
interfaces/efl_input_device.c
+ interfaces/efl_ecore_input_device.c
interfaces/efl_io_closer.c
interfaces/efl_io_positioner.c
interfaces/efl_io_reader.c
/* Input events */
#include "interfaces/efl_input_types.eot.h"
#include "interfaces/efl_input_device.eo.h"
+#include "interfaces/efl_ecore_input_device.eo.h"
/* Canvas & UI */
#include "interfaces/efl_canvas.eo.h"
#include "interfaces/efl_image.eo.legacy.h"
#include "interfaces/efl_image_animated.eo.legacy.h"
#include "interfaces/efl_input_device.eo.legacy.h"
+#include "interfaces/efl_ecore_input_device.eo.legacy.h"
#include "interfaces/efl_text_types.eot.h"
#endif
typedef struct _Efl_Input_Pointer_Data Efl_Input_Pointer_Data;
typedef struct _Efl_Input_Key_Data Efl_Input_Key_Data;
typedef struct _Efl_Input_Device_Data Efl_Input_Device_Data;
+// TIZEN_ONLY(20180118): support a Ecore_Device
+typedef struct _Efl_Ecore_Input_Device_Data Efl_Ecore_Input_Device_Data;
+//
typedef struct _Efl_Input_Hold_Data Efl_Input_Hold_Data;
typedef struct _Efl_Input_Focus_Data Efl_Input_Focus_Data;
unsigned int pointer_count;
};
+// TIZEN_ONLY(20180118): support a Ecore_Device
+struct _Efl_Ecore_Input_Device_Data
+{
+ Eo *eo;
+ Efl_Ecore_Input_Device *source; /* ref */
+ Eina_List *children; /* ref'ed by efl_parent, not by this list */
+ unsigned int id;
+ Efl_Ecore_Input_Device_Type klass;
+ unsigned int subclass; // Evas_Device_Subclass (unused)
+ unsigned int pointer_count;
+};
+//
+
struct _Efl_Input_Hold_Data
{
Eo *eo;
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Efl.h>
+
+#define EFL_INTERNAL_UNSTABLE
+#include "efl_common_internal.h"
+
+#define MY_CLASS EFL_ECORE_INPUT_DEVICE_CLASS
+
+/* Efl Input Device = Evas Device */
+
+typedef struct _Child_Device_Iterator Child_Device_Iterator;
+
+struct _Child_Device_Iterator
+{
+ Eina_Iterator iterator;
+ Eina_List *list;
+ Eina_Iterator *real_iterator;
+ Eo *object;
+};
+
+static Eina_Bool
+_is_pointer(Efl_Ecore_Input_Device_Data *pd)
+{
+ return (pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_MOUSE ||
+ pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_TOUCH ||
+ pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_PEN ||
+ pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_WAND);
+}
+
+static void
+_seat_pointers_update(Efl_Ecore_Input_Device_Data *seat, Efl_Ecore_Input_Device_Data *dev)
+{
+ if (seat && _is_pointer(dev))
+ seat->pointer_count++;
+}
+
+EOLIAN static Efl_Object *
+_efl_ecore_input_device_efl_object_constructor(Eo *obj, Efl_Ecore_Input_Device_Data *pd)
+{
+ obj = efl_constructor(efl_super(obj, MY_CLASS));
+ pd->eo = obj;
+ return obj;
+}
+
+EOLIAN static void
+_efl_ecore_input_device_efl_object_destructor(Eo *obj, Efl_Ecore_Input_Device_Data *pd)
+{
+ pd->children = eina_list_free(pd->children);
+ if (pd->klass != EFL_ECORE_INPUT_DEVICE_TYPE_SEAT)
+ {
+ Efl_Ecore_Input_Device_Data *p;
+ Eo *seat;
+
+ seat = efl_ecore_input_device_seat_get(obj);
+ p = efl_data_scope_get(seat, MY_CLASS);
+ if (p) p->children = eina_list_remove(p->children, obj);
+ }
+ efl_unref(pd->source);
+
+ return efl_destructor(efl_super(obj, MY_CLASS));
+}
+
+EOLIAN static void
+_efl_ecore_input_device_efl_object_parent_set(Eo *obj, Efl_Ecore_Input_Device_Data *pd EINA_UNUSED, Eo *parent)
+{
+ Efl_Ecore_Input_Device_Data *p;
+
+ if (parent)
+ {
+ if (efl_isa(parent, MY_CLASS))
+ {
+ p = efl_data_scope_get(parent, MY_CLASS);
+ EINA_SAFETY_ON_FALSE_RETURN(p->klass == EFL_ECORE_INPUT_DEVICE_TYPE_SEAT);
+ if (!eina_list_data_find(p->children, obj))
+ {
+ p->children = eina_list_append(p->children, obj);
+ _seat_pointers_update(p, pd);
+ }
+ }
+ else if(!efl_isa(parent, EFL_CANVAS_INTERFACE))
+ {
+ EINA_SAFETY_ERROR("The parent of a device must be a seat or the canvas");
+ return;
+ }
+ }
+ else
+ {
+ Eo *old_parent = efl_parent_get(obj);
+ if (old_parent && efl_isa(old_parent, MY_CLASS))
+ {
+ p = efl_data_scope_get(old_parent, MY_CLASS);
+ p->children = eina_list_remove(p->children, obj);
+ if (_is_pointer(pd))
+ p->pointer_count--;
+ }
+ }
+
+ efl_parent_set(efl_super(obj, MY_CLASS), parent);
+}
+
+EOLIAN static void
+_efl_ecore_input_device_device_type_set(Eo *obj, Efl_Ecore_Input_Device_Data *pd, Efl_Ecore_Input_Device_Type klass)
+{
+ EINA_SAFETY_ON_TRUE_RETURN(pd->klass);
+ pd->klass = klass;
+ if (klass != EFL_ECORE_INPUT_DEVICE_TYPE_SEAT)
+ {
+ Efl_Ecore_Input_Device_Data *seat = efl_data_scope_get(efl_ecore_input_device_seat_get(obj), MY_CLASS);
+ _seat_pointers_update(seat, pd);
+ }
+}
+
+EOLIAN static Efl_Ecore_Input_Device_Type
+_efl_ecore_input_device_device_type_get(Eo *obj EINA_UNUSED, Efl_Ecore_Input_Device_Data *pd)
+{
+ return pd->klass;
+}
+
+EOLIAN static void
+_efl_ecore_input_device_source_set(Eo *obj EINA_UNUSED, Efl_Ecore_Input_Device_Data *pd, Efl_Ecore_Input_Device *src)
+{
+ if (pd->source == src) return;
+ efl_unref(pd->source);
+ pd->source = efl_ref(src);
+}
+
+EOLIAN static Efl_Ecore_Input_Device *
+_efl_ecore_input_device_source_get(Eo *obj EINA_UNUSED, Efl_Ecore_Input_Device_Data *pd)
+{
+ return pd->source;
+}
+
+EOLIAN static void
+_efl_ecore_input_device_seat_id_set(Eo *obj EINA_UNUSED, Efl_Ecore_Input_Device_Data *pd, unsigned int id)
+{
+ EINA_SAFETY_ON_TRUE_RETURN(pd->klass != EFL_ECORE_INPUT_DEVICE_TYPE_SEAT);
+ pd->id = id;
+}
+
+EOLIAN static unsigned int
+_efl_ecore_input_device_seat_id_get(Eo *obj, Efl_Ecore_Input_Device_Data *pd)
+{
+ if (pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_SEAT)
+ return pd->id;
+ return efl_ecore_input_device_seat_id_get(efl_ecore_input_device_seat_get(obj));
+}
+
+EOLIAN static Efl_Ecore_Input_Device *
+_efl_ecore_input_device_seat_get(Eo *obj, Efl_Ecore_Input_Device_Data *pd)
+{
+ for (; obj; obj = efl_parent_get(obj))
+ {
+ if (pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_SEAT)
+ return pd->eo;
+
+ if (!efl_isa(obj, MY_CLASS)) break;
+ pd = efl_data_scope_get(obj, MY_CLASS);
+ }
+
+ return NULL;
+}
+
+static Eina_Bool
+_child_device_iterator_next(Child_Device_Iterator *it, void **data)
+{
+ Eo *sub;
+
+ if (!eina_iterator_next(it->real_iterator, (void **) &sub))
+ return EINA_FALSE;
+
+ if (data) *data = sub;
+ return EINA_TRUE;
+}
+
+static Eo *
+_child_device_iterator_get_container(Child_Device_Iterator *it)
+{
+ return it->object;
+}
+
+static void
+_child_device_iterator_free(Child_Device_Iterator *it)
+{
+ eina_iterator_free(it->real_iterator);
+ free(it);
+}
+
+EOLIAN static Eina_Iterator *
+_efl_ecore_input_device_children_iterate(Eo *obj, Efl_Ecore_Input_Device_Data *pd)
+{
+ Child_Device_Iterator *it;
+
+ it = calloc(1, sizeof(*it));
+ if (!it) return NULL;
+
+ EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
+
+ it->list = pd->children;
+ it->real_iterator = eina_list_iterator_new(it->list);
+ it->iterator.version = EINA_ITERATOR_VERSION;
+ it->iterator.next = FUNC_ITERATOR_NEXT(_child_device_iterator_next);
+ it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_child_device_iterator_get_container);
+ it->iterator.free = FUNC_ITERATOR_FREE(_child_device_iterator_free);
+ it->object = obj;
+
+ return &it->iterator;
+}
+
+EOLIAN static unsigned int
+_efl_ecore_input_device_has_pointer_caps(Eo *obj EINA_UNUSED, Efl_Ecore_Input_Device_Data *pd)
+{
+ if (pd->klass == EFL_ECORE_INPUT_DEVICE_TYPE_SEAT)
+ return pd->pointer_count;
+ return _is_pointer(pd);
+}
+
+#include "interfaces/efl_ecore_input_device.eo.c"
--- /dev/null
+enum Efl.Ecore.Input.Device.Type
+{
+ [[General type of input device.
+
+ Legacy support since 1.8 as $Evas_Device_Class.
+ ]]
+ none, [[Not a device.]]
+ seat, [[The user/seat (the user themselves).]]
+ keyboard, [[A regular keyboard, numberpad or attached buttons.]]
+ mouse, [[A mouse, trackball or touchpad relative motion device.]]
+ touch, [[A touchscreen with fingers or stylus.]]
+ pen, [[A special pen device.]]
+ wand, [[A laser pointer, wii-style or "Minority Report" pointing device.]]
+ gamepad, [[A gamepad controller or joystick.]]
+}
+
+// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
+enum Efl.Ecore.Input.Device.Subtype
+{
+ [[General type of input device.
+
+ Legacy support since 1.8 as $Evas_Device_Subclass.
+ ]]
+ none, [[Not a device.]]
+ finger, [[The normal flat of your finger.]]
+ fingernail, [[A fingernai.]]
+ knuckle, [[A Knuckle.]]
+ palm, [[The palm of a users hand.]]
+ hand_size, [[The side of your hand.]]
+ hand_flat, [[The flat of your hand.]]
+ pen_tip, [[The tip of a pen.]]
+ trackpad, [[A trackpad style mouse.]]
+ trackpoint, [[A trackpoint style mouse.]]
+ trackball, [[A trackball style mouse.]]
+// TIZEN_ONLY(20170620): Add new device subclasses.
+ remocon, [[A remote controller.]]
+ virtual_keyboard, [[A virtual keyboard.]]
+//
+}
+//
+
+/* TODO: Add canvas property. Current problem is we need to return
+ Efl.Ui.Win and not Evas:
+ @property canvas { values { canvas: Efl.Canvas; } }
+*/
+
+class Efl.Ecore.Input.Device (Efl.Object)
+{
+ [[Represents a pointing device such as a touch finger, pen or mouse.
+
+ @since 1.18
+ ]]
+ methods {
+ @property device_type {
+ [[Device type property]]
+ values {
+ klass: Efl.Ecore.Input.Device.Type; [[Input device class]]
+ }
+ }
+ @property source {
+ [[Device source property]]
+ values {
+ src: Efl.Ecore.Input.Device; [[Input device]]
+ }
+ }
+ @property seat {
+ [[Get the @Efl.Ecore.Input.Device that represents a seat.
+
+ This method will find the seat the device belongs to.
+
+ For this, it walk through device's parents looking for a device
+ with @Efl.Ecore.Input.Device.Type.seat. It may be
+ the device itself.
+
+ In case no seat is found, $null is returned.
+ ]]
+ get {}
+ values {
+ seat: Efl.Ecore.Input.Device; [[The seat this device belongs to.]]
+ }
+ }
+ @property seat_id {
+ [[Seat id number
+
+ @since 1.20
+ ]]
+ values {
+ id: uint; [[The id of the seat]]
+ }
+ }
+ children_iterate {
+ [[Lists the children attached to this device.
+
+ This is only meaningful with seat devices, as they are groups of
+ real input devices.
+
+ @since 1.20
+ ]]
+ return: iterator<const(Efl.Ecore.Input.Device)> @owned; [[List of device children]]
+ }
+ has_pointer_caps {
+ [[Determine whether a device has pointer capabilities.
+
+ Returns 1 for Mouse, Touch, Pen, Pointer, and Wand type devices.
+
+ If a seat device is passed returns the number of pointer devices in the seat.
+
+ @since 1.20
+ ]]
+ return: uint; [[Pointer caps]]
+ }
+ }
+ implements {
+ Efl.Object.constructor;
+ Efl.Object.destructor;
+ Efl.Object.parent { set; }
+ }
+}
//TIZEN_ONLY(20171220): send a hw device for pointer events
EAPI Evas_Device *evas_device_top_get(const Evas *eo_e);
//
+EAPI Evas_Device *evas_device_default_get(const Evas *eo_e, Evas_Device_Class clas);
/**
* @}
return _evas_device_top_get(eo_e);
}
//
+
+EAPI Evas_Device *
+evas_device_default_get(const Evas *eo_e, Evas_Device_Class clas)
+{
+ Evas_Public_Data *e;
+
+ SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
+
+ e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
+
+ if (clas == EVAS_DEVICE_CLASS_SEAT)
+ {
+ return e->default_seat;
+ }
+ else if (clas == EVAS_DEVICE_CLASS_KEYBOARD)
+ {
+ return e->default_keyboard;
+ }
+ else if (clas == EVAS_DEVICE_CLASS_MOUSE ||
+ clas == EVAS_DEVICE_CLASS_TOUCH)
+ {
+ return e->default_mouse;
+ }
+
+ return NULL;
+}
return EINA_FALSE;
}
-static void
-_ecore_evas_wl_common_tizen_device_event_add(int type, Evas_Device *dev, Ecore_Evas *ee)
-{
- Ecore_Wl2_Event_Tizen_Input_Device_Info *ev;
-
- ev = calloc(1, sizeof(Ecore_Wl2_Event_Tizen_Input_Device_Info));
- EINA_SAFETY_ON_NULL_RETURN(ev);
-
- ev->dev = efl_ref(dev);
- ev->name = evas_device_name_get(dev);
- ev->identifier = evas_device_description_get(dev);
- ev->window_id = ee->prop.window;
-
- ecore_event_add(type, ev, NULL, dev);
-}
-
static Evas_Device *
_ecore_evas_wl_common_default_seat_get(Evas *evas)
{
seat, NULL,
ev->clas,
ev->subclas);
- _ecore_evas_wl_common_tizen_device_event_add(ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED, device, ee);
}
return ECORE_CALLBACK_PASS_ON;
{
if (!strncmp(evas_device_description_get(device), ev->identifier, strlen(ev->identifier)))
{
- _ecore_evas_wl_common_tizen_device_event_add(ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED, device, ee);
evas_device_del(device);
}
}