From 6bb56b3f5651fab85b1a0a1a1a8040f4e488c799 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 28 Jul 2017 15:44:43 -0400 Subject: [PATCH] ecore-wl2: implement support for aux hints this is a direct copy of a feature from tizen git with no modifications other than what was required for compilation and functionality https://review.tizen.org/git/?p=platform/upstream/efl.git;a=commitdiff_plain;h=01e72b7e3484ece4b589f95315990ba2c366c231 https://review.tizen.org/git/?p=platform/upstream/efl.git;a=commitdiff;h=670d84b579f248ae0e3df48e9953fe8128da9468 fix T5780 @feature --- src/Makefile_Ecore_Wl2.am | 4 + src/Makefile_Wayland_Protocols.am | 1 + src/lib/ecore_wl2/Ecore_Wl2.h | 19 ++- src/lib/ecore_wl2/ecore_wl2.c | 6 + src/lib/ecore_wl2/ecore_wl2_display.c | 141 ++++++++++++++++++ src/lib/ecore_wl2/ecore_wl2_private.h | 4 +- src/lib/ecore_wl2/ecore_wl2_window.c | 115 +++++--------- .../wayland/ecore_evas_wayland_common.c | 67 ++++++++- src/wayland_protocol/efl-aux-hints.xml | 39 +++++ 9 files changed, 319 insertions(+), 77 deletions(-) create mode 100644 src/wayland_protocol/efl-aux-hints.xml diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am index 414c20e3b5..7f3eb2f007 100644 --- a/src/Makefile_Ecore_Wl2.am +++ b/src/Makefile_Ecore_Wl2.am @@ -18,6 +18,8 @@ lib/ecore_wl2/ecore_wl2.c \ lib/ecore_wl2/ecore_wl2_private.h nodist_lib_ecore_wl2_libecore_wl2_la_SOURCES = \ +lib/ecore_wl2/efl-aux-hints-protocol.c \ +lib/ecore_wl2/efl-aux-hints-client-protocol.h \ lib/ecore_wl2/teamwork-protocol.c \ lib/ecore_wl2/teamwork-client-protocol.h \ lib/ecore_wl2/session-recovery-client-protocol.h \ @@ -39,6 +41,8 @@ lib_ecore_wl2_libecore_wl2_la_DEPENDENCIES = @ECORE_WL2_INTERNAL_LIBS@ lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ BUILT_SOURCES += \ +lib/ecore_wl2/efl-aux-hints-protocol.c \ +lib/ecore_wl2/efl-aux-hints-client-protocol.h \ lib/ecore_wl2/www-client-protocol.h \ lib/ecore_wl2/www-protocol.c \ lib/ecore_wl2/teamwork-protocol.c \ diff --git a/src/Makefile_Wayland_Protocols.am b/src/Makefile_Wayland_Protocols.am index 27c0e68c91..56544a2a30 100644 --- a/src/Makefile_Wayland_Protocols.am +++ b/src/Makefile_Wayland_Protocols.am @@ -1,4 +1,5 @@ EXTRA_DIST2 += \ +wayland_protocol/aux-hints.xml \ wayland_protocol/session-recovery.xml \ wayland_protocol/teamwork.xml \ wayland_protocol/www.xml diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 7b4857f95c..81084e1975 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -44,7 +44,6 @@ typedef struct _Ecore_Wl2_Pointer Ecore_Wl2_Pointer; typedef struct _Ecore_Wl2_Keyboard Ecore_Wl2_Keyboard; typedef struct _Ecore_Wl2_Touch Ecore_Wl2_Touch; typedef struct _Ecore_Wl2_Offer Ecore_Wl2_Offer; -typedef struct _Ecore_Wl2_Aux_Hint Ecore_Wl2_Aux_Hint; /* matches protocol values */ typedef enum @@ -335,8 +334,24 @@ typedef struct _Ecore_Wl2_Event_Aux_Hint_Allowed { unsigned int win; int id; + Ecore_Wl2_Display *display; } Ecore_Wl2_Event_Aux_Hint_Allowed; +typedef struct _Ecore_Wl2_Event_Aux_Hint_Supported +{ + unsigned int win; + Ecore_Wl2_Display *display; +} Ecore_Wl2_Event_Aux_Hint_Supported; + +typedef struct Ecore_Wl2_Event_Aux_Message +{ + unsigned int win; + Eina_Stringshare *key; + Eina_Stringshare *val; + Eina_List *options; + Ecore_Wl2_Display *display; +} Ecore_Wl2_Event_Aux_Message; + 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); @@ -374,6 +389,8 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE_DONE; /** @since EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_AUX_HINT_ALLOWED; /** @since 1.20 */ +EAPI extern int ECORE_WL2_EVENT_AUX_HINT_SUPPORTED; /** @since 1.20 */ +EAPI extern int ECORE_WL2_EVENT_AUX_MESSAGE; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_WINDOW_SHOW; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */ EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */ diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c index a4dd62eb80..645012f4e4 100644 --- a/src/lib/ecore_wl2/ecore_wl2.c +++ b/src/lib/ecore_wl2/ecore_wl2.c @@ -46,6 +46,8 @@ EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE_DONE = 0; EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = 0; EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = 0; EAPI int ECORE_WL2_EVENT_AUX_HINT_ALLOWED = 0; +EAPI int ECORE_WL2_EVENT_AUX_HINT_SUPPORTED = 0; +EAPI int ECORE_WL2_EVENT_AUX_MESSAGE = 0; EAPI int ECORE_WL2_EVENT_WINDOW_SHOW = 0; EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0; EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0; @@ -126,6 +128,8 @@ ecore_wl2_init(void) ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = ecore_event_type_new(); ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = ecore_event_type_new(); ECORE_WL2_EVENT_AUX_HINT_ALLOWED = ecore_event_type_new(); + ECORE_WL2_EVENT_AUX_HINT_SUPPORTED = ecore_event_type_new(); + ECORE_WL2_EVENT_AUX_MESSAGE = ecore_event_type_new(); ECORE_WL2_EVENT_WINDOW_SHOW = ecore_event_type_new(); ECORE_WL2_EVENT_WINDOW_HIDE = ecore_event_type_new(); ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new(); @@ -194,6 +198,8 @@ ecore_wl2_shutdown(void) ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST, ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE, ECORE_WL2_EVENT_AUX_HINT_ALLOWED, + ECORE_WL2_EVENT_AUX_HINT_SUPPORTED, + ECORE_WL2_EVENT_AUX_MESSAGE, ECORE_WL2_EVENT_WINDOW_SHOW, ECORE_WL2_EVENT_WINDOW_HIDE, ECORE_WL2_EVENT_WINDOW_ACTIVATE, diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index 94fdd56c82..f1699ecbad 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -94,6 +94,136 @@ static const struct zwp_e_session_recovery_listener _session_listener = _session_recovery_create_uuid, }; +static void +_aux_hints_supported_aux_hints(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, struct wl_array *hints, uint32_t num_hints) +{ + Ecore_Wl2_Display *ewd = data; + struct wl_surface *surface = surface_resource; + Ecore_Wl2_Window *win = NULL; + char *p = NULL; + char **str = NULL; + const char *hint = NULL; + unsigned int i = 0; + Ecore_Wl2_Event_Aux_Hint_Supported *ev; + + if (!surface) return; + win = _ecore_wl2_display_window_surface_find(ewd, surface_resource); + if (!win) return; + + p = hints->data; + str = calloc(num_hints, sizeof(char *)); + if (!str) return; + + while ((const char *)p < ((const char *)hints->data + hints->size)) + { + str[i] = (char *)eina_stringshare_add(p); + p += strlen(p) + 1; + i++; + } + for (i = 0; i < num_hints; i++) + { + hint = eina_stringshare_add(str[i]); + win->supported_aux_hints = + eina_list_append(win->supported_aux_hints, hint); + } + if (str) + { + for (i = 0; i < num_hints; i++) + { + if (str[i]) + { + eina_stringshare_del(str[i]); + str[i] = NULL; + } + } + free(str); + } + + if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Hint_Supported)))) return; + ev->win = win->id; + ev->display = ewd; + ewd->refs++; + ecore_event_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED, ev, _display_event_free, NULL); +} + +static void +_aux_hints_allowed_aux_hint(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, int id) +{ + struct wl_surface *surface = surface_resource; + Ecore_Wl2_Window *win = NULL; + Ecore_Wl2_Display *ewd = data; + Ecore_Wl2_Event_Aux_Hint_Allowed *ev; + + if (!surface) return; + win = _ecore_wl2_display_window_surface_find(ewd, surface_resource); + if (!win) return; + + if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Hint_Allowed)))) return; + ev->win = win->id; + ev->id = id; + ev->display = ewd; + ewd->refs++; + ecore_event_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED, ev, _display_event_free, NULL); +} + + static void +_cb_aux_message_free(void *data EINA_UNUSED, void *event) +{ + Ecore_Wl2_Event_Aux_Message *ev; + char *str; + + ev = event; + ecore_wl2_display_disconnect(ev->display); + eina_stringshare_del(ev->key); + eina_stringshare_del(ev->val); + EINA_LIST_FREE(ev->options, str) + eina_stringshare_del(str); + free(ev); +} + + static void +_aux_hints_aux_message(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, const char *key, const char *val, struct wl_array *options) +{ + Ecore_Wl2_Window *win = NULL; + Ecore_Wl2_Event_Aux_Message *ev; + char *p = NULL, *str = NULL; + Eina_List *opt_list = NULL; + Ecore_Wl2_Display *ewd = data; + + if (!surface_resource) return; + win = _ecore_wl2_display_window_surface_find(ewd, surface_resource); + if (!win) return; + + if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Message)))) return; + + if ((options) && (options->size)) + { + p = options->data; + while ((const char *)p < ((const char *)options->data + options->size)) + { + str = (char *)eina_stringshare_add(p); + opt_list = eina_list_append(opt_list, str); + p += strlen(p) + 1; + } + } + + ev->win = win->id; + ev->key = eina_stringshare_add(key); + ev->val = eina_stringshare_add(val); + ev->options = opt_list; + ev->display = ewd; + ewd->refs++; + + ecore_event_add(ECORE_WL2_EVENT_AUX_MESSAGE, ev, _cb_aux_message_free, NULL); +} + +static const struct efl_aux_hints_listener _aux_hints_listener = +{ + _aux_hints_supported_aux_hints, + _aux_hints_allowed_aux_hint, + _aux_hints_aux_message, +}; + static void _cb_global_event_free(void *data EINA_UNUSED, void *event) { @@ -186,6 +316,16 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const zwp_e_session_recovery_add_listener(ewd->wl.session_recovery, &_session_listener, ewd); } + else if (!strcmp(interface, "efl_aux_hints")) + { + Ecore_Wl2_Window *window; + ewd->wl.efl_aux_hints = + wl_registry_bind(registry, id, + &efl_aux_hints_interface, 1); + efl_aux_hints_add_listener(ewd->wl.efl_aux_hints, &_aux_hints_listener, ewd); + EINA_INLIST_FOREACH(ewd->windows, window) + if (window->surface) efl_aux_hints_get_supported_aux_hints(ewd->wl.efl_aux_hints, window->surface); + } else if (!strcmp(interface, "zwp_teamwork")) { ewd->wl.teamwork = @@ -296,6 +436,7 @@ _ecore_wl2_display_globals_cleanup(Ecore_Wl2_Display *ewd) if (ewd->wl.compositor) wl_compositor_destroy(ewd->wl.compositor); if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor); if (ewd->wl.dmabuf) zwp_linux_dmabuf_v1_destroy(ewd->wl.dmabuf); + if (ewd->wl.efl_aux_hints) efl_aux_hints_destroy(ewd->wl.efl_aux_hints); if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry); } diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index ba74ba31b3..2bdf0610e0 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -16,6 +16,7 @@ # include "session-recovery-client-protocol.h" # include "xdg-shell-unstable-v6-client-protocol.h" +# include "efl-aux-hints-client-protocol.h" extern int _ecore_wl2_log_dom; extern Eina_Bool no_session_recovery; @@ -93,6 +94,7 @@ struct _Ecore_Wl2_Display struct zxdg_shell_v6 *zxdg_shell; struct www *www; struct zwp_e_session_recovery *session_recovery; + struct efl_aux_hints *efl_aux_hints; struct zwp_teamwork *teamwork; int compositor_version; } wl; @@ -177,7 +179,7 @@ struct _Ecore_Wl2_Window Ecore_Wl2_Window_Type type; Eina_Inlist *subsurfs; - Eina_Inlist *supported_aux_hints; + Eina_List *supported_aux_hints; Eina_Bool moving : 1; Eina_Bool minimized : 1; diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index f16535fb22..0c48718770 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -555,17 +555,11 @@ _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window) window->surface_id = wl_proxy_get_id((struct wl_proxy *)window->surface); + if (window->display->wl.efl_aux_hints) + efl_aux_hints_get_supported_aux_hints(window->display->wl.efl_aux_hints, window->surface); } } -static void -_ecore_wl2_aux_hint_free(Ecore_Wl2_Aux_Hint *ehint) -{ - eina_stringshare_del(ehint->hint); - eina_stringshare_del(ehint->val); - free(ehint); -} - static void _ecore_wl2_window_show_send(Ecore_Wl2_Window *window) { @@ -708,13 +702,20 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window) window->configure_ack = NULL; } +void +_ecore_wl_window_aux_hint_free(Ecore_Wl2_Window *win) +{ + const char *supported; + EINA_LIST_FREE(win->supported_aux_hints, supported) + if (supported) eina_stringshare_del(supported); +} + EAPI void ecore_wl2_window_free(Ecore_Wl2_Window *window) { Ecore_Wl2_Display *display; Ecore_Wl2_Input *input; Ecore_Wl2_Subsurface *subsurf; - Ecore_Wl2_Aux_Hint *ehint; Eina_Inlist *tmp; EINA_SAFETY_ON_NULL_RETURN(window); @@ -727,8 +728,7 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window) EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf) _ecore_wl2_subsurf_free(subsurf); - EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint) - _ecore_wl2_aux_hint_free(ehint); + _ecore_wl_window_aux_hint_free(window); if (window->uuid && window->surface && window->display->wl.session_recovery) zwp_e_session_recovery_destroy_uuid(window->display->wl.session_recovery, @@ -1456,80 +1456,47 @@ ecore_wl2_window_rotation_change_done_send(Ecore_Wl2_Window *window, int rot, in } EAPI Eina_List * -ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *window) +ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *win) { - Eina_List *ret = NULL; - Ecore_Wl2_Aux_Hint *ehint; + Eina_List *res = NULL; + Eina_List *ll; + char *supported_hint = NULL; + const char *hint = NULL; - EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); + if (!win) return NULL; + if (!win->surface) return NULL; - EINA_INLIST_FOREACH(window->supported_aux_hints, ehint) - ret = eina_list_append(ret, eina_stringshare_add(ehint->val)); - - return ret; -} - -EAPI void -ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *window, int id, const char *hint, const char *val) -{ - Ecore_Wl2_Aux_Hint *ehint; - - EINA_SAFETY_ON_NULL_RETURN(window); - - ehint = calloc(1, sizeof(Ecore_Wl2_Aux_Hint)); - if (!ehint) return; - - ehint->id = id; - ehint->hint = eina_stringshare_add(hint); - ehint->val = eina_stringshare_add(val); - - window->supported_aux_hints = - eina_inlist_append(window->supported_aux_hints, EINA_INLIST_GET(ehint)); -} - -EAPI void -ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *window, int id, const char *val) -{ - Eina_Inlist *tmp; - Ecore_Wl2_Aux_Hint *ehint; - - EINA_SAFETY_ON_NULL_RETURN(window); - - EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint) + EINA_LIST_FOREACH(win->supported_aux_hints, ll, supported_hint) { - if (ehint->id == id) - { - eina_stringshare_replace(&ehint->val, val); - break; - } + hint = eina_stringshare_add(supported_hint); + res = eina_list_append(res, hint); } + return res; } EAPI void -ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *window, int id) +ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, const char *val) { - Eina_Inlist *tmp; - Ecore_Wl2_Aux_Hint *ehint; - - EINA_SAFETY_ON_NULL_RETURN(window); - - EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint) - { - if (ehint->id == id) - { - window->supported_aux_hints = - eina_inlist_remove(window->supported_aux_hints, - EINA_INLIST_GET(ehint)); - - eina_stringshare_del(ehint->hint); - eina_stringshare_del(ehint->val); - free(ehint); - - break; - } - } + if (!win) return; + if ((win->surface) && (win->display->wl.efl_aux_hints)) + efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val); } +EAPI void +ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val) +{ + if (!win) return; + if ((win->surface) && (win->display->wl.efl_aux_hints)) + efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val); +} + +EAPI void +ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *win, int id) +{ + if (!win) return; + if ((win->surface) && (win->display->wl.efl_aux_hints)) + efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id); +} EAPI void ecore_wl2_window_focus_skip_set(Ecore_Wl2_Window *window, Eina_Bool focus_skip) { diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 396ca75733..df0a6bafe1 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -28,7 +28,7 @@ struct _EE_Wl_Device /* local variables */ static int _ecore_evas_wl_init_count = 0; -static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[14]; +static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[20]; static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize); @@ -543,6 +543,53 @@ _ecore_evas_wl_common_cb_window_configure_complete(void *data EINA_UNUSED, int t return ECORE_CALLBACK_PASS_ON; } + static Eina_Bool +_ecore_evas_wl_common_cb_aux_hint_supported(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl2_Event_Aux_Hint_Supported *ev; + Eina_Stringshare *hint; + Ecore_Evas_Engine_Wl_Data *wdata; + + ev = event; + ee = ecore_event_window_match(ev->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + wdata = ee->engine.data; + EINA_LIST_FREE(ee->prop.aux_hint.supported_list, hint) eina_stringshare_del(hint); + ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); + return ECORE_CALLBACK_RENEW; +} + + static Eina_Bool +_ecore_evas_wl_common_cb_aux_hint_allowed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl2_Event_Aux_Hint_Allowed *ev; + Eina_List *l; + Ecore_Evas_Aux_Hint *aux; + + ev = event; + ee = ecore_event_window_match(ev->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + EINA_LIST_FOREACH(ee->prop.aux_hint.hints, l, aux) + { + if (aux->id == ev->id) + { + aux->allowed = 1; + if (!aux->notified) + { + _ecore_evas_wl_common_state_update(ee); + aux->notified = 1; + } + break; + } + } + return ECORE_CALLBACK_PASS_ON; +} + static Eina_Bool _ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { @@ -1080,6 +1127,12 @@ _ecore_evas_wl_common_init(void) _ecore_evas_wl_event_hdls[13] = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, _ecore_evas_wl_common_cb_window_rotate, NULL); + _ecore_evas_wl_event_hdls[14] = + ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED, + _ecore_evas_wl_common_cb_aux_hint_allowed, NULL); + _ecore_evas_wl_event_hdls[15] = + ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED, + _ecore_evas_wl_common_cb_aux_hint_supported, NULL); ecore_event_evas_init(); @@ -1309,6 +1362,18 @@ _ecore_evas_wl_common_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Inpu ecore_wl2_input_pointer_xy_get(input, x, y); } + void +_ecore_evas_wl_common_aux_hints_supported_update(Ecore_Evas *ee) +{ + Ecore_Evas_Engine_Wl_Data *wdata; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + wdata = ee->engine.data; + ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); +} + static void _ecore_evas_wl_common_raise(Ecore_Evas *ee) { diff --git a/src/wayland_protocol/efl-aux-hints.xml b/src/wayland_protocol/efl-aux-hints.xml new file mode 100644 index 0000000000..442285a13f --- /dev/null +++ b/src/wayland_protocol/efl-aux-hints.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +