typedef struct _E_Input_Event
{
E_Input_Evdev *evdev;
+ Eina_Bool touch_event;
int event_type;
void *ev;
ev_free_func free_func;
static void _device_configured_size_get(E_Input_Evdev *edev, int *x, int *y, int *w, int *h);
static void _device_output_assign(E_Input_Evdev *edev, E_Input_Seat_Capabilities cap);
+static void _pointer_touch_ecore_event_add(void *data);
+
static Eina_Bool _touch_blocked_by_palm, _touch_up_blocked_by_palm;
void
if (tmp) free(tmp);
}
-static void
-_device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event)
+static Ecore_Device *
+_pointer_device_get(E_Input_Evdev *evdev)
{
E_Input_Backend *input;
- Ecore_Event_Mouse_Move *ev;
Ecore_Device *ecore_dev = NULL, *data, *detent_data = NULL;
Eina_List *l;
- int x = 0, y = 0, w = 0, h = 0;
- const char *device_name = edev->name;
-
- if (!(input = edev->seat->input)) return;
+ const char *device_name = NULL;
- ecore_thread_main_loop_begin();
+ if (!(input = evdev->seat->input)) return NULL;
+ device_name = evdev->name;
- if (edev->ecore_dev) ecore_dev = edev->ecore_dev;
- else if (edev->ecore_dev_list && eina_list_count(edev->ecore_dev_list) > 0)
+ if (evdev->ecore_dev) ecore_dev = evdev->ecore_dev;
+ else if (evdev->ecore_dev_list && eina_list_count(evdev->ecore_dev_list) > 0)
{
- EINA_LIST_FOREACH(edev->ecore_dev_list, l, data)
+ EINA_LIST_FOREACH(evdev->ecore_dev_list, l, data)
{
if (ecore_device_class_get(data) == ECORE_DEVICE_CLASS_MOUSE)
{
}
else
{
- edev->ecore_dev = e_input_evdev_get_ecore_device(edev->path, ECORE_DEVICE_CLASS_MOUSE);
- ecore_dev = edev->ecore_dev;
+ evdev->ecore_dev = e_input_evdev_get_ecore_device(evdev->path, ECORE_DEVICE_CLASS_MOUSE);
+ ecore_dev = evdev->ecore_dev;
}
if (!ecore_dev)
{
ERR("Failed to get source ecore device from event !\n");
- goto end;
+ return NULL;
}
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. */
- goto end;
+ return NULL;
}
+ return ecore_dev;
+}
+
+static void
+_device_pointer_motion(E_Input_Evdev *edev, struct libinput_event_pointer *event)
+{
+ E_Input_Backend *input;
+ Ecore_Event_Mouse_Move *ev;
+ int x = 0, y = 0, w = 0, h = 0;
+ const char *device_name = edev->name;
+ E_Input_Event_Info *input_event = NULL;
+
+ if (!(input = edev->seat->input)) return;
+
if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
_device_configured_size_get(edev, &x, &y, &w, &h);
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev = ecore_device_ref(ecore_dev);
-
- ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, _e_input_event_mouse_move_cb_free, NULL);
+ input_event = E_NEW(E_Input_Event_Info, 1);
+ input_event->touch_event = EINA_FALSE;
+ input_event->evdev = edev;
+ input_event->ev = ev;
+ input_event->event_type = ECORE_EVENT_MOUSE_MOVE;
+ input_event->free_func = _e_input_event_mouse_move_cb_free;
+ input_event->free_func_data = NULL;
-end:
- ecore_thread_main_loop_end();
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
void
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;
E_Comp_Config *comp_conf = NULL;
const char *device_name = NULL;
+ E_Input_Event_Info *input_event = NULL;
if (!(edev = libinput_device_get_user_data(device)))
{
return;
}
- ecore_thread_main_loop_begin();
-
- 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 (!ecore_dev)
- {
- ERR("Failed to get source ecore device from event !\n");
- goto end;
- }
-
state = libinput_event_pointer_get_button_state(event);
button = libinput_event_pointer_get_button(event);
timestamp = libinput_event_pointer_get_time(event);
ELOGF("Mouse", "Button Press (btn: %d, device: %s) is blocked by %p, server: 0x%x", NULL,
button, device_name, blocked_client,
edev->seat->dev->server_blocked);
- goto end;
+ return;
}
else
{
if (!(edev->mouse.pressed_button & (1 << button)))
{
ELOGF("Mouse", "Button Release (btn: %d, device: %s) is blocked by %p, server: 0x%x", NULL,
- button, ecore_device_name_get(ecore_dev), blocked_client,
+ button, device_name, blocked_client,
edev->seat->dev->server_blocked);
- goto end;
+ return;
}
edev->mouse.pressed_button &= ~(1 << button);
}
- if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button))))
- {
- goto end;
- }
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return;
ev->window = (Ecore_Window)input->dev->window;
ev->event_window = (Ecore_Window)input->dev->window;
ev->multi.y = ev->y;
ev->multi.root.x = ev->x;
ev->multi.root.y = ev->y;
- ev->dev = ecore_device_ref(ecore_dev);
if (state)
{
if (comp_conf && comp_conf->input_log_enable)
ELOGF("Mouse", "Button %s (btn: %d, device: %s)", NULL, state?"Press":"Release", button, ecore_device_name_get(ev->dev));
- if (state)
- ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, _e_input_event_mouse_button_cb_free, NULL);
- else
- ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, _e_input_event_mouse_button_cb_free, NULL);
+ input_event = E_NEW(E_Input_Event_Info, 1);
+ input_event->touch_event = EINA_FALSE;
+ input_event->evdev = edev;
+ input_event->ev = ev;
+ input_event->event_type = state? ECORE_EVENT_MOUSE_BUTTON_DOWN : ECORE_EVENT_MOUSE_BUTTON_UP;
+ input_event->free_func = _e_input_event_mouse_button_cb_free;
+ input_event->free_func_data = NULL;
-end:
- ecore_thread_main_loop_end();
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
#if !LIBINPUT_HAVE_SCROLL_VALUE_V120
device_name = edev->name;
- ecore_thread_main_loop_begin();
-
- 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 (!ecore_dev)
- {
- ERR("Failed to get source ecore device from event !\n");
- goto end;
- }
-
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
if (libinput_event_pointer_has_axis(event, axis))
z = _axis_value_get(event, axis);
if (z == 0)
{
ELOGF("Mouse", "Axis event is ignored since it has zero value", NULL);
- goto end;
+ return;
}
comp_conf = e_comp_config_get();
ELOGF("Mouse", "Wheel (direction: %d, value: %d) is blocked by %p, server: 0x%x", NULL,
direction, z, blocked_client, edev->seat->dev->server_blocked);
- goto end;
+ return;
}
- if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel))))
- {
- goto end;
- }
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
timestamp = libinput_event_pointer_get_time(event);
ELOGF("Mouse", "Wheel (direction: %d, value: %d)", NULL, ev->direction, ev->z);
}
+ input_event = E_NEW(E_Input_Event_Info, 1);
+ input_event->touch_event = EINA_FALSE;
+ input_event->evdev = evdev;
+ input_event->ev = ev;
+ input_event->event_type = ECORE_EVENT_MOUSE_WHEEL;
+ input_event->free_func = _e_input_event_mouse_wheel_cb_free;
+ input_event->free_func_data = NULL;
- ev->dev = ecore_device_ref(ecore_dev);
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _e_input_event_mouse_wheel_cb_free, NULL);
-
-end:
- ecore_thread_main_loop_end();
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
#endif
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;
+ Ecore_Device *detent_data = NULL;
E_Comp_Config *comp_conf = NULL;
int direction = 0, z = 0;
+ E_Input_Event_Info *input_event = NULL;
if (!(edev = libinput_device_get_user_data(device)))
{
return;
}
- ecore_thread_main_loop_begin();
-
- 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 (!ecore_dev)
- {
- ERR("Failed to get source ecore device from event !\n");
- goto end;
- }
-
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
if (libinput_event_pointer_has_axis(event, axis))
z = _scroll_value_get(event, axis, source);
if (z == 0)
{
ELOGF("Mouse", "Scroll event is ignored since it has zero value", NULL);
- goto end;
+ return;
}
comp_conf = e_comp_config_get();
ELOGF("Mouse", "Wheel (direction: %d, value: %d) is blocked by %p, server: 0x%x", NULL,
direction, z, blocked_client, edev->seat->dev->server_blocked);
- goto end;
+ return;
}
- if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel))))
- {
- goto end;
- }
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
timestamp = libinput_event_pointer_get_time(event);
ELOGF("Mouse", "Wheel (direction: %d, value: %d)", NULL, ev->direction, ev->z);
}
- ev->dev = ecore_device_ref(ecore_dev);
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _e_input_event_mouse_wheel_cb_free, NULL);
+ input_event = E_NEW(E_Input_Event_Info, 1);
+ input_event->touch_event = EINA_FALSE;
+ input_event->evdev = edev;
+ input_event->ev = ev;
+ input_event->event_type = ECORE_EVENT_MOUSE_WHEEL;
+ input_event->free_func = _e_input_event_mouse_wheel_cb_free;
+ input_event->free_func_data = NULL;
-end:
- ecore_thread_main_loop_end();
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
#endif
}
static void
-_touch_ecore_event_add(void *data)
+_pointer_touch_ecore_event_add(void *data)
{
E_Input_Event_Info *input_info = data;
Ecore_Device *ecore_dev = NULL;
- ecore_dev = _touch_device_get(input_info->evdev);
+ if (input_info->touch_event)
+ ecore_dev = _touch_device_get(input_info->evdev);
+ else
+ ecore_dev = _pointer_device_get(input_info->evdev);
if (input_info->event_type == ECORE_EVENT_MOUSE_MOVE)
{
Ecore_Event_Mouse_Move *ev = input_info->ev;
ev->dev = ecore_device_ref(ecore_dev);
}
+ else if (input_info->event_type == ECORE_EVENT_MOUSE_WHEEL)
+ {
+ Ecore_Event_Mouse_Wheel *ev = input_info->ev;
+ ev->dev = ecore_device_ref(ecore_dev);
+ }
else if (input_info->event_type == ECORE_EVENT_MOUSE_BUTTON_DOWN ||
input_info->event_type == ECORE_EVENT_MOUSE_BUTTON_UP ||
input_info->event_type == ECORE_EVENT_MOUSE_BUTTON_CANCEL)
return;
input_event = E_NEW(E_Input_Event_Info, 1);
+ input_event->touch_event = EINA_TRUE;
input_event->evdev = evdev;
input_event->event_type = event_type;
input_event->ev = ev;
input_event->free_func = free_func;
input_event->free_func_data = free_func_data;
- ecore_main_loop_thread_safe_call_async(_touch_ecore_event_add, input_event);
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
static void