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 *evdev, int *x, int *y, int *w, int *h);
static void _device_output_assign(E_Input_Evdev *evdev, 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
static void
_device_pointer_motion(E_Input_Evdev *evdev, struct libinput_event_pointer *event)
{
- Ecore_Device *ecore_dev = NULL;
E_Device *e_dev = NULL;
Ecore_Event_Mouse_Move *ev;
E_Input_Backend *input;
uint32_t timestamp = 0;
const char *device_name = evdev->name;
+ E_Input_Event_Info *input_event = NULL;
if (!(input = evdev->seat->input)) return;
if (event)
}
else
{
- ecore_thread_main_loop_begin();
-
- ecore_dev = _main_thread_mode_pointer_device_get(evdev);
- 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 = evdev;
+ 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;
- ecore_thread_main_loop_end();
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
}
Ecore_Event_Mouse_Button *ev;
enum libinput_button_state state;
uint32_t button, timestamp;
- Ecore_Device *ecore_dev = NULL;
E_Device *e_dev = NULL;
E_Comp_Config *comp_conf = NULL;
const char *device_name = NULL;
+ E_Input_Event_Info *input_event = NULL;
EINA_SAFETY_ON_NULL_RETURN(evdev);
}
else
{
- ecore_thread_main_loop_begin();
-
- ecore_dev = _main_thread_mode_pointer_device_get(evdev);
- ev->dev = ecore_device_ref(ecore_dev);
- ecore_event_add(state ? ECORE_EVENT_MOUSE_BUTTON_DOWN : 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 = evdev;
+ 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;
- ecore_thread_main_loop_end();
+ ecore_main_loop_thread_safe_call_async(_pointer_touch_ecore_event_add, input_event);
}
}
E_Comp_Config *comp_conf = NULL;
int direction = 0, z = 0;
const char *device_name = NULL;
+ E_Input_Event_Info *input_event = NULL;
EINA_SAFETY_ON_NULL_RETURN(evdev);
return;
}
- ecore_thread_main_loop_begin();
-
- 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(evdev->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(device_name))
- {
- ecore_dev = detent_data;
- }
- }
- else
- {
- evdev->ecore_dev = e_input_evdev_ecore_device_get(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;
- }
-
comp_conf = e_comp_config_get();
if (comp_conf && comp_conf->e_wheel_click_angle)
{
ELOGF("Mouse", "Wheel (direction: %d, value: %d) is blocked by %p, server: 0x%x", NULL,
direction, z, blocked_client, evdev->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;
ev->window = (Ecore_Window)input->dev->window;
ev->event_window = (Ecore_Window)input->dev->window;
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);
+ if (e_input_thread_mode_get() && e_input_pointer_thread_mode_get())
+ {
+ e_dev = _input_thread_mode_pointer_device_get(evdev);
+ ev->dev = (Eo *)g_object_ref(e_dev);
+ e_input_event_add(input->event_source, ECORE_EVENT_MOUSE_WHEEL, ev, _e_input_event_mouse_wheel_cb_free, NULL);
+ }
+ else
+ {
+ 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;
-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;
+ Ecore_Device *detent_data = NULL;
E_Device *e_dev = NULL;
E_Comp_Config *comp_conf = NULL;
int direction = 0, z = 0;
+ E_Input_Event_Info *input_event = NULL;
EINA_SAFETY_ON_NULL_RETURN(evdev);
}
else
{
- ecore_thread_main_loop_begin();
- ecore_dev = _main_thread_mode_pointer_device_get(evdev);
- ev->dev = ecore_device_ref(ecore_dev);
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _e_input_event_mouse_wheel_cb_free, NULL);
- ecore_thread_main_loop_end();
+ 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;
+
+ 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 = _main_thread_mode_touch_device_get(input_info->evdev);
+ if (input_info->touch)
+ ecore_dev = _main_thread_mode_touch_device_get(input_info->evdev);
+ else
+ ecore_dev = _main_thread_mode_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)
else
{
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);
}
}