static Eina_Bool
_e_comp_screen_cb_input_device_add(void *data, int type, void *event)
{
- E_Input_Event_Input_Device_Add *e;
+ Ecore_Event_Device_Info *e;
E_Comp *comp = data;
if (!(e = event)) goto end;
- if (e->caps & E_INPUT_SEAT_POINTER)
+ if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
{
if (comp->wl_comp_data->ptr.num_devices == 0)
{
}
comp->wl_comp_data->ptr.num_devices++;
}
- if (e->caps & E_INPUT_SEAT_KEYBOARD)
+ else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
{
comp->wl_comp_data->kbd.num_devices++;
e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
}
- if (e->caps & E_INPUT_SEAT_TOUCH)
+ else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
{
e_comp_wl_input_touch_enabled_set(EINA_TRUE);
comp->wl_comp_data->touch.num_devices++;
}
static void
-_e_comp_screen_pointer_renew(E_Input_Event_Input_Device_Del *ev)
+_e_comp_screen_pointer_renew(void)
{
if ((e_comp_wl->ptr.num_devices == 0) && e_comp_wl->ptr.ec && e_comp_wl->ptr.ec->pointer_enter_sent)
{
static Eina_Bool
_e_comp_screen_cb_input_device_del(void *data, int type, void *event)
{
- E_Input_Event_Input_Device_Del *e;
+ Ecore_Event_Device_Info *e;
E_Comp *comp = data;
if (!(e = event)) goto end;
- if (e->caps & E_INPUT_SEAT_POINTER)
+ if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
{
comp->wl_comp_data->ptr.num_devices--;
if (comp->wl_comp_data->ptr.num_devices == 0)
e_pointer_object_set(comp->pointer, NULL, 0, 0);
e_pointer_hide(e_comp->pointer);
- _e_comp_screen_pointer_renew(e);
+ _e_comp_screen_pointer_renew();
}
}
- if (e->caps & E_INPUT_SEAT_KEYBOARD)
+ else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
{
comp->wl_comp_data->kbd.num_devices--;
if (comp->wl_comp_data->kbd.num_devices == 0)
e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
}
}
- if (e->caps & E_INPUT_SEAT_TOUCH)
+ else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
{
comp->wl_comp_data->touch.num_devices--;
if (comp->wl_comp_data->touch.num_devices == 0)
tzsr_client_hook_del = e_client_hook_add(E_CLIENT_HOOK_DEL, _tz_screen_rotation_cb_client_del, NULL);
- E_LIST_HANDLER_APPEND(event_handlers, E_INPUT_EVENT_INPUT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
- E_LIST_HANDLER_APPEND(event_handlers, E_INPUT_EVENT_INPUT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
+ E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
+ E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
if (e_comp->e_comp_screen->rotation > 0)
{
E_API int e_devicemgr_init(void);
E_API int e_devicemgr_shutdown(void);
+Eina_Bool e_devicemgr_detent_is_detent(const char *name);
+
+
#endif
#endif
return keycode;
}
-static Eina_Bool
-_e_devicemgr_detent_is_detent(const char *name)
+Eina_Bool
+e_devicemgr_detent_is_detent(const char *name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
{
Eina_Bool res = ECORE_CALLBACK_PASS_ON;
- if (ev->dev && _e_devicemgr_detent_is_detent(ecore_device_name_get(ev->dev)))
- return res;
-
res = e_devicemgr_block_check_move(ev);
return res;
if (!ev->dev) return ECORE_CALLBACK_PASS_ON;
- if (!_e_devicemgr_detent_is_detent(ecore_device_name_get(ev->dev)))
+ if (!e_devicemgr_detent_is_detent(ecore_device_name_get(ev->dev)))
return ECORE_CALLBACK_PASS_ON;
detent = (int)(ev->z / (e_devicemgr->detent.wheel_click_angle
if (!event) return res;
- if ((ECORE_EVENT_DEVICE_ADD == type) ||
- (ECORE_EVENT_DEVICE_DEL == type))
- {
- Ecore_Event_Device_Info *ev;
- ev = (Ecore_Event_Device_Info *)event;
-
- /* Remove mouse class from tizen detent device */
- if (_e_devicemgr_detent_is_detent(ev->name))
- ev->clas &= ~ECORE_DEVICE_CLASS_MOUSE;
- }
- else if (E_INPUT_EVENT_INPUT_DEVICE_ADD == type)
- {
- E_Input_Event_Input_Device_Add *ev;
- ev = (E_Input_Event_Input_Device_Add *)event;
-
- /* Remove pointer capability from tizen detent device */
- if (_e_devicemgr_detent_is_detent(ev->name))
- ev->caps &= ~E_INPUT_SEAT_POINTER;
- }
- else if (E_INPUT_EVENT_INPUT_DEVICE_DEL == type)
- {
- E_Input_Event_Input_Device_Del *ev;
- ev = (E_Input_Event_Input_Device_Del *)event;
-
- /* Remove pointer capability from tizen detent device */
- if (_e_devicemgr_detent_is_detent(ev->name))
- ev->caps &= ~E_INPUT_SEAT_POINTER;
- }
- else if (ECORE_EVENT_KEY_DOWN == type)
+ if (ECORE_EVENT_KEY_DOWN == type)
{
Ecore_Event_Key *ev;
ev = (Ecore_Event_Key *)event;
int _e_input_init_count;
int _e_input_log_dom = -1;
-E_API int E_INPUT_EVENT_INPUT_DEVICE_ADD = -1;
-E_API int E_INPUT_EVENT_INPUT_DEVICE_DEL = -1;
E_API int E_INPUT_EVENT_SEAT_ADD = -1;
E_API int E_EVENT_INPUT_ENABLED = -1;
E_API int E_EVENT_INPUT_DISABLED = -1;
goto log_err;
}
- E_INPUT_EVENT_INPUT_DEVICE_ADD = ecore_event_type_new();
- E_INPUT_EVENT_INPUT_DEVICE_DEL = ecore_event_type_new();
E_INPUT_EVENT_SEAT_ADD = ecore_event_type_new();
E_EVENT_INPUT_ENABLED = ecore_event_type_new();
E_EVENT_INPUT_DISABLED = ecore_event_type_new();
ecore_event_add(E_EVENT_INPUT_DISABLED, NULL, NULL, NULL);
- E_INPUT_EVENT_INPUT_DEVICE_ADD = -1;
- E_INPUT_EVENT_INPUT_DEVICE_DEL = -1;
E_INPUT_EVENT_SEAT_ADD = -1;
E_EVENT_INPUT_ENABLED = -1;
E_EVENT_INPUT_DISABLED = -1;
typedef struct _E_Input E_Input;
-E_API extern int E_INPUT_EVENT_INPUT_DEVICE_ADD;
-E_API extern int E_INPUT_EVENT_INPUT_DEVICE_DEL;
E_API extern int E_INPUT_EVENT_SEAT_ADD;
E_API extern int E_EVENT_INPUT_ENABLED;
E_API extern int E_EVENT_INPUT_DISABLED;
E_INPUT_LIBINPUT_BACKEND_PATH
} E_Input_Libinput_Backend;
-struct _E_Input_Event_Input_Device_Add
-{
- const char *name; /* descriptive device name */
- const char *sysname; /* system name of the input device */
- const char *seatname; /* logical name of the seat */
- const char *identifier; /* unique identifier (e.g. path) */
-
- E_Input_Seat_Capabilities caps; /* capabilities on a device */
- Ecore_Device_Class clas; /* class of a device */
- Ecore_Device_Subclass subclas; /* subclass of a device */
-};
-
-struct _E_Input_Event_Input_Device_Del
-{
- const char *name; /* descriptive device name */
- const char *sysname; /* system name of the input device */
- const char *seatname; /* logical name of the seat */
- const char *identifier; /* unique identifier (e.g. path) */
-
- E_Input_Seat_Capabilities caps; /* capabilities on a device */
- Ecore_Device_Class clas; /* class of a device */
- Ecore_Device_Subclass subclas; /* subclass of a device */
-};
-
typedef struct _E_Input_Device E_Input_Device;
typedef struct _E_Input_Backend E_Input_Backend;
typedef struct _E_Input_Evdev E_Input_Evdev;
typedef struct _E_Input_Seat E_Input_Seat;
-typedef struct _E_Input_Event_Input_Device_Add E_Input_Event_Input_Device_Add;
-typedef struct _E_Input_Event_Input_Device_Del E_Input_Event_Input_Device_Del;
-
struct _E_Input
{
Ecore_Window window;
Ecore_Event_Key *e;
char *tmp = NULL, *compose = NULL;
E_Keyrouter_Event_Data *key_data;
+ Ecore_Device *ecore_dev = NULL, *data;
+ Eina_List *l;
if (!(edev = libinput_device_get_user_data(device)))
{
return;
}
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_KEYBOARD))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_KEYBOARD);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_KEYBOARD)
+ {
+ ecore_dev = data;
+ break;
+ }
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_KEYBOARD);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
return;
_device_modifiers_update(edev);
e->modifiers = edev->xkb.modifiers;
- e->dev = ecore_device_ref(edev->ecore_dev);
+ e->dev = ecore_device_ref(ecore_dev);
if (state)
ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _e_input_event_key_cb_free, NULL);
{
E_Input_Backend *input;
Ecore_Event_Mouse_Move *ev;
+ Ecore_Device *ecore_dev = NULL, *data, *detent_data = NULL;
+ Eina_List *l;
if (!(input = edev->seat->input)) return;
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_MOUSE))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_MOUSE)
+ {
+ ecore_dev = data;
+ break;
+ }
+ else if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_NONE)
+ {
+ detent_data = data;
+ }
+ }
+ if (!ecore_dev && e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+ {
+ ecore_dev = detent_data;
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
return;
}
+ else if ((detent_data == ecore_dev) || e_devicemgr_detent_is_detent(ecore_device_name_get(ecore_dev)))
+ {
+ /* Do not process detent device's move events. */
+ return;
+ }
if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev = ecore_device_ref(edev->ecore_dev);
+ ev->dev = ecore_device_ref(ecore_dev);
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL);
}
Ecore_Event_Mouse_Button *ev;
enum libinput_button_state state;
uint32_t button, timestamp;
+ Ecore_Device *ecore_dev = NULL, *detent_data = NULL, *data;
+ Eina_List *l;
if (!(edev = libinput_device_get_user_data(device)))
{
return;
}
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_MOUSE))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_MOUSE)
+ {
+ ecore_dev = data;
+ break;
+ }
+ else if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_NONE)
+ {
+ detent_data = data;
+ }
+ }
+ if (!ecore_dev && e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+ {
+ ecore_dev = detent_data;
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
return;
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev = ecore_device_ref(edev->ecore_dev);
+ ev->dev = ecore_device_ref(ecore_dev);
if (state)
{
Ecore_Event_Mouse_Wheel *ev;
uint32_t timestamp;
enum libinput_pointer_axis axis;
+ Ecore_Device *ecore_dev = NULL, *detent_data = NULL, *data;
+ Eina_List *l;
if (!(edev = libinput_device_get_user_data(device)))
{
return;
}
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_MOUSE))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_MOUSE)
+ {
+ ecore_dev = data;
+ break;
+ }
+ else if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_NONE)
+ {
+ detent_data = data;
+ }
+ }
+ if (!ecore_dev && e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+ {
+ ecore_dev = detent_data;
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
return;
ev->y = edev->seat->ptr.iy;
ev->root.x = ev->x;
ev->root.y = ev->y;
- ev->dev = ecore_device_ref(edev->ecore_dev);
+ ev->dev = ecore_device_ref(ecore_dev);
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
if (libinput_event_pointer_has_axis(event, axis))
E_Input_Backend *input;
Ecore_Event_Mouse_Button *ev;
uint32_t timestamp, button = 0;
+ Ecore_Device *ecore_dev = NULL, *data;
+ Eina_List *l;
if (!edev) return;
if (!(input = edev->seat->input)) return;
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_TOUCH))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_TOUCH)
+ {
+ ecore_dev = data;
+ break;
+ }
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
return;
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev = ecore_device_ref(edev->ecore_dev);
+ ev->dev = ecore_device_ref(ecore_dev);
if (state == ECORE_EVENT_MOUSE_BUTTON_DOWN)
{
{
E_Input_Backend *input;
Ecore_Event_Mouse_Move *ev;
+ Ecore_Device *ecore_dev = NULL, *data;
+ Eina_List *l;
if (!edev) return;
if (!(input = edev->seat->input)) return;
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_TOUCH))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_TOUCH)
+ {
+ ecore_dev = data;
+ break;
+ }
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
return;
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev = ecore_device_ref(edev->ecore_dev);
+ ev->dev = ecore_device_ref(ecore_dev);
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL);
}
E_Input_Backend *input;
Ecore_Event_Axis_Update *ev;
Ecore_Axis *axis;
+ Ecore_Device *ecore_dev = NULL, *data;
+ Eina_List *l;
if (libinput_event_touch_aux_data_get_type(event) != LIBINPUT_TOUCH_AUX_DATA_TYPE_PALM &&
libinput_event_touch_aux_data_get_value(event) > 0)
if (!(edev = libinput_device_get_user_data(device))) goto end;
if (!(input = edev->seat->input)) goto end;
- if (!edev->ecore_dev || (ecore_device_class_get(edev->ecore_dev) != ECORE_DEVICE_CLASS_TOUCH))
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
+ if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
+ else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ {
+ if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_TOUCH)
+ {
+ ecore_dev = data;
+ break;
+ }
+ }
+ }
+ else
+ {
+ edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_TOUCH);
+ ecore_dev = edev->ecore_dev;
+ }
- if (!edev->ecore_dev)
+ if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
goto end;
ev->naxis = 1;
}
ev->axis = axis;
- ev->dev = ecore_device_ref(edev->ecore_dev);
+ ev->dev = ecore_device_ref(ecore_dev);
ecore_event_add(ECORE_EVENT_AXIS_UPDATE, ev, _e_input_aux_data_event_free, NULL);
void
_e_input_evdev_device_destroy(E_Input_Evdev *edev)
{
+ Ecore_Device *dev;
+
EINA_SAFETY_ON_NULL_RETURN(edev);
if (edev->caps & E_INPUT_SEAT_KEYBOARD)
}
if (edev->ecore_dev) ecore_device_del(edev->ecore_dev);
+ if (edev->ecore_dev_list)
+ EINA_LIST_FREE(edev->ecore_dev_list, dev)
+ {
+ ecore_device_del(dev);
+ }
if (edev->path) eina_stringshare_del(edev->path);
if (edev->device) libinput_device_unref(edev->device);
if (edev->key_remap_hash) eina_hash_free(edev->key_remap_hash);
#include "e.h"
#include "e_input_private.h"
+static char *
+_e_input_ecore_device_class_to_string(Ecore_Device_Class clas)
+{
+ switch (clas)
+ {
+ case ECORE_DEVICE_CLASS_NONE:
+ return "None";
+ break;
+ case ECORE_DEVICE_CLASS_SEAT:
+ return "Seat";
+ break;
+ case ECORE_DEVICE_CLASS_KEYBOARD:
+ return "Keyboard";
+ break;
+ case ECORE_DEVICE_CLASS_MOUSE:
+ return "Mouse";
+ break;
+ case ECORE_DEVICE_CLASS_TOUCH:
+ return "Touch";
+ break;
+ case ECORE_DEVICE_CLASS_PEN:
+ return "Pen";
+ break;
+ case ECORE_DEVICE_CLASS_WAND:
+ return "Wand";
+ break;
+ case ECORE_DEVICE_CLASS_GAMEPAD:
+ return "Gamepad";
+ break;
+ default:
+ return "Unknown";
+ }
+}
+
static Ecore_Device_Class
_e_input_seat_cap_to_ecore_device_class(unsigned int cap)
{
return s;
}
-static void
-_e_input_event_input_device_add_free(void *data EINA_UNUSED, void *ev)
-{
- E_Input_Event_Input_Device_Add *e;
-
- e = ev;
- eina_stringshare_del(e->name);
- eina_stringshare_del(e->sysname);
- eina_stringshare_del(e->seatname);
- eina_stringshare_del(e->identifier);
-
- free(e);
-}
-
-static void
-_e_input_event_input_device_del_free(void *data EINA_UNUSED, void *ev)
-{
- E_Input_Event_Input_Device_Del *e;
-
- e = ev;
- eina_stringshare_del(e->name);
- eina_stringshare_del(e->sysname);
- eina_stringshare_del(e->seatname);
- eina_stringshare_del(e->identifier);
-
- free(e);
-}
-
static E_Input_Seat *
_seat_get(E_Input_Backend *input, const char *seat)
{
return _seat_create(input, seat);
}
-
static Eina_Bool
_e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas)
{
ecore_device_class_set(dev, clas);
ecore_device_subclass_set(dev, ECORE_DEVICE_SUBCLASS_NONE);
- edev->ecore_dev = ecore_device_ref(dev);
+ if (!edev->ecore_dev)
+ {
+ if (!edev->ecore_dev_list || (eina_list_count(edev->ecore_dev_list) == 0))
+ {
+ /* 1st Ecore_Device is added */
+ edev->ecore_dev = ecore_device_ref(dev);
+ }
+ else
+ {
+ /* 3rd or more Ecore_Device is added */
+ edev->ecore_dev_list = eina_list_append(edev->ecore_dev_list, ecore_device_ref(dev));
+ }
+ }
+ else
+ {
+ /* 2nd Ecore_Device is added */
+ edev->ecore_dev_list = eina_list_append(edev->ecore_dev_list, edev->ecore_dev);
+ edev->ecore_dev = NULL;
+
+ edev->ecore_dev_list = eina_list_append(edev->ecore_dev_list, ecore_device_ref(dev));
+ }
_e_input_ecore_device_event(dev, EINA_TRUE);
static Eina_Bool
_e_input_remove_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas)
{
- const Eina_List *dev_list = NULL;
- const Eina_List *l;
- Ecore_Device *dev = NULL;
+ const Eina_List *dev_list = NULL, *l;
+ Eina_List *ll, *ll_next;
+ Ecore_Device *dev = NULL, *data;
const char *identifier;
if (!edev->path) return EINA_FALSE;
if (!identifier) continue;
if ((ecore_device_class_get(dev) == clas) && (!strcmp(identifier, edev->path)))
{
+ if (edev->ecore_dev) edev->ecore_dev = NULL;
+ else if (edev->ecore_dev_list)
+ {
+ EINA_LIST_FOREACH_SAFE(edev->ecore_dev_list, ll, ll_next, data)
+ {
+ if (data == dev)
+ {
+ edev->ecore_dev_list = eina_list_remove_list(edev->ecore_dev_list, ll);
+ }
+ }
+ }
ecore_device_del(dev);
- edev->ecore_dev = NULL;
_e_input_ecore_device_event(dev, EINA_FALSE);
return EINA_TRUE;
}
_e_input_device_add(E_Input_Evdev *edev)
{
Eina_Bool ret = EINA_FALSE;
- Ecore_Device_Class clas;
+ Ecore_Device_Class clas = ECORE_DEVICE_CLASS_NONE;
if (edev->caps & E_INPUT_SEAT_POINTER)
{
- clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
+ if (!e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+ clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
ret = _e_input_add_ecore_device(edev, clas);
}
if (edev->caps & E_INPUT_SEAT_KEYBOARD)
void
_e_input_device_remove(E_Input_Evdev *edev)
{
- Ecore_Device_Class clas;
+ Ecore_Device_Class clas = ECORE_DEVICE_CLASS_NONE;
+ Ecore_Device *data;
if (edev->caps & E_INPUT_SEAT_POINTER)
{
- clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
+ if (!e_devicemgr_detent_is_detent(libinput_device_get_name(edev->device)))
+ clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_POINTER);
_e_input_remove_ecore_device(edev, clas);
}
if (edev->caps & E_INPUT_SEAT_KEYBOARD)
clas = _e_input_seat_cap_to_ecore_device_class(E_INPUT_SEAT_TOUCH);
_e_input_remove_ecore_device(edev, clas);
}
+
+ if (edev->ecore_dev_list)
+ {
+ if (eina_list_count(edev->ecore_dev_list) > 0)
+ {
+ EINA_LIST_FREE(edev->ecore_dev_list, data)
+ {
+ WRN("Invalid device is left. name: %s, identifier: %s, clas: %s\n",
+ ecore_device_name_get(data), ecore_device_description_get(data),
+ _e_input_ecore_device_class_to_string(ecore_device_class_get(data)));
+ ecore_device_del(data);
+ }
+ }
+ edev->ecore_dev_list = NULL;
+ }
}
static void
const char *seat_name;
E_Input_Seat *seat;
E_Input_Evdev *edev;
- E_Input_Event_Input_Device_Add *ev;
libinput_seat = libinput_device_get_seat(device);
seat_name = libinput_seat_get_logical_name(libinput_seat);
/* append this device to the seat */
seat->devices = eina_list_append(seat->devices, edev);
- ev = calloc(1, sizeof(E_Input_Event_Input_Device_Add));
- if (!ev)
- {
- return;
- }
-
if (EINA_FALSE == _e_input_device_add(edev))
{
ERR("Failed to create evas device !\n");
- free(ev);
return;
}
-
- ev->name = eina_stringshare_add(libinput_device_get_name(device));
- ev->sysname = eina_stringshare_add(edev->path);
- ev->seatname = eina_stringshare_add(edev->seat->name);
- ev->caps = edev->caps;
- ev->clas = ecore_device_class_get(edev->ecore_dev);
- ev->identifier = eina_stringshare_add(edev->path);
- ev->subclas = ecore_device_subclass_get(edev->ecore_dev);
-
- ecore_event_add(E_INPUT_EVENT_INPUT_DEVICE_ADD,
- ev,
- _e_input_event_input_device_add_free,
- NULL);
}
static void
_device_removed(E_Input_Backend *input, struct libinput_device *device)
{
E_Input_Evdev *edev;
- E_Input_Event_Input_Device_Del *ev;
/* try to get the evdev structure */
if (!(edev = libinput_device_get_user_data(device)))
return;
}
- ev = calloc(1, sizeof(E_Input_Event_Input_Device_Del));
- if (!ev)
- {
- return;
- }
-
- ev->name = eina_stringshare_add(libinput_device_get_name(device));
- ev->sysname = eina_stringshare_add(edev->path);
- ev->seatname = eina_stringshare_add(edev->seat->name);
- ev->caps = edev->caps;
- ev->clas = ecore_device_class_get(edev->ecore_dev);
- ev->identifier = eina_stringshare_add(edev->path);
- ev->subclas = ecore_device_subclass_get(edev->ecore_dev);
-
- ecore_event_add(E_INPUT_EVENT_INPUT_DEVICE_DEL,
- ev,
- _e_input_event_input_device_del_free,
- NULL);
-
_e_input_device_remove(edev);
/* remove this evdev from the seat's list of devices */
const char *path;
int fd;
Ecore_Device *ecore_dev;
+ Eina_List *ecore_dev_list;
int mt_slot;