static Eina_Bool
_e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
{
- int ec_x, ec_y;
-
e_comp_wl->ptr.x = wl_fixed_from_int(ev->x);
e_comp_wl->ptr.y = wl_fixed_from_int(ev->y);
- if (e_comp_wl->selection.target &&
- e_comp_wl->drag)
- {
- struct wl_resource *res;
- int x, y;
- E_Client *ec = NULL;
- E_Client *legacy_target = e_comp_wl->selection.target;
- int device_id = e_comp_wl_data_current_device_id_get();
-
- if (device_id < 0)
- {
- e_comp_wl_data_current_device_id_set(ev->multi.device);
- }
- else if (device_id != ev->multi.device)
- {
- return ECORE_CALLBACK_RENEW;
- }
-
- ec = e_client_under_position_input_get(legacy_target->desk, ev->x, ev->y);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ECORE_CALLBACK_RENEW);
-
- struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
- EINA_SAFETY_ON_NULL_RETURN_VAL(surface, ECORE_CALLBACK_RENEW);
-
- res = e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
- EINA_SAFETY_ON_NULL_RETURN_VAL(res, ECORE_CALLBACK_RENEW);
-
- if ((e_comp_wl->drag_offer != wl_resource_get_user_data(res)) &&
- (ec != legacy_target))
- {
- e_comp_wl_data_device_send_leave(legacy_target);
- e_comp_wl_data_device_send_enter(ec);
- }
-
- if (e_comp_wl->drag)
- e_drag_move(e_comp_wl->drag, ev->x, ev->y);
-
- if (e_client_transform_core_enable_get(ec))
- {
- int trans_x, trans_y;
- e_client_transform_core_input_transform(ec, ev->x, ev->y, &trans_x, &trans_y);
- x = trans_x - ec->client.x;
- y = trans_y - ec->client.y;
- }
- else
- {
- e_client_geometry_get(ec, &ec_x, &ec_y, NULL, NULL);
- x = ev->x - ec_x;
- y = ev->y - ec_y;
- }
-
- wl_data_device_send_motion(res, ev->timestamp, wl_fixed_from_int(x), wl_fixed_from_int(y));
- }
-
return ECORE_CALLBACK_RENEW;
}
wl_data_device_send_leave(res);
}
+EINTERN void
+e_comp_wl_data_device_send_motion(E_Client *ec, int x, int y, uint32_t timestamp)
+{
+ int motion_x, motion_y;
+ struct wl_resource *surface, *data_device_res;
+
+ surface = e_comp_wl_client_surface_get(ec);
+ if (!surface) return;
+
+ data_device_res = e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
+ if (!data_device_res) return;
+
+ if (e_client_transform_core_enable_get(ec))
+ {
+ int trans_x, trans_y;
+ e_client_transform_core_input_transform(ec, x, y, &trans_x, &trans_y);
+ motion_x = trans_x - ec->client.x;
+ motion_y = trans_y - ec->client.y;
+ }
+ else
+ {
+ int ec_x, ec_y;
+ e_client_geometry_get(ec, &ec_x, &ec_y, NULL, NULL);
+ motion_x = x - ec_x;
+ motion_y = y - ec_y;
+ }
+
+ wl_data_device_send_motion(data_device_res, timestamp, wl_fixed_from_int(motion_x), wl_fixed_from_int(motion_y));
+}
+
EINTERN void *
e_comp_wl_data_device_send_offer(E_Client *ec)
{
EINTERN void e_comp_wl_data_device_send_enter(E_Client *ec);
EINTERN void e_comp_wl_data_device_send_leave(E_Client *ec);
+EINTERN void e_comp_wl_data_device_send_motion(E_Client *ec, int x, int y, uint32_t timestamp);
EINTERN void *e_comp_wl_data_device_send_offer(E_Client *ec);
EINTERN struct wl_resource *e_comp_wl_data_find_for_client(struct wl_client *client);
#include "e_dnd_intern.h"
+#include "e_comp_wl_intern.h"
#include "e_comp_wl_data_intern.h"
#include "e_grabinput_intern.h"
{
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_dnd_cb_mouse_up, NULL);
- E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_MOVE, _e_dnd_cb_mouse_move, NULL);
+ E_LIST_HANDLER_PREPEND(_event_handlers, ECORE_EVENT_MOUSE_MOVE, _e_dnd_cb_mouse_move, NULL);
}
if (!_zone_event_handlers)
static Eina_Bool
_e_dnd_cb_mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
+ int x, y;
Ecore_Event_Mouse_Move *ev = event;
- if (ev->window != _drag_win) return ECORE_CALLBACK_PASS_ON;
+ if (e_comp_wl->selection.target &&
+ e_comp_wl->drag)
+ {
+ struct wl_resource *res;
+ E_Client *ec = NULL;
+ E_Client *legacy_target = e_comp_wl->selection.target;
+ int device_id = e_comp_wl_data_current_device_id_get();
+
+ x = ev->x;
+ y = ev->y;
+
+ if (device_id < 0)
+ {
+ e_comp_wl_data_current_device_id_set(ev->multi.device);
+ }
+ else if (device_id != ev->multi.device)
+ {
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ ec = e_client_under_position_input_get(legacy_target->desk, x, y);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ECORE_CALLBACK_RENEW);
+
+ struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(surface, ECORE_CALLBACK_RENEW);
+
+ res = e_comp_wl_data_find_for_client(wl_resource_get_client(surface));
+ EINA_SAFETY_ON_NULL_RETURN_VAL(res, ECORE_CALLBACK_RENEW);
+
+ if ((e_comp_wl->drag_offer != wl_resource_get_user_data(res)) &&
+ (ec != legacy_target))
+ {
+ e_comp_wl_data_device_send_leave(legacy_target);
+ e_comp_wl_data_device_send_enter(ec);
+ }
+
+ if (e_comp_wl->drag)
+ e_drag_move(e_comp_wl->drag, x, y);
+
+ e_comp_wl_data_device_send_motion(ec, x, y, ev->timestamp);
+ }
+
return ECORE_CALLBACK_PASS_ON;
}