Previously, E_Comp_Wl_Data contained a single seat as a sub struct.
This patch introduces a new E_Comp_Wl_Seat structure and processes input events
according to their corresponding seats.
Some remaining tasks include:
- considering seat in drag-and-drop scenarios
- sending input events to app from a specific seat (zone)
- refactoring devicemgr to be seat-aware
Change-Id: I61760271c578c616d727438ea73e1825d3534892
{
Ecore_Event_Device_Info *e;
E_Comp *comp = data;
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *seat;
if (!(e = event)) goto end;
+ ELOGF("COMP_SCREEN", "Input Device Add. name:%s(%s), seat:%s", NULL, e->name, e->identifier, e->seatname);
+
+ seat = e_comp_wl_input_seat_get(e->seatname);
+ if (!seat) goto end;
if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
{
- if (comp_wl->ptr.num_devices == 0)
+ if (seat->ptr.num_devices == 0)
{
e_pointer_view_set(comp->pointer, NULL, 0, 0);
- e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
+ e_comp_wl_input_pointer_enabled_set(seat, EINA_TRUE);
}
- comp_wl->ptr.num_devices++;
+ seat->ptr.num_devices++;
}
else if (e->clas == ECORE_DEVICE_CLASS_KEYBOARD)
{
else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
{
E_Comp_Screen *comp_screen = e_comp_screen_get();
- e_comp_wl_input_touch_enabled_set(EINA_TRUE);
+ e_comp_wl_input_touch_enabled_set(seat, EINA_TRUE);
if (comp_screen)
_e_comp_screen_input_rotation_set(comp_screen->rotation);
- comp_wl->touch.num_devices++;
+ seat->touch.num_devices++;
}
end:
}
static void
-_e_comp_screen_pointer_renew(void)
+_e_comp_screen_pointer_renew(E_Comp_Wl_Seat *seat)
{
E_Comp_Wl_Data *comp_wl;
comp_wl = e_comp_wl_get();
- if ((comp_wl->ptr.num_devices == 0) && comp_wl->ptr.ec && comp_wl->ptr.ec->pointer_enter_sent)
+ if ((seat->ptr.num_devices == 0) && comp_wl->ptr.ec && comp_wl->ptr.ec->pointer_enter_sent)
{
if (e_devicemgr->last_device_ptr)
{
{
Ecore_Event_Device_Info *e;
E_Comp *comp = data;
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *seat;
if (!(e = event)) goto end;
+ ELOGF("COMP_SCREEN", "Input Device Del. name:%s(%s), seat:%s", NULL, e->name, e->identifier, e->seatname);
+
+ seat = e_comp_wl_input_seat_get(e->seatname);
+ if (!seat) goto end;
if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
{
- comp_wl->ptr.num_devices--;
- if (comp_wl->ptr.num_devices == 0)
+ seat->ptr.num_devices--;
+ if (seat->ptr.num_devices == 0)
{
- e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
+ e_comp_wl_input_pointer_enabled_set(seat, EINA_FALSE);
e_pointer_view_set(comp->pointer, NULL, 0, 0);
e_pointer_hide(comp->pointer);
- _e_comp_screen_pointer_renew();
+ _e_comp_screen_pointer_renew(seat);
}
}
else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
{
- comp_wl->touch.num_devices--;
- if (comp_wl->touch.num_devices == 0)
+ seat->touch.num_devices--;
+ if (seat->touch.num_devices == 0)
{
- e_comp_wl_input_touch_enabled_set(EINA_FALSE);
+ e_comp_wl_input_touch_enabled_set(seat, EINA_FALSE);
}
}
return TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_SURFACE;
}
- if ((!e_config->show_cursor) || (!comp_wl->ptr.enabled))
+ if ((!e_config->show_cursor) || (!e_comp_wl_input_seat_pointer_enabled_get(NULL)))
{
DMERR("Pointer is not available");
if (!e_comp_wl_input_pointer_constraint_activated_get())
static Eina_Bool _e_comp_wl_cursor_timer_control(Evas_Callback_Type type, E_Comp_Wl_Data *comp_wl, E_Client *ec);
static void _e_comp_wl_surface_state_serial_update(E_Client *ec, E_Comp_Wl_Surface_State *state);
+static void _e_comp_wl_seat_pointer_send_axis(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ uint32_t axis, uint32_t dir, uint32_t timestamp);
+
+static void _e_comp_wl_seat_touch_send_cancel(E_Comp_Wl_Seat *seat, struct wl_client *wc, E_Client *ec);
+static void _e_comp_wl_seat_touch_send_frame(E_Comp_Wl_Seat *seat, struct wl_client *wc);
+
/* local variables */
typedef struct _E_Comp_Wl_Key_Data
{
static void
_e_comp_wl_send_touch_cancel(E_Client *ec)
{
- Eina_List *l;
- struct wl_resource *res;
struct wl_client *wc;
- E_Comp_Wl_Data *comp_wl;
if (!ec) return;
if (e_object_is_del(E_OBJECT(ec))) return;
wc = wl_resource_get_client(surface);
- comp_wl = e_comp_wl_get();
- EINA_LIST_FOREACH(comp_wl->touch.resources, l, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_comp_wl_input_touch_check(res)) continue;
-
- ELOGF("Touch", "Cancel name:%20s", ec, e_client_util_name_get(ec));
-
- wl_touch_send_cancel(res);
- }
+ _e_comp_wl_seat_touch_send_cancel(NULL, wc, ec);
}
static void
static void
_e_comp_wl_cursor_reload(E_Comp_Wl_Data *comp_wl, E_Client *ec)
{
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
E_Map *map;
- uint32_t serial;
+
int cx, cy, px, py;
E_Pointer *comp_pointer = e_comp_pointer_get();
cy = py - ec->client.y;
wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- wl_pointer_send_enter(res, serial, surface,
- wl_fixed_from_int(cx), wl_fixed_from_int(cy));
- ec->pointer_enter_sent = EINA_TRUE;
- }
+
+ e_comp_wl_seat_pointer_send_enter(NULL, wc, ec, surface, cx, cy);
+
wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
}
{
E_Client *ec;
Evas_Event_Mouse_In *ev;
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
- uint32_t serial;
E_Client *prev_ptr_ec;
E_Comp_Wl_Data *comp_wl;
return;
}
- if (!eina_list_count(comp_wl->ptr.resources)) return;
- wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
- _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp);
+ wc = wl_resource_get_client(surface);
+ _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp);
+ e_comp_wl_seat_pointer_send_enter(NULL, wc, ec, surface, ev->canvas.x - ec->client.x, ev->canvas.y - ec->client.y);
- wl_pointer_send_enter(res, serial, surface,
- wl_fixed_from_int(ev->canvas.x - ec->client.x),
- wl_fixed_from_int(ev->canvas.y - ec->client.y));
- ec->pointer_enter_sent = EINA_TRUE;
- }
- wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
+ wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
}
static void
{
E_Client *ec;
Evas_Event_Mouse_Out *ev;
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
- uint32_t serial;
Eina_Bool inside_check;
E_Comp_Wl_Data *comp_wl;
E_Comp *comp;
return;
}
- if (!eina_list_count(comp_wl->ptr.resources)) return;
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- if (ec->pointer_enter_sent == EINA_FALSE) continue;
+ _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp);
+ e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, surface);
- _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, ev->timestamp);
-
- wl_pointer_send_leave(res, serial, surface);
- ec->pointer_enter_sent = EINA_FALSE;
- }
- wl_signal_emit(&comp_wl->ptr_constraints.surface_mouseout_signal, ec);
+ wl_signal_emit(&comp_wl->ptr_constraints.surface_mouseout_signal, ec);
}
static void
_e_comp_wl_surface_send_touch(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, int idx, int canvas_x, int canvas_y, int client_x, int client_y, uint32_t timestamp, Eina_Bool pressed)
{
- Eina_List *l;
struct wl_client *wc;
- struct wl_resource *res;
wl_fixed_t x, y;
- uint32_t serial;
wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
-
- x = wl_fixed_from_int(canvas_x - client_x);
- y = wl_fixed_from_int(canvas_y - client_y);
- EINA_LIST_FOREACH(comp_wl->touch.resources, l, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_comp_wl_input_touch_check(res)) continue;
- TRACE_INPUT_BEGIN(_e_comp_wl_surface_send_touch);
- if (pressed)
- {
- ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, canvas_x - client_x, canvas_y - client_y);
-
- wl_touch_send_down(res, serial, timestamp, surface, idx, x, y); //id 0 for the 1st finger
- }
- else
- {
- ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)\n", NULL, idx, timestamp, canvas_x - client_x, canvas_y - client_y);
+ x = canvas_x - client_x;
+ y = canvas_y - client_y;
- wl_touch_send_up(res, serial, timestamp, idx);
- }
- TRACE_INPUT_END();
- }
+ e_comp_wl_seat_touch_send_downup(NULL, wc, surface, idx, x, y, timestamp, pressed);
}
static void
e_comp_wl_touch_frame_send_ec_set(comp_wl, ec);
}
-EINTERN void
-e_comp_wl_surface_send_touch_move(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, int idx, int canvas_x, int canvas_y, int client_x, int client_y, uint32_t timestamp)
-{
- Eina_List *l;
- struct wl_client *wc;
- struct wl_resource *res;
- wl_fixed_t x, y;
-
- wc = wl_resource_get_client(surface);
-
- x = wl_fixed_from_int(canvas_x - client_x);
- y = wl_fixed_from_int(canvas_y - client_y);
-
- EINA_LIST_FOREACH(comp_wl->touch.resources, l, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_comp_wl_input_touch_check(res)) continue;
- wl_touch_send_motion(res, timestamp, idx, x, y);
- }
-}
-
static void
_e_comp_wl_send_touch_move(E_Comp_Wl_Data *comp_wl, E_Client *ec, int idx, int canvas_x, int canvas_y, uint32_t timestamp)
{
if (ec->cur_mouse_action) return;
if (e_object_is_del(E_OBJECT(ec))) return;
if (_e_comp_wl_check_block_input(ec)) return;
+ int x, y;
+ struct wl_client *wc;
struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
if (!surface) return;
- e_comp_wl_surface_send_touch_move(comp_wl, surface, idx, canvas_x, canvas_y, ec->client.x, ec->client.y, timestamp);
-
- e_comp_wl_touch_frame_send_ec_set(comp_wl, ec);
-}
-
-static void
-_e_comp_wl_send_touch_frame(E_Comp_Wl_Data *comp_wl, E_Client *ec)
-{
- Eina_List *l;
- struct wl_client *wc;
- struct wl_resource *res;
- struct wl_resource *surface;
-
- if (!ec) return;
- if (e_object_is_del(E_OBJECT(ec))) return;
- if (_e_comp_wl_check_block_input(ec)) return;
- if (!(surface = e_comp_wl_client_surface_get(ec))) return;
-
wc = wl_resource_get_client(surface);
+ x = canvas_x - ec->client.x;
+ y = canvas_y - ec->client.y;
- EINA_LIST_FOREACH(comp_wl->touch.resources, l, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_comp_wl_input_touch_check(res)) continue;
- wl_touch_send_frame(res);
- }
-
- e_comp_wl_touch_frame_send_ec_set(comp_wl, NULL);
-}
-
-EINTERN void
-e_comp_wl_surface_send_mouse_move(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, int x, int y, int client_x, int client_y, unsigned int timestamp)
-{
- struct wl_resource *res;
- struct wl_client *wc;
- Eina_List *l;
-
- if (!surface) return;
+ e_comp_wl_seat_touch_send_motion(NULL, wc, idx, x, y, timestamp);
- wc = wl_resource_get_client(surface);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- wl_pointer_send_motion(res, timestamp,
- wl_fixed_from_int(x - client_x),
- wl_fixed_from_int(y - client_y));
- }
+ e_comp_wl_touch_frame_send_ec_set(comp_wl, ec);
}
static void
if (ec->cur_mouse_action) 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_send_mouse_move(comp_wl, surface, x, y, ec->client.x, ec->client.y, timestamp);
+ struct wl_client *wc;
+ int sx, sy;
+
+ wc = wl_resource_get_client(surface);
+ sx = x - ec->client.x;
+ sy = y - ec->client.y;
+
+ e_comp_wl_seat_pointer_send_motion(NULL, wc, sx, sy, timestamp);
}
static void
EINTERN void
e_comp_wl_surface_mouse_wheel_send(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, int direction, int z, int timestamp)
{
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
+ uint32_t axis, dir;
if (!surface) return;
- uint32_t axis, dir;
-
if (direction == 0)
axis = WL_POINTER_AXIS_VERTICAL_SCROLL;
else
dir = wl_fixed_from_int(z);
wc = wl_resource_get_client(surface);
- EINA_LIST_FOREACH(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);
- }
+ _e_comp_wl_seat_pointer_send_axis(NULL, wc, axis, dir, timestamp);
}
static void
if (!surface) return;
comp_wl = e_comp_wl_get();
- if (!eina_list_count(comp_wl->ptr.resources))
- return;
+
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
if (_e_comp_wl_check_cursor_timer_needed(ec))
{
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
E_Client *ec = e_comp_wl_touch_frame_send_ec_get(comp_wl);
- _e_comp_wl_send_touch_frame(comp_wl, ec);
+ struct wl_client *wc;
+ struct wl_resource *surface;
+
+ if (!(ec = data)) return ECORE_CALLBACK_PASS_ON;
+ if (e_object_is_del(E_OBJECT(ec))) return ECORE_CALLBACK_PASS_ON;
+ if (_e_comp_wl_check_block_input(ec)) return ECORE_CALLBACK_PASS_ON;
+
+ if (!(surface = e_comp_wl_client_surface_get(ec))) return ECORE_CALLBACK_PASS_ON;
+ wc = wl_resource_get_client(surface);
+ _e_comp_wl_seat_touch_send_frame(NULL, wc);
+ e_comp_wl_touch_frame_send_ec_set(comp_wl, NULL);
+
return ECORE_CALLBACK_PASS_ON;
}
EINTERN void
e_comp_wl_surface_mouse_button_send(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, uint32_t timestamp, uint32_t button_id, uint32_t state)
{
- Eina_List *l;
struct wl_client *wc;
- struct wl_resource *res;
- uint32_t serial, btn;
+ uint32_t btn;
switch (button_id)
{
default: btn = button_id; break;
}
- comp_wl = e_comp_wl_get();
comp_wl->ptr.button = btn;
wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
-
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_comp_wl_input_pointer_check(res)) continue;
- TRACE_INPUT_BEGIN(e_comp_wl_surface_mouse_button);
-
- ELOGF("Mouse", "Button %s (btn: %d, time: %d)", NULL, (state ? "Down" : "Up"), btn, timestamp);
-
- wl_pointer_send_button(res, serial, timestamp, btn, state);
- TRACE_INPUT_END();
- }
+ e_comp_wl_seat_pointer_send_button(NULL, wc, btn, state, timestamp);
}
EINTERN Eina_Bool
struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
if (!surface) return EINA_FALSE;
- if (!eina_list_count(comp_wl->ptr.resources))
- return EINA_TRUE;
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return EINA_FALSE;
ELOGF("Mouse", "Button %s (btn: %d, time: %d)", ec, (state ? "Down" : "Up"), button_id, timestamp);
E_Comp_Wl_Data *comp_wl;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
E_Comp_Wl_Data *comp_wl;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
e_comp_wl_touch_cancel_send(E_Client *ec)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_wl_get(), EINA_FALSE);
_e_comp_wl_send_touch_cancel(ec);
E_Comp_Wl_Data *comp_wl;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
E_Comp_Wl_Data *comp_wl;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
E_Comp_Wl_Data *comp_wl;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
{
uint32_t serial;
struct wl_client *wc;
- struct wl_resource *res;
- Eina_List *l;
E_Comp_Wl_Data *comp_wl;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE);
- if (!eina_list_count(comp_wl->ptr.resources)) return EINA_FALSE;
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return EINA_FALSE;
+
wc = wl_resource_get_client(surface);
serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
- else _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, time);
+ if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
+ else _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, time);
- wl_pointer_send_enter(res, serial, surface,
- wl_fixed_from_int(x),
- wl_fixed_from_int(y));
- ec->pointer_enter_sent = EINA_TRUE;
- }
+ e_comp_wl_seat_pointer_send_enter(NULL, wc, ec, surface, x, y);
wl_signal_emit(&comp_wl->ptr_constraints.surface_mousein_signal, ec);
return EINA_TRUE;
{
uint32_t serial;
struct wl_client *wc;
- struct wl_resource *res;
- Eina_List *l;
E_Comp_Wl_Data *comp_wl;
comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN_VAL(comp_wl, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
EINA_SAFETY_ON_TRUE_RETURN_VAL(e_object_is_del(E_OBJECT(ec)), EINA_FALSE);
- if (!eina_list_count(comp_wl->ptr.resources)) return EINA_FALSE;
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return EINA_FALSE;
+
wc = wl_resource_get_client(surface);
serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
- else _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, time);
+ if (dev) _e_comp_wl_send_event_device(wc, time, dev, serial);
+ else _e_comp_wl_device_send_last_event_device(comp_wl, ec, ECORE_DEVICE_CLASS_MOUSE, time);
- wl_pointer_send_leave(res, serial, surface);
- ec->pointer_enter_sent = EINA_FALSE;
- }
+ e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, surface);
wl_signal_emit(&comp_wl->ptr_constraints.surface_mouseout_signal, ec);
return EINA_TRUE;
EINTERN Eina_Bool
e_comp_wl_cursor_hide(E_Client *ec)
{
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
- uint32_t serial;
E_Comp_Wl_Data *comp_wl;
e_pointer_view_set(e_comp_pointer_get(), NULL, 0, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- if (ec->pointer_enter_sent == EINA_FALSE) continue;
- wl_pointer_send_leave(res, serial, surface);
- ec->pointer_enter_sent = EINA_FALSE;
- }
+ e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, surface);
return EINA_TRUE;
}
return comp_wl->ptr.ec;
}
+
+static void
+_e_comp_wl_seat_touch_send_cancel(E_Comp_Wl_Seat *seat, struct wl_client *wc, E_Client *ec)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
+
+ wl_touch_send_cancel(res);
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->touch.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
+
+ wl_touch_send_cancel(res);
+ }
+ }
+}
+
+static void
+_e_comp_wl_seat_touch_send_frame(E_Comp_Wl_Seat *seat, struct wl_client *wc)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ wl_touch_send_frame(res);
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->touch.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+ wl_touch_send_frame(res);
+ }
+ }
+}
+
+EINTERN void
+e_comp_wl_seat_touch_send_downup(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
+ Eina_Bool pressed)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ uint32_t serial;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ serial = wl_display_next_serial(comp_wl->wl.disp);
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ TRACE_INPUT_BEGIN(e_comp_wl_seat_touch_send_downup);
+ if(pressed)
+ {
+ ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+ wl_touch_send_down(res, serial, timestamp, surface, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+ }
+ else
+ {
+ ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+ wl_touch_send_up(res, serial, timestamp, idx);
+ }
+ TRACE_INPUT_END();
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->touch.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ TRACE_INPUT_BEGIN(e_comp_wl_seat_touch_send_downup);
+ if (pressed)
+ {
+ ELOGF("Touch", "Down (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+ wl_touch_send_down(res, serial, timestamp, surface, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+ }
+ else
+ {
+ ELOGF("Touch", "Up (id: %d, time: %d, x:%d, y:%d)", NULL, idx, timestamp, x, y);
+ wl_touch_send_up(res, serial, timestamp, idx);
+ }
+ TRACE_INPUT_END();
+ }
+ }
+}
+
+EINTERN void
+e_comp_wl_seat_touch_send_motion(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ int idx, int x, int y, uint32_t timestamp)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->touch.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_touch_check(res)) continue;
+
+ wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
+ }
+ }
+}
+
+EINTERN void
+e_comp_wl_seat_pointer_send_enter(E_Comp_Wl_Seat *seat, struct wl_client *wc, E_Client *ec,
+ struct wl_resource *surface, int x, int y)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ uint32_t serial;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ serial = wl_display_next_serial(comp_wl->wl.disp);
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_enter(res, serial, surface,
+ wl_fixed_from_int(x), wl_fixed_from_int(y));
+
+ if (ec)
+ ec->pointer_enter_sent = EINA_TRUE;
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_enter(res, serial, surface,
+ wl_fixed_from_int(x), wl_fixed_from_int(y));
+
+ if (ec)
+ ec->pointer_enter_sent = EINA_TRUE;
+ }
+ }
+}
+
+EINTERN void
+e_comp_wl_seat_pointer_send_leave(E_Comp_Wl_Seat *seat, struct wl_client *wc, E_Client *ec,
+ struct wl_resource *surface)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ uint32_t serial;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ serial = wl_display_next_serial(comp_wl->wl.disp);
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+ if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
+
+ wl_pointer_send_leave(res, serial, surface);
+
+ if (ec)
+ ec->pointer_enter_sent = EINA_FALSE;
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+ if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
+
+ wl_pointer_send_leave(res, serial, surface);
+
+ if (ec)
+ ec->pointer_enter_sent = EINA_FALSE;
+ }
+ }
+}
+
+EINTERN void
+e_comp_wl_seat_pointer_send_motion(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ int x, int y, uint32_t timestamp)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_motion(res, timestamp,
+ wl_fixed_from_int(x),
+ wl_fixed_from_int(y));
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_motion(res, timestamp,
+ wl_fixed_from_int(x),
+ wl_fixed_from_int(y));
+ }
+ }
+}
+
+EINTERN void
+e_comp_wl_seat_pointer_send_button(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ uint32_t button, uint32_t state, uint32_t timestamp)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ uint32_t serial;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ serial = wl_display_next_serial(comp_wl->wl.disp);
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ TRACE_INPUT_BEGIN(e_comp_wl_surface_mouse_button);
+ ELOGF("Mouse", "Button %s (btn: %d, time: %d)", NULL, (state ? "Down" : "Up"), button, timestamp);
+ wl_pointer_send_button(res, serial, timestamp,
+ button, state);
+ TRACE_INPUT_END();
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_button(res, serial, timestamp,
+ button, state);
+ }
+ }
+}
+
+static void
+_e_comp_wl_seat_pointer_send_axis(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ uint32_t axis, uint32_t dir, uint32_t timestamp)
+{
+ Eina_List *l, *ll;
+ struct wl_resource *res;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *s;
+
+ if (!seat) goto iterate;
+
+ EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_axis(res, timestamp, axis, dir);
+ }
+ return;
+
+iterate:
+ EINA_LIST_FOREACH(comp_wl->seats, l, s)
+ {
+ EINA_LIST_FOREACH(s->ptr.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
+ if (!e_comp_wl_input_pointer_check(res)) continue;
+
+ wl_pointer_send_axis(res, timestamp, axis, dir);
+ }
+ }
+}
}
static void
-_e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial)
+_e_comp_wl_data_device_cb_drag_start(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial)
{
E_Comp_Wl_Data *comp_wl;
E_Comp_Wl_Data_Source *source;
- Eina_List *l;
- struct wl_resource *res;
E_Client *drag_icon_ec = NULL, *ec = NULL;
E_Client *ec_under_pointer = NULL;
E_Desk *desk;
int x, y;
+ struct wl_client *wc;
DBG("Data Device Drag Start");
ec = e_client_from_surface_resource(origin_resource);
if (ec && ec->pointer_enter_sent)
{
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != client) continue;
- if (!ec->comp_data) continue;
-
- wl_pointer_send_leave(res, serial, e_comp_wl_client_surface_get(ec));
- }
-
- ec->pointer_enter_sent = EINA_FALSE;
+ wc = wl_resource_get_client(origin_resource);
+ //TODO: consider multi-seat
+ e_comp_wl_seat_pointer_send_leave(NULL, wc, ec, e_comp_wl_client_surface_get(ec));
}
evas_pointer_canvas_xy_get(e_comp_evas_get(), &x, &y);
static int constraint_last_hint_x = -1;
static int constraint_last_hint_y = -1;
+static Eina_List *event_handlers = NULL;
+
static Eina_Bool
_e_comp_wl_input_is_position_inside_constraint_region(E_Comp_Wl_Pointer_Constraint *constraint,
wl_fixed_t fx,
wl_fixed_t fy);
static void
-_e_comp_wl_input_update_seat_caps(E_Comp_Wl_Data *comp_wl, struct wl_client *wc)
+_e_comp_wl_input_update_seat_caps(E_Comp_Wl_Seat *seat, struct wl_client *wc)
{
Eina_List *l;
struct wl_resource *res;
enum wl_seat_capability caps = 0;
- if (comp_wl->ptr.enabled)
+ if (!seat)
+ seat = e_comp_wl_input_seat_get("default");
+
+ if (seat->ptr.enabled)
caps |= WL_SEAT_CAPABILITY_POINTER;
if (e_comp_input_key->kbd.enabled)
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
- if (comp_wl->touch.enabled)
+ if (seat->touch.enabled)
caps |= WL_SEAT_CAPABILITY_TOUCH;
- EINA_LIST_FOREACH(comp_wl->seat.resources, l, res)
+ EINA_LIST_FOREACH(seat->resources, l, res)
{
/* if a wc is null, send seat capability to all wl_seat resources */
if (wc && (wl_resource_get_client(res) != wc)) continue;
}
static void
-_e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource, int32_t x, int32_t y)
+_e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *resource, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource, int32_t x, int32_t y)
{
E_Client *ec;
Eina_Bool got_mouse = EINA_FALSE;
struct wl_resource *surface;
E_Pointer *comp_pointer = e_comp_pointer_get();
+ E_Comp_Wl_Seat *seat;
+ seat = wl_resource_get_user_data(resource);
+ if (!seat) return;
E_Input_Thread_Request_EClient_Data ec_data;
memset(&ec_data, 0, sizeof(E_Input_Thread_Request_EClient_Data));
static void
_e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource)
{
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Data *comp_wl;
+ E_Comp_Wl_Seat *seat;
+ seat = wl_resource_get_user_data(resource);
+ if (!seat) return;
- comp_wl->ptr.resources =
- eina_list_remove(comp_wl->ptr.resources, resource);
+ seat->ptr.resources =
+ eina_list_remove(seat->ptr.resources, resource);
+ comp_wl = e_comp_wl_get();
wl_signal_emit(&comp_wl->ptr_constraints.pointer_destroy_signal, resource);
}
struct wl_client *ptr_client = NULL;
E_Comp_Wl_Client_Data *cdata = NULL;
E_Comp_Wl_Data *comp_wl;
+ E_Comp_Wl_Seat *seat;
+ seat = wl_resource_get_user_data(resource);
+ if (!seat) return;
comp_wl = e_comp_wl_get();
if (!res)
{
ERR("Could not create pointer on seat %s: %m",
- comp_wl->seat.name);
+ seat->name);
wl_client_post_no_memory(client);
return;
}
- comp_wl->ptr.resources =
- eina_list_append(comp_wl->ptr.resources, res);
+ seat->ptr.resources =
+ eina_list_append(seat->ptr.resources, res);
wl_resource_set_implementation(res, &_e_pointer_interface,
- comp_wl,
+ seat,
_e_comp_wl_input_cb_pointer_unbind);
- if ((comp_wl->ptr.num_devices == 1) && comp_wl->ptr.ec && !comp_wl->ptr.ec->pointer_enter_sent && !e_config->use_cursor_timer)
+ if ((seat->ptr.num_devices == 1) && comp_wl->ptr.ec && !comp_wl->ptr.ec->pointer_enter_sent && !e_config->use_cursor_timer)
{
cdata = (E_Comp_Wl_Client_Data*)comp_wl->ptr.ec->comp_data;
if (cdata && cdata->wl_surface)
wl_resource_get_version(resource), id);
if (!res)
{
- ERR("Could not create keyboard on seat %s: %m",
- comp_wl->seat.name);
+ // ERR("Could not create keyboard on seat %s: %m",
+ // comp_wl->seat.name);
wl_client_post_no_memory(client);
return;
}
static void
_e_comp_wl_input_cb_touch_unbind(struct wl_resource *resource)
{
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
- comp_wl->touch.resources =
- eina_list_remove(comp_wl->touch.resources, resource);
+ E_Comp_Wl_Seat *seat;
+ seat = wl_resource_get_user_data(resource);
+ if (!seat) return;
+
+ seat->touch.resources =
+ eina_list_remove(seat->touch.resources, resource);
}
static void
_e_comp_wl_input_cb_touch_get(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id EINA_UNUSED)
{
- struct wl_resource *res;
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ struct wl_resource *res;
+ E_Comp_Wl_Seat *seat;
+ seat = wl_resource_get_user_data(resource);
+ if (!seat) return;
/* try to create pointer resource */
res = wl_resource_create(client, &wl_touch_interface,
if (!res)
{
ERR("Could not create touch on seat %s: %m",
- comp_wl->seat.name);
+ seat->name);
wl_client_post_no_memory(client);
return;
}
- comp_wl->touch.resources =
- eina_list_append(comp_wl->touch.resources, res);
+ seat->touch.resources =
+ eina_list_append(seat->touch.resources, res);
wl_resource_set_implementation(res, &_e_touch_interface,
- comp_wl,
+ seat,
_e_comp_wl_input_cb_touch_unbind);
}
static void
_e_comp_wl_input_cb_unbind_seat(struct wl_resource *resource)
{
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *seat;
+ seat = wl_resource_get_user_data(resource);
+ if (!seat) return;
INF("Unbind seat: %u (client: %p)", wl_resource_get_id(resource), wl_resource_get_client(resource));
- comp_wl->seat.resources =
- eina_list_remove(comp_wl->seat.resources, resource);
+ seat->resources =
+ eina_list_remove(seat->resources, resource);
}
static void
-_e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data EINA_UNUSED, uint32_t version, uint32_t id)
+_e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
struct wl_resource *res;
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *seat;
+
+ if (!(seat = data)) return;
res = wl_resource_create(client, &wl_seat_interface, version, id);
if (!res)
INF("Bind seat: %u (client: %p)", wl_resource_get_id(res), client);
/* store version of seat interface for reuse in updating capabilities */
- comp_wl->seat.version = version;
- comp_wl->seat.resources =
- eina_list_append(comp_wl->seat.resources, res);
+ seat->version = version;
+ seat->resources =
+ eina_list_append(seat->resources, res);
wl_resource_set_implementation(res, &_e_seat_interface,
- NULL,
+ seat,
_e_comp_wl_input_cb_unbind_seat);
- _e_comp_wl_input_update_seat_caps(comp_wl, client);
- if (comp_wl->seat.version >= WL_SEAT_NAME_SINCE_VERSION)
- wl_seat_send_name(res, comp_wl->seat.name);
+ _e_comp_wl_input_update_seat_caps(seat, client);
+ if (seat->version >= WL_SEAT_NAME_SINCE_VERSION)
+ wl_seat_send_name(res, seat->name);
}
static void
e_comp_input_key->xkb.state = NULL;
}
-EINTERN Eina_Bool
-e_comp_wl_input_init(void)
+static Eina_Bool
+_e_comp_wl_input_seat_init(const char *seat_name)
{
+ E_Comp_Wl_Seat *seat;
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ seat = e_comp_wl_input_seat_get(seat_name);
+ if (seat) return EINA_FALSE;
+
+ if (!(seat = E_NEW(E_Comp_Wl_Seat, 1))) return EINA_FALSE;
/* set default seat name */
- if (!comp_wl->seat.name)
- comp_wl->seat.name = "default";
+ if (!seat_name)
+ seat->name = "default";
+ else
+ seat->name = strdup(seat_name);
+
+ /* create the global resource for input seat */
+ seat->global =
+ wl_global_create(comp_wl->wl.disp, &wl_seat_interface, 7,
+ seat, _e_comp_wl_input_cb_bind_seat);
+ if (!seat->global)
+ {
+ ERR("Could not create global for seat: %m");
+ return EINA_FALSE;
+ }
+ seat->resources = NULL;
+
+ comp_wl->seats = eina_list_append(comp_wl->seats, seat);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_e_comp_wl_input_cb_input_device_add(void *data, int type, void *event)
+{
+ Ecore_Event_Device_Info *e;
+ if (!(e = (Ecore_Event_Device_Info *)event)) goto end;
+
+ if (e->clas == ECORE_DEVICE_CLASS_SEAT)
+ {
+ ERR("Seat added. name: %s identifier: %s, seatname: %s", e->name, e->identifier, e->seatname);
+ _e_comp_wl_input_seat_init(e->name);
+ }
+
+end:
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+EINTERN Eina_Bool
+e_comp_wl_input_init(void)
+{
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
dont_set_e_input_keymap = e_secure_getenv("NO_E_INPUT_KEYMAP_CACHE") ? EINA_TRUE : EINA_FALSE;
dont_use_xkb_cache = e_secure_getenv("NO_KEYMAP_CACHE") ? EINA_TRUE : EINA_FALSE;
if (e_comp_input_key->kbd.repeat_rate < 0)
atomic_store(&e_comp_input_key->kbd.repeat_rate, 25);
- /* create the global resource for input seat */
- comp_wl->seat.global =
- wl_global_create(comp_wl->wl.disp, &wl_seat_interface, 7,
- comp_wl, _e_comp_wl_input_cb_bind_seat);
- if (!comp_wl->seat.global)
- {
- ERR("Could not create global for seat: %m");
- return EINA_FALSE;
- }
+ _e_comp_wl_input_seat_init("default");
/* create the global resource for relative pointer */
comp_wl->relative_ptr.global =
_env_e_default_xkb_variant = e_util_env_get("E_DEFAULT_XKB_VARIANT");
_env_e_default_xkb_opts = e_util_env_get("E_DEFAULT_XKB_OPTIONS");
+ E_LIST_HANDLER_PREPEND(event_handlers, ECORE_EVENT_DEVICE_ADD, _e_comp_wl_input_cb_input_device_add, NULL);
+
return EINA_TRUE;
}
_surface_commit_hook = NULL;
}
- /* destroy pointer resources */
- EINA_LIST_FREE(comp_wl->ptr.resources, res)
- wl_resource_destroy(res);
-
/* destroy relative pointer resources */
EINA_LIST_FREE(comp_wl->relative_ptr.resources, res)
wl_resource_destroy(res);
wl_resource_destroy(res);
e_comp_input_key->kbd.resources = eina_list_free(e_comp_input_key->kbd.resources);
- /* destroy touch resources */
- EINA_LIST_FREE(comp_wl->touch.resources, res)
- wl_resource_destroy(res);
-
/* destroy e_comp_input_key->kbd.keys array */
wl_array_release(&e_comp_input_key->kbd.keys);
wl_global_destroy(comp_wl->ptr_constraints.global);
comp_wl->ptr_constraints.global = NULL;
- /* destroy the global seat resource */
- if (comp_wl->seat.global)
- wl_global_destroy(comp_wl->seat.global);
- comp_wl->seat.global = NULL;
+ E_Comp_Wl_Seat *seat;
+ EINA_LIST_FREE(comp_wl->seats, seat)
+ {
+ EINA_LIST_FREE(seat->ptr.resources, res)
+ wl_resource_destroy(res);
+ EINA_LIST_FREE(seat->touch.resources, res)
+ wl_resource_destroy(res);
+ EINA_LIST_FREE(seat->resources, res)
+ wl_resource_destroy(res);
+ wl_global_destroy(seat->global);
+ }
dont_set_e_input_keymap = EINA_FALSE;
dont_use_xkb_cache = EINA_FALSE;
}
EINTERN void
-e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled)
+e_comp_wl_input_pointer_enabled_set(E_Comp_Wl_Seat *seat, Eina_Bool enabled)
{
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
- /* check for valid compositor data */
- if (!comp_wl)
- {
- ERR("No compositor data");
- return;
- }
+ if (!seat) return;
- comp_wl->ptr.enabled = !!enabled;
- _e_comp_wl_input_update_seat_caps(comp_wl, NULL);
+ seat->ptr.enabled = !!enabled;
+ _e_comp_wl_input_update_seat_caps(seat, NULL);
}
static void
}
e_input_backend_thread_safe_call(_e_comp_wl_input_thread_cb_keyboard_enabled_set, &enabled, sizeof(Eina_Bool));
- _e_comp_wl_input_update_seat_caps(comp_wl, NULL);
+ _e_comp_wl_input_update_seat_caps(NULL, NULL);
}
E_API Eina_Bool
}
EINTERN void
-e_comp_wl_input_touch_enabled_set(Eina_Bool enabled)
+e_comp_wl_input_touch_enabled_set(E_Comp_Wl_Seat *seat, Eina_Bool enabled)
{
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
- /* check for valid compositor data */
- if (!comp_wl)
- {
- ERR("No compositor data");
- return;
- }
+ if (!seat) return;
- comp_wl->touch.enabled = !!enabled;
- _e_comp_wl_input_update_seat_caps(comp_wl, NULL);
+ seat->touch.enabled = !!enabled;
+ _e_comp_wl_input_update_seat_caps(seat, NULL);
}
EINTERN void
e_comp_wl_input_seat_caps_set(unsigned int caps)
{
Eina_Bool need_update = EINA_FALSE;
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Comp_Wl_Seat *seat;
- /* check for valid compositor data */
- if (!comp_wl)
- {
- ERR("No compositor data");
- return;
- }
+ seat = e_comp_wl_input_seat_get("default");
if (caps & E_INPUT_SEAT_POINTER)
- comp_wl->ptr.enabled = need_update = EINA_TRUE;
+ seat->ptr.enabled = need_update = EINA_TRUE;
if (caps & E_INPUT_SEAT_KEYBOARD)
e_comp_input_key->kbd.enabled = need_update = EINA_TRUE;
if (caps & E_INPUT_SEAT_TOUCH)
- comp_wl->touch.enabled = need_update = EINA_TRUE;
+ seat->touch.enabled = need_update = EINA_TRUE;
if (need_update)
- _e_comp_wl_input_update_seat_caps(comp_wl, NULL);
+ _e_comp_wl_input_update_seat_caps(seat, NULL);
}
EINTERN Eina_Bool
EINA_SAFETY_ON_NULL_RETURN(e_comp_input_key);
g_rec_mutex_unlock(&e_comp_input_key->kbd.resources_mutex);
}
+
+EINTERN E_Comp_Wl_Seat *
+e_comp_wl_input_seat_get(const char *name)
+{
+ Eina_List *l;
+ E_Comp_Wl_Seat *seat;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+
+ EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+ {
+ if (seat->name && !strcmp(seat->name, name))
+ return seat;
+ }
+
+ return NULL;
+}
+
+EINTERN Eina_Bool
+e_comp_wl_input_seat_pointer_is_empty(E_Comp_Wl_Seat *seat)
+{
+ if (!seat) goto iterate;
+
+ if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
+
+ return EINA_FALSE;
+
+iterate:
+ Eina_List *l;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+ {
+ if (eina_list_count(seat->ptr.resources))
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+}
+
+EINTERN Eina_Bool
+e_comp_wl_input_seat_touch_is_empty(E_Comp_Wl_Seat *seat)
+{
+ if (!seat) goto iterate;
+
+ if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
+
+ return EINA_FALSE;
+
+iterate:
+ Eina_List *l;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+ {
+ if (eina_list_count(seat->touch.resources))
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+}
+
+EINTERN Eina_Bool
+e_comp_wl_input_seat_pointer_enabled_get(E_Comp_Wl_Seat *seat)
+{
+ if (!seat) goto iterate;
+
+ if (seat->ptr.enabled) return EINA_TRUE;
+
+ return EINA_FALSE;
+
+iterate:
+ Eina_List *l;
+ E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ EINA_LIST_FOREACH(comp_wl->seats, l, seat)
+ {
+ if (seat->ptr.enabled) return EINA_TRUE;
+ }
+ return EINA_FALSE;
+}
EINTERN Eina_Bool e_comp_wl_input_relative_pointer_check(struct wl_resource *res);
EINTERN Eina_Bool e_comp_wl_input_pointer_check(struct wl_resource *res);
-EINTERN void e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled);
+EINTERN void e_comp_wl_input_pointer_enabled_set(E_Comp_Wl_Seat *seat, Eina_Bool enabled);
EINTERN Eina_Bool e_comp_wl_input_touch_check(struct wl_resource *res);
-EINTERN void e_comp_wl_input_touch_enabled_set(Eina_Bool enabled);
+EINTERN void e_comp_wl_input_touch_enabled_set(E_Comp_Wl_Seat *seat, Eina_Bool enabled);
EINTERN Eina_Bool e_comp_wl_input_keyboard_check(struct wl_resource *res);
EINTERN Eina_Bool e_comp_wl_input_keyboard_modifiers_serialize(void);
EINTERN void e_comp_wl_input_keymap_keycode_repeat_set(uint32_t keycode, Eina_Bool enable);
EINTERN void e_comp_wl_input_keymap_init(void);
+
+EINTERN E_Comp_Wl_Seat *e_comp_wl_input_seat_get(const char *name);
+EINTERN Eina_Bool e_comp_wl_input_seat_pointer_is_empty(E_Comp_Wl_Seat *seat);
+EINTERN Eina_Bool e_comp_wl_input_seat_touch_is_empty(E_Comp_Wl_Seat *seat);
+EINTERN Eina_Bool e_comp_wl_input_seat_pointer_enabled_get(E_Comp_Wl_Seat *seat);
+
#endif
}
static void
-_e_comp_wl_input_thread_send_mouse_in(E_Input_Thread_Client *iec, int x, int y, int client_x, int client_y, int timestamp)
+_e_comp_wl_input_thread_send_mouse_in(E_Comp_Wl_Seat *seat, E_Input_Thread_Client *iec, int x, int y, int client_x, int client_y, int timestamp)
{
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
- uint32_t serial;
+ struct wl_resource *surface;
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
comp_wl->ptr.x = wl_fixed_from_int(x);
if (!iec) return;
- struct wl_resource *surface = e_input_thread_client_wl_resource_get(iec);
+ surface = e_input_thread_client_wl_resource_get(iec);
if (!surface) return;
ELOGF("Mouse", "In (time: %d, canvas(%d, %d) output(%d, %d), name:%20s)",
NULL, timestamp, x, y, x, y,
e_input_thread_client_util_name_get(iec));
- if (!eina_list_count(comp_wl->ptr.resources)) return;
- wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(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", "call wl_pointer_send_enter", NULL);
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
- wl_pointer_send_enter(res, serial, surface,
- wl_fixed_from_int(x - client_x),
- wl_fixed_from_int(y - client_y));
-
- e_input_thread_client_pointer_enter_sent_set(iec, EINA_TRUE);
- }
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_pointer_send_enter(seat, wc, NULL, surface, x - client_x, y - client_y);
+ e_input_thread_client_pointer_enter_sent_set(iec, EINA_TRUE);
}
static void
-_e_comp_wl_input_thread_send_mouse_out(E_Input_Thread_Client *iec, int timestamp)
+_e_comp_wl_input_thread_send_mouse_out(E_Comp_Wl_Seat *seat, E_Input_Thread_Client *iec, int timestamp)
{
- struct wl_resource *res;
struct wl_client *wc;
- Eina_List *l;
- uint32_t serial;
- E_Comp_Wl_Data *comp_wl;
+ struct wl_resource *surface;
if (!iec) return;
- struct wl_resource *surface = e_input_thread_client_wl_resource_get(iec);
+ surface = e_input_thread_client_wl_resource_get(iec);
if (!surface) return;
ELOGF("Mouse", "Out (time: %d, name:%20s)",
NULL, timestamp,
e_input_thread_client_util_name_get(iec));
- comp_wl = e_comp_wl_get();
- if (!eina_list_count(comp_wl->ptr.resources)) return;
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return;
wc = wl_resource_get_client(surface);
- serial = wl_display_next_serial(comp_wl->wl.disp);
- EINA_LIST_FOREACH(comp_wl->ptr.resources, l, res)
- {
- if (!e_comp_wl_input_pointer_check(res)) continue;
- if (wl_resource_get_client(res) != wc) continue;
- if (e_input_thread_client_pointer_enter_sent_get(iec) == EINA_FALSE) continue;
-
- wl_pointer_send_leave(res, serial, surface);
-
- e_input_thread_client_pointer_enter_sent_set(iec, EINA_FALSE);
- }
+ e_comp_wl_seat_pointer_send_leave(seat, wc, NULL, surface);
+ e_input_thread_client_pointer_enter_sent_set(iec, EINA_FALSE);
}
static void
-_e_comp_wl_input_thread_check_mouse_out(E_Input_Thread_Client *hit_iec, int timestamp)
+_e_comp_wl_input_thread_check_mouse_out(E_Comp_Wl_Seat *seat, E_Input_Thread_Client *hit_iec, int timestamp)
{
E_Input_Thread_Client *iec = NULL;
for (iec = e_input_thread_client_top_get(); iec; iec = e_input_thread_client_below_get(iec))
{
- if (e_input_thread_client_mouse_in_get(iec) && iec != hit_iec)
+ if (e_input_thread_client_zone_id_get(iec) == 0 && e_input_thread_client_mouse_in_get(iec) && iec != hit_iec)
{
// send leave
- _e_comp_wl_input_thread_send_mouse_out(iec, timestamp);
+ _e_comp_wl_input_thread_send_mouse_out(seat, iec, timestamp);
e_input_thread_client_mouse_in_set(iec, EINA_FALSE);
break;
}
E_Input_Thread_Client *iec;
E_Comp_Config *comp_conf;
E_Device *dev = NULL;
- const char *dev_name;
+ const char *dev_name, *seat_name;
Ecore_Device_Class dev_class;
int client_x = 0, client_y = 0;
E_Comp_Wl_Data *comp_wl;
+ struct wl_resource *surface;
+ struct wl_client *wc;
+ E_Comp_Wl_Seat *seat;
comp_wl = e_comp_wl_get();
comp_wl->ptr.x = wl_fixed_from_int(ev->x);
if (!e_input_pointer_thread_mode_get()) return ECORE_CALLBACK_RENEW;
+ comp_conf = e_comp_config_get();
+
iec = _e_comp_wl_input_thread_client_under_pointer(ev->x, ev->y);
+ if (comp_conf && comp_conf->input_log_enable)
+ ELOGF("Mouse", "Move. cursor under pointer iec: %p", NULL, iec);
if (!iec)
return ECORE_CALLBACK_RENEW;
- struct wl_resource *surface = e_input_thread_client_wl_resource_get(iec);
+ surface = e_input_thread_client_wl_resource_get(iec);
if (!surface)
{
ELOGF("Mouse", "Move. surface NULL", NULL);
dev = (E_Device *)ev->dev;
dev_name = e_device_name_get(dev);
dev_class = e_device_class_get(dev);
+ seat_name = e_device_seatname_get(dev);
+ seat = e_comp_wl_input_seat_get(seat_name);
- comp_conf = e_comp_config_get();
if (comp_conf && comp_conf->input_log_enable)
- ELOGF("Mouse", "Move (time: %d, output(%d, %d), name:%20s) (dev:%s, device class:%d)",
+ ELOGF("Mouse", "Move (time: %d, x:%d, y:%d), (name:%20s) (dev:%s, class:%d, seat:%s)",
NULL, ev->timestamp, ev->x, ev->y,
- e_input_thread_client_util_name_get(iec), dev_name, dev_class);
+ e_input_thread_client_util_name_get(iec), dev_name, dev_class, seat_name);
if (e_input_backend_mouse_printing_needed())
e_input_backend_mouse_timestamp_append(ev->timestamp);
e_input_thread_client_geometry_get(iec, &client_x, &client_y, NULL, NULL);
// send mouse-out event
- _e_comp_wl_input_thread_check_mouse_out(iec, ev->timestamp);
+ _e_comp_wl_input_thread_check_mouse_out(seat, iec, ev->timestamp);
- if (!e_input_thread_client_mouse_in_get(iec))
+ if (e_input_thread_client_mouse_in_get(iec) && !e_input_thread_client_mouse_in_get(iec))
{
e_input_thread_client_mouse_in_set(iec, EINA_TRUE);
// send mouse-in event
- _e_comp_wl_input_thread_send_mouse_in(iec, ev->x, ev->y, client_x, client_y, ev->timestamp);
+ _e_comp_wl_input_thread_send_mouse_in(seat, iec, ev->x, ev->y, client_x, client_y, ev->timestamp);
}
- // send mouse move event
- e_comp_wl_surface_send_mouse_move(comp_wl, surface, ev->x, ev->y, client_x, client_y, ev->timestamp);
-
e_input_thread_client_geometry_get(iec, &client_x, &client_y, NULL, NULL);
+ // send mouse move event
if (dev && (dev_class == ECORE_DEVICE_CLASS_TOUCH))
{
if (!comp_wl->drag_client)
{
_e_comp_wl_device_input_thread_send_event_device(iec, dev, ev->timestamp);
- e_comp_wl_surface_send_touch_move(comp_wl, surface, 0, ev->x, ev->y, client_x, client_y, ev->timestamp);
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_touch_send_motion(seat, wc, 0, ev->x - client_x, ev->y - client_y, ev->timestamp);
}
}
{
_e_comp_wl_device_input_thread_send_event_device(iec, dev, ev->timestamp);
- e_comp_wl_surface_send_mouse_move(comp_wl, surface, ev->x, ev->y, client_x, client_y, ev->timestamp);
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_pointer_send_motion(seat, wc, ev->x - client_x, ev->y - client_y, ev->timestamp);
}
e_pointer_mouse_move(e_comp_pointer_get(), ev->x, ev->y);
return ECORE_CALLBACK_RENEW;
}
+static uint32_t
+_e_comp_wl_input_thread_button_convert(uint32_t button_id)
+{
+ uint32_t btn;
+ switch (button_id)
+ {
+ case 1: btn = BTN_LEFT; break;
+ case 2: btn = BTN_MIDDLE; break;
+ case 3: btn = BTN_RIGHT; break;
+ default: btn = button_id; break;
+ }
+ return btn;
+}
+
static Eina_Bool
_e_comp_wl_cb_mouse_button_down_thread_mode(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
{
Ecore_Event_Mouse_Button *ev = event;
E_Device *dev = NULL;
- const char *dev_name = NULL;;
- Ecore_Device_Class device_class;
+ const char *dev_name = NULL, *seat_name;
+ Ecore_Device_Class dev_class;
E_Input_Thread_Client *iec = NULL;
int client_x = 0, client_y = 0;
struct wl_resource *surface = NULL;
E_Comp_Wl_Data *comp_wl;
+ struct wl_client *wc;
+ E_Comp_Wl_Seat *seat;
+ uint32_t btn;
- ELOGF("Mouse", "E Event Mouse Down (time: %d, x:%d y:%d), fixed(%d, %d)", NULL, ev->timestamp, ev->x, ev->y, wl_fixed_from_int(ev->x), wl_fixed_from_int(ev->y));
+ ELOGF("Mouse", "E Event Mouse Down (time: %d, x:%d y:%d)", NULL, ev->timestamp, ev->x, ev->y);
if (!e_input_pointer_thread_mode_get()) return ECORE_CALLBACK_RENEW;
iec = _e_comp_wl_input_thread_client_under_pointer(ev->x, ev->y);
+ ELOGF("Mouse", "Down. cursor under pointer iec: %p", NULL, iec);
if (!iec)
return ECORE_CALLBACK_RENEW;
// send device data
dev = (E_Device *)ev->dev;
dev_name = e_device_name_get(dev);
+ dev_class = e_device_class_get(dev);
+ seat_name = e_device_seatname_get(dev);
+ seat = e_comp_wl_input_seat_get(seat_name);
- device_class = e_device_class_get(dev);
-
- ELOGF("Mouse", "Down (button: %d, time: %d, x:%d, y:%d, fixed_x: %d, fixed_y: %d) (dev:%s)",
- NULL, ev->buttons, ev->timestamp, ev->x, ev->y, wl_fixed_from_int(ev->x), wl_fixed_from_int(ev->y),
- dev_name);
+ ELOGF("Mouse", "Down (button: %d, time: %d, x:%d, y:%d) (name:%20s) (dev:%s, class:%d, seat:%s)",
+ NULL, ev->buttons, ev->timestamp, ev->x, ev->y,
+ e_input_thread_client_util_name_get(iec), dev_name, dev_class, seat_name);
if (e_input_backend_mouse_printing_needed())
e_input_backend_mouse_timestamp_append(ev->timestamp);
_e_comp_wl_device_input_thread_send_event_device(iec, dev, ev->timestamp);
comp_wl = e_comp_wl_get();
- if (dev && device_class == ECORE_DEVICE_CLASS_TOUCH)
+ if (dev && dev_class == ECORE_DEVICE_CLASS_TOUCH)
{
if (dev_name)
- e_comp_wl_surface_device_renew_axis(dev_name, device_class,
+ e_comp_wl_surface_device_renew_axis(dev_name, dev_class,
surface, 0, ev->x, ev->y, ev->multi.pressure, ev->multi.angle);
- e_comp_wl_surface_handle_mouse_button_to_touch(comp_wl, surface, ev->timestamp, ev->x, ev->y, client_x, client_y, EINA_TRUE);
+ comp_wl->ptr.button = BTN_LEFT;
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_touch_send_downup(seat, wc, surface, 0, ev->x - client_x, ev->y - client_y, ev->timestamp, EINA_TRUE);
e_pointer_touch_move(e_comp_pointer_get(), ev->x, ev->y);
}
else
{
- ELOGF("Mouse", "button(%d)", NULL, ev->buttons);
- e_comp_wl_surface_mouse_button_send(comp_wl, surface, ev->timestamp, ev->buttons, WL_POINTER_BUTTON_STATE_PRESSED);
+ btn = _e_comp_wl_input_thread_button_convert(ev->buttons);
+ comp_wl->ptr.button = btn;
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_pointer_send_button(seat, wc, btn, WL_POINTER_BUTTON_STATE_PRESSED, ev->timestamp);
e_pointer_mouse_move(e_comp_pointer_get(), ev->x, ev->y);
}
{
Ecore_Event_Mouse_Button *ev = event;
E_Device *dev = NULL;
- const char *dev_name = NULL;
- Ecore_Device_Class device_class;
+ const char *dev_name = NULL, *seat_name;
+ Ecore_Device_Class dev_class;
E_Input_Thread_Client *iec = NULL;
struct wl_resource *surface;
int client_x = 0, client_y = 0;
E_Comp_Wl_Data *comp_wl;
+ struct wl_client *wc;
+ E_Comp_Wl_Seat *seat;
+ uint32_t btn;
if (!need_send_released)
{
need_send_motion = EINA_TRUE;
}
+ ELOGF("Mouse", "E Event Mouse Up (time: %d, x:%d y:%d)", NULL, ev->timestamp, ev->x, ev->y);
+
+ if (!e_input_pointer_thread_mode_get()) return ECORE_CALLBACK_RENEW;
+
dev = (E_Device *)ev->dev;
dev_name = e_device_name_get(dev);
- device_class = e_device_class_get(dev);
-
- ELOGF("Mouse", "Up (button: %d, time: %d, x:%d, y:%d) (dev:%s)",
- NULL, ev->buttons, ev->timestamp, ev->x, ev->y, dev_name);
+ dev_class = e_device_class_get(dev);
+ seat_name = e_device_seatname_get(dev);
+ seat = e_comp_wl_input_seat_get(seat_name);
comp_wl = e_comp_wl_get();
- if (dev && (device_class == EVAS_DEVICE_CLASS_TOUCH))
+ if (dev && (dev_class == ECORE_DEVICE_CLASS_TOUCH))
{
comp_wl->touch.pressed &= ~(1 << 0);
goto err;
}
+ ELOGF("Mouse", "Up (button: %d, time: %d, x:%d, y:%d) (name:%20s) (dev:%s, class:%d, seat:%s)",
+ NULL, ev->buttons, ev->timestamp, ev->x, ev->y,
+ e_input_thread_client_util_name_get(iec), dev_name, dev_class, seat_name);
+
if (e_input_backend_mouse_printing_needed())
e_input_backend_mouse_timestamp_append(ev->timestamp);
e_input_thread_client_geometry_get(iec, &client_x, &client_y, NULL, NULL);
- if (dev && (device_class == ECORE_DEVICE_CLASS_TOUCH))
+ if (dev && (dev_class == ECORE_DEVICE_CLASS_TOUCH))
{
if (dev_name)
- e_comp_wl_surface_device_handle_axes(dev_name, device_class,
+ e_comp_wl_surface_device_handle_axes(dev_name, dev_class,
surface, 0, ev->x, ev->y, ev->multi.pressure, ev->multi.angle);
- e_comp_wl_surface_handle_mouse_button_to_touch(comp_wl, surface, ev->timestamp, ev->x, ev->y, client_x, client_y, EINA_FALSE);
+ comp_wl->ptr.button = BTN_LEFT;
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_touch_send_downup(seat, wc, surface, 0, ev->x - client_x, ev->y - client_y, ev->timestamp, EINA_FALSE);
}
else
{
- e_comp_wl_surface_mouse_button_send(comp_wl, surface, ev->timestamp, ev->buttons,
- WL_POINTER_BUTTON_STATE_RELEASED);
+ btn = _e_comp_wl_input_thread_button_convert(ev->buttons);
+ comp_wl->ptr.button = btn;
+ wc = wl_resource_get_client(surface);
+ e_comp_wl_seat_pointer_send_button(seat, wc, btn, WL_POINTER_BUTTON_STATE_RELEASED, ev->timestamp);
+
}
need_send_released = EINA_FALSE;
}
comp_wl = e_comp_wl_get();
- if (!eina_list_count(comp_wl->ptr.resources))
- return ECORE_CALLBACK_RENEW;
+
+ if (e_comp_wl_input_seat_pointer_is_empty(NULL)) return ECORE_CALLBACK_RENEW;
if (e_input_backend_mouse_printing_needed())
e_input_backend_mouse_timestamp_append(ev->timestamp);
EINTERN void e_comp_wl_trace_serial_debug(Eina_Bool on);
-EINTERN void e_comp_wl_surface_send_mouse_move(E_Comp_Wl_Data *comp_wl, 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(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, uint32_t timestamp, uint32_t button_id, uint32_t state);
EINTERN void e_comp_wl_surface_mouse_wheel_send(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, int direction, int z, int timestamp);
EINTERN void e_comp_wl_surface_device_renew_axis(const char *dev_name, Evas_Device_Class dev_class, struct wl_resource *surface, unsigned int idx, double radius_x, double radius_y, double pressure, double angle);
EINTERN void e_comp_wl_surface_device_handle_axes(const char *dev_name, Ecore_Device_Class dev_class, struct wl_resource *surface, unsigned int idx, double radius_x, double radius_y, double pressure, double angle);
EINTERN void e_comp_wl_surface_handle_mouse_button_to_touch(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, uint32_t timestamp, int canvas_x, int canvas_y, int client_x, int client_y, Eina_Bool flag);
-EINTERN void e_comp_wl_surface_send_touch_move(E_Comp_Wl_Data *comp_wl, struct wl_resource *surface, int idx, int canvas_x, int canvas_y, int client_x, int client_y, uint32_t 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);
+EINTERN void e_comp_wl_seat_touch_send_motion(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ int idx, int x, int y, uint32_t timestamp);
+EINTERN void e_comp_wl_seat_touch_send_downup(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
+ Eina_Bool pressed);
+
+EINTERN void e_comp_wl_seat_pointer_send_motion(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ int x, int y, unsigned int timestamp);
+EINTERN void e_comp_wl_seat_pointer_send_enter(E_Comp_Wl_Seat *seat, struct wl_client *wc, E_Client *ec,
+ struct wl_resource *surface, int x, int y);
+EINTERN void e_comp_wl_seat_pointer_send_leave(E_Comp_Wl_Seat *seat, struct wl_client *wc, E_Client *ec,
+ struct wl_resource *surface);
+EINTERN void e_comp_wl_seat_pointer_send_button(E_Comp_Wl_Seat *seat, struct wl_client *wc,
+ uint32_t button, uint32_t state, uint32_t timestamp);
#endif
#include "e_devicemgr_intern.h"
#include "e_input_intern.h"
#include "e_comp_wl_intern.h"
+#include "e_comp_wl_input_intern.h"
#include "e_client_intern.h"
#include "e_privilege_intern.h"
#include "e_security.h"
E_Tizen_Devicemgr_User_Data *device_user_data;
struct wl_array axes;
E_Comp_Wl_Data *comp_wl;
+ E_Comp_Wl_Seat *seat;
+
+ seat = e_comp_wl_input_seat_get(dev->seat_name);
+ if (!seat)
+ {
+ DMERR("Could not find seat by seat_name(%s)", dev->seat_name);
+ return;
+ }
- /* TODO: find the seat corresponding to event */
comp_wl = e_comp_wl_get();
serial = wl_display_next_serial(comp_wl->wl.disp);
wl_array_init(&axes);
- EINA_LIST_FOREACH(comp_wl->seat.resources, l, seat_res)
+ EINA_LIST_FOREACH(seat->resources, l, seat_res)
{
wc = wl_resource_get_client(seat_res);
}
else
{
- EINA_LIST_FOREACH(comp_wl->seat.resources, l, seat_resource)
+ E_Comp_Wl_Seat *seat;
+ Eina_List *lll;
+ EINA_LIST_FOREACH(comp_wl->seats, lll, seat)
{
- wc = wl_resource_get_client(seat_resource);
-
- EINA_LIST_FOREACH(g_tizen_devicemgr->mgr_resources, ll, dev_mgr_resource)
+ EINA_LIST_FOREACH(seat->resources, l, seat_resource)
{
- if (!dev_mgr_resource) continue;
- if (wl_resource_get_client(dev_mgr_resource) != wc) continue;
- if (wl_resource_get_version(dev_mgr_resource) < 4) continue;
- tizen_input_device_manager_send_max_touch_count(dev_mgr_resource, serial, slot, seat_resource);
+ wc = wl_resource_get_client(seat_resource);
+
+ EINA_LIST_FOREACH(g_tizen_devicemgr->mgr_resources, ll, dev_mgr_resource)
+ {
+ if (!dev_mgr_resource) continue;
+ if (wl_resource_get_client(dev_mgr_resource) != wc) continue;
+ if (wl_resource_get_version(dev_mgr_resource) < 4) continue;
+ tizen_input_device_manager_send_max_touch_count(dev_mgr_resource, serial, slot, seat_resource);
+ }
}
}
}
g_tizen_devicemgr->mgr_resources = eina_list_append(g_tizen_devicemgr->mgr_resources, res);
comp_wl = e_comp_wl_get();
- EINA_LIST_FOREACH(comp_wl->seat.resources, l, seat_res)
+ E_Comp_Wl_Seat *seat;
+ Eina_List *lll;
+ EINA_LIST_FOREACH(comp_wl->seats, lll, seat)
{
- if (wl_resource_get_client(seat_res) != client) continue;
-
- wl_array_init(&axes);
- serial = wl_display_next_serial(comp_wl->wl.disp);
-
- if (e_devicemgr->max_touch_count > 0)
+ EINA_LIST_FOREACH(seat->resources, l, seat_res)
{
- e_devicemgr_wl_touch_max_count_send(e_devicemgr->max_touch_count, res, seat_res);
- }
+ if (wl_resource_get_client(seat_res) != client) continue;
- g_rec_mutex_lock(&e_devicemgr->device_list_mutex);
- EINA_LIST_FOREACH(e_devicemgr->device_list, ll, dev)
- {
- device_res = wl_resource_create(client, &tizen_input_device_interface, 1, 0);
- if (!device_res)
+ wl_array_init(&axes);
+ serial = wl_display_next_serial(comp_wl->wl.disp);
+
+ if (e_devicemgr->max_touch_count > 0)
{
- DMERR("Could not create tizen_input_device resource: %m");
- wl_client_post_no_memory(client);
- g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
- return;
+ e_devicemgr_wl_touch_max_count_send(e_devicemgr->max_touch_count, res, seat_res);
}
- device_user_data = E_NEW(E_Tizen_Devicemgr_User_Data, 1);
- if (!device_user_data)
+ g_rec_mutex_lock(&e_devicemgr->device_list_mutex);
+ EINA_LIST_FOREACH(e_devicemgr->device_list, ll, dev)
{
- DMERR("Failed to allocate memory for input device user data\n");
- wl_client_post_no_memory(client);
- wl_resource_destroy(device_res);
- g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
- return;
+ seat = e_comp_wl_input_seat_get(dev->seat_name);
+ if (!seat)
+ {
+ DMWRN("Could not find seat by seat_name(%s)", dev->seat_name);
+ continue;
+ }
+ device_res = wl_resource_create(client, &tizen_input_device_interface, 1, 0);
+ if (!device_res)
+ {
+ DMERR("Could not create tizen_input_device resource: %m");
+ wl_client_post_no_memory(client);
+ g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
+ return;
+ }
+
+ device_user_data = E_NEW(E_Tizen_Devicemgr_User_Data, 1);
+ if (!device_user_data)
+ {
+ DMERR("Failed to allocate memory for input device user data\n");
+ wl_client_post_no_memory(client);
+ wl_resource_destroy(device_res);
+ g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
+ return;
+ }
+
+ wl_resource_set_implementation(device_res, &_e_devicemgr_wl_device_interface, device_user_data,
+ _e_devicemgr_wl_device_cb_unbind);
+
+ device_user_data->dev = dev;
+ device_user_data->resource = device_res;
+
+ device_user_data->seat_res = seat_res;
+ device_user_data->seat_destroy_listener.notify =
+ _e_devicemgr_wl_device_cb_seat_destroy;
+ wl_resource_add_destroy_listener(seat_res, &device_user_data->seat_destroy_listener);
+
+ device_user_data->mgr_res = res;
+ device_user_data->manager_destroy_listener.notify =
+ _e_devicemgr_wl_device_cb_manager_destroy;
+ wl_resource_add_destroy_listener(res, &device_user_data->manager_destroy_listener);
+
+ dev->resources = eina_list_append(dev->resources, device_res);
+
+ tizen_input_device_manager_send_device_add(res, serial, dev->identifier, device_res, seat_res);
+ tizen_input_device_send_device_info(device_res, dev->name, dev->clas, dev->subclas, &axes);
}
-
- wl_resource_set_implementation(device_res, &_e_devicemgr_wl_device_interface, device_user_data,
- _e_devicemgr_wl_device_cb_unbind);
-
- device_user_data->dev = dev;
- device_user_data->resource = device_res;
-
- device_user_data->seat_res = seat_res;
- device_user_data->seat_destroy_listener.notify =
- _e_devicemgr_wl_device_cb_seat_destroy;
- wl_resource_add_destroy_listener(seat_res, &device_user_data->seat_destroy_listener);
-
- device_user_data->mgr_res = res;
- device_user_data->manager_destroy_listener.notify =
- _e_devicemgr_wl_device_cb_manager_destroy;
- wl_resource_add_destroy_listener(res, &device_user_data->manager_destroy_listener);
-
- dev->resources = eina_list_append(dev->resources, device_res);
-
- tizen_input_device_manager_send_device_add(res, serial, dev->identifier, device_res, seat_res);
- tizen_input_device_send_device_info(device_res, dev->name, dev->clas, dev->subclas, &axes);
- }
- g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
- }
+ g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
+ }
+ }
}
E_Tizen_Devicemgr *
#include "e_pointer_intern.h"
#include "e_input_device_intern.h"
#include "e_comp_wl_intern.h"
+#include "e_comp_wl_input_intern.h"
#include "e_client_intern.h"
#include "e_comp_canvas.h"
#include "e_comp_wl_intern.h"
e_pointer_view_set(E_Pointer *ptr, E_View_Client *view_client, int x, int y)
{
Eina_Bool need_call_hide = EINA_FALSE;
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
EINA_SAFETY_ON_NULL_RETURN(ptr);
/* don't show cursor if in hidden mode */
- if ((!e_config->show_cursor) || (!comp_wl->ptr.enabled))
+ if ((!e_config->show_cursor) || (!e_comp_wl_input_seat_pointer_enabled_get(NULL)))
{
if (ptr->view_client && _e_pointer_view_hide(ptr, ptr->view_client))
_e_pointer_hook_call(E_POINTER_HOOK_HIDE, ptr);
static struct wl_resource *
_volume_wl_touch_resource_get(void)
{
- Eina_List *l;
+ Eina_List *l, *ll;
struct wl_client *wc;
struct wl_resource *res;
E_Comp_Wl_Data *comp_wl;
+ E_Comp_Wl_Seat *seat;
+
E_Comp_Wl_Client_Data *volume_cdata = e_client_cdata_get(_volume_ec);
if (_volume_wl_touch) goto end;
wc = wl_resource_get_client(volume_cdata->surface);
comp_wl = e_comp_wl_get();
- EINA_LIST_FOREACH(comp_wl->touch.resources, l, res)
+ EINA_LIST_FOREACH(comp_wl->seats, l, seat)
{
- if (wl_resource_get_client(res) != wc) continue;
+ EINA_LIST_FOREACH(seat->touch.resources, ll, res)
+ {
+ if (wl_resource_get_client(res) != wc) continue;
- _volume_wl_touch = res;
- goto end;
+ _volume_wl_touch = res;
+ goto end;
+ }
}
end:
typedef struct _E_Comp_Wl_Output E_Comp_Wl_Output;
typedef struct _E_Comp_Wl_Intercept_Hook E_Comp_Wl_Intercept_Hook;
typedef struct _E_Comp_Wl_Pointer_Constraint E_Comp_Wl_Pointer_Constraint;
+typedef struct _E_Comp_Wl_Seat E_Comp_Wl_Seat;
typedef enum _E_Comp_Wl_Buffer_Type
{
struct
{
- Eina_List *resources;
+ E_DEPRECATED Eina_List *resources;
wl_fixed_t x, y;
wl_fixed_t grab_x, grab_y;
uint32_t button;
Ecore_Timer *hide_tmr;
E_Client *ec;
- Eina_Bool enabled : 1;
- unsigned int num_devices;
+ E_DEPRECATED Eina_Bool enabled : 1;
+ E_DEPRECATED unsigned int num_devices;
} ptr;
struct
struct
{
- Eina_List *resources;
- Eina_Bool enabled : 1;
- unsigned int num_devices;
+ Eina_List *resources;
+ E_DEPRECATED Eina_Bool enabled : 1;
+ E_DEPRECATED unsigned int num_devices;
unsigned int pressed;
E_Client *faked_ec;
E_Client *frame_ec;
struct wl_global *global;
struct wl_resource *resource;
} im;
- } seat;
+ } E_DEPRECATED seat;
+ Eina_List *seats;
struct
{
void *data;
};
+struct _E_Comp_Wl_Seat
+{
+ struct wl_global *global;
+ Eina_List *resources;
+ uint32_t version;
+ char *name;
+ struct
+ {
+ Eina_List *resources;
+ Eina_Bool enabled : 1;
+ unsigned int num_devices;
+ } ptr;
+
+ struct
+ {
+ Eina_List *resources;
+ Eina_Bool enabled : 1;
+ unsigned int num_devices;
+ } touch;
+};
+
struct _E_Comp_Wl_Hook
{
EINA_INLIST;