#include "e_devicemgr_private.h"
+Eina_Bool
+e_devicemgr_strcmp(const char *dst, const char *src)
+{
+ int dst_len, src_len, str_len;
+
+ dst_len = strlen(dst);
+ src_len = strlen(src);
+
+ if (src_len > dst_len) str_len = src_len;
+ else str_len = dst_len;
+
+ if (!strncmp(dst, src, str_len))
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
+}
+
static int
_e_devicemgr_input_pointer_warp(int x, int y)
{
E_FREE(dev);
}
+static void
+_e_devicemgr_input_device_update(Ecore_Device *dev)
+{
+ Eina_List *l;
+ E_Devicemgr_Input_Device *data;
+ char *dev_identifier;
+
+ EINA_SAFETY_ON_NULL_RETURN(dev);
+
+ dev_identifier = (char *)ecore_device_identifier_get(dev);
+ EINA_SAFETY_ON_NULL_RETURN(dev_identifier);
+
+ EINA_LIST_FOREACH(e_devicemgr->device_list, l, data)
+ {
+ if (data->clas == ecore_device_class_get(dev) && data->identifier)
+ {
+ if (e_devicemgr_strcmp(dev_identifier, data->identifier))
+ {
+ data->subclas = ecore_device_subclass_get(dev);
+
+ e_devicemgr_wl_device_update(data);
+ return;
+ }
+ }
+ }
+}
+
static Eina_Bool
_e_devicemgr_input_cb_mouse_button_down(void *data, int type, void *event)
{
return ECORE_CALLBACK_PASS_ON;
}
+static Eina_Bool
+_e_devicemgr_input_cb_device_update(void *data, int type, void *event)
+{
+ Ecore_Event_Device_Update *ev;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(event, ECORE_CALLBACK_PASS_ON);
+
+ ev = (Ecore_Event_Device_Update *)event;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ev->dev, ECORE_CALLBACK_PASS_ON);
+
+ _e_devicemgr_input_device_update(ev->dev);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
static Eina_Bool
_e_devicemgr_input_process_mouse_button_down(Ecore_Event_Mouse_Button *ev)
{
E_LIST_HANDLER_APPEND(e_devicemgr->handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_devicemgr_input_cb_mouse_button_up, NULL);
E_LIST_HANDLER_APPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_ADD, _e_devicemgr_input_cb_device_add, NULL);
E_LIST_HANDLER_APPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_DEL, _e_devicemgr_input_cb_device_del, NULL);
+ E_LIST_HANDLER_APPEND(e_devicemgr->handlers, ECORE_EVENT_DEVICE_SUBCLASS_UPDATE, _e_devicemgr_input_cb_device_update, NULL);
_e_devicemgr_device_query();
void e_devicemgr_wl_shutdown(void);
void e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev);
void e_devicemgr_wl_device_del(E_Devicemgr_Input_Device *dev);
+void e_devicemgr_wl_device_update(E_Devicemgr_Input_Device *dev);
Eina_Bool e_devicemgr_block_check_keyboard(Ecore_Event_Key *ev, Eina_Bool pressed);
Eina_Bool e_devicemgr_block_check_move(Ecore_Event_Mouse_Move *ev);
int e_devicemgr_create_virtual_device(Ecore_Device_Class clas, const char *name);
void e_devicemgr_destroy_virtual_device(int uinp_fd);
+Eina_Bool e_devicemgr_strcmp(const char *dst, const char *src);
int e_devicemgr_keycode_from_string(const char *keyname);
int e_devicemgr_input_pointer_warp(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface, wl_fixed_t x, wl_fixed_t y);
void e_devicemgr_wl_detent_send_event(int detent);
dev->resources = eina_list_remove(dev->resources, resource);
}
+void
+e_devicemgr_wl_device_update(E_Devicemgr_Input_Device *dev)
+{
+ struct wl_array axes;
+ Eina_List *l;
+ struct wl_resource *res;
+
+ wl_array_init(&axes);
+
+ EINA_LIST_FOREACH(dev->resources, l, res)
+ {
+ tizen_input_device_send_device_info(res, dev->name, dev->clas, dev->subclas, &axes);
+ }
+}
+
void
e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev)
{