summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-07-28 15:44:43 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-07-28 15:43:48 -0400
commit6bb56b3f5651fab85b1a0a1a1a8040f4e488c799 (patch)
treee0f3505bdf79022a9085c700f6e2e4f8a51360bc
parent6dc937d26c6bcddb42193907207b84ae1953a04c (diff)
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
-rw-r--r--src/Makefile_Ecore_Wl2.am4
-rw-r--r--src/Makefile_Wayland_Protocols.am1
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h19
-rw-r--r--src/lib/ecore_wl2/ecore_wl2.c6
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c141
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h4
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c105
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c67
-rw-r--r--src/wayland_protocol/efl-aux-hints.xml39
9 files changed, 314 insertions, 72 deletions
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 \
18lib/ecore_wl2/ecore_wl2_private.h 18lib/ecore_wl2/ecore_wl2_private.h
19 19
20nodist_lib_ecore_wl2_libecore_wl2_la_SOURCES = \ 20nodist_lib_ecore_wl2_libecore_wl2_la_SOURCES = \
21lib/ecore_wl2/efl-aux-hints-protocol.c \
22lib/ecore_wl2/efl-aux-hints-client-protocol.h \
21lib/ecore_wl2/teamwork-protocol.c \ 23lib/ecore_wl2/teamwork-protocol.c \
22lib/ecore_wl2/teamwork-client-protocol.h \ 24lib/ecore_wl2/teamwork-client-protocol.h \
23lib/ecore_wl2/session-recovery-client-protocol.h \ 25lib/ecore_wl2/session-recovery-client-protocol.h \
@@ -39,6 +41,8 @@ lib_ecore_wl2_libecore_wl2_la_DEPENDENCIES = @ECORE_WL2_INTERNAL_LIBS@
39lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ 41lib_ecore_wl2_libecore_wl2_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
40 42
41BUILT_SOURCES += \ 43BUILT_SOURCES += \
44lib/ecore_wl2/efl-aux-hints-protocol.c \
45lib/ecore_wl2/efl-aux-hints-client-protocol.h \
42 lib/ecore_wl2/www-client-protocol.h \ 46 lib/ecore_wl2/www-client-protocol.h \
43 lib/ecore_wl2/www-protocol.c \ 47 lib/ecore_wl2/www-protocol.c \
44 lib/ecore_wl2/teamwork-protocol.c \ 48 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 @@
1EXTRA_DIST2 += \ 1EXTRA_DIST2 += \
2wayland_protocol/aux-hints.xml \
2wayland_protocol/session-recovery.xml \ 3wayland_protocol/session-recovery.xml \
3wayland_protocol/teamwork.xml \ 4wayland_protocol/teamwork.xml \
4wayland_protocol/www.xml 5wayland_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;
44typedef struct _Ecore_Wl2_Keyboard Ecore_Wl2_Keyboard; 44typedef struct _Ecore_Wl2_Keyboard Ecore_Wl2_Keyboard;
45typedef struct _Ecore_Wl2_Touch Ecore_Wl2_Touch; 45typedef struct _Ecore_Wl2_Touch Ecore_Wl2_Touch;
46typedef struct _Ecore_Wl2_Offer Ecore_Wl2_Offer; 46typedef struct _Ecore_Wl2_Offer Ecore_Wl2_Offer;
47typedef struct _Ecore_Wl2_Aux_Hint Ecore_Wl2_Aux_Hint;
48 47
49/* matches protocol values */ 48/* matches protocol values */
50typedef enum 49typedef enum
@@ -335,8 +334,24 @@ typedef struct _Ecore_Wl2_Event_Aux_Hint_Allowed
335{ 334{
336 unsigned int win; 335 unsigned int win;
337 int id; 336 int id;
337 Ecore_Wl2_Display *display;
338} Ecore_Wl2_Event_Aux_Hint_Allowed; 338} Ecore_Wl2_Event_Aux_Hint_Allowed;
339 339
340typedef struct _Ecore_Wl2_Event_Aux_Hint_Supported
341{
342 unsigned int win;
343 Ecore_Wl2_Display *display;
344} Ecore_Wl2_Event_Aux_Hint_Supported;
345
346typedef struct Ecore_Wl2_Event_Aux_Message
347{
348 unsigned int win;
349 Eina_Stringshare *key;
350 Eina_Stringshare *val;
351 Eina_List *options;
352 Ecore_Wl2_Display *display;
353} Ecore_Wl2_Event_Aux_Message;
354
340typedef void (*Ecore_Wl2_Bind_Cb)(struct wl_client *client, void *data, uint32_t version, uint32_t id); 355typedef void (*Ecore_Wl2_Bind_Cb)(struct wl_client *client, void *data, uint32_t version, uint32_t id);
341typedef void (*Ecore_Wl2_Unbind_Cb)(struct wl_resource *resource); 356typedef void (*Ecore_Wl2_Unbind_Cb)(struct wl_resource *resource);
342 357
@@ -374,6 +389,8 @@ EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE_DONE; /** @since
374EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST; /** @since 1.20 */ 389EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST; /** @since 1.20 */
375EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE; /** @since 1.20 */ 390EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE; /** @since 1.20 */
376EAPI extern int ECORE_WL2_EVENT_AUX_HINT_ALLOWED; /** @since 1.20 */ 391EAPI extern int ECORE_WL2_EVENT_AUX_HINT_ALLOWED; /** @since 1.20 */
392EAPI extern int ECORE_WL2_EVENT_AUX_HINT_SUPPORTED; /** @since 1.20 */
393EAPI extern int ECORE_WL2_EVENT_AUX_MESSAGE; /** @since 1.20 */
377EAPI extern int ECORE_WL2_EVENT_WINDOW_SHOW; /** @since 1.20 */ 394EAPI extern int ECORE_WL2_EVENT_WINDOW_SHOW; /** @since 1.20 */
378EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */ 395EAPI extern int ECORE_WL2_EVENT_WINDOW_HIDE; /** @since 1.20 */
379EAPI extern int ECORE_WL2_EVENT_WINDOW_ACTIVATE; /** @since 1.20 */ 396EAPI 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;
46EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = 0; 46EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = 0;
47EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = 0; 47EAPI int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = 0;
48EAPI int ECORE_WL2_EVENT_AUX_HINT_ALLOWED = 0; 48EAPI int ECORE_WL2_EVENT_AUX_HINT_ALLOWED = 0;
49EAPI int ECORE_WL2_EVENT_AUX_HINT_SUPPORTED = 0;
50EAPI int ECORE_WL2_EVENT_AUX_MESSAGE = 0;
49EAPI int ECORE_WL2_EVENT_WINDOW_SHOW = 0; 51EAPI int ECORE_WL2_EVENT_WINDOW_SHOW = 0;
50EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0; 52EAPI int ECORE_WL2_EVENT_WINDOW_HIDE = 0;
51EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0; 53EAPI int ECORE_WL2_EVENT_WINDOW_ACTIVATE = 0;
@@ -126,6 +128,8 @@ ecore_wl2_init(void)
126 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = ecore_event_type_new(); 128 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST = ecore_event_type_new();
127 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = ecore_event_type_new(); 129 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE = ecore_event_type_new();
128 ECORE_WL2_EVENT_AUX_HINT_ALLOWED = ecore_event_type_new(); 130 ECORE_WL2_EVENT_AUX_HINT_ALLOWED = ecore_event_type_new();
131 ECORE_WL2_EVENT_AUX_HINT_SUPPORTED = ecore_event_type_new();
132 ECORE_WL2_EVENT_AUX_MESSAGE = ecore_event_type_new();
129 ECORE_WL2_EVENT_WINDOW_SHOW = ecore_event_type_new(); 133 ECORE_WL2_EVENT_WINDOW_SHOW = ecore_event_type_new();
130 ECORE_WL2_EVENT_WINDOW_HIDE = ecore_event_type_new(); 134 ECORE_WL2_EVENT_WINDOW_HIDE = ecore_event_type_new();
131 ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new(); 135 ECORE_WL2_EVENT_WINDOW_ACTIVATE = ecore_event_type_new();
@@ -194,6 +198,8 @@ ecore_wl2_shutdown(void)
194 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST, 198 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST,
195 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE, 199 ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE,
196 ECORE_WL2_EVENT_AUX_HINT_ALLOWED, 200 ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
201 ECORE_WL2_EVENT_AUX_HINT_SUPPORTED,
202 ECORE_WL2_EVENT_AUX_MESSAGE,
197 ECORE_WL2_EVENT_WINDOW_SHOW, 203 ECORE_WL2_EVENT_WINDOW_SHOW,
198 ECORE_WL2_EVENT_WINDOW_HIDE, 204 ECORE_WL2_EVENT_WINDOW_HIDE,
199 ECORE_WL2_EVENT_WINDOW_ACTIVATE, 205 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
@@ -95,6 +95,136 @@ static const struct zwp_e_session_recovery_listener _session_listener =
95}; 95};
96 96
97static void 97static void
98_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)
99{
100 Ecore_Wl2_Display *ewd = data;
101 struct wl_surface *surface = surface_resource;
102 Ecore_Wl2_Window *win = NULL;
103 char *p = NULL;
104 char **str = NULL;
105 const char *hint = NULL;
106 unsigned int i = 0;
107 Ecore_Wl2_Event_Aux_Hint_Supported *ev;
108
109 if (!surface) return;
110 win = _ecore_wl2_display_window_surface_find(ewd, surface_resource);
111 if (!win) return;
112
113 p = hints->data;
114 str = calloc(num_hints, sizeof(char *));
115 if (!str) return;
116
117 while ((const char *)p < ((const char *)hints->data + hints->size))
118 {
119 str[i] = (char *)eina_stringshare_add(p);
120 p += strlen(p) + 1;
121 i++;
122 }
123 for (i = 0; i < num_hints; i++)
124 {
125 hint = eina_stringshare_add(str[i]);
126 win->supported_aux_hints =
127 eina_list_append(win->supported_aux_hints, hint);
128 }
129 if (str)
130 {
131 for (i = 0; i < num_hints; i++)
132 {
133 if (str[i])
134 {
135 eina_stringshare_del(str[i]);
136 str[i] = NULL;
137 }
138 }
139 free(str);
140 }
141
142 if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Hint_Supported)))) return;
143 ev->win = win->id;
144 ev->display = ewd;
145 ewd->refs++;
146 ecore_event_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED, ev, _display_event_free, NULL);
147}
148
149static void
150_aux_hints_allowed_aux_hint(void *data, struct efl_aux_hints *aux_hints EINA_UNUSED, struct wl_surface *surface_resource, int id)
151{
152 struct wl_surface *surface = surface_resource;
153 Ecore_Wl2_Window *win = NULL;
154 Ecore_Wl2_Display *ewd = data;
155 Ecore_Wl2_Event_Aux_Hint_Allowed *ev;
156
157 if (!surface) return;
158 win = _ecore_wl2_display_window_surface_find(ewd, surface_resource);
159 if (!win) return;
160
161 if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Hint_Allowed)))) return;
162 ev->win = win->id;
163 ev->id = id;
164 ev->display = ewd;
165 ewd->refs++;
166 ecore_event_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED, ev, _display_event_free, NULL);
167}
168
169 static void
170_cb_aux_message_free(void *data EINA_UNUSED, void *event)
171{
172 Ecore_Wl2_Event_Aux_Message *ev;
173 char *str;
174
175 ev = event;
176 ecore_wl2_display_disconnect(ev->display);
177 eina_stringshare_del(ev->key);
178 eina_stringshare_del(ev->val);
179 EINA_LIST_FREE(ev->options, str)
180 eina_stringshare_del(str);
181 free(ev);
182}
183
184 static void
185_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)
186{
187 Ecore_Wl2_Window *win = NULL;
188 Ecore_Wl2_Event_Aux_Message *ev;
189 char *p = NULL, *str = NULL;
190 Eina_List *opt_list = NULL;
191 Ecore_Wl2_Display *ewd = data;
192
193 if (!surface_resource) return;
194 win = _ecore_wl2_display_window_surface_find(ewd, surface_resource);
195 if (!win) return;
196
197 if (!(ev = calloc(1, sizeof(Ecore_Wl2_Event_Aux_Message)))) return;
198
199 if ((options) && (options->size))
200 {
201 p = options->data;
202 while ((const char *)p < ((const char *)options->data + options->size))
203 {
204 str = (char *)eina_stringshare_add(p);
205 opt_list = eina_list_append(opt_list, str);
206 p += strlen(p) + 1;
207 }
208 }
209
210 ev->win = win->id;
211 ev->key = eina_stringshare_add(key);
212 ev->val = eina_stringshare_add(val);
213 ev->options = opt_list;
214 ev->display = ewd;
215 ewd->refs++;
216
217 ecore_event_add(ECORE_WL2_EVENT_AUX_MESSAGE, ev, _cb_aux_message_free, NULL);
218}
219
220static const struct efl_aux_hints_listener _aux_hints_listener =
221{
222 _aux_hints_supported_aux_hints,
223 _aux_hints_allowed_aux_hint,
224 _aux_hints_aux_message,
225};
226
227static void
98_cb_global_event_free(void *data EINA_UNUSED, void *event) 228_cb_global_event_free(void *data EINA_UNUSED, void *event)
99{ 229{
100 Ecore_Wl2_Event_Global *ev; 230 Ecore_Wl2_Event_Global *ev;
@@ -186,6 +316,16 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
186 zwp_e_session_recovery_add_listener(ewd->wl.session_recovery, 316 zwp_e_session_recovery_add_listener(ewd->wl.session_recovery,
187 &_session_listener, ewd); 317 &_session_listener, ewd);
188 } 318 }
319 else if (!strcmp(interface, "efl_aux_hints"))
320 {
321 Ecore_Wl2_Window *window;
322 ewd->wl.efl_aux_hints =
323 wl_registry_bind(registry, id,
324 &efl_aux_hints_interface, 1);
325 efl_aux_hints_add_listener(ewd->wl.efl_aux_hints, &_aux_hints_listener, ewd);
326 EINA_INLIST_FOREACH(ewd->windows, window)
327 if (window->surface) efl_aux_hints_get_supported_aux_hints(ewd->wl.efl_aux_hints, window->surface);
328 }
189 else if (!strcmp(interface, "zwp_teamwork")) 329 else if (!strcmp(interface, "zwp_teamwork"))
190 { 330 {
191 ewd->wl.teamwork = 331 ewd->wl.teamwork =
@@ -296,6 +436,7 @@ _ecore_wl2_display_globals_cleanup(Ecore_Wl2_Display *ewd)
296 if (ewd->wl.compositor) wl_compositor_destroy(ewd->wl.compositor); 436 if (ewd->wl.compositor) wl_compositor_destroy(ewd->wl.compositor);
297 if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor); 437 if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor);
298 if (ewd->wl.dmabuf) zwp_linux_dmabuf_v1_destroy(ewd->wl.dmabuf); 438 if (ewd->wl.dmabuf) zwp_linux_dmabuf_v1_destroy(ewd->wl.dmabuf);
439 if (ewd->wl.efl_aux_hints) efl_aux_hints_destroy(ewd->wl.efl_aux_hints);
299 440
300 if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry); 441 if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry);
301} 442}
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 @@
16# include "session-recovery-client-protocol.h" 16# include "session-recovery-client-protocol.h"
17 17
18# include "xdg-shell-unstable-v6-client-protocol.h" 18# include "xdg-shell-unstable-v6-client-protocol.h"
19# include "efl-aux-hints-client-protocol.h"
19 20
20extern int _ecore_wl2_log_dom; 21extern int _ecore_wl2_log_dom;
21extern Eina_Bool no_session_recovery; 22extern Eina_Bool no_session_recovery;
@@ -93,6 +94,7 @@ struct _Ecore_Wl2_Display
93 struct zxdg_shell_v6 *zxdg_shell; 94 struct zxdg_shell_v6 *zxdg_shell;
94 struct www *www; 95 struct www *www;
95 struct zwp_e_session_recovery *session_recovery; 96 struct zwp_e_session_recovery *session_recovery;
97 struct efl_aux_hints *efl_aux_hints;
96 struct zwp_teamwork *teamwork; 98 struct zwp_teamwork *teamwork;
97 int compositor_version; 99 int compositor_version;
98 } wl; 100 } wl;
@@ -177,7 +179,7 @@ struct _Ecore_Wl2_Window
177 Ecore_Wl2_Window_Type type; 179 Ecore_Wl2_Window_Type type;
178 180
179 Eina_Inlist *subsurfs; 181 Eina_Inlist *subsurfs;
180 Eina_Inlist *supported_aux_hints; 182 Eina_List *supported_aux_hints;
181 183
182 Eina_Bool moving : 1; 184 Eina_Bool moving : 1;
183 Eina_Bool minimized : 1; 185 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,18 +555,12 @@ _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window)
555 555
556 window->surface_id = 556 window->surface_id =
557 wl_proxy_get_id((struct wl_proxy *)window->surface); 557 wl_proxy_get_id((struct wl_proxy *)window->surface);
558 if (window->display->wl.efl_aux_hints)
559 efl_aux_hints_get_supported_aux_hints(window->display->wl.efl_aux_hints, window->surface);
558 } 560 }
559} 561}
560 562
561static void 563static void
562_ecore_wl2_aux_hint_free(Ecore_Wl2_Aux_Hint *ehint)
563{
564 eina_stringshare_del(ehint->hint);
565 eina_stringshare_del(ehint->val);
566 free(ehint);
567}
568
569static void
570_ecore_wl2_window_show_send(Ecore_Wl2_Window *window) 564_ecore_wl2_window_show_send(Ecore_Wl2_Window *window)
571{ 565{
572 Ecore_Wl2_Event_Window_Show *ev; 566 Ecore_Wl2_Event_Window_Show *ev;
@@ -708,13 +702,20 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
708 window->configure_ack = NULL; 702 window->configure_ack = NULL;
709} 703}
710 704
705void
706_ecore_wl_window_aux_hint_free(Ecore_Wl2_Window *win)
707{
708 const char *supported;
709 EINA_LIST_FREE(win->supported_aux_hints, supported)
710 if (supported) eina_stringshare_del(supported);
711}
712
711EAPI void 713EAPI void
712ecore_wl2_window_free(Ecore_Wl2_Window *window) 714ecore_wl2_window_free(Ecore_Wl2_Window *window)
713{ 715{
714 Ecore_Wl2_Display *display; 716 Ecore_Wl2_Display *display;
715 Ecore_Wl2_Input *input; 717 Ecore_Wl2_Input *input;
716 Ecore_Wl2_Subsurface *subsurf; 718 Ecore_Wl2_Subsurface *subsurf;
717 Ecore_Wl2_Aux_Hint *ehint;
718 Eina_Inlist *tmp; 719 Eina_Inlist *tmp;
719 720
720 EINA_SAFETY_ON_NULL_RETURN(window); 721 EINA_SAFETY_ON_NULL_RETURN(window);
@@ -727,8 +728,7 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window)
727 EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf) 728 EINA_INLIST_FOREACH_SAFE(window->subsurfs, tmp, subsurf)
728 _ecore_wl2_subsurf_free(subsurf); 729 _ecore_wl2_subsurf_free(subsurf);
729 730
730 EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint) 731 _ecore_wl_window_aux_hint_free(window);
731 _ecore_wl2_aux_hint_free(ehint);
732 732
733 if (window->uuid && window->surface && window->display->wl.session_recovery) 733 if (window->uuid && window->surface && window->display->wl.session_recovery)
734 zwp_e_session_recovery_destroy_uuid(window->display->wl.session_recovery, 734 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
1456} 1456}
1457 1457
1458EAPI Eina_List * 1458EAPI Eina_List *
1459ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *window) 1459ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *win)
1460{ 1460{
1461 Eina_List *ret = NULL; 1461 Eina_List *res = NULL;
1462 Ecore_Wl2_Aux_Hint *ehint; 1462 Eina_List *ll;
1463 char *supported_hint = NULL;
1464 const char *hint = NULL;
1463 1465
1464 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); 1466 if (!win) return NULL;
1465 1467 if (!win->surface) return NULL;
1466 EINA_INLIST_FOREACH(window->supported_aux_hints, ehint)
1467 ret = eina_list_append(ret, eina_stringshare_add(ehint->val));
1468 1468
1469 return ret; 1469 EINA_LIST_FOREACH(win->supported_aux_hints, ll, supported_hint)
1470 {
1471 hint = eina_stringshare_add(supported_hint);
1472 res = eina_list_append(res, hint);
1473 }
1474 return res;
1470} 1475}
1471 1476
1472EAPI void 1477EAPI void
1473ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *window, int id, const char *hint, const char *val) 1478ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *win, int id, const char *hint, const char *val)
1474{ 1479{
1475 Ecore_Wl2_Aux_Hint *ehint; 1480 if (!win) return;
1476 1481 if ((win->surface) && (win->display->wl.efl_aux_hints))
1477 EINA_SAFETY_ON_NULL_RETURN(window); 1482 efl_aux_hints_add_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, hint, val);
1478
1479 ehint = calloc(1, sizeof(Ecore_Wl2_Aux_Hint));
1480 if (!ehint) return;
1481
1482 ehint->id = id;
1483 ehint->hint = eina_stringshare_add(hint);
1484 ehint->val = eina_stringshare_add(val);
1485
1486 window->supported_aux_hints =
1487 eina_inlist_append(window->supported_aux_hints, EINA_INLIST_GET(ehint));
1488} 1483}
1489 1484
1490EAPI void 1485EAPI void
1491ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *window, int id, const char *val) 1486ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *win, int id, const char *val)
1492{ 1487{
1493 Eina_Inlist *tmp; 1488 if (!win) return;
1494 Ecore_Wl2_Aux_Hint *ehint; 1489 if ((win->surface) && (win->display->wl.efl_aux_hints))
1495 1490 efl_aux_hints_change_aux_hint(win->display->wl.efl_aux_hints, win->surface, id, val);
1496 EINA_SAFETY_ON_NULL_RETURN(window);
1497
1498 EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint)
1499 {
1500 if (ehint->id == id)
1501 {
1502 eina_stringshare_replace(&ehint->val, val);
1503 break;
1504 }
1505 }
1506} 1491}
1507 1492
1508EAPI void 1493EAPI void
1509ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *window, int id) 1494ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *win, int id)
1510{ 1495{
1511 Eina_Inlist *tmp; 1496 if (!win) return;
1512 Ecore_Wl2_Aux_Hint *ehint; 1497 if ((win->surface) && (win->display->wl.efl_aux_hints))
1513 1498 efl_aux_hints_del_aux_hint(win->display->wl.efl_aux_hints, win->surface, id);
1514 EINA_SAFETY_ON_NULL_RETURN(window);
1515
1516 EINA_INLIST_FOREACH_SAFE(window->supported_aux_hints, tmp, ehint)
1517 {
1518 if (ehint->id == id)
1519 {
1520 window->supported_aux_hints =
1521 eina_inlist_remove(window->supported_aux_hints,
1522 EINA_INLIST_GET(ehint));
1523
1524 eina_stringshare_del(ehint->hint);
1525 eina_stringshare_del(ehint->val);
1526 free(ehint);
1527
1528 break;
1529 }
1530 }
1531} 1499}
1532
1533EAPI void 1500EAPI void
1534ecore_wl2_window_focus_skip_set(Ecore_Wl2_Window *window, Eina_Bool focus_skip) 1501ecore_wl2_window_focus_skip_set(Ecore_Wl2_Window *window, Eina_Bool focus_skip)
1535{ 1502{
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
28 28
29/* local variables */ 29/* local variables */
30static int _ecore_evas_wl_init_count = 0; 30static int _ecore_evas_wl_init_count = 0;
31static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[14]; 31static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[20];
32 32
33static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location); 33static void _ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
34static void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize); 34static 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
543 return ECORE_CALLBACK_PASS_ON; 543 return ECORE_CALLBACK_PASS_ON;
544} 544}
545 545
546 static Eina_Bool
547_ecore_evas_wl_common_cb_aux_hint_supported(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
548{
549 Ecore_Evas *ee;
550 Ecore_Wl2_Event_Aux_Hint_Supported *ev;
551 Eina_Stringshare *hint;
552 Ecore_Evas_Engine_Wl_Data *wdata;
553
554 ev = event;
555 ee = ecore_event_window_match(ev->win);
556 if (!ee) return ECORE_CALLBACK_PASS_ON;
557 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
558 wdata = ee->engine.data;
559 EINA_LIST_FREE(ee->prop.aux_hint.supported_list, hint) eina_stringshare_del(hint);
560 ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win);
561 return ECORE_CALLBACK_RENEW;
562}
563
564 static Eina_Bool
565_ecore_evas_wl_common_cb_aux_hint_allowed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
566{
567 Ecore_Evas *ee;
568 Ecore_Wl2_Event_Aux_Hint_Allowed *ev;
569 Eina_List *l;
570 Ecore_Evas_Aux_Hint *aux;
571
572 ev = event;
573 ee = ecore_event_window_match(ev->win);
574 if (!ee) return ECORE_CALLBACK_PASS_ON;
575 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
576
577 EINA_LIST_FOREACH(ee->prop.aux_hint.hints, l, aux)
578 {
579 if (aux->id == ev->id)
580 {
581 aux->allowed = 1;
582 if (!aux->notified)
583 {
584 _ecore_evas_wl_common_state_update(ee);
585 aux->notified = 1;
586 }
587 break;
588 }
589 }
590 return ECORE_CALLBACK_PASS_ON;
591}
592
546static Eina_Bool 593static Eina_Bool
547_ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 594_ecore_evas_wl_common_cb_window_rotate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
548{ 595{
@@ -1080,6 +1127,12 @@ _ecore_evas_wl_common_init(void)
1080 _ecore_evas_wl_event_hdls[13] = 1127 _ecore_evas_wl_event_hdls[13] =
1081 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, 1128 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE,
1082 _ecore_evas_wl_common_cb_window_rotate, NULL); 1129 _ecore_evas_wl_common_cb_window_rotate, NULL);
1130 _ecore_evas_wl_event_hdls[14] =
1131 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_ALLOWED,
1132 _ecore_evas_wl_common_cb_aux_hint_allowed, NULL);
1133 _ecore_evas_wl_event_hdls[15] =
1134 ecore_event_handler_add(ECORE_WL2_EVENT_AUX_HINT_SUPPORTED,
1135 _ecore_evas_wl_common_cb_aux_hint_supported, NULL);
1083 1136
1084 ecore_event_evas_init(); 1137 ecore_event_evas_init();
1085 1138
@@ -1309,6 +1362,18 @@ _ecore_evas_wl_common_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Inpu
1309 ecore_wl2_input_pointer_xy_get(input, x, y); 1362 ecore_wl2_input_pointer_xy_get(input, x, y);
1310} 1363}
1311 1364
1365 void
1366_ecore_evas_wl_common_aux_hints_supported_update(Ecore_Evas *ee)
1367{
1368 Ecore_Evas_Engine_Wl_Data *wdata;
1369
1370 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1371
1372 if (!ee) return;
1373 wdata = ee->engine.data;
1374 ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win);
1375}
1376
1312static void 1377static void
1313_ecore_evas_wl_common_raise(Ecore_Evas *ee) 1378_ecore_evas_wl_common_raise(Ecore_Evas *ee)
1314{ 1379{
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 @@
1<protocol name="efl_aux_hints">
2
3 <interface name="efl_aux_hints" version="1">
4 <request name="add_aux_hint">
5 <arg name="surface" type="object" interface="wl_surface"/>
6 <arg name="id" type="int"/>
7 <arg name="hint" type="string"/>
8 <arg name="val" type="string"/>
9 </request>
10 <request name="change_aux_hint">
11 <arg name="surface" type="object" interface="wl_surface"/>
12 <arg name="id" type="int"/>
13 <arg name="val" type="string"/>
14 </request>
15 <request name="del_aux_hint">
16 <arg name="surface" type="object" interface="wl_surface"/>
17 <arg name="id" type="int"/>
18 </request>
19 <request name="get_supported_aux_hints">
20 <arg name="surface" type="object" interface="wl_surface"/>
21 </request>
22 <event name="supported_aux_hints">
23 <arg name="surface" type="object" interface="wl_surface"/>
24 <arg name="hints" type="array"/>
25 <arg name="num_hints" type="uint"/>
26 </event>
27 <event name="allowed_aux_hint">
28 <arg name="surface" type="object" interface="wl_surface"/>
29 <arg name="id" type="int"/>
30 </event>
31 <event name="aux_message">
32 <arg name="surface" type="object" interface="wl_surface"/>
33 <arg name="key" type="string"/>
34 <arg name="val" type="string"/>
35 <arg name="options" type="array"/>
36 </event>
37 </interface>
38
39</protocol>