discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=265ad8b5d0c46ad17de790e85ceaa593d7a5dd24

commit 265ad8b5d0c46ad17de790e85ceaa593d7a5dd24
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Mon Oct 19 16:13:50 2015 -0400

    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
---
 src/lib/ecore_wayland/ecore_wl.c         |   8 ++
 src/lib/ecore_wayland/ecore_wl_private.h |   1 +
 src/lib/ecore_wayland/ecore_wl_window.c  | 238 ++++++++++++++++---------------
 3 files changed, 131 insertions(+), 116 deletions(-)

diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index 5d1e0e0..e336e95 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -701,11 +701,19 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry 
*registry, unsigned in
 #endif
    else if (!strcmp(interface, "xdg_shell") && 
!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL"))
      {
+        Eina_Hash *h;
+        Eina_Iterator *it;
+        Ecore_Wl_Window *win;
+
         ewd->wl.xdg_shell =
           wl_registry_bind(registry, id, &xdg_shell_interface, 1);
         xdg_shell_use_unstable_version(ewd->wl.xdg_shell, XDG_VERSION);
         xdg_shell_add_listener(ewd->wl.xdg_shell, &xdg_shell_listener,
                                ewd->wl.display);
+        h = _ecore_wl_window_hash_get();
+        it = eina_hash_iterator_data_new(h);
+        EINA_ITERATOR_FOREACH(it, win)
+          _ecore_wl_window_shell_surface_init(win);
      }
    else if (!strcmp(interface, "wl_shell"))
      {
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h 
b/src/lib/ecore_wayland/ecore_wl_private.h
index 3493472..6d4f677 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -283,6 +283,7 @@ extern Ecore_Wl_Display *_ecore_wl_disp;
 void _ecore_wl_window_init(void);
 void _ecore_wl_window_shutdown(void);
 Eina_Hash *_ecore_wl_window_hash_get(void);
+void _ecore_wl_window_shell_surface_init(Ecore_Wl_Window *win);
 
 void _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id);
 void _ecore_wl_output_del(Ecore_Wl_Output *output);
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c 
b/src/lib/ecore_wayland/ecore_wl_window.c
index 8250e78..d951be2 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)
    return _windows;
 }
 
+void
+_ecore_wl_window_shell_surface_init(Ecore_Wl_Window *win)
+{
+   if ((win->type == ECORE_WL_WINDOW_TYPE_DND) ||
+       (win->type == ECORE_WL_WINDOW_TYPE_NONE)) return;
+#ifdef USE_IVI_SHELL
+   if ((!win->ivi_surface) && (_ecore_wl_disp->wl.ivi_application))
+     {
+        if (win->parent && win->parent->ivi_surface)
+          win->ivi_surface_id = win->parent->ivi_surface_id + 1;
+        else if ((env = getenv("ECORE_IVI_SURFACE_ID")))
+          win->ivi_surface_id = atoi(env);
+        else
+          win->ivi_surface_id = IVI_SURFACE_ID + getpid();
+
+        win->ivi_surface =
+          ivi_application_surface_create(_ecore_wl_disp->wl.ivi_application,
+                                         win->ivi_surface_id, win->surface);
+     }
+
+   if (!win->ivi_surface)
+     {
+#endif
+        if (_ecore_wl_disp->wl.xdg_shell)
+          {
+             if (win->xdg_surface) return;
+             win->xdg_surface =
+               xdg_shell_get_xdg_surface(_ecore_wl_disp->wl.xdg_shell,
+                                         win->surface);
+             if (!win->xdg_surface) return;
+             if (win->title)
+               xdg_surface_set_title(win->xdg_surface, win->title);
+             if (win->class_name)
+               xdg_surface_set_app_id(win->xdg_surface, win->class_name);
+             xdg_surface_set_user_data(win->xdg_surface, win);
+             xdg_surface_add_listener(win->xdg_surface,
+                                      &_ecore_xdg_surface_listener, win);
+          }
+        else if (_ecore_wl_disp->wl.shell)
+          {
+             if (win->shell_surface) return;
+             win->shell_surface =
+               wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell,
+                                          win->surface);
+             if (!win->shell_surface) return;
+
+             if (win->title)
+               wl_shell_surface_set_title(win->shell_surface, win->title);
+
+             if (win->class_name)
+               wl_shell_surface_set_class(win->shell_surface, win->class_name);
+          }
+
+        if (win->shell_surface)
+          wl_shell_surface_add_listener(win->shell_surface,
+                                        &_ecore_wl_shell_surface_listener, 
win);
+#ifdef USE_IVI_SHELL
+     }
+#endif
+
+   /* trap for valid shell surface */
+   if ((!win->xdg_surface) && (!win->shell_surface)) return;
+
+   switch (win->type)
+     {
+      case ECORE_WL_WINDOW_TYPE_FULLSCREEN:
+        if (win->xdg_surface)
+          xdg_surface_set_fullscreen(win->xdg_surface, NULL);
+        else if (win->shell_surface)
+          wl_shell_surface_set_fullscreen(win->shell_surface,
+                                          
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
+                                          0, NULL);
+        break;
+      case ECORE_WL_WINDOW_TYPE_MAXIMIZED:
+        if (win->xdg_surface)
+          xdg_surface_set_maximized(win->xdg_surface);
+        else if (win->shell_surface)
+          wl_shell_surface_set_maximized(win->shell_surface, NULL);
+        break;
+      case ECORE_WL_WINDOW_TYPE_TRANSIENT:
+        if (win->xdg_surface)
+          xdg_surface_set_parent(win->xdg_surface, win->parent->xdg_surface);
+        else if (win->shell_surface)
+          wl_shell_surface_set_transient(win->shell_surface,
+                                         win->parent->surface,
+                                         win->allocation.x,
+                                         win->allocation.y, 0);
+        break;
+      case ECORE_WL_WINDOW_TYPE_MENU:
+        if (win->xdg_surface)
+          {
+             win->xdg_popup =
+               xdg_shell_get_xdg_popup(_ecore_wl_disp->wl.xdg_shell,
+                                       win->surface,
+                                       win->parent->surface,
+                                       _ecore_wl_disp->input->seat,
+                                       _ecore_wl_disp->serial,
+                                       win->allocation.x, win->allocation.y);
+             if (!win->xdg_popup) return;
+             xdg_popup_set_user_data(win->xdg_popup, win);
+             xdg_popup_add_listener(win->xdg_popup,
+                                    &_ecore_xdg_popup_listener, win);
+          }
+        else if (win->shell_surface)
+          wl_shell_surface_set_popup(win->shell_surface,
+                                     _ecore_wl_disp->input->seat,
+                                     _ecore_wl_disp->serial,
+                                     win->parent->surface,
+                                     win->allocation.x, win->allocation.y, 0);
+        break;
+      case ECORE_WL_WINDOW_TYPE_TOPLEVEL:
+        if (win->xdg_surface)
+          xdg_surface_set_parent(win->xdg_surface, NULL);
+        else if (win->shell_surface)
+          wl_shell_surface_set_toplevel(win->shell_surface);
+        break;
+      default:
+        break;
+     }
+}
+
 EAPI Ecore_Wl_Window *
 ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int 
buffer_type)
 {
@@ -289,122 +410,7 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
 
    ecore_wl_window_surface_create(win);
 
-   if ((win->type != ECORE_WL_WINDOW_TYPE_DND) &&
-       (win->type != ECORE_WL_WINDOW_TYPE_NONE))
-     {
-#ifdef USE_IVI_SHELL
-        if ((!win->ivi_surface) && (_ecore_wl_disp->wl.ivi_application))
-          {
-             if (win->parent && win->parent->ivi_surface)
-               win->ivi_surface_id = win->parent->ivi_surface_id + 1;
-             else if ((env = getenv("ECORE_IVI_SURFACE_ID")))
-               win->ivi_surface_id = atoi(env);
-             else
-               win->ivi_surface_id = IVI_SURFACE_ID + getpid();
-
-             win->ivi_surface =
-               
ivi_application_surface_create(_ecore_wl_disp->wl.ivi_application,
-                                              win->ivi_surface_id, 
win->surface);
-          }
-
-        if (!win->ivi_surface)
-          {
-#endif
-             if ((!win->xdg_surface) && (_ecore_wl_disp->wl.xdg_shell))
-               {
-                  win->xdg_surface =
-                    xdg_shell_get_xdg_surface(_ecore_wl_disp->wl.xdg_shell,
-                                              win->surface);
-                  if (!win->xdg_surface) return;
-                  if (win->title)
-                    xdg_surface_set_title(win->xdg_surface, win->title);
-                  if (win->class_name)
-                    xdg_surface_set_app_id(win->xdg_surface, win->class_name);
-                  xdg_surface_set_user_data(win->xdg_surface, win);
-                  xdg_surface_add_listener(win->xdg_surface,
-                                           &_ecore_xdg_surface_listener, win);
-               }
-             else if ((!win->shell_surface) && (_ecore_wl_disp->wl.shell))
-               {
-                  win->shell_surface =
-                    wl_shell_get_shell_surface(_ecore_wl_disp->wl.shell,
-                                               win->surface);
-                  if (!win->shell_surface) return;
-
-                  if (win->title)
-                    wl_shell_surface_set_title(win->shell_surface, win->title);
-
-                  if (win->class_name)
-                    wl_shell_surface_set_class(win->shell_surface, 
win->class_name);
-               }
-
-             if (win->shell_surface)
-               wl_shell_surface_add_listener(win->shell_surface,
-                                             
&_ecore_wl_shell_surface_listener, win);
-#ifdef USE_IVI_SHELL
-          }
-#endif
-     }
-
-   /* trap for valid shell surface */
-   if ((!win->xdg_surface) && (!win->shell_surface)) return;
-
-   switch (win->type)
-     {
-      case ECORE_WL_WINDOW_TYPE_FULLSCREEN:
-        if (win->xdg_surface)
-          xdg_surface_set_fullscreen(win->xdg_surface, NULL);
-        else if (win->shell_surface)
-          wl_shell_surface_set_fullscreen(win->shell_surface,
-                                          
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
-                                          0, NULL);
-        break;
-      case ECORE_WL_WINDOW_TYPE_MAXIMIZED:
-        if (win->xdg_surface)
-          xdg_surface_set_maximized(win->xdg_surface);
-        else if (win->shell_surface)
-          wl_shell_surface_set_maximized(win->shell_surface, NULL);
-        break;
-      case ECORE_WL_WINDOW_TYPE_TRANSIENT:
-        if (win->xdg_surface)
-          xdg_surface_set_parent(win->xdg_surface, win->parent->xdg_surface);
-        else if (win->shell_surface)
-          wl_shell_surface_set_transient(win->shell_surface,
-                                         win->parent->surface,
-                                         win->allocation.x,
-                                         win->allocation.y, 0);
-        break;
-      case ECORE_WL_WINDOW_TYPE_MENU:
-        if (win->xdg_surface)
-          {
-             win->xdg_popup =
-               xdg_shell_get_xdg_popup(_ecore_wl_disp->wl.xdg_shell,
-                                       win->surface,
-                                       win->parent->surface,
-                                       _ecore_wl_disp->input->seat,
-                                       _ecore_wl_disp->serial,
-                                       win->allocation.x, win->allocation.y);
-             if (!win->xdg_popup) return;
-             xdg_popup_set_user_data(win->xdg_popup, win);
-             xdg_popup_add_listener(win->xdg_popup,
-                                    &_ecore_xdg_popup_listener, win);
-          }
-        else if (win->shell_surface)
-          wl_shell_surface_set_popup(win->shell_surface,
-                                     _ecore_wl_disp->input->seat,
-                                     _ecore_wl_disp->serial,
-                                     win->parent->surface,
-                                     win->allocation.x, win->allocation.y, 0);
-        break;
-      case ECORE_WL_WINDOW_TYPE_TOPLEVEL:
-        if (win->xdg_surface)
-          xdg_surface_set_parent(win->xdg_surface, NULL);
-        else if (win->shell_surface)
-          wl_shell_surface_set_toplevel(win->shell_surface);
-        break;
-      default:
-        break;
-     }
+   _ecore_wl_window_shell_surface_init(win);
 }
 
 EAPI void

-- 


Reply via email to