diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2015-10-19 16:13:50 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2015-10-19 16:15:46 -0400 |
commit | 265ad8b5d0c46ad17de790e85ceaa593d7a5dd24 (patch) | |
tree | 3d5768e3a67110820374ec2958ce25a6b1677b05 /src/lib/ecore_wayland/ecore_wl_window.c | |
parent | 69c2b13474b84fa7c8fd9f3942ab89c0d346af79 (diff) |
ecore-wayland: defer shell surface creation for windows if shell is not bound
in the case where a surface is created before the compositor binds its shell(s),
a shell surface would never be created
fixes case where internal windows would not create frames in enlightenment
@fix
Diffstat (limited to 'src/lib/ecore_wayland/ecore_wl_window.c')
-rw-r--r-- | src/lib/ecore_wayland/ecore_wl_window.c | 238 |
1 files changed, 122 insertions, 116 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 8250e78338..d951be2f14 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c | |||
@@ -65,6 +65,127 @@ _ecore_wl_window_hash_get(void) | |||
65 | return _windows; | 65 | return _windows; |
66 | } | 66 | } |
67 | 67 | ||
68 | void | ||
69 | _ecore_wl_window_shell_surface_init(Ecore_Wl_Window *win) | ||
70 | { | ||
71 | if ((win->type == ECORE_WL_WINDOW_TYPE_DND) || | ||
72 | (win->type == ECORE_WL_WINDOW_TYPE_NONE)) return; | ||
73 | #ifdef USE_IVI_SHELL | ||
74 | if ((!win->ivi_surface) && (_ecore_wl_disp->wl.ivi_application)) | ||
75 | { | ||
76 | if (win->parent && win->parent->ivi_surface) | ||
77 | win->ivi_surface_id = win->parent->ivi_surface_id + 1; | ||
78 | else if ((env = getenv("ECORE_IVI_SURFACE_ID"))) | ||
79 | win->ivi_surface_id = atoi(env); | ||
80 | else | ||
81 | win->ivi_surface_id = IVI_SURFACE_ID + getpid(); | ||
82 | |||
83 | win->ivi_surface = | ||
84 | ivi_application_surface_create(_ecore_wl_disp->wl.ivi_application, | ||
85 | win->ivi_surface_id, win->surface); | ||
86 | } | ||
87 | |||
88 | if (!win->ivi_surface) | ||
89 | { | ||
90 | #endif | ||
91 | if (_ecore_wl_disp->wl.xdg_shell) | ||
92 | { | ||
93 | if (win->xdg_surface) return; | ||
94 | win->xdg_surface = | ||
95 | xdg_shell_get_xdg_surface(_ecore_wl_disp->wl.xdg_shell, | ||
96 | win->surface); | ||
97 | if (!win->xdg_surface) return; | ||
98 | if (win->title) | ||
99 | xdg_surface_set_title(win->xdg_surface, win->title); | ||
100 | if (win->class_name) | ||
101 | xdg_surface_set_app_id(win->xdg_surface, win->class_name); | ||
102 | xdg_surface_set_user_data(win->xdg_surface, win); | ||
103 | xdg_surface_add_listener(win->xdg_surface, | ||
104 | &_ecore_xdg_surface_listener, win); | ||
105 | } | ||
106 | else if (_ecore_wl_disp->wl.shell) | ||
107 | { | ||
108 | if (win->shell_surface) return; | ||
109 | win->shell_surface = | ||
110 | wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, | ||
111 | win->surface); | ||
112 | if (!win->shell_surface) return; | ||
113 | |||
114 | if (win->title) | ||
115 | wl_shell_surface_set_title(win->shell_surface, win->title); | ||
116 | |||
117 | if (win->class_name) | ||
118 | wl_shell_surface_set_class(win->shell_surface, win->class_name); | ||
119 | } | ||
120 | |||
121 | if (win->shell_surface) | ||
122 | wl_shell_surface_add_listener(win->shell_surface, | ||
123 | &_ecore_wl_shell_surface_listener, win); | ||
124 | #ifdef USE_IVI_SHELL | ||
125 | } | ||
126 | #endif | ||
127 | |||
128 | /* trap for valid shell surface */ | ||
129 | if ((!win->xdg_surface) && (!win->shell_surface)) return; | ||
130 | |||
131 | switch (win->type) | ||
132 | { | ||
133 | case ECORE_WL_WINDOW_TYPE_FULLSCREEN: | ||
134 | if (win->xdg_surface) | ||
135 | xdg_surface_set_fullscreen(win->xdg_surface, NULL); | ||
136 | else if (win->shell_surface) | ||
137 | wl_shell_surface_set_fullscreen(win->shell_surface, | ||
138 | WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, | ||
139 | 0, NULL); | ||
140 | break; | ||
141 | case ECORE_WL_WINDOW_TYPE_MAXIMIZED: | ||
142 | if (win->xdg_surface) | ||
143 | xdg_surface_set_maximized(win->xdg_surface); | ||
144 | else if (win->shell_surface) | ||
145 | wl_shell_surface_set_maximized(win->shell_surface, NULL); | ||
146 | break; | ||
147 | case ECORE_WL_WINDOW_TYPE_TRANSIENT: | ||
148 | if (win->xdg_surface) | ||
149 | xdg_surface_set_parent(win->xdg_surface, win->parent->xdg_surface); | ||
150 | else if (win->shell_surface) | ||
151 | wl_shell_surface_set_transient(win->shell_surface, | ||
152 | win->parent->surface, | ||
153 | win->allocation.x, | ||
154 | win->allocation.y, 0); | ||
155 | break; | ||
156 | case ECORE_WL_WINDOW_TYPE_MENU: | ||
157 | if (win->xdg_surface) | ||
158 | { | ||
159 | win->xdg_popup = | ||
160 | xdg_shell_get_xdg_popup(_ecore_wl_disp->wl.xdg_shell, | ||
161 | win->surface, | ||
162 | win->parent->surface, | ||
163 | _ecore_wl_disp->input->seat, | ||
164 | _ecore_wl_disp->serial, | ||
165 | win->allocation.x, win->allocation.y); | ||
166 | if (!win->xdg_popup) return; | ||
167 | xdg_popup_set_user_data(win->xdg_popup, win); | ||
168 | xdg_popup_add_listener(win->xdg_popup, | ||
169 | &_ecore_xdg_popup_listener, win); | ||
170 | } | ||
171 | else if (win->shell_surface) | ||
172 | wl_shell_surface_set_popup(win->shell_surface, | ||
173 | _ecore_wl_disp->input->seat, | ||
174 | _ecore_wl_disp->serial, | ||
175 | win->parent->surface, | ||
176 | win->allocation.x, win->allocation.y, 0); | ||
177 | break; | ||
178 | case ECORE_WL_WINDOW_TYPE_TOPLEVEL: | ||
179 | if (win->xdg_surface) | ||
180 | xdg_surface_set_parent(win->xdg_surface, NULL); | ||
181 | else if (win->shell_surface) | ||
182 | wl_shell_surface_set_toplevel(win->shell_surface); | ||
183 | break; | ||
184 | default: | ||
185 | break; | ||
186 | } | ||
187 | } | ||
188 | |||
68 | EAPI Ecore_Wl_Window * | 189 | EAPI Ecore_Wl_Window * |
69 | ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type) | 190 | ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type) |
70 | { | 191 | { |
@@ -289,122 +410,7 @@ ecore_wl_window_show(Ecore_Wl_Window *win) | |||
289 | 410 | ||
290 | ecore_wl_window_surface_create(win); | 411 | ecore_wl_window_surface_create(win); |
291 | 412 | ||
292 | if ((win->type != ECORE_WL_WINDOW_TYPE_DND) && | 413 | _ecore_wl_window_shell_surface_init(win); |
293 | (win->type != ECORE_WL_WINDOW_TYPE_NONE)) | ||
294 | { | ||
295 | #ifdef USE_IVI_SHELL | ||
296 | if ((!win->ivi_surface) && (_ecore_wl_disp->wl.ivi_application)) | ||
297 | { | ||
298 | if (win->parent && win->parent->ivi_surface) | ||
299 | win->ivi_surface_id = win->parent->ivi_surface_id + 1; | ||
300 | else if ((env = getenv("ECORE_IVI_SURFACE_ID"))) | ||
301 | win->ivi_surface_id = atoi(env); | ||
302 | else | ||
303 | win->ivi_surface_id = IVI_SURFACE_ID + getpid(); | ||
304 | |||
305 | win->ivi_surface = | ||
306 | ivi_application_surface_create(_ecore_wl_disp->wl.ivi_application, | ||
307 | win->ivi_surface_id, win->surface); | ||
308 | } | ||
309 | |||
310 | if (!win->ivi_surface) | ||
311 | { | ||
312 | #endif | ||
313 | if ((!win->xdg_surface) && (_ecore_wl_disp->wl.xdg_shell)) | ||
314 | { | ||
315 | win->xdg_surface = | ||
316 | xdg_shell_get_xdg_surface(_ecore_wl_disp->wl.xdg_shell, | ||
317 | win->surface); | ||
318 | if (!win->xdg_surface) return; | ||
319 | if (win->title) | ||
320 | xdg_surface_set_title(win->xdg_surface, win->title); | ||
321 | if (win->class_name) | ||
322 | xdg_surface_set_app_id(win->xdg_surface, win->class_name); | ||
323 | xdg_surface_set_user_data(win->xdg_surface, win); | ||
324 | xdg_surface_add_listener(win->xdg_surface, | ||
325 | &_ecore_xdg_surface_listener, win); | ||
326 | } | ||
327 | else if ((!win->shell_surface) && (_ecore_wl_disp->wl.shell)) | ||
328 | { | ||
329 | win->shell_surface = | ||
330 | wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell, | ||
331 | win->surface); | ||
332 | if (!win->shell_surface) return; | ||
333 | |||
334 | if (win->title) | ||
335 | wl_shell_surface_set_title(win->shell_surface, win->title); | ||
336 | |||
337 | if (win->class_name) | ||
338 | wl_shell_surface_set_class(win->shell_surface, win->class_name); | ||
339 | } | ||
340 | |||
341 | if (win->shell_surface) | ||
342 | wl_shell_surface_add_listener(win->shell_surface, | ||
343 | &_ecore_wl_shell_surface_listener, win); | ||
344 | #ifdef USE_IVI_SHELL | ||
345 | } | ||
346 | #endif | ||
347 | } | ||
348 | |||
349 | /* trap for valid shell surface */ | ||
350 | if ((!win->xdg_surface) && (!win->shell_surface)) return; | ||
351 | |||
352 | switch (win->type) | ||
353 | { | ||
354 | case ECORE_WL_WINDOW_TYPE_FULLSCREEN: | ||
355 | if (win->xdg_surface) | ||
356 | xdg_surface_set_fullscreen(win->xdg_surface, NULL); | ||
357 | else if (win->shell_surface) | ||
358 | wl_shell_surface_set_fullscreen(win->shell_surface, | ||
359 | WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, | ||
360 | 0, NULL); | ||
361 | break; | ||
362 | case ECORE_WL_WINDOW_TYPE_MAXIMIZED: | ||
363 | if (win->xdg_surface) | ||
364 | xdg_surface_set_maximized(win->xdg_surface); | ||
365 | else if (win->shell_surface) | ||
366 | wl_shell_surface_set_maximized(win->shell_surface, NULL); | ||
367 | break; | ||
368 | case ECORE_WL_WINDOW_TYPE_TRANSIENT: | ||
369 | if (win->xdg_surface) | ||
370 | xdg_surface_set_parent(win->xdg_surface, win->parent->xdg_surface); | ||
371 | else if (win->shell_surface) | ||
372 | wl_shell_surface_set_transient(win->shell_surface, | ||
373 | win->parent->surface, | ||
374 | win->allocation.x, | ||
375 | win->allocation.y, 0); | ||
376 | break; | ||
377 | case ECORE_WL_WINDOW_TYPE_MENU: | ||
378 | if (win->xdg_surface) | ||
379 | { | ||
380 | win->xdg_popup = | ||
381 | xdg_shell_get_xdg_popup(_ecore_wl_disp->wl.xdg_shell, | ||
382 | win->surface, | ||
383 | win->parent->surface, | ||
384 | _ecore_wl_disp->input->seat, | ||
385 | _ecore_wl_disp->serial, | ||
386 | win->allocation.x, win->allocation.y); | ||
387 | if (!win->xdg_popup) return; | ||
388 | xdg_popup_set_user_data(win->xdg_popup, win); | ||
389 | xdg_popup_add_listener(win->xdg_popup, | ||
390 | &_ecore_xdg_popup_listener, win); | ||
391 | } | ||
392 | else if (win->shell_surface) | ||
393 | wl_shell_surface_set_popup(win->shell_surface, | ||
394 | _ecore_wl_disp->input->seat, | ||
395 | _ecore_wl_disp->serial, | ||
396 | win->parent->surface, | ||
397 | win->allocation.x, win->allocation.y, 0); | ||
398 | break; | ||
399 | case ECORE_WL_WINDOW_TYPE_TOPLEVEL: | ||
400 | if (win->xdg_surface) | ||
401 | xdg_surface_set_parent(win->xdg_surface, NULL); | ||
402 | else if (win->shell_surface) | ||
403 | wl_shell_surface_set_toplevel(win->shell_surface); | ||
404 | break; | ||
405 | default: | ||
406 | break; | ||
407 | } | ||
408 | } | 414 | } |
409 | 415 | ||
410 | EAPI void | 416 | EAPI void |