{
Ecore_Event_Mouse_Wheel *ev = event;
- if (ev->dev) ecore_device_unref(ev->dev);
+ if (ev->dev)
+ {
+ if (e_input_thread_mode_get() && e_input_pointer_thread_mode_get())
+ g_object_unref(ev->dev);
+ else
+ ecore_device_unref(ev->dev);
+ }
free(ev);
}
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 *ecore_dev = NULL, *detent_data = NULL;
+ E_Device *e_dev = NULL;
E_Comp_Config *comp_conf = NULL;
int direction = 0, z = 0;
- const char *device_name = NULL;
EINA_SAFETY_ON_NULL_RETURN(evdev);
return;
}
- device_name = evdev->name;
timestamp = libinput_event_pointer_get_time(event);
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
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;
+ return;
}
ev->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);
-
-end:
- ecore_thread_main_loop_end();
+ if (e_input_thread_mode_get() && e_input_pointer_thread_mode_get())
+ {
+ e_dev = _device_pointer_send_motion_thread_mode(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
+ {
+ ecore_thread_main_loop_begin();
+ ecore_dev = _device_pointer_send_motion(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();
+ }
}
#endif
need_send_released = EINA_FALSE;
}
-static void
-_e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, int timestamp)
+EINTERN void
+e_comp_wl_surface_mouse_wheel_send(struct wl_resource *surface, int direction, int z, int timestamp)
{
struct wl_resource *res;
struct wl_client *wc;
Eina_List *l;
+
+ if (!surface) return;
+
uint32_t axis, dir;
if (direction == 0)
else
dir = wl_fixed_from_int(z);
- if (!ec) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
- struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
- if (!surface) return;
-
wc = wl_resource_get_client(surface);
EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res)
{
if (!e_comp_wl_input_pointer_check(res)) continue;
if (wl_resource_get_client(res) != wc) continue;
+ ELOGF("Mouse", "Send wheel event (timestamp: %d, axis: %d, dir: %d)", NULL, timestamp, axis, dir);
wl_pointer_send_axis(res, timestamp, axis, dir);
}
}
+static void
+_e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, int timestamp)
+{
+ if (!ec) return;
+ if (e_object_is_del(E_OBJECT(ec))) return;
+ struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
+ e_comp_wl_surface_mouse_wheel_send(surface, direction, z, timestamp);
+}
+
static void
_e_comp_wl_evas_cb_mouse_wheel(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
{
static E_Input_Event_Handler *_mouse_move_handler = NULL;
static E_Input_Event_Handler *_mouse_down_handler = NULL;
static E_Input_Event_Handler *_mouse_up_handler = NULL;
+static E_Input_Event_Handler *_mouse_wheel_handler = NULL;
static Eina_Bool e_input_handlers_added = EINA_FALSE;
return ECORE_CALLBACK_RENEW;
}
+static Eina_Bool
+_e_comp_wl_cb_mouse_wheel_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
+{
+ Ecore_Event_Mouse_Wheel *ev = event;
+ E_Input_Thread_Client *iec = NULL;
+ struct wl_resource *surface = NULL;
+
+ iec = _e_comp_wl_input_thread_client_under_pointer(ev->x, ev->y);
+ if (!iec)
+ goto err;
+
+ surface = e_input_thread_client_wl_resource_get(iec);
+ if (!surface)
+ {
+ ELOGF("Mouse", "Wheel. surface NULL", NULL);
+ goto err;
+ }
+
+ if (!eina_list_count(e_comp_wl->ptr.resources))
+ return ECORE_CALLBACK_RENEW;
+
+ _e_comp_wl_device_input_thread_send_event_device(iec, (E_Device *)ev->dev, ev->timestamp);
+
+ e_comp_wl_surface_mouse_wheel_send(surface, ev->direction, ev->z, ev->timestamp);
+
+err:
+ return ECORE_CALLBACK_RENEW;
+}
+
EINTERN void
e_comp_wl_input_thread_add_e_input_handlers()
{
if (!_mouse_up_handler)
_mouse_up_handler = e_input_event_handler_add(input_event_source, ECORE_EVENT_MOUSE_BUTTON_UP, _e_comp_wl_cb_mouse_button_up_thread_mode, NULL);
+ if (!_mouse_wheel_handler)
+ _mouse_wheel_handler = e_input_event_handler_add(input_event_source, ECORE_EVENT_MOUSE_WHEEL, _e_comp_wl_cb_mouse_wheel_thread_mode, NULL);
+
e_input_handlers_added = EINA_TRUE;
}
}
e_input_event_handler_del(input_event_source, _mouse_up_handler);
_mouse_up_handler = NULL;
+
+ if (_mouse_wheel_handler)
+ e_input_event_handler_del(input_event_source, _mouse_wheel_handler);
+
+ _mouse_wheel_handler = NULL;
}
}
else
EINTERN void e_comp_wl_surface_send_mouse_move(struct wl_resource *surface, int x, int y, int client_x, int client_y, unsigned int timestamp);
EINTERN void e_comp_wl_surface_mouse_button_send(struct wl_resource *surface, uint32_t timestamp, uint32_t button_id, uint32_t state);
+EINTERN void e_comp_wl_surface_mouse_wheel_send(struct wl_resource *surface, int direction, int z, int timestamp);
EINTERN E_Devicemgr_Input_Device *e_comp_wl_device_last_device_get(Ecore_Device_Class dev_class);
EINTERN void e_comp_wl_device_last_device_set(Ecore_Device_Class dev_class, E_Devicemgr_Input_Device *device);