lib/ecore/ecore_throttle.c \
lib/ecore/ecore_exe.c \
lib/ecore/ecore_exe_private.h \
+lib/ecore/ecore_device.c \
lib/ecore/ecore_private.h
if HAVE_WIN32
* @}
*/
+/**
+ * @defgroup Ecore_Device_Group Ecore Device functions
+ * @ingroup Ecore
+ *
+ * @{
+ */
+ typedef struct _Ecore_Device Ecore_Device; /**< A handle for an device */
+/**
+ * @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 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; /**< A general subclass of device @since 1.18 */
+
+typedef struct _Ecore_Device_Event_Info Ecore_Device_Event_Info; /**< @since 1.18 */
+
+/** Add a new device type
+ *
+ * Adds a new device node. All devices created whenever a new device
+ * is plugged and will be removed whenever it gets unplugged.
+ *
+ * @return the device node created or NULL if an error occurred.
+ *
+ * @see ecore_device_del
+ * @since 1.18
+ */
+EAPI Ecore_Device *ecore_device_add();
+
+/**
+ * Delete a new device type
+ *
+ * @param dev The device node you want to delete.
+ *
+ * @since 1.18
+ */
+EAPI void ecore_device_del(Ecore_Device *dev);
+
+/**
+ * List all current devices
+ *
+ * @return An internal list of Ecore_Device pointers, or NULL if no devices are found
+ *
+ * This will list all devices allowing you to walk the device tree.
+ *
+ * If there are no devices, NULL is returned.
+ *
+ * @see evas_device_name_get
+ * @see evas_device_description_get
+ * @see ecore_device_identifier_get
+ * @see evas_device_class_get
+ * @see evas_device_subclass_get
+ * @since 1.8
+ */
+EAPI const Eina_List *ecore_device_list(void);
+
+/**
+ * Set the name of a device as a string
+ *
+ * @p dev The device to set the name of
+ * @p name The name string as a readable C UTF8 string
+ *
+ * @since 1.8
+ */
+EAPI void ecore_device_name_set(Ecore_Device *dev, const char *name);
+
+/**
+ * Get the name of a device
+ *
+ * @p dev The device to query
+ * @return The device name string or NULL if none is set
+ *
+ * This gets the name set by ecore_device_name_set(). This is a readable UTF8
+ * C string, or NULL if no name is set.
+ *
+ * The name should be a short name like "Wireless Mouse", "Joystick",
+ * "Finger", "Keyboard" or "Numberpad" etc.
+ *
+ * @since 1.8
+ */
+EAPI const char *ecore_device_name_get(const Ecore_Device *dev);
+
+/**
+ * Set the description of a device as a string
+ *
+ * @p dev The device to set the description of
+ * @p desc The description string as a readable C UTF8 string
+ *
+ * @since 1.8
+ */
+EAPI void ecore_device_description_set(Ecore_Device *dev, const char *desc);
+
+/**
+ * Get the description of a device
+ *
+ * @p dev The device to query
+ * @return The device description string or NULL if none is set
+ *
+ * This gets the description set by ecore_device_description_set(). This is
+ * a readable UTF8 C string, or NULL if no description is set.
+ *
+ * A description is meant to be a longer string describing the device so a
+ * human may make sense of it. For example "Wireless 6 button mouse in Black
+ * with red buttons" would be a good description, so a user may identify
+ * precisely which device is being talked about.
+ *
+ * @since 1.8
+ */
+EAPI const char *ecore_device_description_get(const Ecore_Device *dev);
+
+/**
+ * Set the identifier of a device as a string
+ *
+ * @p dev The device to set the identifier of
+ * @p identifier The identifier string as a readable C UTF8 string
+ *
+ * @since 1.8
+ */
+EAPI void ecore_device_identifier_set(Ecore_Device *dev, const char *desc);
+
+/**
+ * Get the identifier of a device
+ *
+ * @p dev The device to query
+ * @return The device identifier string or NULL if none is set
+ *
+ * This gets the identifier set by ecore_device_identifier_set(). This is
+ * a readable UTF8 C string, or NULL if no identifier is set.
+ *
+ * A identifier should be unique string distinguishing input devices.
+ * For now, the sys name of device provided by udev is used. ex)/dev/input/event2.
+ *
+ * @since 1.8
+ */
+EAPI const char *ecore_device_identifier_get(const Ecore_Device *dev);
+
+/**
+ * Set the major class of device
+ *
+ * @param dev The device whose class to set
+ * @param clas The class to set it to
+ *
+ * This sets the "primary" class of device (a broad thing like mouse, keyboard,
+ * touch, pen etc.).
+ *
+ * @since 1.8
+ */
+EAPI void ecore_device_class_set(Ecore_Device *dev, Ecore_Device_Class clas);
+
+/**
+ * Get the major class of a device
+ *
+ * @param dev The devise to query
+ * @return The device class to set
+ *
+ * This sets the device class set by evas_device_class_set().
+ *
+ * @since 1.8
+ */
+EAPI Ecore_Device_Class ecore_device_class_get(const Ecore_Device *dev);
+
+/**
+ * Set the sub-class of a device
+ *
+ * @param dev The device to modify
+ * @param clas The sub-class to set
+ *
+ * This sets the sub-class of a device which gives much more detailed usage
+ * within a broader category.
+ *
+ * @since 1.8
+ */
+EAPI void ecore_device_subclass_set(Ecore_Device *dev, Ecore_Device_Subclass clas);
+
+/**
+ * Get the device sub-class
+ *
+ * @param dev The device to query
+ * @return The device sub-class set by evas_device_subclass_set().
+ *
+ * @since 1.8
+ */
+EAPI Ecore_Device_Subclass ecore_device_subclass_get(const Ecore_Device *dev);
+
+/**
+ * @}
+ */
#ifdef __cplusplus
}
#endif
_ecore_glib_shutdown();
_ecore_job_shutdown();
_ecore_thread_shutdown();
+ _ecore_device_cleanup();
/* this looks horrible - a hack for now, but something to note. as
* we delete the _thread_call pipe a thread COULD be doing
return "Ecore_Event (Event)";
break;
+ case ECORE_MAGIC_DEV:
+ return "Ecore_Device (Device)";
+ break;
+
default:
return "<UNKNOWN>";
}
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#include "Ecore.h"
+#include "ecore_private.h"
+
+/**
+ * @struct _Ecore_Device
+ * Contains information about a device.
+ */
+struct _Ecore_Device
+ {
+ ECORE_MAGIC; /**< ecore magic data */
+ const char *name; /**< name of device */
+ const char *desc; /**< description of device */
+ const char *identifier; /**< identifier of device */
+ Ecore_Device_Class clas; /**<Device class */
+ Ecore_Device_Subclass subclas; /**< device subclass */
+ };
+
+static Eina_List *_ecore_devices = NULL;
+static int devices_num;
+
+void _ecore_device_free(Ecore_Device *dev);
+
+EAPI Ecore_Device *
+ecore_device_add()
+{
+ Ecore_Device *dev;
+
+ dev = calloc(1, sizeof(Ecore_Device));
+ if (!dev) return NULL;
+ ECORE_MAGIC_SET(dev, ECORE_MAGIC_DEV);
+ _ecore_devices = eina_list_append(_ecore_devices, dev);
+ devices_num++;
+ return dev;
+}
+
+EAPI void
+ecore_device_del(Ecore_Device *dev)
+{
+ if (!dev) return;
+
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_del");
+ return;
+ }
+ _ecore_device_free(dev);
+}
+
+EAPI const Eina_List *
+ecore_device_list(void)
+{
+ return _ecore_devices;
+}
+
+EAPI void
+ecore_device_name_set(Ecore_Device *dev, const char *name)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_name_set");
+ return;
+ }
+ eina_stringshare_replace(&(dev->name), name);
+}
+
+EAPI const char *
+ecore_device_name_get(const Ecore_Device *dev)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_name_get");
+ return NULL;
+ }
+ return dev->name;
+}
+
+EAPI void
+ecore_device_description_set(Ecore_Device *dev, const char *desc)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_description_set");
+ return;
+ }
+ eina_stringshare_replace(&(dev->desc), desc);
+}
+
+EAPI const char *
+ecore_device_description_get(const Ecore_Device *dev)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_description_get");
+ return NULL;
+ }
+ return dev->desc;
+}
+
+EAPI void
+ecore_device_identifier_set(Ecore_Device *dev, const char *identifier)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_identifier_set");
+ return;
+ }
+ eina_stringshare_replace(&(dev->identifier), identifier);
+}
+
+EAPI const char *
+ecore_device_identifier_get(const Ecore_Device *dev)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_identifier_get");
+ return NULL;
+ }
+ return dev->identifier;
+}
+
+EAPI void
+ecore_device_class_set(Ecore_Device *dev, Ecore_Device_Class clas)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_class_set");
+ return;
+ }
+ dev->clas = clas;
+}
+
+EAPI Ecore_Device_Class
+ecore_device_class_get(const Ecore_Device *dev)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_class_get");
+ return ECORE_DEVICE_CLASS_NONE;
+ }
+ return dev->clas;
+}
+
+EAPI void
+ecore_device_subclass_set(Ecore_Device *dev, Ecore_Device_Subclass subclas)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_class_set");
+ return;
+ }
+ dev->subclas = subclas;
+}
+
+EAPI Ecore_Device_Subclass
+ecore_device_subclass_get(const Ecore_Device *dev)
+{
+ if (!ECORE_MAGIC_CHECK(dev, ECORE_MAGIC_DEV))
+ {
+ ECORE_MAGIC_FAIL(dev, ECORE_MAGIC_DEV, "ecore_device_class_get");
+ return ECORE_DEVICE_CLASS_NONE;
+ }
+ return dev->subclas;
+}
+
+void
+_ecore_device_cleanup(void)
+{
+ Ecore_Device *dev = NULL;
+ Eina_List *l1, *l2;
+
+ EINA_LIST_FOREACH_SAFE(_ecore_devices, l1, l2, dev)
+ _ecore_device_free(dev);
+}
+
+void _ecore_device_free(Ecore_Device *dev)
+{
+ _ecore_devices = eina_list_remove(_ecore_devices, dev);
+ if (dev->name) eina_stringshare_del(dev->name);
+ if (dev->desc) eina_stringshare_del(dev->desc);
+ if (dev->identifier) eina_stringshare_del(dev->identifier);
+ ECORE_MAGIC_SET(dev, 0);
+ free(dev);
+ devices_num--;
+}
#define ECORE_MAGIC_PIPE 0xf7458226
#define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3
#define ECORE_MAGIC_JOB 0x76543210
+#define ECORE_MAGIC_DEV 0x5e9e6510
typedef unsigned int Ecore_Magic;
#define ECORE_MAGIC Ecore_Magic __magic
void _ecore_job_init(void);
void _ecore_job_shutdown(void);
+void _ecore_device_cleanup(void);
+
void _ecore_main_loop_init(void);
void _ecore_main_loop_shutdown(void);
GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Handler, ecore_event_handler);
GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Filter, ecore_event_filter);
GENERIC_ALLOC_FREE_HEADER(Ecore_Event, ecore_event);
+//GENERIC_ALLOC_FREE_HEADER(Ecore_Device, ecore_device);
//GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Exiter, ecore_idle_exiter);
//GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Enterer, ecore_idle_enterer);
//GENERIC_ALLOC_FREE_HEADER(Ecore_Idler, ecore_idler);
struct xkb_context *xkb_ctx;
- unsigned int window;
+ int window;
Eeze_Udev_Watch *watch;
EAPI Eina_Bool ecore_drm_evdev_key_remap_enable(Ecore_Drm_Evdev *edev, Eina_Bool enable);
EAPI Eina_Bool ecore_drm_evdev_key_remap_set(Ecore_Drm_Evdev *edev, int *from_keys, int *to_keys, int num);
EAPI int ecore_drm_evdev_wheel_click_angle_get(Ecore_Drm_Evdev *dev);
+EAPI Ecore_Device *ecore_drm_evdev_get_ecore_device(const char *path, Ecore_Device_Class clas);
typedef void (*Ecore_Drm_VBlank_Cb)(void *data);
EAPI Eina_Bool ecore_drm_output_wait_vblank(Ecore_Drm_Output *output, int interval, Ecore_Drm_VBlank_Cb func, void *data);
EINA_LIST_FOREACH(dev->seats, l , seat)
{
EINA_LIST_FOREACH(seat->devices, ll, edev)
- _ecore_drm_device_info_send(window, edev, EINA_TRUE);
+ _ecore_drm_device_add(window, edev);
}
}
return code;
}
+EAPI Ecore_Device *
+ecore_drm_evdev_get_ecore_device(const char *path, Ecore_Device_Class clas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Ecore_Device *dev = NULL;
+ const char *identifier;
+
+ if (!path) return NULL;
+
+ dev_list = ecore_device_list();
+ if (!dev_list) return NULL;
+ EINA_LIST_FOREACH(dev_list, l, dev)
+ {
+ if (!dev) continue;
+ identifier = ecore_device_identifier_get(dev);
+ if (!identifier) continue;
+ if ((ecore_device_class_get(dev) == clas) && !(strcmp(identifier, path)))
+ return dev;
+ }
+ return NULL;
+}
+
static void
_device_handle_key(struct libinput_device *device, struct libinput_event_keyboard *event)
{
_device_modifiers_update(edev);
e->modifiers = edev->xkb.modifiers;
- e->dev_name = eina_stringshare_add(edev->path);
+ e->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_KEYBOARD);
if (state)
ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev_name = eina_stringshare_add(edev->path);
+ ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
}
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev_name = eina_stringshare_add(edev->path);
+ ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
if (state)
{
ev->y = edev->seat->ptr.iy;
ev->root.x = ev->x;
ev->root.y = ev->y;
- ev->dev_name = eina_stringshare_add(edev->path);
+ ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
#if LIBINPUT_HIGHER_08
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev_name = eina_stringshare_add(edev->path);
+ ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
if (state == ECORE_EVENT_MOUSE_BUTTON_DOWN)
{
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev_name = eina_stringshare_add(edev->path);
+ ev->dev = ecore_drm_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL);
}
free(e);
}
+static Ecore_Device_Class
+_ecore_drm_seat_cap_to_ecore_device_class(unsigned int cap)
+{
+ switch(cap)
+ {
+ case EVDEV_SEAT_POINTER:
+ return ECORE_DEVICE_CLASS_MOUSE;
+ case EVDEV_SEAT_KEYBOARD:
+ return ECORE_DEVICE_CLASS_KEYBOARD;
+ case EVDEV_SEAT_TOUCH:
+ return ECORE_DEVICE_CLASS_TOUCH;
+ default:
+ return ECORE_DEVICE_CLASS_NONE;
+ }
+ return ECORE_DEVICE_CLASS_NONE;
+}
+
void
-_ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Eina_Bool flag)
+_ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Ecore_Device_Class clas, Eina_Bool flag)
{
Ecore_Event_Device_Info *e;
e->name = eina_stringshare_add(libinput_device_get_name(edev->device));
e->identifier = eina_stringshare_add(edev->path);
e->seatname = eina_stringshare_add(edev->seat->name);
- e->caps = edev->seat_caps;
+ e->clas = clas;
e->window = window;
if (flag)
ecore_event_add(ECORE_EVENT_DEVICE_DEL, e, _ecore_event_device_info_free, NULL);
}
+static Eina_Bool
+_ecore_drm_device_add_ecore_device(Ecore_Drm_Evdev *edev, Ecore_Device_Class clas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Ecore_Device *dev = NULL;
+ const char *identifier;
+
+ if (!edev->path) return EINA_FALSE;
+
+ dev_list = ecore_device_list();
+ if (dev_list)
+ {
+ EINA_LIST_FOREACH(dev_list, l, dev)
+ {
+ if (!dev) continue;
+ identifier = ecore_device_identifier_get(dev);
+ if (!identifier) continue;
+ if ((ecore_device_class_get(dev) == clas) && (!strcmp(identifier, edev->path)))
+ return EINA_FALSE;
+ }
+ }
+
+ if(!(dev = ecore_device_add())) return EINA_FALSE;
+
+ ecore_device_name_set(dev, libinput_device_get_name(edev->device));
+ ecore_device_description_set(dev, libinput_device_get_name(edev->device));
+ ecore_device_identifier_set(dev, edev->path);
+ ecore_device_class_set(dev, clas);
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_ecore_drm_device_del_ecore_device(Ecore_Drm_Evdev *edev, Ecore_Device_Class clas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Ecore_Device *dev = NULL;
+ const char *identifier;
+
+ if (!edev->path) return EINA_FALSE;
+
+ dev_list = ecore_device_list();
+ if (!dev_list) return EINA_FALSE;
+ EINA_LIST_FOREACH(dev_list, l, dev)
+ {
+ if (!dev) continue;
+ identifier = ecore_device_identifier_get(dev);
+ if (!identifier) continue;
+ if ((ecore_device_class_get(dev) == clas) && (!strcmp(identifier, edev->path)))
+ {
+ ecore_device_del(dev);
+ return EINA_TRUE;
+ }
+ }
+ return EINA_FALSE;
+}
+
+void
+_ecore_drm_device_add(unsigned int window, Ecore_Drm_Evdev *edev)
+{
+ Eina_Bool ret = EINA_FALSE;
+ Ecore_Device_Class clas;
+
+ if (edev->seat_caps & EVDEV_SEAT_POINTER)
+ {
+ clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_POINTER);
+ ret = _ecore_drm_device_add_ecore_device(edev, clas);
+ if (ret) _ecore_drm_device_info_send(window, edev, clas, 1);
+ }
+ if (edev->seat_caps & EVDEV_SEAT_KEYBOARD)
+ {
+ clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_KEYBOARD);
+ ret = _ecore_drm_device_add_ecore_device(edev, clas);
+ if (ret) _ecore_drm_device_info_send(window, edev, clas, 1);
+ }
+ if (edev->seat_caps & EVDEV_SEAT_TOUCH)
+ {
+ clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_TOUCH);
+ ret = _ecore_drm_device_add_ecore_device(edev, clas);
+ if (ret) _ecore_drm_device_info_send(window, edev, clas, 1);
+ }
+}
+
+void
+_ecore_drm_device_remove(unsigned int window, Ecore_Drm_Evdev *edev)
+{
+ Eina_Bool ret = EINA_FALSE;
+ Ecore_Device_Class clas;
+
+ if (edev->seat_caps & EVDEV_SEAT_POINTER)
+ {
+ clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_POINTER);
+ ret = _ecore_drm_device_del_ecore_device(edev, clas);
+ if (ret) _ecore_drm_device_info_send(window, edev, clas, 0);
+ }
+ if (edev->seat_caps & EVDEV_SEAT_KEYBOARD)
+ {
+ clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_KEYBOARD);
+ ret = _ecore_drm_device_del_ecore_device(edev, clas);
+ if (ret) _ecore_drm_device_info_send(window, edev, clas, 0);
+ }
+ if (edev->seat_caps & EVDEV_SEAT_TOUCH)
+ {
+ clas = _ecore_drm_seat_cap_to_ecore_device_class(EVDEV_SEAT_TOUCH);
+ ret = _ecore_drm_device_del_ecore_device(edev, clas);
+ if (ret) _ecore_drm_device_info_send(window, edev, clas, 0);
+ }
+}
+
static void
_device_added(Ecore_Drm_Input *input, struct libinput_device *device)
{
NULL);
if (input->dev->window != -1) // window id is valid
- _ecore_drm_device_info_send(input->dev->window, edev, EINA_TRUE);
+ _ecore_drm_device_add(input->dev->window, edev);
TRACE_INPUT_END();
}
NULL);
if (input->dev->window != -1) // window id is valid
- _ecore_drm_device_info_send(input->dev->window, edev, EINA_FALSE);
+ _ecore_drm_device_remove(input->dev->window, edev);
/* remove this evdev from the seat's list of devices */
edev->seat->devices = eina_list_remove(edev->seat->devices, edev);
Eina_Bool _ecore_drm_dbus_session_take(void);
Eina_Bool _ecore_drm_dbus_session_release(void);
-void _ecore_drm_device_info_send(unsigned int window, Ecore_Drm_Evdev *edev, Eina_Bool flag);
+void _ecore_drm_device_add(unsigned int window, Ecore_Drm_Evdev *edev);
void _ecore_drm_inputs_init(void);
void _ecore_drm_inputs_shutdown(void);
ECORE_COMPOSE_DONE
} Ecore_Compose_State;
+ typedef enum _Ecore_Device_Type
+ {
+ ECORE_DEVICE_POINTER = (1 << 0),
+ ECORE_DEVICE_KEYBOARD = (1 << 1),
+ ECORE_DEVICE_TOUCH = (1 << 2),
+ } Ecore_Device_Type;
+
+ struct _Ecore_Event_Device_Info
+ {
+ Ecore_Window window;
+ const char *name;
+ const char *identifier;
+ const char *seatname;
+ Ecore_Device_Class clas;
+ };
+
/**
* @struct _Ecore_Event_Key
* Contains information about an Ecore keyboard event.
Ecore_Window window; /**< The main window where event happened */
Ecore_Window root_window; /**< The root window where event happened */
Ecore_Window event_window; /**< The child window where event happened */
- const char *dev_name; /**<The sysname of source device where event came from*/
+ Ecore_Device *dev; /**< source device object associated with an Ecore_Event_Key @since 1.18 */
unsigned int timestamp; /**< Time when the event occurred */
unsigned int modifiers; /**< The combination of modifiers key (SHIT,CTRL,ALT,..)*/
Ecore_Window window; /**< The main window where event happened */
Ecore_Window root_window; /**< The root window where event happened */
Ecore_Window event_window; /**< The child window where event happened */
- const char *dev_name; /**<The sysname of source device where event came from*/
+ Ecore_Device *dev; /**< source device object associated with an Ecore_Event_Mouse_Button @since 1.18 */
unsigned int timestamp; /**< Time when the event occurred */
unsigned int modifiers; /**< The combination of modifiers key (SHIT,CTRL,ALT,..)*/
Ecore_Window window; /**< The main window where event happened */
Ecore_Window root_window; /**< The root window where event happened */
Ecore_Window event_window; /**< The child window where event happened */
- const char *dev_name; /**<The sysname of source device where event came from*/
-
+ Ecore_Device *dev; /**< source device object associated with an Ecore_Event_Mouse_Wheel @since 1.18 */
unsigned int timestamp; /**< Time when the event occurred */
unsigned int modifiers; /**< The combination of modifiers key (SHIT,CTRL,ALT,..)*/
Ecore_Window window; /**< The main window where event happened */
Ecore_Window root_window; /**< The root window where event happened */
Ecore_Window event_window; /**< The child window where event happened */
- const char *dev_name; /**<The sysname of source device where event came from*/
-
+ Ecore_Device *dev; /**< source device object associated with an Ecore_Event_Mouse_Move @since 1.18 */
+
unsigned int timestamp; /**< Time when the event occurred */
unsigned int modifiers; /**< The combination of modifiers key (SHIT,CTRL,ALT,..)*/
Ecore_Axis *axis;
};
- typedef enum _Ecore_Device_Type
- {
- ECORE_DEVICE_POINTER = (1 << 0),
- ECORE_DEVICE_KEYBOARD = (1 << 1),
- ECORE_DEVICE_TOUCH = (1 << 2),
- } Ecore_Device_Type;
-
- struct _Ecore_Event_Device_Info
- {
- Ecore_Window window;
- const char *name;
- const char *identifier;
- const char *seatname;
- unsigned int caps;
- };
// TIZEN ONLY
typedef enum _Ecore_Detent_Direction
{
{
Ecore_Window window; /**< The main window where event happened */
Ecore_Window event_window; /**< The child window where event happened */
- const char *dev_name; /**<The sysname of source device where event came from*/
-
+ Ecore_Device *dev; /**< source device object associated with an Ecore_Event_Mouse_IO @since 1.18 */
+
unsigned int timestamp; /**< Time when the event occurred */
unsigned int modifiers; /**< The combination of modifiers key (SHIT,CTRL,ALT,..)*/
}
static Evas_Device *
-_ecore_event_get_evas_device(Evas *e, const char *dev_name, Evas_Device_Class clas)
+_ecore_event_get_evas_device(Evas *e, Ecore_Device *dev)
{
const Eina_List *dev_list = NULL;
const Eina_List *l;
Evas_Device *edev = NULL;
- const char *name = NULL;
+ const char *edev_name, *name;
+ Ecore_Device_Class clas;
- if (!dev_name) return NULL;
+ if (!dev) return NULL;
+ name = ecore_device_identifier_get(dev);
+ if (!name) return NULL;
+ clas = ecore_device_class_get(dev);
dev_list = evas_device_list(e, NULL);
- if (!dev_list)
- return NULL;
+ if (!dev_list) return NULL;
EINA_LIST_FOREACH(dev_list, l, edev)
{
if (!edev) continue;
- name = evas_device_description_get(edev);
- if (!name) continue;
- if (!(strcmp(name, dev_name)) && (evas_device_class_get(edev) == clas))
- {
- break;
- }
+ edev_name = evas_device_description_get(edev);
+ if (!edev_name) continue;
+ if ( (evas_device_class_get(edev) == (Evas_Device_Class)clas) && (!strcmp(edev_name, name)))
+ return edev;
}
- return edev;
+ return NULL;
}
static Eina_Bool
_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
{
Ecore_Input_Window *lookup;
+ Evas_Device *dev;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
- Evas_Device *dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_KEYBOARD);
+ dev = _ecore_event_get_evas_device(lookup->evas, e->dev);
if (dev)
evas_device_push(lookup->evas, dev);
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
Ecore_Event_Last *eel;
Ecore_Input_Window *lookup;
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
+ Evas_Device *dev;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
}
}
- Evas_Device *dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_MOUSE);
- if (!dev)
- dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_TOUCH);
+ dev = _ecore_event_get_evas_device(lookup->evas, e->dev);
if (dev)
evas_device_push(lookup->evas, dev);
if (e->multi.device == 0)
{
Ecore_Event_Mouse_Move *e;
Ecore_Input_Window *lookup;
+ Evas_Device *dev;
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
- Evas_Device *dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_MOUSE);
- if (!dev)
- dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_TOUCH);
+ dev = _ecore_event_get_evas_device(lookup->evas, e->dev);
if (dev)
evas_device_push(lookup->evas, dev);
if (e->multi.device == 0)
e->multi.x, e->multi.y, e->timestamp,
NULL);
}
- evas_device_pop(lookup->evas);
+ evas_device_pop(lookup->evas);
return ECORE_CALLBACK_PASS_ON;
}
_ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
{
Ecore_Input_Window *lookup;
+ Evas_Device *dev;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
- Evas_Device *dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_MOUSE);
- if (!dev)
- dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_TOUCH);
+ dev = _ecore_event_get_evas_device(lookup->evas, e->dev);
if (dev)
evas_device_push(lookup->evas, dev);
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
{
Ecore_Event_Mouse_Wheel *e;
Ecore_Input_Window *lookup;
+ Evas_Device *dev;
e = event;
lookup = _ecore_event_window_match(e->event_window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
- Evas_Device *dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_MOUSE);
- if (!dev)
- dev = _ecore_event_get_evas_device(lookup->evas, e->dev_name, EVAS_DEVICE_CLASS_TOUCH);
+ dev = _ecore_event_get_evas_device(lookup->evas, e->dev);
if (dev)
evas_device_push(lookup->evas, dev);
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
return ECORE_CALLBACK_PASS_ON;
}
-static short
-_ecore_event_device_cap_to_class(int cap)
-{
- switch(cap)
- {
- case ECORE_DEVICE_POINTER:
- return EVAS_DEVICE_CLASS_MOUSE;
- case ECORE_DEVICE_KEYBOARD:
- return EVAS_DEVICE_CLASS_KEYBOARD;
- case ECORE_DEVICE_TOUCH:
- return EVAS_DEVICE_CLASS_TOUCH;
- default:
- return EVAS_DEVICE_CLASS_NONE;
- }
- return EVAS_DEVICE_CLASS_NONE;
-}
-
static void
-_ecore_event_evas_add_evas_device(Evas *e, const char *name, const char *identifier, Evas_Device_Class clas)
+_ecore_event_evas_add_evas_device(Evas *e, const char *name, const char *identifier, Ecore_Device_Class clas)
{
const Eina_List *dev_list = NULL;
const Eina_List *l;
Evas_Device *edev = NULL;
+ const char *edev_name;
dev_list = evas_device_list(e, NULL);
if (dev_list)
EINA_LIST_FOREACH(dev_list, l, edev)
{
if (!edev) continue;
- if ((evas_device_class_get(edev) == clas) &&
- !(strcmp(evas_device_description_get(edev), identifier)))
+ edev_name = evas_device_description_get(edev);
+ if (!edev_name) continue;
+ if ((evas_device_class_get(edev) == (Evas_Device_Class)clas) && (!strcmp(edev_name, identifier)))
return;
}
}
}
evas_device_name_set(edev, name);
evas_device_description_set(edev, identifier);
- evas_device_class_set(edev, clas);
+ evas_device_class_set(edev, (Evas_Device_Class)clas);
}
static void
-_ecore_event_evas_del_evas_device(Evas *e, const char *name, const char *identifier, Evas_Device_Class clas)
+_ecore_event_evas_del_evas_device(Evas *e, const char *name, const char *identifier, Ecore_Device_Class clas)
{
const Eina_List *dev_list = NULL;
const Eina_List *l;
Evas_Device *edev = NULL;
+ const char *edev_name;
dev_list = evas_device_list(e, NULL);
if (!dev_list)
EINA_LIST_FOREACH(dev_list, l, edev)
{
if (!edev) continue;
- if ((evas_device_class_get(edev) == clas) &&
- !(strcmp(evas_device_description_get(edev), identifier)) &&
- !(strcmp(evas_device_name_get(edev), name)))
+ edev_name = evas_device_description_get(edev);
+ if (!edev_name) continue;
+ if ((evas_device_class_get(edev) == (Evas_Device_Class)clas) && (!strcmp(edev_name, identifier)))
{
evas_device_del(edev);
return;
}
}
-static void
-_ecore_event_add_del_evas_devices(Evas *e, const char *name, const char *identifier, int caps, Eina_Bool flag)
-{
- Evas_Device_Class clas = EVAS_DEVICE_CLASS_NONE;
- if (caps & ECORE_DEVICE_POINTER)
- {
- clas = _ecore_event_device_cap_to_class(ECORE_DEVICE_POINTER);
- if (flag)
- _ecore_event_evas_add_evas_device(e, name, identifier, clas);
- else
- _ecore_event_evas_del_evas_device(e, name, identifier, clas);
- }
- if (caps & ECORE_DEVICE_KEYBOARD)
- {
- clas = _ecore_event_device_cap_to_class(ECORE_DEVICE_KEYBOARD);
- if (flag)
- _ecore_event_evas_add_evas_device(e, name, identifier, clas);
- else
- _ecore_event_evas_del_evas_device(e, name, identifier, clas);
- }
- if (caps & ECORE_DEVICE_TOUCH)
- {
- clas = _ecore_event_device_cap_to_class(ECORE_DEVICE_TOUCH);
- if (flag)
- _ecore_event_evas_add_evas_device(e, name, identifier, clas);
- else
- _ecore_event_evas_del_evas_device(e, name, identifier, clas);
- }
-}
-
EAPI Eina_Bool
ecore_event_evas_device_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
lookup = _ecore_event_window_match(e->window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
- _ecore_event_add_del_evas_devices(lookup->evas, e->name, e->identifier, e->caps, EINA_TRUE);
+ _ecore_event_evas_add_evas_device(lookup->evas, e->name, e->identifier, e->clas);
return ECORE_CALLBACK_PASS_ON;
}
lookup = _ecore_event_window_match(e->window);
if (!lookup) return ECORE_CALLBACK_PASS_ON;
- _ecore_event_add_del_evas_devices(lookup->evas, e->name, e->identifier, e->caps, EINA_FALSE);
+ _ecore_event_evas_del_evas_device(lookup->evas, e->name, e->identifier, e->clas);
return ECORE_CALLBACK_PASS_ON;
}
static Ecore_Wl_Mouse_Down_Info *_ecore_wl_mouse_down_info_get(int dev);
static void _ecore_wl_input_device_manager_cb_device_add(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, unsigned int serial EINA_UNUSED, const char *identifier, struct tizen_input_device *device, struct wl_seat *seat);
static void _ecore_wl_input_device_manager_cb_device_remove(void *data EINA_UNUSED, struct tizen_input_device_manager *tizen_input_device_manager EINA_UNUSED, unsigned int serial EINA_UNUSED, const char *identifier, struct tizen_input_device *device, struct wl_seat *seat);
+static Ecore_Device *_ecore_wl_input_get_ecore_device(const char *name, Ecore_Device_Class clas);
static void _ecore_wl_input_device_cb_device_info(void *data, struct tizen_input_device *tizen_input_device EINA_UNUSED, const char *name, uint32_t clas, uint32_t subclas, struct wl_array *axes EINA_UNUSED);
static void _ecore_wl_input_device_cb_event_device(void *data, struct tizen_input_device *tizen_input_device EINA_UNUSED, unsigned int serial EINA_UNUSED, const char *name EINA_UNUSED, uint32_t time EINA_UNUSED);
static void _ecore_wl_input_device_cb_axis(void *data EINA_UNUSED, struct tizen_input_device *tizen_input_device EINA_UNUSED, uint32_t axis_type EINA_UNUSED, wl_fixed_t value EINA_UNUSED);
e->timestamp = timestamp;
e->modifiers = input->modifiers;
e->keycode = code;
- e->dev_name = input->last_device_name;
+ e->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_KEYBOARD);
if (state)
ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
ev->multi.y = input->sy;
ev->multi.root.x = input->sx;
ev->multi.root.y = input->sy;
- ev->dev_name = input->last_device_name;
+ ev->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_MOUSE);
if ((down_info = _ecore_wl_mouse_down_info_get(device)))
{
static void
_ecore_wl_input_mouse_in_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp)
{
- Ecore_Wl_Event_Mouse_In *ev;
+ Ecore_Event_Mouse_IO *ev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_In)))) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_IO)))) return;
ev->x = input->sx;
ev->y = input->sy;
- ev->root.x = input->sx;
- ev->root.y = input->sy;
ev->modifiers = input->modifiers;
ev->timestamp = timestamp;
+ ev->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_MOUSE);
if (win)
{
ev->event_window = win->id;
}
- ecore_event_add(ECORE_WL_EVENT_MOUSE_IN, ev, NULL, NULL);
+ ecore_event_add(ECORE_EVENT_MOUSE_IN, ev, NULL, NULL);
}
static void
_ecore_wl_input_mouse_out_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp)
{
- Ecore_Wl_Event_Mouse_Out *ev;
+ Ecore_Event_Mouse_IO *ev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_Out)))) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_IO)))) return;
ev->x = input->sx;
ev->y = input->sy;
- ev->root.x = input->sx;
- ev->root.y = input->sy;
ev->modifiers = input->modifiers;
ev->timestamp = timestamp;
+ ev->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_MOUSE);
if (win)
{
ev->event_window = win->id;
}
- ecore_event_add(ECORE_WL_EVENT_MOUSE_OUT, ev, NULL, NULL);
+ ecore_event_add(ECORE_EVENT_MOUSE_OUT, ev, NULL, NULL);
}
static void
ev->multi.y = input->sy;
ev->multi.root.x = input->sx;
ev->multi.root.y = input->sy;
- ev->dev_name = input->last_device_name;
+ ev->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_MOUSE);
if (win)
{
ev->multi.angle = 0.0;
ev->multi.root.x = input->sx;
ev->multi.root.y = input->sy;
- ev->dev_name = input->last_device_name;
+ ev->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_MOUSE);
+
if (device < ECORE_WL_TOUCH_MAX)
{
input->touch_axis[device].radius_x = 1.0;
ev->y = input->sy;
/* ev->root.x = input->sx; */
/* ev->root.y = input->sy; */
- ev->dev_name = input->last_device_name;
+ ev->dev = _ecore_wl_input_get_ecore_device(input->last_device_name, ECORE_DEVICE_CLASS_MOUSE);
if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
{
free(e);
}
+static Ecore_Device_Class
+_ecore_wl_input_cap_to_ecore_device_class(unsigned int cap)
+{
+ switch(cap)
+ {
+ case ECORE_DEVICE_POINTER:
+ return ECORE_DEVICE_CLASS_MOUSE;
+ case ECORE_DEVICE_KEYBOARD:
+ return ECORE_DEVICE_CLASS_KEYBOARD;
+ case ECORE_DEVICE_TOUCH:
+ return ECORE_DEVICE_CLASS_TOUCH;
+ default:
+ return ECORE_DEVICE_CLASS_NONE;
+ }
+ return ECORE_DEVICE_CLASS_NONE;
+}
+
void
-_ecore_wl_input_device_info_send(int win_id, const char *name, const char *identifier, Ecore_Device_Type type, Eina_Bool flag)
+_ecore_wl_input_device_info_send(int win_id, const char *name, const char *identifier, Ecore_Device_Class clas, Eina_Bool flag)
{
Ecore_Event_Device_Info *e;
e->name = eina_stringshare_add(name);
e->identifier = eina_stringshare_add(identifier);
e->seatname = eina_stringshare_add(name);
- e->caps = type;
+ e->clas = clas;
e->window = win_id;
if (flag)
ecore_event_add(ECORE_EVENT_DEVICE_DEL, e, _ecore_wl_input_device_info_free, NULL);
}
+static Ecore_Device *
+_ecore_wl_input_get_ecore_device(const char *name, Ecore_Device_Class clas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Ecore_Device *dev = NULL;
+ const char *identifier;
+
+ if (!name) return NULL;
+
+ dev_list = ecore_device_list();
+ if (!dev_list) return NULL;
+ EINA_LIST_FOREACH(dev_list, l, dev)
+ {
+ if (!dev) continue;
+ identifier = ecore_device_identifier_get(dev);
+ if (!identifier) continue;
+ if ((ecore_device_class_get(dev) == clas) && (!strcmp(identifier, name)))
+ return dev;
+ }
+ return NULL;
+}
+
+static Eina_Bool
+_ecore_wl_input_add_ecore_device(const char *name, const char *identifier, Ecore_Device_Class clas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Ecore_Device *dev;
+ const char *ecdev_name;
+
+ if (!identifier) return EINA_FALSE;
+
+ dev_list = ecore_device_list();
+ if (dev_list)
+ {
+ EINA_LIST_FOREACH(dev_list, l, dev)
+ {
+ if (!dev) continue;
+ ecdev_name = ecore_device_identifier_get(dev);
+ if (!ecdev_name) continue;
+ if ((ecore_device_class_get(dev) == clas) && (!strcmp(ecdev_name, identifier)))
+ return EINA_FALSE;
+ }
+ }
+
+ if(!(dev = ecore_device_add())) return EINA_FALSE;
+
+ ecore_device_name_set(dev, name);
+ ecore_device_description_set(dev, name);
+ ecore_device_identifier_set(dev, identifier);
+ ecore_device_class_set(dev, clas);
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_ecore_wl_input_del_ecore_device(const char *name, const char *identifier, Ecore_Device_Class clas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Ecore_Device *dev = NULL;
+ const char *ecdev_name;
+
+ if (!identifier) return EINA_FALSE;
+
+ dev_list = ecore_device_list();
+ if (!dev_list) return EINA_FALSE;
+ EINA_LIST_FOREACH(dev_list, l, dev)
+ {
+ if (!dev) continue;
+ ecdev_name = ecore_device_identifier_get(dev);
+ if (!ecdev_name) continue;
+ if ((ecore_device_class_get(dev) == clas) && (!strcmp(ecdev_name, identifier)))
+ {
+ ecore_device_del(dev);
+ return EINA_TRUE;
+ }
+ }
+ return EINA_FALSE;
+}
+
void
-_ecore_wl_input_device_info_broadcast(const char *name, const char *identifier, Ecore_Device_Type type, Eina_Bool flag)
+_ecore_wl_input_device_info_broadcast(const char *name, const char *identifier, Ecore_Device_Class clas, Eina_Bool flag)
{
Eina_Hash *windows = NULL;
Eina_Iterator *itr;
Ecore_Wl_Window *win = NULL;
void *data;
+ Eina_Bool ret = EINA_FALSE;
windows = _ecore_wl_window_hash_get();
if (!windows) return;
while (eina_iterator_next(itr, &data))
{
win = data;
- _ecore_wl_input_device_info_send(win->id, name, identifier, type, flag);
+ if (flag)
+ ret = _ecore_wl_input_add_ecore_device(name, identifier, clas);
+ else
+ ret = _ecore_wl_input_del_ecore_device(name, identifier, clas);
+ if (ret)
+ _ecore_wl_input_device_info_send(win->id, name, identifier, clas, flag);
}
eina_iterator_free(itr);
Ecore_Wl_Input *input = _ecore_wl_disp->input;
Eina_List *l, *ll;
Ecore_Wl_Input_Device *dev;
+ Ecore_Device_Class clas;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!input) return;
EINA_LIST_FOREACH_SAFE(input->devices, l, ll, dev)
{
+ if (!dev->identifier) continue;
if ((!strcmp(dev->identifier, identifier)) && (seat == dev->seat) && (device == dev->tz_device))
{
- _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, dev->clas, EINA_FALSE);
+ clas = _ecore_wl_input_cap_to_ecore_device_class(dev->clas);
+ _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, clas, EINA_FALSE);
if (dev->tz_device) tizen_input_device_destroy(dev->tz_device);
if (dev->name) eina_stringshare_del(dev->name);
_ecore_wl_input_device_cb_device_info(void *data, struct tizen_input_device *tizen_input_device EINA_UNUSED, const char *name, uint32_t clas, uint32_t subclas, struct wl_array *axes EINA_UNUSED)
{
Ecore_Wl_Input_Device *dev;
+ Ecore_Device_Class e_clas;
if (!(dev = data)) return;
dev->clas = clas;
dev->subclas = subclas;
dev->name = eina_stringshare_add(name);
+ e_clas = _ecore_wl_input_cap_to_ecore_device_class(clas);
- if (!dev->identifier) return;
- _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, dev->clas, EINA_TRUE);
+ _ecore_wl_input_device_info_broadcast(dev->name, dev->identifier, e_clas, EINA_TRUE);
}
static void
_ecore_evas_wl_common_cb_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Evas *ee;
- Ecore_Wl_Event_Mouse_In *ev;
+ Ecore_Event_Mouse_IO *ev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (ee->in) return ECORE_CALLBACK_PASS_ON;
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
- ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
- evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
- _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
ee->in = EINA_TRUE;
return ECORE_CALLBACK_PASS_ON;
}
_ecore_evas_wl_common_cb_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Evas *ee;
- Ecore_Wl_Event_Mouse_Out *ev;
+ Ecore_Event_Mouse_IO *ev;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (ee->in)
{
- ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
- _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
- evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
ee->in = EINA_FALSE;
return _ecore_evas_wl_init_count;
_ecore_evas_wl_event_hdls[0] =
- ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
_ecore_evas_wl_common_cb_mouse_in, NULL);
_ecore_evas_wl_event_hdls[1] =
- ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
+ ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
_ecore_evas_wl_common_cb_mouse_out, NULL);
_ecore_evas_wl_event_hdls[2] =
ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,