summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-01-08 13:42:11 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-01-10 11:39:52 -0500
commitffa276fce3b812372a063431903fa0569d71fcb2 (patch)
treece5945fe3c5a1ef486340dc0b2a1bd4735e9dc27 /src
parent79ca67d8a53d1d6612af1d1e46771699cb3e3661 (diff)
wayland: add xdg-shell vfinal support for client-side
@feature
Diffstat (limited to '')
-rw-r--r--src/Makefile_Ecore_Wl2.am6
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c33
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h10
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c388
-rw-r--r--src/lib/ecore_wl2/window_v6.x188
-rw-r--r--src/lib/elementary/efl_ui_win.c5
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c34
-rw-r--r--src/wayland_protocol/efl-hints.xml4
8 files changed, 510 insertions, 158 deletions
diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am
index a794d0b3ba..311cd27eec 100644
--- a/src/Makefile_Ecore_Wl2.am
+++ b/src/Makefile_Ecore_Wl2.am
@@ -40,6 +40,8 @@ lib/ecore_wl2/www-client-protocol.h \
40lib/ecore_wl2/www-protocol.c \ 40lib/ecore_wl2/www-protocol.c \
41lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \ 41lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \
42lib/ecore_wl2/linux-dmabuf-unstable-v1-client-protocol.h \ 42lib/ecore_wl2/linux-dmabuf-unstable-v1-client-protocol.h \
43lib/ecore_wl2/xdg-shell-client-protocol.h \
44lib/ecore_wl2/xdg-shell-protocol.c \
43lib/ecore_wl2/xdg-shell-unstable-v6-client-protocol.h \ 45lib/ecore_wl2/xdg-shell-unstable-v6-client-protocol.h \
44lib/ecore_wl2/xdg-shell-unstable-v6-protocol.c \ 46lib/ecore_wl2/xdg-shell-unstable-v6-protocol.c \
45lib/ecore_wl2/text-input-unstable-v1-client-protocol.h \ 47lib/ecore_wl2/text-input-unstable-v1-client-protocol.h \
@@ -59,6 +61,8 @@ lib/ecore_wl2/efl-aux-hints-client-protocol.h \
59 lib/ecore_wl2/www-protocol.c \ 61 lib/ecore_wl2/www-protocol.c \
60 lib/ecore_wl2/teamwork-protocol.c \ 62 lib/ecore_wl2/teamwork-protocol.c \
61 lib/ecore_wl2/teamwork-client-protocol.h \ 63 lib/ecore_wl2/teamwork-client-protocol.h \
64 lib/ecore_wl2/xdg-shell-client-protocol.h \
65 lib/ecore_wl2/xdg-shell-protocol.c \
62 lib/ecore_wl2/xdg-shell-unstable-v6-client-protocol.h \ 66 lib/ecore_wl2/xdg-shell-unstable-v6-client-protocol.h \
63 lib/ecore_wl2/xdg-shell-unstable-v6-protocol.c \ 67 lib/ecore_wl2/xdg-shell-unstable-v6-protocol.c \
64 lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \ 68 lib/ecore_wl2/linux-dmabuf-unstable-v1-protocol.c \
@@ -70,4 +74,6 @@ lib/ecore_wl2/efl-aux-hints-client-protocol.h \
70lib/ecore_wl2/efl-hints-client-protocol.h \ 74lib/ecore_wl2/efl-hints-client-protocol.h \
71lib/ecore_wl2/efl-hints-protocol.c 75lib/ecore_wl2/efl-hints-protocol.c
72 76
77EXTRA_DIST2 += lib/ecore_wl2/window_v6.x
78
73endif 79endif
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 9785406d97..740090c23a 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -59,6 +59,17 @@ static const struct zwp_linux_dmabuf_v1_listener _dmabuf_listener =
59}; 59};
60 60
61static void 61static void
62_xdg_shell_cb_ping(void *data EINA_UNUSED, struct xdg_wm_base *shell, uint32_t serial)
63{
64 xdg_wm_base_pong(shell, serial);
65}
66
67static const struct xdg_wm_base_listener _xdg_shell_listener =
68{
69 _xdg_shell_cb_ping,
70};
71
72static void
62_zxdg_shell_cb_ping(void *data EINA_UNUSED, struct zxdg_shell_v6 *shell, uint32_t serial) 73_zxdg_shell_cb_ping(void *data EINA_UNUSED, struct zxdg_shell_v6 *shell, uint32_t serial)
63{ 74{
64 zxdg_shell_v6_pong(shell, serial); 75 zxdg_shell_v6_pong(shell, serial);
@@ -337,13 +348,13 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
337 ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, MIN(version, 2)); 348 ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, MIN(version, 2));
338 EINA_INLIST_FOREACH(ewd->windows, window) 349 EINA_INLIST_FOREACH(ewd->windows, window)
339 { 350 {
340 if (!window->zxdg_surface) continue; 351 if (!window->xdg_surface) continue;
341 if (window->aspect.set) 352 if (window->aspect.set)
342 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_surface, 353 efl_hints_set_aspect(window->display->wl.efl_hints, window->xdg_surface,
343 window->aspect.w, window->aspect.h, window->aspect.aspect); 354 window->aspect.w, window->aspect.h, window->aspect.aspect);
344 if (window->weight.set) 355 if (window->weight.set)
345 efl_hints_set_weight(window->display->wl.efl_hints, 356 efl_hints_set_weight(window->display->wl.efl_hints,
346 window->zxdg_surface, window->weight.w, window->weight.h); 357 window->xdg_surface, window->weight.w, window->weight.h);
347 } 358 }
348 } 359 }
349 360
@@ -438,6 +449,7 @@ _ecore_wl2_display_globals_cleanup(Ecore_Wl2_Display *ewd)
438 if (ewd->wl.session_recovery) 449 if (ewd->wl.session_recovery)
439 zwp_e_session_recovery_destroy(ewd->wl.session_recovery); 450 zwp_e_session_recovery_destroy(ewd->wl.session_recovery);
440 if (ewd->wl.www) www_destroy(ewd->wl.www); 451 if (ewd->wl.www) www_destroy(ewd->wl.www);
452 if (ewd->wl.xdg_wm_base) xdg_wm_base_destroy(ewd->wl.xdg_wm_base);
441 if (ewd->wl.zxdg_shell) zxdg_shell_v6_destroy(ewd->wl.zxdg_shell); 453 if (ewd->wl.zxdg_shell) zxdg_shell_v6_destroy(ewd->wl.zxdg_shell);
442 if (ewd->wl.shm) wl_shm_destroy(ewd->wl.shm); 454 if (ewd->wl.shm) wl_shm_destroy(ewd->wl.shm);
443 if (ewd->wl.data_device_manager) 455 if (ewd->wl.data_device_manager)
@@ -488,6 +500,9 @@ _recovery_timer_add(Ecore_Wl2_Display *ewd)
488 _ecore_wl2_window_semi_free(window); 500 _ecore_wl2_window_semi_free(window);
489 window->set_config.serial = 0; 501 window->set_config.serial = 0;
490 window->req_config.serial = 0; 502 window->req_config.serial = 0;
503 window->xdg_configure_ack = NULL;
504 window->xdg_set_min_size = NULL;
505 window->xdg_set_max_size = NULL;
491 window->zxdg_configure_ack = NULL; 506 window->zxdg_configure_ack = NULL;
492 window->zxdg_set_min_size = NULL; 507 window->zxdg_set_min_size = NULL;
493 window->zxdg_set_max_size = NULL; 508 window->zxdg_set_max_size = NULL;
@@ -611,6 +626,7 @@ _ecore_wl2_shell_bind(Ecore_Wl2_Display *ewd)
611 const char **itr; 626 const char **itr;
612 const char *shells[] = 627 const char *shells[] =
613 { 628 {
629 "xdg_wm_base",
614 "zxdg_shell_v6", 630 "zxdg_shell_v6",
615 NULL 631 NULL
616 }; 632 };
@@ -626,7 +642,16 @@ _ecore_wl2_shell_bind(Ecore_Wl2_Display *ewd)
626 642
627 if (!global) return; 643 if (!global) return;
628 644
629 if (!strcmp(global->interface, "zxdg_shell_v6")) 645 if (!strcmp(global->interface, "xdg_wm_base"))
646 {
647 ewd->wl.xdg_wm_base =
648 wl_registry_bind(ewd->wl.registry, global->id,
649 &xdg_wm_base_interface, 1);
650 xdg_wm_base_add_listener(ewd->wl.xdg_wm_base,
651 &_xdg_shell_listener, NULL);
652 ewd->shell_done = EINA_TRUE;
653 }
654 else if (!strcmp(global->interface, "zxdg_shell_v6"))
630 { 655 {
631 ewd->wl.zxdg_shell = 656 ewd->wl.zxdg_shell =
632 wl_registry_bind(ewd->wl.registry, global->id, 657 wl_registry_bind(ewd->wl.registry, global->id,
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 0648bfcb30..6ec509e9c4 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -12,6 +12,7 @@
12 12
13# include "session-recovery-client-protocol.h" 13# include "session-recovery-client-protocol.h"
14 14
15# include "xdg-shell-client-protocol.h"
15# include "xdg-shell-unstable-v6-client-protocol.h" 16# include "xdg-shell-unstable-v6-client-protocol.h"
16# include "efl-aux-hints-client-protocol.h" 17# include "efl-aux-hints-client-protocol.h"
17 18
@@ -88,6 +89,7 @@ struct _Ecore_Wl2_Display
88 struct wl_shm *shm; 89 struct wl_shm *shm;
89 struct zwp_linux_dmabuf_v1 *dmabuf; 90 struct zwp_linux_dmabuf_v1 *dmabuf;
90 struct zxdg_shell_v6 *zxdg_shell; 91 struct zxdg_shell_v6 *zxdg_shell;
92 struct xdg_wm_base *xdg_wm_base;
91 struct www *www; 93 struct www *www;
92 struct zwp_e_session_recovery *session_recovery; 94 struct zwp_e_session_recovery *session_recovery;
93 struct efl_aux_hints *efl_aux_hints; 95 struct efl_aux_hints *efl_aux_hints;
@@ -181,12 +183,20 @@ struct _Ecore_Wl2_Window
181 void *buffer; 183 void *buffer;
182 struct wl_callback *callback; 184 struct wl_callback *callback;
183 struct www_surface *www_surface; 185 struct www_surface *www_surface;
186 struct xdg_surface *xdg_surface;
187 struct xdg_toplevel *xdg_toplevel;
188 struct xdg_popup *xdg_popup;
189
184 struct zxdg_surface_v6 *zxdg_surface; 190 struct zxdg_surface_v6 *zxdg_surface;
185 struct zxdg_toplevel_v6 *zxdg_toplevel; 191 struct zxdg_toplevel_v6 *zxdg_toplevel;
186 struct zxdg_popup_v6 *zxdg_popup; 192 struct zxdg_popup_v6 *zxdg_popup;
187 193
188 Eina_Stringshare *uuid; 194 Eina_Stringshare *uuid;
189 195
196 void (*xdg_configure_ack)(struct xdg_surface *surface, uint32_t serial);
197 void (*xdg_set_min_size)(struct xdg_toplevel *toplevel, int32_t w, int32_t h);
198 void (*xdg_set_max_size)(struct xdg_toplevel *toplevel, int32_t w, int32_t h);
199
190 void (*zxdg_configure_ack)(struct zxdg_surface_v6 *surface, uint32_t serial); 200 void (*zxdg_configure_ack)(struct zxdg_surface_v6 *surface, uint32_t serial);
191 void (*zxdg_set_min_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h); 201 void (*zxdg_set_min_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h);
192 void (*zxdg_set_max_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h); 202 void (*zxdg_set_max_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h);
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 231e48f6cb..a765d14f87 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -8,6 +8,15 @@
8void 8void
9_ecore_wl2_window_semi_free(Ecore_Wl2_Window *window) 9_ecore_wl2_window_semi_free(Ecore_Wl2_Window *window)
10{ 10{
11 if (window->xdg_popup) xdg_popup_destroy(window->xdg_popup);
12 window->xdg_popup = NULL;
13
14 if (window->xdg_toplevel) xdg_toplevel_destroy(window->xdg_toplevel);
15 window->xdg_toplevel = NULL;
16
17 if (window->xdg_surface) xdg_surface_destroy(window->xdg_surface);
18 window->xdg_surface = NULL;
19
11 if (window->zxdg_popup) zxdg_popup_v6_destroy(window->zxdg_popup); 20 if (window->zxdg_popup) zxdg_popup_v6_destroy(window->zxdg_popup);
12 window->zxdg_popup = NULL; 21 window->zxdg_popup = NULL;
13 22
@@ -109,8 +118,74 @@ _configure_complete(Ecore_Wl2_Window *window)
109 118
110} 119}
111 120
121#include "window_v6.x"
122
123static void
124_www_surface_end_drag(void *data, struct www_surface *www_surface EINA_UNUSED)
125{
126 Ecore_Wl2_Window *window = data;
127 Ecore_Wl2_Event_Window_WWW_Drag *ev;
128
129 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag));
130 EINA_SAFETY_ON_NULL_RETURN(ev);
131 ev->window = window->id;
132 ev->dragging = 0;
133
134 ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL);
135}
136
137static void
138_www_surface_start_drag(void *data, struct www_surface *www_surface EINA_UNUSED)
139{
140 Ecore_Wl2_Window *window = data;
141 Ecore_Wl2_Event_Window_WWW_Drag *ev;
142
143 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag));
144 EINA_SAFETY_ON_NULL_RETURN(ev);
145 ev->window = window->id;
146 ev->dragging = 1;
147
148 ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL);
149}
150
112static void 151static void
113_zxdg_surface_cb_configure(void *data, struct zxdg_surface_v6 *zxdg_surface EINA_UNUSED, uint32_t serial) 152_www_surface_status(void *data, struct www_surface *www_surface EINA_UNUSED, int32_t x_rel, int32_t y_rel, uint32_t timestamp)
153{
154 Ecore_Wl2_Window *window = data;
155 Ecore_Wl2_Event_Window_WWW *ev;
156
157 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW));
158 EINA_SAFETY_ON_NULL_RETURN(ev);
159 ev->window = window->id;
160 ev->x_rel = x_rel;
161 ev->y_rel = y_rel;
162 ev->timestamp = timestamp;
163
164 ecore_event_add(_ecore_wl2_event_window_www, ev, NULL, NULL);
165}
166
167static struct www_surface_listener _www_surface_listener =
168{
169 .status = _www_surface_status,
170 .start_drag = _www_surface_start_drag,
171 .end_drag = _www_surface_end_drag,
172};
173
174void
175_ecore_wl2_window_www_surface_init(Ecore_Wl2_Window *window)
176{
177 if (!window->surface) return;
178 if (!window->display->wl.www) return;
179 if (window->www_surface) return;
180 window->www_surface = www_create(window->display->wl.www, window->surface);
181 www_surface_set_user_data(window->www_surface, window);
182 www_surface_add_listener(window->www_surface, &_www_surface_listener,
183 window);
184}
185
186
187static void
188_xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSED, uint32_t serial)
114{ 189{
115 Ecore_Wl2_Window *window; 190 Ecore_Wl2_Window *window;
116 191
@@ -130,13 +205,13 @@ _zxdg_surface_cb_configure(void *data, struct zxdg_surface_v6 *zxdg_surface EINA
130 _ecore_wl2_window_configure_send(window); 205 _ecore_wl2_window_configure_send(window);
131} 206}
132 207
133static const struct zxdg_surface_v6_listener _zxdg_surface_listener = 208static const struct xdg_surface_listener _xdg_surface_listener =
134{ 209{
135 _zxdg_surface_cb_configure, 210 _xdg_surface_cb_configure,
136}; 211};
137 212
138static void 213static void
139_zxdg_toplevel_cb_configure(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel EINA_UNUSED, int32_t width, int32_t height, struct wl_array *states) 214_xdg_toplevel_cb_configure(void *data, struct xdg_toplevel *xdg_toplevel EINA_UNUSED, int32_t width, int32_t height, struct wl_array *states)
140{ 215{
141 Ecore_Wl2_Window *win = data; 216 Ecore_Wl2_Window *win = data;
142 uint32_t *s; 217 uint32_t *s;
@@ -172,7 +247,7 @@ _zxdg_toplevel_cb_configure(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel E
172} 247}
173 248
174static void 249static void
175_zxdg_toplevel_cb_close(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel EINA_UNUSED) 250_xdg_toplevel_cb_close(void *data, struct xdg_toplevel *xdg_toplevel EINA_UNUSED)
176{ 251{
177 Ecore_Wl2_Window *win; 252 Ecore_Wl2_Window *win;
178 253
@@ -182,14 +257,14 @@ _zxdg_toplevel_cb_close(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel EINA_
182 ecore_wl2_window_free(win); 257 ecore_wl2_window_free(win);
183} 258}
184 259
185static const struct zxdg_toplevel_v6_listener _zxdg_toplevel_listener = 260static const struct xdg_toplevel_listener _xdg_toplevel_listener =
186{ 261{
187 _zxdg_toplevel_cb_configure, 262 _xdg_toplevel_cb_configure,
188 _zxdg_toplevel_cb_close, 263 _xdg_toplevel_cb_close,
189}; 264};
190 265
191static void 266static void
192_zxdg_popup_cb_configure(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSED, int32_t x EINA_UNUSED, int32_t y EINA_UNUSED, int32_t width, int32_t height) 267_xdg_popup_cb_configure(void *data, struct xdg_popup *xdg_popup EINA_UNUSED, int32_t x EINA_UNUSED, int32_t y EINA_UNUSED, int32_t width, int32_t height)
193{ 268{
194 Ecore_Wl2_Window *win = data; 269 Ecore_Wl2_Window *win = data;
195 win->def_config.geometry.w = width; 270 win->def_config.geometry.w = width;
@@ -197,7 +272,7 @@ _zxdg_popup_cb_configure(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSE
197} 272}
198 273
199static void 274static void
200_zxdg_popup_cb_done(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSED) 275_xdg_popup_cb_done(void *data, struct xdg_popup *xdg_popup EINA_UNUSED)
201{ 276{
202 Ecore_Wl2_Window *win; 277 Ecore_Wl2_Window *win;
203 278
@@ -207,40 +282,39 @@ _zxdg_popup_cb_done(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSED)
207 if (win->grab) _ecore_wl2_input_ungrab(win->grab); 282 if (win->grab) _ecore_wl2_input_ungrab(win->grab);
208} 283}
209 284
210static const struct zxdg_popup_v6_listener _zxdg_popup_listener = 285static const struct xdg_popup_listener _xdg_popup_listener =
211{ 286{
212 _zxdg_popup_cb_configure, 287 _xdg_popup_cb_configure,
213 _zxdg_popup_cb_done, 288 _xdg_popup_cb_done,
214}; 289};
215 290
216static void 291static void
217_ecore_wl2_window_zxdg_popup_create(Ecore_Wl2_Window *win) 292_ecore_wl2_window_xdg_popup_create(Ecore_Wl2_Window *win)
218{ 293{
219 struct zxdg_positioner_v6 *pos; 294 struct xdg_positioner *pos;
220 295
221 EINA_SAFETY_ON_NULL_RETURN(win->parent); 296 EINA_SAFETY_ON_NULL_RETURN(win->parent);
222 pos = zxdg_shell_v6_create_positioner(win->display->wl.zxdg_shell); 297 pos = xdg_wm_base_create_positioner(win->display->wl.xdg_wm_base);
223 if (!pos) return; 298 if (!pos) return;
224 299
225 zxdg_positioner_v6_set_anchor_rect(pos, win->set_config.geometry.x, 300 xdg_positioner_set_anchor_rect(pos, win->set_config.geometry.x,
226 win->set_config.geometry.y, 301 win->set_config.geometry.y,
227 1, 1); 302 1, 1);
228 zxdg_positioner_v6_set_size(pos, win->set_config.geometry.w, 303 xdg_positioner_set_size(pos, win->set_config.geometry.w,
229 win->set_config.geometry.h); 304 win->set_config.geometry.h);
230 zxdg_positioner_v6_set_anchor(pos, ZXDG_POSITIONER_V6_ANCHOR_TOP | 305 xdg_positioner_set_anchor(pos, XDG_POSITIONER_ANCHOR_TOP_LEFT);
231 ZXDG_POSITIONER_V6_ANCHOR_LEFT); 306 xdg_positioner_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
232 zxdg_positioner_v6_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
233 ZXDG_POSITIONER_V6_ANCHOR_RIGHT); 307 ZXDG_POSITIONER_V6_ANCHOR_RIGHT);
234 308
235 win->zxdg_popup = zxdg_surface_v6_get_popup(win->zxdg_surface, 309 win->xdg_popup = xdg_surface_get_popup(win->xdg_surface,
236 win->parent->zxdg_surface, pos); 310 win->parent->xdg_surface, pos);
237 311
238 zxdg_positioner_v6_destroy(pos); 312 xdg_positioner_destroy(pos);
239 if (win->grab) 313 if (win->grab)
240 zxdg_popup_v6_grab(win->zxdg_popup, win->grab->wl.seat, 314 xdg_popup_grab(win->xdg_popup, win->grab->wl.seat,
241 wl_display_get_serial(win->display->wl.display)); 315 wl_display_get_serial(win->display->wl.display));
242 zxdg_popup_v6_set_user_data(win->zxdg_popup, win); 316 xdg_popup_set_user_data(win->xdg_popup, win);
243 zxdg_popup_v6_add_listener(win->zxdg_popup, &_zxdg_popup_listener, win); 317 xdg_popup_add_listener(win->xdg_popup, &_xdg_popup_listener, win);
244 318
245 win->pending.configure = EINA_TRUE; 319 win->pending.configure = EINA_TRUE;
246 320
@@ -248,128 +322,70 @@ _ecore_wl2_window_zxdg_popup_create(Ecore_Wl2_Window *win)
248} 322}
249 323
250static void 324static void
251_www_surface_end_drag(void *data, struct www_surface *www_surface EINA_UNUSED) 325_window_shell_surface_create(Ecore_Wl2_Window *window)
252{ 326{
253 Ecore_Wl2_Window *window = data; 327 if (window->xdg_surface) return;
254 Ecore_Wl2_Event_Window_WWW_Drag *ev; 328 window->xdg_surface =
255 329 xdg_wm_base_get_xdg_surface(window->display->wl.xdg_wm_base,
256 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag)); 330 window->surface);
257 EINA_SAFETY_ON_NULL_RETURN(ev); 331 xdg_surface_set_user_data(window->xdg_surface, window);
258 ev->window = window->id; 332 xdg_surface_add_listener(window->xdg_surface,
259 ev->dragging = 0; 333 &_xdg_surface_listener, window);
334
335 window->xdg_configure_ack = xdg_surface_ack_configure;
336 window->pending.configure = EINA_TRUE;
337 if (window->display->wl.efl_hints)
338 {
339 if (window->aspect.set)
340 efl_hints_set_aspect(window->display->wl.efl_hints, window->xdg_surface,
341 window->aspect.w, window->aspect.h, window->aspect.aspect);
342 if (window->weight.set)
343 efl_hints_set_weight(window->display->wl.efl_hints, window->xdg_surface,
344 window->weight.w, window->weight.h);
345 }
260 346
261 ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL); 347 if (window->type == ECORE_WL2_WINDOW_TYPE_MENU)
262} 348 _ecore_wl2_window_xdg_popup_create(window);
349 else
350 {
351 struct xdg_toplevel *ptop = NULL;
263 352
264static void 353 window->xdg_toplevel =
265_www_surface_start_drag(void *data, struct www_surface *www_surface EINA_UNUSED) 354 xdg_surface_get_toplevel(window->xdg_surface);
266{ 355 xdg_toplevel_set_user_data(window->xdg_toplevel, window);
267 Ecore_Wl2_Window *window = data; 356 xdg_toplevel_add_listener(window->xdg_toplevel,
268 Ecore_Wl2_Event_Window_WWW_Drag *ev; 357 &_xdg_toplevel_listener, window);
269 358
270 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag)); 359 if (window->title)
271 EINA_SAFETY_ON_NULL_RETURN(ev); 360 xdg_toplevel_set_title(window->xdg_toplevel, window->title);
272 ev->window = window->id; 361 if (window->class)
273 ev->dragging = 1; 362 xdg_toplevel_set_app_id(window->xdg_toplevel, window->class);
274 363
275 ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL); 364 window->xdg_set_min_size = xdg_toplevel_set_min_size;
276} 365 window->xdg_set_max_size = xdg_toplevel_set_max_size;
277 366
278static void 367 if (window->parent)
279_www_surface_status(void *data, struct www_surface *www_surface EINA_UNUSED, int32_t x_rel, int32_t y_rel, uint32_t timestamp) 368 ptop = window->parent->xdg_toplevel;
280{
281 Ecore_Wl2_Window *window = data;
282 Ecore_Wl2_Event_Window_WWW *ev;
283 369
284 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW)); 370 if (ptop)
285 EINA_SAFETY_ON_NULL_RETURN(ev); 371 xdg_toplevel_set_parent(window->xdg_toplevel, ptop);
286 ev->window = window->id;
287 ev->x_rel = x_rel;
288 ev->y_rel = y_rel;
289 ev->timestamp = timestamp;
290 372
291 ecore_event_add(_ecore_wl2_event_window_www, ev, NULL, NULL); 373 if (window->set_config.maximized)
292} 374 xdg_toplevel_set_maximized(window->xdg_toplevel);
293 375
294static struct www_surface_listener _www_surface_listener = 376 if (window->set_config.fullscreen)
295{ 377 xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
296 .status = _www_surface_status, 378 }
297 .start_drag = _www_surface_start_drag,
298 .end_drag = _www_surface_end_drag,
299};
300 379
301void 380 ecore_wl2_window_commit(window, EINA_TRUE);
302_ecore_wl2_window_www_surface_init(Ecore_Wl2_Window *window)
303{
304 if (!window->surface) return;
305 if (!window->display->wl.www) return;
306 if (window->www_surface) return;
307 window->www_surface = www_create(window->display->wl.www, window->surface);
308 www_surface_set_user_data(window->www_surface, window);
309 www_surface_add_listener(window->www_surface, &_www_surface_listener,
310 window);
311} 381}
312 382
313void 383void
314_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window) 384_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
315{ 385{
316 if (!window->surface) return; 386 if (!window->surface) return;
317 if ((window->display->wl.zxdg_shell) && (!window->zxdg_surface)) 387 if (window->display->wl.xdg_wm_base) _window_shell_surface_create(window);
318 { 388 if (window->display->wl.zxdg_shell) _window_v6_shell_surface_create(window);
319 window->zxdg_surface =
320 zxdg_shell_v6_get_xdg_surface(window->display->wl.zxdg_shell,
321 window->surface);
322 zxdg_surface_v6_set_user_data(window->zxdg_surface, window);
323 zxdg_surface_v6_add_listener(window->zxdg_surface,
324 &_zxdg_surface_listener, window);
325
326 window->zxdg_configure_ack = zxdg_surface_v6_ack_configure;
327 window->pending.configure = EINA_TRUE;
328 if (window->display->wl.efl_hints)
329 {
330 if (window->aspect.set)
331 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_surface,
332 window->aspect.w, window->aspect.h, window->aspect.aspect);
333 if (window->weight.set)
334 efl_hints_set_weight(window->display->wl.efl_hints, window->zxdg_surface,
335 window->weight.w, window->weight.h);
336 }
337
338 if (window->type == ECORE_WL2_WINDOW_TYPE_MENU)
339 _ecore_wl2_window_zxdg_popup_create(window);
340 else
341 {
342 struct zxdg_toplevel_v6 *ptop = NULL;
343
344 window->zxdg_toplevel =
345 zxdg_surface_v6_get_toplevel(window->zxdg_surface);
346 zxdg_toplevel_v6_set_user_data(window->zxdg_toplevel, window);
347 zxdg_toplevel_v6_add_listener(window->zxdg_toplevel,
348 &_zxdg_toplevel_listener, window);
349
350 if (window->title)
351 zxdg_toplevel_v6_set_title(window->zxdg_toplevel, window->title);
352 if (window->class)
353 zxdg_toplevel_v6_set_app_id(window->zxdg_toplevel, window->class);
354
355 window->zxdg_set_min_size = zxdg_toplevel_v6_set_min_size;
356 window->zxdg_set_max_size = zxdg_toplevel_v6_set_max_size;
357
358 if (window->parent)
359 ptop = window->parent->zxdg_toplevel;
360
361 if (ptop)
362 zxdg_toplevel_v6_set_parent(window->zxdg_toplevel, ptop);
363
364 if (window->set_config.maximized)
365 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
366
367 if (window->set_config.fullscreen)
368 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
369 }
370
371 ecore_wl2_window_commit(window, EINA_TRUE);
372 }
373 389
374 if (window->display->wl.session_recovery) 390 if (window->display->wl.session_recovery)
375 { 391 {
@@ -377,6 +393,12 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
377 { 393 {
378 zwp_e_session_recovery_set_uuid(window->display->wl.session_recovery, 394 zwp_e_session_recovery_set_uuid(window->display->wl.session_recovery,
379 window->surface, window->uuid); 395 window->surface, window->uuid);
396 if (window->xdg_surface)
397 xdg_surface_set_window_geometry(window->xdg_surface,
398 window->set_config.geometry.x,
399 window->set_config.geometry.y,
400 window->set_config.geometry.w,
401 window->set_config.geometry.h);
380 if (window->zxdg_surface) 402 if (window->zxdg_surface)
381 zxdg_surface_v6_set_window_geometry(window->zxdg_surface, 403 zxdg_surface_v6_set_window_geometry(window->zxdg_surface,
382 window->set_config.geometry.x, 404 window->set_config.geometry.x,
@@ -571,6 +593,9 @@ ecore_wl2_window_hide(Ecore_Wl2_Window *window)
571 window->req_config.serial = 0; 593 window->req_config.serial = 0;
572 window->def_config.serial = 0; 594 window->def_config.serial = 0;
573 window->zxdg_configure_ack = NULL; 595 window->zxdg_configure_ack = NULL;
596 window->xdg_configure_ack = NULL;
597 window->xdg_set_min_size = NULL;
598 window->xdg_set_max_size = NULL;
574 window->zxdg_set_min_size = NULL; 599 window->zxdg_set_min_size = NULL;
575 window->zxdg_set_max_size = NULL; 600 window->zxdg_set_max_size = NULL;
576} 601}
@@ -637,6 +662,9 @@ ecore_wl2_window_move(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input)
637 662
638 window->moving = EINA_TRUE; 663 window->moving = EINA_TRUE;
639 664
665 if (window->xdg_toplevel)
666 xdg_toplevel_move(window->xdg_toplevel, input->wl.seat,
667 window->display->serial);
640 if (window->zxdg_toplevel) 668 if (window->zxdg_toplevel)
641 zxdg_toplevel_v6_move(window->zxdg_toplevel, input->wl.seat, 669 zxdg_toplevel_v6_move(window->zxdg_toplevel, input->wl.seat,
642 window->display->serial); 670 window->display->serial);
@@ -651,6 +679,9 @@ ecore_wl2_window_resize(Ecore_Wl2_Window *window, Ecore_Wl2_Input *input, int lo
651 if (!input) 679 if (!input)
652 input = EINA_INLIST_CONTAINER_GET(window->display->inputs, Ecore_Wl2_Input); 680 input = EINA_INLIST_CONTAINER_GET(window->display->inputs, Ecore_Wl2_Input);
653 681
682 if (window->xdg_toplevel)
683 xdg_toplevel_resize(window->xdg_toplevel, input->wl.seat,
684 window->display->serial, location);
654 if (window->zxdg_toplevel) 685 if (window->zxdg_toplevel)
655 zxdg_toplevel_v6_resize(window->zxdg_toplevel, input->wl.seat, 686 zxdg_toplevel_v6_resize(window->zxdg_toplevel, input->wl.seat,
656 window->display->serial, location); 687 window->display->serial, location);
@@ -847,11 +878,15 @@ ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
847 if (!window->set_config.fullscreen) 878 if (!window->set_config.fullscreen)
848 window->saved = window->set_config.geometry; 879 window->saved = window->set_config.geometry;
849 880
881 if (window->xdg_toplevel)
882 xdg_toplevel_set_maximized(window->xdg_toplevel);
850 if (window->zxdg_toplevel) 883 if (window->zxdg_toplevel)
851 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel); 884 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
852 } 885 }
853 else 886 else
854 { 887 {
888 if (window->xdg_toplevel)
889 xdg_toplevel_unset_maximized(window->xdg_toplevel);
855 if (window->zxdg_toplevel) 890 if (window->zxdg_toplevel)
856 zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel); 891 zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel);
857 } 892 }
@@ -889,11 +924,15 @@ ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
889 if (!window->set_config.maximized) 924 if (!window->set_config.maximized)
890 window->saved = window->set_config.geometry; 925 window->saved = window->set_config.geometry;
891 926
927 if (window->xdg_toplevel)
928 xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
892 if (window->zxdg_toplevel) 929 if (window->zxdg_toplevel)
893 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 930 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
894 } 931 }
895 else 932 else
896 { 933 {
934 if (window->xdg_toplevel)
935 xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
897 if (window->zxdg_toplevel) 936 if (window->zxdg_toplevel)
898 zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel); 937 zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel);
899 } 938 }
@@ -924,6 +963,8 @@ ecore_wl2_window_title_set(Ecore_Wl2_Window *window, const char *title)
924 eina_stringshare_replace(&window->title, title); 963 eina_stringshare_replace(&window->title, title);
925 if (!window->title) return; 964 if (!window->title) return;
926 965
966 if (window->xdg_toplevel)
967 xdg_toplevel_set_title(window->xdg_toplevel, window->title);
927 if (window->zxdg_toplevel) 968 if (window->zxdg_toplevel)
928 zxdg_toplevel_v6_set_title(window->zxdg_toplevel, window->title); 969 zxdg_toplevel_v6_set_title(window->zxdg_toplevel, window->title);
929} 970}
@@ -936,6 +977,8 @@ ecore_wl2_window_class_set(Ecore_Wl2_Window *window, const char *clas)
936 eina_stringshare_replace(&window->class, clas); 977 eina_stringshare_replace(&window->class, clas);
937 if (!window->class) return; 978 if (!window->class) return;
938 979
980 if (window->xdg_toplevel)
981 xdg_toplevel_set_app_id(window->xdg_toplevel, window->class);
939 if (window->zxdg_toplevel) 982 if (window->zxdg_toplevel)
940 zxdg_toplevel_v6_set_app_id(window->zxdg_toplevel, window->class); 983 zxdg_toplevel_v6_set_app_id(window->zxdg_toplevel, window->class);
941} 984}
@@ -992,11 +1035,26 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
992 1035
993 if (iconified) 1036 if (iconified)
994 { 1037 {
1038 if (window->xdg_toplevel)
1039 xdg_toplevel_set_minimized(window->xdg_toplevel);
995 if (window->zxdg_toplevel) 1040 if (window->zxdg_toplevel)
996 zxdg_toplevel_v6_set_minimized(window->zxdg_toplevel); 1041 zxdg_toplevel_v6_set_minimized(window->zxdg_toplevel);
997 } 1042 }
998 else 1043 else
999 { 1044 {
1045 if (window->xdg_toplevel)
1046 {
1047 struct wl_array states;
1048 uint32_t *s;
1049
1050 wl_array_init(&states);
1051 s = wl_array_add(&states, sizeof(*s));
1052 *s = XDG_TOPLEVEL_STATE_ACTIVATED;
1053 _xdg_toplevel_cb_configure(window, window->xdg_toplevel,
1054 window->set_config.geometry.w,
1055 window->set_config.geometry.h, &states);
1056 wl_array_release(&states);
1057 }
1000 if (window->zxdg_toplevel) 1058 if (window->zxdg_toplevel)
1001 { 1059 {
1002 struct wl_array states; 1060 struct wl_array states;
@@ -1044,7 +1102,7 @@ EAPI Eina_Bool
1044ecore_wl2_window_shell_surface_exists(Ecore_Wl2_Window *window) 1102ecore_wl2_window_shell_surface_exists(Ecore_Wl2_Window *window)
1045{ 1103{
1046 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 1104 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
1047 return !!window->zxdg_surface; 1105 return !!window->zxdg_surface || !!window->xdg_surface;
1048} 1106}
1049 1107
1050EAPI Eina_Bool 1108EAPI Eina_Bool
@@ -1352,9 +1410,9 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int
1352 window->aspect.aspect = aspect; 1410 window->aspect.aspect = aspect;
1353 window->aspect.set = 1; 1411 window->aspect.set = 1;
1354 if (!window->display->wl.efl_hints) return; 1412 if (!window->display->wl.efl_hints) return;
1355 if (window->zxdg_surface) 1413 if (window->xdg_surface)
1356 efl_hints_set_aspect(window->display->wl.efl_hints, 1414 efl_hints_set_aspect(window->display->wl.efl_hints,
1357 window->zxdg_surface, w, h, aspect); 1415 window->xdg_surface, w, h, aspect);
1358} 1416}
1359 1417
1360EAPI void 1418EAPI void
@@ -1373,9 +1431,9 @@ ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h)
1373 window->weight.h = hh; 1431 window->weight.h = hh;
1374 window->weight.set = 1; 1432 window->weight.set = 1;
1375 if (!window->display->wl.efl_hints) return; 1433 if (!window->display->wl.efl_hints) return;
1376 if (window->zxdg_surface) 1434 if (window->xdg_surface)
1377 efl_hints_set_weight(window->display->wl.efl_hints, 1435 efl_hints_set_weight(window->display->wl.efl_hints,
1378 window->zxdg_surface, ww, hh); 1436 window->xdg_surface, ww, hh);
1379} 1437}
1380 1438
1381static void 1439static void
@@ -1401,29 +1459,45 @@ static struct wl_callback_listener _frame_listener =
1401static void 1459static void
1402_maximized_set(Ecore_Wl2_Window *window) 1460_maximized_set(Ecore_Wl2_Window *window)
1403{ 1461{
1404 EINA_SAFETY_ON_NULL_RETURN(window->zxdg_toplevel); 1462 EINA_SAFETY_ON_FALSE_RETURN(window->zxdg_toplevel || window->xdg_toplevel);
1405 1463
1406 if (window->set_config.maximized) 1464 if (window->set_config.maximized)
1407 { 1465 {
1408 window->saved = window->set_config.geometry; 1466 window->saved = window->set_config.geometry;
1409 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel); 1467 if (window->xdg_toplevel)
1468 xdg_toplevel_set_maximized(window->xdg_toplevel);
1469 if (window->zxdg_toplevel)
1470 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
1410 } 1471 }
1411 else 1472 else
1412 zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel); 1473 {
1474 if (window->xdg_toplevel)
1475 xdg_toplevel_unset_maximized(window->xdg_toplevel);
1476 if (window->zxdg_toplevel)
1477 zxdg_toplevel_v6_unset_maximized(window->zxdg_toplevel);
1478 }
1413} 1479}
1414 1480
1415static void 1481static void
1416_fullscreen_set(Ecore_Wl2_Window *window) 1482_fullscreen_set(Ecore_Wl2_Window *window)
1417{ 1483{
1418 EINA_SAFETY_ON_NULL_RETURN(window->zxdg_toplevel); 1484 EINA_SAFETY_ON_FALSE_RETURN(window->zxdg_toplevel || window->xdg_toplevel);
1419 1485
1420 if (window->set_config.fullscreen) 1486 if (window->set_config.fullscreen)
1421 { 1487 {
1422 window->saved = window->set_config.geometry; 1488 window->saved = window->set_config.geometry;
1423 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 1489 if (window->xdg_toplevel)
1490 xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
1491 if (window->zxdg_toplevel)
1492 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
1424 } 1493 }
1425 else 1494 else
1426 zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel); 1495 {
1496 if (window->xdg_toplevel)
1497 xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
1498 if (window->zxdg_toplevel)
1499 zxdg_toplevel_v6_unset_fullscreen(window->zxdg_toplevel);
1500 }
1427} 1501}
1428 1502
1429static void 1503static void
@@ -1493,12 +1567,21 @@ ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush)
1493 window->callback = wl_surface_frame(window->surface); 1567 window->callback = wl_surface_frame(window->surface);
1494 wl_callback_add_listener(window->callback, &_frame_listener, window); 1568 wl_callback_add_listener(window->callback, &_frame_listener, window);
1495 /* Dispatch any state we've been saving along the way */ 1569 /* Dispatch any state we've been saving along the way */
1496 if (window->pending.geom && window->zxdg_toplevel) 1570 if (window->pending.geom)
1497 zxdg_surface_v6_set_window_geometry(window->zxdg_surface, 1571 {
1498 window->set_config.geometry.x, 1572 if (window->xdg_toplevel)
1499 window->set_config.geometry.y, 1573 xdg_surface_set_window_geometry(window->xdg_surface,
1500 window->set_config.geometry.w, 1574 window->set_config.geometry.x,
1501 window->set_config.geometry.h); 1575 window->set_config.geometry.y,
1576 window->set_config.geometry.w,
1577 window->set_config.geometry.h);
1578 if (window->zxdg_surface)
1579 zxdg_surface_v6_set_window_geometry(window->zxdg_surface,
1580 window->set_config.geometry.x,
1581 window->set_config.geometry.y,
1582 window->set_config.geometry.w,
1583 window->set_config.geometry.h);
1584 }
1502 if (window->pending.opaque) 1585 if (window->pending.opaque)
1503 _opaque_set(window); 1586 _opaque_set(window);
1504 1587
@@ -1520,6 +1603,9 @@ ecore_wl2_window_commit(Ecore_Wl2_Window *window, Eina_Bool flush)
1520 1603
1521 if (window->req_config.serial != window->set_config.serial) 1604 if (window->req_config.serial != window->set_config.serial)
1522 { 1605 {
1606 if (window->xdg_configure_ack)
1607 window->xdg_configure_ack(window->xdg_surface,
1608 window->req_config.serial);
1523 if (window->zxdg_configure_ack) 1609 if (window->zxdg_configure_ack)
1524 window->zxdg_configure_ack(window->zxdg_surface, 1610 window->zxdg_configure_ack(window->zxdg_surface,
1525 window->req_config.serial); 1611 window->req_config.serial);
diff --git a/src/lib/ecore_wl2/window_v6.x b/src/lib/ecore_wl2/window_v6.x
new file mode 100644
index 0000000000..34a12d692e
--- /dev/null
+++ b/src/lib/ecore_wl2/window_v6.x
@@ -0,0 +1,188 @@
1
2static void
3_zxdg_surface_cb_configure(void *data, struct zxdg_surface_v6 *zxdg_surface EINA_UNUSED, uint32_t serial)
4{
5 Ecore_Wl2_Window *window;
6
7 window = data;
8 window->def_config.serial = serial;
9
10 if (window->pending.configure)
11 {
12 window->saved.w = window->set_config.geometry.w;
13 window->saved.h = window->set_config.geometry.h;
14 _configure_complete(window);
15 }
16 if (window->pending.configure && window->updating)
17 ERR("Window shouldn't be rendering before initial configure");
18
19 if (!window->updating)
20 _ecore_wl2_window_configure_send(window);
21}
22
23static const struct zxdg_surface_v6_listener _zxdg_surface_listener =
24{
25 _zxdg_surface_cb_configure,
26};
27
28static void
29_zxdg_toplevel_cb_configure(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel EINA_UNUSED, int32_t width, int32_t height, struct wl_array *states)
30{
31 Ecore_Wl2_Window *win = data;
32 uint32_t *s;
33
34 win->def_config.minimized = EINA_FALSE;
35 win->def_config.maximized = EINA_FALSE;
36 win->def_config.fullscreen = EINA_FALSE;
37 win->def_config.focused = EINA_FALSE;
38 win->def_config.resizing = EINA_FALSE;
39 win->def_config.geometry.w = width;
40 win->def_config.geometry.h = height;
41
42 wl_array_for_each(s, states)
43 {
44 switch (*s)
45 {
46 case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
47 win->def_config.maximized = EINA_TRUE;
48 break;
49 case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
50 win->def_config.fullscreen = EINA_TRUE;
51 break;
52 case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
53 win->def_config.resizing = EINA_TRUE;
54 break;
55 case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED:
56 win->def_config.focused = EINA_TRUE;
57 win->def_config.minimized = EINA_FALSE;
58 default:
59 break;
60 }
61 }
62}
63
64static void
65_zxdg_toplevel_cb_close(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel EINA_UNUSED)
66{
67 Ecore_Wl2_Window *win;
68
69 win = data;
70 if (!win) return;
71
72 ecore_wl2_window_free(win);
73}
74
75static const struct zxdg_toplevel_v6_listener _zxdg_toplevel_listener =
76{
77 _zxdg_toplevel_cb_configure,
78 _zxdg_toplevel_cb_close,
79};
80
81static void
82_zxdg_popup_cb_configure(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSED, int32_t x EINA_UNUSED, int32_t y EINA_UNUSED, int32_t width, int32_t height)
83{
84 Ecore_Wl2_Window *win = data;
85 win->def_config.geometry.w = width;
86 win->def_config.geometry.h = height;
87}
88
89static void
90_zxdg_popup_cb_done(void *data, struct zxdg_popup_v6 *zxdg_popup EINA_UNUSED)
91{
92 Ecore_Wl2_Window *win;
93
94 win = data;
95 if (!win) return;
96
97 if (win->grab) _ecore_wl2_input_ungrab(win->grab);
98}
99
100static const struct zxdg_popup_v6_listener _zxdg_popup_listener =
101{
102 _zxdg_popup_cb_configure,
103 _zxdg_popup_cb_done,
104};
105
106static void
107_window_v6_popup_create(Ecore_Wl2_Window *win)
108{
109 struct zxdg_positioner_v6 *pos;
110
111 EINA_SAFETY_ON_NULL_RETURN(win->parent);
112 pos = zxdg_shell_v6_create_positioner(win->display->wl.zxdg_shell);
113 if (!pos) return;
114
115 zxdg_positioner_v6_set_anchor_rect(pos, win->set_config.geometry.x,
116 win->set_config.geometry.y,
117 1, 1);
118 zxdg_positioner_v6_set_size(pos, win->set_config.geometry.w,
119 win->set_config.geometry.h);
120 zxdg_positioner_v6_set_anchor(pos, ZXDG_POSITIONER_V6_ANCHOR_TOP |
121 ZXDG_POSITIONER_V6_ANCHOR_LEFT);
122 zxdg_positioner_v6_set_gravity(pos, ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
123 ZXDG_POSITIONER_V6_ANCHOR_RIGHT);
124
125 win->zxdg_popup = zxdg_surface_v6_get_popup(win->zxdg_surface,
126 win->parent->zxdg_surface, pos);
127
128 zxdg_positioner_v6_destroy(pos);
129 if (win->grab)
130 zxdg_popup_v6_grab(win->zxdg_popup, win->grab->wl.seat,
131 wl_display_get_serial(win->display->wl.display));
132 zxdg_popup_v6_set_user_data(win->zxdg_popup, win);
133 zxdg_popup_v6_add_listener(win->zxdg_popup, &_zxdg_popup_listener, win);
134
135 win->pending.configure = EINA_TRUE;
136
137 ecore_wl2_window_commit(win, EINA_TRUE);
138}
139
140static void
141_window_v6_shell_surface_create(Ecore_Wl2_Window *window)
142{
143 if (window->zxdg_surface) return;
144 window->zxdg_surface =
145 zxdg_shell_v6_get_xdg_surface(window->display->wl.zxdg_shell,
146 window->surface);
147 zxdg_surface_v6_set_user_data(window->zxdg_surface, window);
148 zxdg_surface_v6_add_listener(window->zxdg_surface,
149 &_zxdg_surface_listener, window);
150
151 window->zxdg_configure_ack = zxdg_surface_v6_ack_configure;
152 window->pending.configure = EINA_TRUE;
153
154 if (window->type == ECORE_WL2_WINDOW_TYPE_MENU)
155 _window_v6_popup_create(window);
156 else
157 {
158 struct zxdg_toplevel_v6 *ptop = NULL;
159
160 window->zxdg_toplevel =
161 zxdg_surface_v6_get_toplevel(window->zxdg_surface);
162 zxdg_toplevel_v6_set_user_data(window->zxdg_toplevel, window);
163 zxdg_toplevel_v6_add_listener(window->zxdg_toplevel,
164 &_zxdg_toplevel_listener, window);
165
166 if (window->title)
167 zxdg_toplevel_v6_set_title(window->zxdg_toplevel, window->title);
168 if (window->class)
169 zxdg_toplevel_v6_set_app_id(window->zxdg_toplevel, window->class);
170
171 window->zxdg_set_min_size = zxdg_toplevel_v6_set_min_size;
172 window->zxdg_set_max_size = zxdg_toplevel_v6_set_max_size;
173
174 if (window->parent)
175 ptop = window->parent->zxdg_toplevel;
176
177 if (ptop)
178 zxdg_toplevel_v6_set_parent(window->zxdg_toplevel, ptop);
179
180 if (window->set_config.maximized)
181 zxdg_toplevel_v6_set_maximized(window->zxdg_toplevel);
182
183 if (window->set_config.fullscreen)
184 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
185 }
186
187 ecore_wl2_window_commit(window, EINA_TRUE);
188}
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index d78994423c..c3580bcbb6 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -4176,7 +4176,10 @@ _elm_win_frame_cb_menu(void *data,
4176 EINA_ITERATOR_FOREACH(it, input) break; 4176 EINA_ITERATOR_FOREACH(it, input) break;
4177 eina_iterator_free(it); 4177 eina_iterator_free(it);
4178 } 4178 }
4179 if (sd->wl.win->zxdg_toplevel) 4179 if (sd->wl.win->xdg_toplevel)
4180 xdg_toplevel_show_window_menu(sd->wl.win->xdg_toplevel,
4181 ecore_wl2_input_seat_get(input), 0, x, y);
4182 else if (sd->wl.win->zxdg_toplevel)
4180 zxdg_toplevel_v6_show_window_menu(sd->wl.win->zxdg_toplevel, 4183 zxdg_toplevel_v6_show_window_menu(sd->wl.win->zxdg_toplevel,
4181 ecore_wl2_input_seat_get(input), 0, x, y); 4184 ecore_wl2_input_seat_get(input), 0, x, y);
4182#else 4185#else
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 54daeb3259..4593ae8655 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
@@ -241,6 +241,17 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
241 ee->w = w; 241 ee->w = w;
242 ee->h = h; 242 ee->h = h;
243 243
244 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
245 {
246 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w, ee->prop.min.h);
247 wdata->win->pending.min = 0;
248 }
249 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
250 {
251 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w, ee->prop.max.h);
252 wdata->win->pending.max = 0;
253 }
254
244 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min) 255 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
245 { 256 {
246 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h); 257 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h);
@@ -524,6 +535,9 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
524 wdata->win->req_config.serial && wdata->win->surface && 535 wdata->win->req_config.serial && wdata->win->surface &&
525 ((!state_change) || ((pfw == fw) && (pfh == fh)))) 536 ((!state_change) || ((pfw == fw) && (pfh == fh))))
526 { 537 {
538 if (wdata->win->xdg_configure_ack)
539 wdata->win->xdg_configure_ack(wdata->win->xdg_surface,
540 wdata->win->req_config.serial);
527 if (wdata->win->zxdg_configure_ack) 541 if (wdata->win->zxdg_configure_ack)
528 wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface, 542 wdata->win->zxdg_configure_ack(wdata->win->zxdg_surface,
529 wdata->win->req_config.serial); 543 wdata->win->req_config.serial);
@@ -1558,6 +1572,11 @@ _ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
1558 ee->prop.min.w = w; 1572 ee->prop.min.w = w;
1559 ee->prop.min.h = h; 1573 ee->prop.min.h = h;
1560 wdata = ee->engine.data; 1574 wdata = ee->engine.data;
1575 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel)
1576 {
1577 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, w, h);
1578 wdata->win->pending.min = 0;
1579 }
1561 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel) 1580 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel)
1562 { 1581 {
1563 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w, h); 1582 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w, h);
@@ -1581,6 +1600,11 @@ _ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h)
1581 ee->prop.max.w = w; 1600 ee->prop.max.w = w;
1582 ee->prop.max.h = h; 1601 ee->prop.max.h = h;
1583 wdata = ee->engine.data; 1602 wdata = ee->engine.data;
1603 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel)
1604 {
1605 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, w, h);
1606 wdata->win->pending.max = 0;
1607 }
1584 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel) 1608 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel)
1585 { 1609 {
1586 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w, h); 1610 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w, h);
@@ -2067,6 +2091,16 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
2067 { 2091 {
2068 int fw, fh; 2092 int fw, fh;
2069 2093
2094 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
2095 {
2096 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w, ee->prop.min.h);
2097 wdata->win->pending.min = 0;
2098 }
2099 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
2100 {
2101 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w, ee->prop.max.h);
2102 wdata->win->pending.max = 0;
2103 }
2070 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min) 2104 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
2071 { 2105 {
2072 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h); 2106 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h);
diff --git a/src/wayland_protocol/efl-hints.xml b/src/wayland_protocol/efl-hints.xml
index 9f2b775dda..a29787e25f 100644
--- a/src/wayland_protocol/efl-hints.xml
+++ b/src/wayland_protocol/efl-hints.xml
@@ -9,13 +9,13 @@
9 <entry name="both" value="4"/> 9 <entry name="both" value="4"/>
10 </enum> 10 </enum>
11 <request name="set_aspect"> 11 <request name="set_aspect">
12 <arg name="surface" type="object" interface="zxdg_surface_v6"/> 12 <arg name="surface" type="object" interface="xdg_surface"/>
13 <arg name="width" type="uint"/> 13 <arg name="width" type="uint"/>
14 <arg name="height" type="uint"/> 14 <arg name="height" type="uint"/>
15 <arg name="aspect" type="uint" enum="aspect"/> 15 <arg name="aspect" type="uint" enum="aspect"/>
16 </request> 16 </request>
17 <request name="set_weight"> 17 <request name="set_weight">
18 <arg name="surface" type="object" interface="zxdg_surface_v6"/> 18 <arg name="surface" type="object" interface="xdg_surface"/>
19 <arg name="width" type="int"/> 19 <arg name="width" type="int"/>
20 <arg name="height" type="int"/> 20 <arg name="height" type="int"/>
21 </request> 21 </request>