} Ecore_Wl2_Window_Keygrab_Info;
//
-// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
-typedef struct _Ecore_Wl2_Event_Tizen_Device_Info
-{
- Ecore_Wl2_Display *display;
- const char *name;
- const char *identifier;
- const char *seatname;
- Efl_Input_Device_Type clas;
- Efl_Input_Device_Subtype subclas;
-} Ecore_Wl2_Event_Tizen_Device_Info;
-
-typedef struct _Ecore_Wl2_Event_Tizen_Input_Device_Info
-{
- Eo *dev;
- const char *name;
- const char *identifier;
- int window_id;
-} Ecore_Wl2_Event_Tizen_Input_Device_Info;
-//
-
typedef void (*Ecore_Wl2_Bind_Cb)(struct wl_client *client, void *data, uint32_t version, uint32_t id);
typedef void (*Ecore_Wl2_Unbind_Cb)(struct wl_resource *resource);
typedef void (*Ecore_Wl2_Frame_Cb)(Ecore_Wl2_Window *win, uint32_t timestamp, void *data);
EAPI extern int ECORE_WL2_EVENT_INDICATOR_FLICK;
EAPI extern int ECORE_WL2_EVENT_CLIPBOARD_DATA_SELECTED;
//
-// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
-EAPI extern int ECORE_WL2_EVENT_TIZEN_DEVICE_ADD;
-EAPI extern int ECORE_WL2_EVENT_TIZEN_DEVICE_DEL;
-EAPI extern int ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED;
-EAPI extern int ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED;
-//
/**
* @file
EAPI int ECORE_WL2_EVENT_INDICATOR_FLICK = 0;
EAPI int ECORE_WL2_EVENT_CLIPBOARD_DATA_SELECTED = 0;
//
-// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
-EAPI int ECORE_WL2_EVENT_TIZEN_DEVICE_ADD = 0;
-EAPI int ECORE_WL2_EVENT_TIZEN_DEVICE_DEL = 0;
-EAPI int ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED = 0;
-EAPI int ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED = 0;
-//
EAPI int _ecore_wl2_event_window_www = -1;
EAPI int _ecore_wl2_event_window_www_drag = -1;
ECORE_WL2_EVENT_INDICATOR_FLICK = ecore_event_type_new();
ECORE_WL2_EVENT_CLIPBOARD_DATA_SELECTED = ecore_event_type_new();
//
- // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- ECORE_WL2_EVENT_TIZEN_DEVICE_ADD = ecore_event_type_new();
- ECORE_WL2_EVENT_TIZEN_DEVICE_DEL = ecore_event_type_new();
- ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED = ecore_event_type_new();
- ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED = ecore_event_type_new();
- //
}
if (!no_session_recovery)
no_session_recovery = !!getenv("EFL_NO_WAYLAND_SESSION_RECOVERY");
ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM,
ECORE_WL2_EVENT_INDICATOR_FLICK,
ECORE_WL2_EVENT_CLIPBOARD_DATA_SELECTED,
- ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE,
- // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
- ECORE_WL2_EVENT_TIZEN_DEVICE_ADD,
- ECORE_WL2_EVENT_TIZEN_DEVICE_DEL,
- ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_ADDED,
- ECORE_WL2_EVENT_TIZEN_INPUT_DEVICE_REMOVED);
- //
+ ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE);
/* shutdown Ecore_Event */
ecore_event_shutdown();
static void
_ecore_wl2_input_device_info_free(void *data EINA_UNUSED, void *ev)
{
- Ecore_Wl2_Event_Tizen_Device_Info *e;
+ Ecore_Event_Device_Info *e;
e = ev;
eina_stringshare_del(e->name);
}
void
-_ecore_wl2_input_device_info_send(Ecore_Wl2_Display *dpy, const char *name, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas, Eina_Bool flag)
+_ecore_wl2_input_device_info_send(Ecore_Window win_id, const char *name, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas, Eina_Bool flag)
{
- Ecore_Wl2_Event_Tizen_Device_Info *e;
+ Ecore_Event_Device_Info *e;
- if (!(e = calloc(1, sizeof(Ecore_Wl2_Event_Tizen_Device_Info)))) return;
+ if (!(e = calloc(1, sizeof(Ecore_Event_Device_Info)))) return;
- e->display = dpy;
+ e->window = win_id;
e->name = eina_stringshare_add(name);
e->identifier = eina_stringshare_add(identifier);
e->seatname = eina_stringshare_add(name);
e->subclas = subclas;
if (flag)
- ecore_event_add(ECORE_WL2_EVENT_TIZEN_DEVICE_ADD, e, _ecore_wl2_input_device_info_free, NULL);
+ ecore_event_add(ECORE_EVENT_DEVICE_ADD, e, _ecore_wl2_input_device_info_free, NULL);
else
- ecore_event_add(ECORE_WL2_EVENT_TIZEN_DEVICE_DEL, e, _ecore_wl2_input_device_info_free, NULL);
+ ecore_event_add(ECORE_EVENT_DEVICE_DEL, e, _ecore_wl2_input_device_info_free, NULL);
}
-static void
+static Eina_Bool
_ecore_wl2_input_device_ecore_device_add(Ecore_Wl2_Tizen_Input_Device *dev)
{
Ecore_Device *ecdev;
Eina_List *l;
const char *ecdev_name;
- if (!dev->identifier) return;
+ if (!dev->identifier) return EINA_FALSE;
EINA_LIST_FOREACH((Eina_List *)ecore_device_list(), l, ecdev)
{
ecdev_name = ecore_device_identifier_get(ecdev);
if (!ecdev_name) continue;
if ((ecore_device_class_get(ecdev) == dev->clas) && (!strcmp(ecdev_name, dev->identifier)))
- return;
+ return EINA_FALSE;
}
ecdev = ecore_device_add();
if (!ecdev)
{
ERR("Failed to add ecore device for name: %s (%s)\n", dev->name, dev->identifier);
- return;
+ return EINA_FALSE;
}
ecore_device_name_set(ecdev, dev->name);
ecore_device_identifier_set(ecdev, dev->identifier);
ecore_device_subclass_set(ecdev, dev->subclas);
dev->device = efl_ref(ecdev);
+
+ return EINA_TRUE;
}
-static void
+static Eina_Bool
_ecore_wl2_input_device_ecore_device_remove(Ecore_Wl2_Tizen_Input_Device *dev)
{
Ecore_Device *ecdev;
const Eina_List *l;
const char *ecdev_name;
- if (!dev->identifier) return;
+ if (!dev->identifier) return EINA_FALSE;
EINA_LIST_FOREACH(ecore_device_list(), l, ecdev)
{
{
ecore_device_del(ecdev);
dev->device = NULL;
- return;
+ return EINA_TRUE;
}
}
+
+ return EINA_FALSE;
}
static void
_ecore_wl2_input_device_info_broadcast(Ecore_Wl2_Tizen_Input_Device *dev, Eina_Bool flag)
{
+ Eina_Hash *windows = NULL;
+ Eina_Iterator *itr;
+ Ecore_Wl2_Window *win = NULL;
+ void *data;
+ Eina_Bool res, has_win = EINA_FALSE;
+
if (!dev) return;
if (!dev->name) return;
if (!dev->input || !dev->input->display) return;
- _ecore_wl2_input_device_info_send(dev->input->display, dev->name, dev->identifier, dev->clas, dev->subclas, flag);
-
if (flag)
- _ecore_wl2_input_device_ecore_device_add(dev);
+ res = _ecore_wl2_input_device_ecore_device_add(dev);
else
- _ecore_wl2_input_device_ecore_device_remove(dev);
+ res = _ecore_wl2_input_device_ecore_device_remove(dev);
+
+ if (!res) return;
+
+ windows = _ecore_wl2_window_hash_get();
+ if (windows)
+ {
+ itr = eina_hash_iterator_data_new(windows);
+ while (eina_iterator_next(itr, &data))
+ {
+ win = data;
+ has_win = EINA_TRUE;
+ _ecore_wl2_input_device_info_send(win->id, dev->name, dev->identifier, dev->clas, dev->subclas, flag);
+ }
+
+ eina_iterator_free(itr);
+ }
+ if (!has_win)
+ {
+ _ecore_wl2_input_device_info_send((uintptr_t)NULL, dev->name, dev->identifier, dev->clas, dev->subclas, flag);
+ }
}
+void
+_ecore_wl2_input_devices_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *win)
+{
+ Eina_List *l;
+ Ecore_Wl2_Tizen_Input_Device *dev;
+
+ if (!input) return;
+
+ EINA_LIST_FOREACH(input->devmgr.devices, l, dev)
+ {
+ _ecore_wl2_input_device_info_send(win->id, dev->name, dev->identifier, dev->clas, dev->subclas, EINA_TRUE);
+ }
+}
+
+
static void
_ecore_wl2_input_device_cb_device_info(void *data, struct tizen_input_device *tizen_input_device EINA_UNUSED, const char *name, uint32_t clas, uint32_t subclas, struct wl_array *axes EINA_UNUSED)
{
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
void _ecore_wl2_input_device_manager_setup(Ecore_Wl2_Display *ewd, unsigned int id, unsigned int version);
//
+void _ecore_wl2_input_devices_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *win);
//TIZEN_ONLY(20171115): support output transform
void _ecore_wl2_window_ignore_output_transform_set(Ecore_Wl2_Window *window, Eina_Bool ignore);
void _ecore_wl2_window_init(void);
void _ecore_wl2_window_shutdown(void);
//
+Eina_Hash *_ecore_wl2_window_hash_get(void);
EAPI extern int _ecore_wl2_event_window_www;
EAPI extern int _ecore_wl2_event_window_www_drag;
_windows = NULL;
}
+Eina_Hash *
+_ecore_wl2_window_hash_get(void)
+{
+ return _windows;
+}
+
static char *
_ecore_wl2_window_id_str_get(int win_id)
{
eina_hash_add(_windows, _ecore_wl2_window_id_str_get(win->id), win);
//
+ _ecore_wl2_input_devices_send(ecore_wl2_input_default_input_get(display), win);
+
return win;
}
static Eina_Bool
_ecore_evas_wl_common_cb_tizen_device_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
- Ecore_Wl2_Event_Tizen_Device_Info *ev;
+ Ecore_Event_Device_Info *ev;
+ Ecore_Wl2_Window *win = NULL;
+ Ecore_Wl2_Display *display = NULL;
Ecore_Evas *ee;
Eina_List *l;
ev = event;
+ if (ev->window) win = ecore_wl2_window_find(ev->window);
+ if (win) display = ecore_wl2_window_display_get(win);
EINA_LIST_FOREACH(ee_list, l, ee)
{
Evas_Device *device, *seat;
wdata = ee->engine.data;
- if (ev->display != wdata->display) continue;
+ if (display != wdata->display) continue;
if (_ecore_evas_wl_common_evas_device_find(ee->evas, ev->identifier)) continue;
seat = _ecore_evas_wl_common_default_seat_get(ee->evas);
static Eina_Bool
_ecore_evas_wl_common_cb_tizen_device_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
- Ecore_Wl2_Event_Tizen_Device_Info *ev;
+ Ecore_Event_Device_Info *ev;
+ Ecore_Wl2_Window *win = NULL;
+ Ecore_Wl2_Display *display = NULL;
Ecore_Evas *ee;
Eina_List *list, *l, *ll, *ll_next;
ev = event;
+ if (ev->window) win = ecore_wl2_window_find(ev->window);
+ if (win) display = ecore_wl2_window_display_get(win);
EINA_LIST_FOREACH(ee_list, l, ee)
{
Evas_Device *device;
wdata = ee->engine.data;
- if (ev->display != wdata->display) continue;
+ if (display != wdata->display) continue;
list = (Eina_List *)evas_device_list(ee->evas, NULL);
EINA_LIST_FOREACH_SAFE(list, ll, ll_next, device)
//
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
h =
- ecore_event_handler_add(ECORE_WL2_EVENT_TIZEN_DEVICE_ADD,
+ ecore_event_handler_add(ECORE_EVENT_DEVICE_ADD,
_ecore_evas_wl_common_cb_tizen_device_add, NULL);
eina_array_push(_ecore_evas_wl_event_hdls, h);
h =
- ecore_event_handler_add(ECORE_WL2_EVENT_TIZEN_DEVICE_DEL,
+ ecore_event_handler_add(ECORE_EVENT_DEVICE_DEL,
_ecore_evas_wl_common_cb_tizen_device_del, NULL);
eina_array_push(_ecore_evas_wl_event_hdls, h);
//