a new E_Pointer (cursor) is created when a seat is added.
Find a current seat from (mouse/touch) evas events and send events to the seat
and update the position of the seat's cursor.
Change-Id: I13665f4bf7146480b73c7d890ff86cc57eb5c409
#include "e_display_intern.h"
#include "e_policy_zone_intern.h"
#include "e_comp_canvas_intern.h"
+#include "e_pointer_intern.h"
#include <sys/xattr.h>
#include <sys/types.h>
return e_comp->pointer;
}
+EINTERN void
+e_comp_pointer_set(E_Pointer *pointer)
+{
+ EINA_SAFETY_ON_NULL_RETURN(e_comp);
+ EINA_SAFETY_ON_NULL_RETURN(pointer);
+
+ if(e_comp->pointer == pointer) return;
+
+ INF("Changed pointer from %s -> %s", e_comp->pointer ? e_pointer_name_get(e_comp->pointer) : "NULL",
+ e_pointer_name_get(pointer));
+ e_comp->pointer = pointer;
+}
+
E_API E_Comp_Screen *
e_comp_screen_get(void)
{
EINTERN void e_comp_canvas_render_delayed_unset(E_Comp *comp);
+EINTERN void e_comp_pointer_set(E_Pointer *pointer);
+
#endif
e_comp_wl->ptr.x = wl_fixed_from_int(ptr_x);
e_comp_wl->ptr.y = wl_fixed_from_int(ptr_y);
- e_pointer_mouse_move(e_comp->pointer, ptr_x, ptr_y);
+ e_pointer_mouse_move(e_comp_pointer_get(), ptr_x, ptr_y);
}
}
_e_comp_screen_cb_input_device_add(void *data, int type, void *event)
{
Ecore_Event_Device_Info *e;
- E_Comp *comp = data;
E_Seat *seat;
+ E_Pointer *comp_pointer;
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_seat_find(e->seatname);
if (!seat) goto end;
+ comp_pointer = e_pointer_find(e->seatname);
if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
{
if (e_seat_pointer_device_count(seat) == 0)
{
- e_pointer_view_set(comp->pointer, NULL, 0, 0);
+ e_pointer_view_set(comp_pointer, NULL, 0, 0);
e_seat_pointer_enabled_set(seat, EINA_TRUE);
}
_e_comp_screen_cb_input_device_del(void *data, int type, void *event)
{
Ecore_Event_Device_Info *e;
- E_Comp *comp = data;
E_Seat *seat;
+ E_Pointer *comp_pointer;
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_seat_find(e->seatname);
if (!seat) goto end;
+ comp_pointer = e_pointer_find(e->seatname);
if (e->clas == ECORE_DEVICE_CLASS_MOUSE)
{
if (e_seat_pointer_device_count(seat) == 0)
{
e_seat_pointer_enabled_set(seat, EINA_FALSE);
- e_pointer_view_set(comp->pointer, NULL, 0, 0);
- e_pointer_hide(comp->pointer);
+ e_pointer_view_set(comp_pointer, NULL, 0, 0);
+ e_pointer_hide(comp_pointer);
_e_comp_screen_pointer_renew(seat);
}
evas_event_feed_mouse_in(comp->evas, 0, NULL);
e_main_ts_begin("\tE_Pointer New");
- if ((comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE)))
+ if ((comp->pointer = e_pointer_canvas_new("default", EINA_TRUE)))
{
e_pointer_hide(comp->pointer);
}
}
static void
-_e_comp_wl_device_send_event_device(E_Comp_Wl_Data *comp_wl, E_Client *ec, Evas_Device *dev, uint32_t timestamp)
+_e_comp_wl_device_send_event_device(E_Comp_Wl_Data *comp_wl, E_Client *ec, const Evas_Device *dev, uint32_t timestamp)
{
E_Devicemgr_Input_Device *last_device, *ec_last_device, *input_dev;
struct wl_resource *dev_res;
struct wl_client *wc;
E_Client *prev_ptr_ec;
E_Comp_Wl_Data *comp_wl;
+ const Evas_Device *dev = NULL, *seat_dev;
+ const char *dev_name, *seat_name;
+ E_Seat *seat;
ev = event;
comp_wl = e_comp_wl_get();
comp_wl->ptr.ec = ec;
- ELOGF("Mouse", "In (obj: %p, time: %d, canvas(%d, %d) output(%d, %d), name:%20s)",
+ dev = ev->dev;
+ dev_name = evas_device_description_get(dev);
+ seat_dev = evas_device_parent_get(dev);
+ seat_name = evas_device_name_get(seat_dev);
+ seat = e_seat_find(seat_name);
+ e_seat_current_set(seat);
+
+ ELOGF("Mouse", "In (obj: %p, time: %d, canvas(%d, %d) output(%d, %d), name:%20s) (dev:%s, seat:%s)",
ec, obj, ev->timestamp, ev->canvas.x, ev->canvas.y, ev->output.x, ev->output.y,
- e_client_util_name_get(ec));
+ e_client_util_name_get(ec), dev_name, seat_name);
if (_e_comp_wl_check_cursor_timer_needed(ec))
{
{
E_Client *ec;
Evas_Event_Mouse_Move *ev;
- Evas_Device *dev = NULL;
- const char *dev_name;
+ const Evas_Device *dev = NULL, *seat_dev;
+ const char *dev_name, *seat_name;
E_Comp_Config *comp_conf;
Evas_Device_Class dev_class;
struct wl_resource *surface;
E_Comp_Wl_Data *comp_wl;
+ E_Seat *seat;
+ E_Pointer *pointer;
ev = event;
comp_wl = e_comp_wl_get();
dev = ev->dev;
dev_name = evas_device_description_get(dev);
dev_class = evas_device_class_get(dev);
+ seat_dev = evas_device_parent_get(dev);
+ seat_name = evas_device_name_get(seat_dev);
+ seat = e_seat_find(seat_name);
+ e_seat_current_set(seat);
+ pointer = e_pointer_find(seat_name);
+ e_comp_pointer_set(pointer);
comp_conf = e_comp_config_get();
if (comp_conf && comp_conf->input_log_enable)
- ELOGF("Mouse", "Move (obj: %p, time: %d, canvas(%d, %d), output(%d, %d), name:%20s) (dev:%s)",
+ ELOGF("Mouse", "Move (obj: %p, time: %d, canvas(%d, %d), output(%d, %d), name:%20s) (dev:%s, seat:%s)",
ec, obj, ev->timestamp, ev->cur.canvas.x, ev->cur.canvas.y, ev->cur.output.x, ev->cur.output.y,
- e_client_util_name_get(ec), dev_name);
+ e_client_util_name_get(ec), dev_name, seat_name);
if (e_input_backend_mouse_printing_needed())
e_input_backend_mouse_timestamp_append(ev->timestamp);
_e_comp_wl_send_touch_move(comp_wl, ec, 0, ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp);
}
}
-
e_pointer_touch_move(e_comp_pointer_get(), ev->cur.output.x, ev->cur.output.y);
}
else
{
E_Client *ec;
Evas_Event_Mouse_Down *ev;
- Evas_Device *dev = NULL;
- const Evas_Device *seat_dev;
+ const Evas_Device *dev = NULL, *seat_dev;
const char *dev_name, *seat_name;
Evas_Device_Class dev_class;
E_Comp_Wl_Data *comp_wl;
+ E_Seat *seat;
+ E_Pointer *pointer;
if (!(ec = data)) return;
if (e_object_is_del(E_OBJECT(ec))) return;
dev = ev->dev;
dev_name = evas_device_description_get(dev);
-
+ dev_class = evas_device_class_get(dev);
seat_dev = evas_device_parent_get(dev);
seat_name = evas_device_name_get(seat_dev);
- dev_class = evas_device_class_get(dev);
+ seat = e_seat_find(seat_name);
+ e_seat_current_set(seat);
+ pointer = e_pointer_find(seat_name);
+ e_comp_pointer_set(pointer);
ELOGF("Mouse", "Down (obj: %p, button: %d, time: %d, x:%d, y:%d, name:%20s) (dev:%s, seat:%s)",
ec, obj, ev->button, ev->timestamp, ev->output.x, ev->output.y, e_client_util_name_get(ec),
{
ERR("Seat added. name: %s identifier: %s, seatname: %s", e->name, e->identifier, e->seatname);
e_seat_create(e->name);
+ e_pointer_canvas_new(e->name, EINA_TRUE);
}
end:
e_comp_wl_input_init(void)
{
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
+ E_Seat *seat;
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);
- e_seat_create("default");
+ seat = e_seat_create("default");
+ e_seat_current_set(seat);
/* create the global resource for relative pointer */
comp_wl->relative_ptr.global =
struct wl_resource *surface;
struct wl_client *wc;
E_Seat *seat;
+ E_Pointer *pointer;
comp_wl = e_comp_wl_get();
comp_wl->ptr.x = wl_fixed_from_int(ev->x);
dev_class = e_device_class_get(dev);
seat_name = e_device_seatname_get(dev);
seat = e_seat_find(seat_name);
+ pointer = e_pointer_find(seat_name);
if (comp_conf && comp_conf->input_log_enable)
ELOGF("Mouse", "Move (time: %d, x:%d, y:%d), (name:%20s) (dev:%s, class:%d, seat:%s)",
}
}
- e_pointer_touch_move(e_comp_pointer_get(), ev->x, ev->y);
+ e_pointer_touch_move(pointer, ev->x, ev->y);
}
else
{
e_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);
+ e_pointer_mouse_move(pointer, ev->x, ev->y);
}
err:
struct wl_client *wc;
E_Seat *seat;
uint32_t btn;
+ E_Pointer *pointer;
ELOGF("Mouse", "E Event Mouse Down (time: %d, x:%d y:%d)", NULL, ev->timestamp, ev->x, ev->y);
dev_class = e_device_class_get(dev);
seat_name = e_device_seatname_get(dev);
seat = e_seat_find(seat_name);
+ pointer = e_pointer_find(seat_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,
wc = wl_resource_get_client(surface);
e_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);
+ e_pointer_touch_move(pointer, ev->x, ev->y);
comp_wl->touch.pressed |= (1 << 0);
}
wc = wl_resource_get_client(surface);
e_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);
+ e_pointer_mouse_move(pointer, ev->x, ev->y);
}
need_send_released = EINA_TRUE;
static Eina_List *_ecore_event_handlers = NULL;
static Eina_List *_seats = NULL;
+static E_Seat *_current_seat = NULL;
static void
_e_seat_cb_pointer_unbind(struct wl_resource *resource)
E_Client *ec;
Eina_Bool got_mouse = EINA_FALSE;
struct wl_resource *surface;
- E_Pointer *comp_pointer = e_comp_pointer_get();
+ E_Pointer *comp_pointer;
E_Seat *seat;
seat = wl_resource_get_user_data(resource);
if (!seat) return;
+ comp_pointer = e_pointer_find(e_seat_name_get(seat));
+ e_comp_pointer_set(comp_pointer);
E_Input_Thread_Request_EClient_Data ec_data;
memset(&ec_data, 0, sizeof(E_Input_Thread_Request_EClient_Data));
_seats = eina_list_remove(_seats, seat);
wl_global_destroy(seat->global);
+
+ E_FREE(seat);
}
EINTERN E_Zone *
e_seat_touch_send_motion(E_Seat *seat, struct wl_client *wc,
int idx, int x, int y, uint32_t timestamp)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ EINA_LIST_FOREACH(s->touch.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_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(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->touch.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_touch_check(res)) continue;
-
- wl_touch_send_motion(res, timestamp, idx, wl_fixed_from_int(x), wl_fixed_from_int(y));
- }
- }
}
EINTERN void
struct wl_resource *surface, int idx, int x, int y, uint32_t timestamp,
Eina_Bool pressed)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
uint32_t serial;
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
serial = wl_display_next_serial(comp_wl->wl.disp);
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ EINA_LIST_FOREACH(s->touch.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_touch_check(res)) continue;
TRACE_INPUT_END();
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->touch.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_touch_check(res)) continue;
-
- TRACE_INPUT_BEGIN(e_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_seat_touch_send_cancel(E_Seat *seat, struct wl_client *wc, E_Client *ec)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ EINA_LIST_FOREACH(s->touch.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_touch_check(res)) continue;
wl_touch_send_cancel(res);
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->touch.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_touch_check(res)) continue;
-
- ELOGF("Touch", "Cancel name:%20s", ec, ec ? e_client_util_name_get(ec) : "Unknown");
-
- wl_touch_send_cancel(res);
- }
- }
}
EINTERN void
e_seat_touch_send_frame(E_Seat *seat, struct wl_client *wc)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->touch.resources, l, res)
+ EINA_LIST_FOREACH(s->touch.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_touch_check(res)) continue;
wl_touch_send_frame(res);
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->touch.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_touch_check(res)) continue;
- wl_touch_send_frame(res);
- }
- }
}
EINTERN void
EINTERN Eina_Bool
e_seat_touch_is_empty(E_Seat *seat)
{
- Eina_List *l = NULL;
+ E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- if (!eina_list_count(seat->touch.resources)) return EINA_TRUE;
+ if (!eina_list_count(s->touch.resources)) return EINA_TRUE;
return EINA_FALSE;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, seat)
- {
- if (eina_list_count(seat->touch.resources))
- return EINA_FALSE;
- }
- return EINA_TRUE;
}
EINTERN Eina_Bool
e_seat_pointer_send_motion(E_Seat *seat, struct wl_client *wc,
int x, int y, uint32_t timestamp)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ EINA_LIST_FOREACH(s->ptr.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_pointer_check(res)) continue;
wl_fixed_from_int(y));
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->ptr.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_pointer_check(res)) continue;
-
- wl_pointer_send_motion(res, timestamp,
- wl_fixed_from_int(x),
- wl_fixed_from_int(y));
- }
- }
}
EINTERN void
e_seat_pointer_send_enter(E_Seat *seat, struct wl_client *wc, E_Client *ec,
struct wl_resource *surface, int x, int y)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
uint32_t serial;
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
serial = wl_display_next_serial(comp_wl->wl.disp);
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ EINA_LIST_FOREACH(s->ptr.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_pointer_check(res)) continue;
ec->pointer_enter_sent = EINA_TRUE;
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->ptr.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_pointer_check(res)) continue;
-
- TRACE_INPUT_BEGIN(e_seat_pointer_send_enter);
- ELOGF("Mouse", "Enter (x:%d, y:%d)", NULL, x, y);
- wl_pointer_send_enter(res, serial, surface,
- wl_fixed_from_int(x), wl_fixed_from_int(y));
- TRACE_INPUT_END();
-
- if (ec)
- ec->pointer_enter_sent = EINA_TRUE;
- }
- }
}
EINTERN void
e_seat_pointer_send_leave(E_Seat *seat, struct wl_client *wc, E_Client *ec,
struct wl_resource *surface)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
uint32_t serial;
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
serial = wl_display_next_serial(comp_wl->wl.disp);
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ EINA_LIST_FOREACH(s->ptr.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_pointer_check(res)) continue;
ec->pointer_enter_sent = EINA_FALSE;
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->ptr.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_pointer_check(res)) continue;
- if (ec && ec->pointer_enter_sent == EINA_FALSE) continue;
-
- TRACE_INPUT_BEGIN(e_seat_pointer_send_leave);
- ELOGF("Mouse", "Leave", NULL);
- wl_pointer_send_leave(res, serial, surface);
- TRACE_INPUT_END();
-
- if (ec)
- ec->pointer_enter_sent = EINA_FALSE;
- }
- }
}
EINTERN void
e_seat_pointer_send_button(E_Seat *seat, struct wl_client *wc,
uint32_t button, uint32_t state, uint32_t timestamp)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
uint32_t serial;
E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
serial = wl_display_next_serial(comp_wl->wl.disp);
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ EINA_LIST_FOREACH(s->ptr.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_pointer_check(res)) continue;
TRACE_INPUT_END();
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->ptr.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_pointer_check(res)) continue;
-
- TRACE_INPUT_BEGIN(e_seat_pointer_send_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();
- }
- }
}
EINTERN void
e_seat_pointer_send_axis(E_Seat *seat, struct wl_client *wc,
uint32_t axis, uint32_t dir, uint32_t timestamp)
{
- Eina_List *l, *ll;
+ Eina_List *l;
struct wl_resource *res;
E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- EINA_LIST_FOREACH(seat->ptr.resources, l, res)
+ EINA_LIST_FOREACH(s->ptr.resources, l, res)
{
if (wl_resource_get_client(res) != wc) continue;
if (!e_seat_pointer_check(res)) continue;
wl_pointer_send_axis(res, timestamp, axis, dir);
}
return;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, s)
- {
- EINA_LIST_FOREACH(s->ptr.resources, ll, res)
- {
- if (wl_resource_get_client(res) != wc) continue;
- if (!e_seat_pointer_check(res)) continue;
-
- wl_pointer_send_axis(res, timestamp, axis, dir);
- }
- }
}
EINTERN void
EINTERN Eina_Bool
e_seat_pointer_enabled_get(E_Seat *seat)
{
- Eina_List *l = NULL;
- if (!seat) goto iterate;
+ E_Seat *s;
- if (seat->ptr.enabled) return EINA_TRUE;
+ if (!seat) s = _current_seat;
+ else s = seat;
- return EINA_FALSE;
+ if (s->ptr.enabled) return EINA_TRUE;
-iterate:
- EINA_LIST_FOREACH(_seats, l, seat)
- {
- if (seat->ptr.enabled) return EINA_TRUE;
- }
return EINA_FALSE;
}
EINTERN Eina_Bool
e_seat_pointer_is_empty(E_Seat *seat)
{
- Eina_List *l = NULL;
+ E_Seat *s;
- if (!seat) goto iterate;
+ if (!seat) s = _current_seat;
+ else s = seat;
- if (!eina_list_count(seat->ptr.resources)) return EINA_TRUE;
+ if (!eina_list_count(s->ptr.resources)) return EINA_TRUE;
return EINA_FALSE;
-
-iterate:
- EINA_LIST_FOREACH(_seats, l, seat)
- {
- if (eina_list_count(seat->ptr.resources))
- return EINA_FALSE;
- }
- return EINA_TRUE;
}
EINTERN Eina_Bool
{
return seat->resources;
}
+
+EINTERN void
+e_seat_current_set(E_Seat *seat)
+{
+ EINA_SAFETY_ON_NULL_RETURN(seat);
+ if (_current_seat == seat) return;
+
+ INF("Changed current seat from %s -> %s", _current_seat ? _current_seat->name : "NULL", seat->name);
+ _current_seat = seat;
+}
+
+EINTERN E_Seat *
+e_seat_current_get()
+{
+ return _current_seat;
+}
+
+EINTERN const char *
+e_seat_name_get(E_Seat *seat)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL);
+
+ return seat->name;
+}
EINTERN Eina_Bool e_seat_keyboard_check(struct wl_resource *res);
EINTERN Eina_List *e_seat_resources_get(E_Seat *seat);
+EINTERN void e_seat_current_set(E_Seat *seat);
+EINTERN E_Seat *e_seat_current_get();
+EINTERN const char *e_seat_name_get(E_Seat *seat);
#endif // E_SEAT_INTERN_H
static void
_e_pointer_cb_free(E_Pointer *ptr)
{
+ E_FREE(ptr->name);
+
_e_pointer_view_set(ptr, NULL);
_ptrs = eina_list_remove(_ptrs, ptr);
}
EINTERN E_Pointer *
-e_pointer_canvas_new(Ecore_Evas *ee, Eina_Bool filled)
+e_pointer_canvas_new(const char *name, Eina_Bool filled)
{
E_Pointer *ptr = NULL;
E_Output *output = NULL;
- EINA_SAFETY_ON_FALSE_RETURN_VAL(ee, NULL);
if (!_initted) return NULL;
+ ptr = e_pointer_find(name);
+ if (ptr)
+ {
+ ERR("Pointer with name (%s) already exists.", name);
+ return NULL;
+ }
+
+ INF("Created Pointer with name (%s).", name);
+
/* allocate space for new pointer */
if (!(ptr = E_OBJECT_ALLOC(E_Pointer, E_POINTER_TYPE, _e_pointer_cb_free)))
return NULL;
/* set default pointer properties */
+ if (name)
+ ptr->name = strdup(name);
ptr->canvas = EINA_TRUE;
ptr->w = ptr->h = e_config->cursor_size;
ptr->e_cursor = e_config->use_e_cursor;
{
return _desk_zoom_enable;
}
+
+EINTERN E_Pointer *
+e_pointer_find(const char *name)
+{
+ const Eina_List *l;
+ E_Pointer *ptr;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
+
+ EINA_LIST_FOREACH(_ptrs, l, ptr)
+ {
+ if (ptr->name && !strcmp(ptr->name, name))
+ return ptr;
+ }
+
+ return NULL;
+}
+
+EINTERN const char *
+e_pointer_name_get(E_Pointer *ptr)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ptr, NULL);
+
+ return ptr->name;
+}
EINTERN int e_pointer_init(void);
EINTERN int e_pointer_shutdown(void);
-EINTERN E_Pointer *e_pointer_canvas_new(Ecore_Evas *ee, Eina_Bool filled);
+EINTERN E_Pointer *e_pointer_canvas_new(const char *name, Eina_Bool filled);
EINTERN void e_pointer_view_set(E_Pointer *ptr, E_View_Client *view, int x, int y);
EINTERN void e_pointer_touch_move(E_Pointer *ptr, int x, int y);
EINTERN E_Pointer *e_pointer_get(E_Client *ec);
EINTERN void e_pointer_hide(E_Pointer *ptr);
+EINTERN E_Pointer *e_pointer_find(const char *name);
+EINTERN const char *e_pointer_name_get(E_Pointer *ptr);
#endif
} hot;
E_Pointer_Device device;
+ char *name;
Eina_Bool e_cursor : 1;
Eina_Bool canvas : 1;