ecore-wl2: apply same deferred shell surface creation as ecore-wayland
authorMike Blumenkrantz <zmike@osg.samsung.com>
Sat, 5 Dec 2015 00:01:02 +0000 (19:01 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Sat, 5 Dec 2015 00:06:51 +0000 (19:06 -0500)
new wheel meets old wheel.

ref 265ad8b5d0c46ad17de790e85ceaa593d7a5dd24

src/lib/ecore_wl2/ecore_wl2_display.c
src/lib/ecore_wl2/ecore_wl2_private.h
src/lib/ecore_wl2/ecore_wl2_window.c

index 1839341..4f612b1 100644 (file)
@@ -100,10 +100,14 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
    else if ((!strcmp(interface, "xdg_shell")) &&
             (!getenv("EFL_WAYLAND_DONT_USE_XDG_SHELL")))
      {
+        Ecore_Wl2_Window *window;
+
         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, NULL);
+        EINA_INLIST_FOREACH(ewd->windows, window)
+          _ecore_wl2_window_shell_surface_init(window);
      }
    else if (!strcmp(interface, "wl_output"))
      _ecore_wl2_output_add(ewd, id);
index fee3649..e33eaa2 100644 (file)
@@ -403,4 +403,5 @@ void _ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source);
 
 void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
 
+void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window);
 #endif
index 590dc66..3f6d0a3 100644 (file)
@@ -214,6 +214,49 @@ _ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
      }
 }
 
+void
+_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
+{
+   if (!window->surface) return;
+   if ((window->display->wl.xdg_shell) && (!window->xdg_surface))
+     {
+        window->xdg_surface =
+          xdg_shell_get_xdg_surface(window->display->wl.xdg_shell, window->surface);
+        if (!window->xdg_surface) goto surf_err;
+
+        if (window->title)
+          xdg_surface_set_title(window->xdg_surface, window->title);
+        if (window->class)
+          xdg_surface_set_app_id(window->xdg_surface, window->class);
+
+
+        xdg_surface_set_user_data(window->xdg_surface, window);
+        xdg_surface_add_listener(window->xdg_surface,
+                                 &_xdg_surface_listener, window);
+
+        window->configure_ack = xdg_surface_ack_configure;
+        _ecore_wl2_window_type_set(window);
+     }
+   else if ((window->display->wl.wl_shell) && (!window->wl_shell_surface))
+     {
+        window->wl_shell_surface =
+          wl_shell_get_shell_surface(window->display->wl.wl_shell, window->surface);
+        if (!window->wl_shell_surface) goto surf_err;
+
+        if (window->title)
+          wl_shell_surface_set_title(window->wl_shell_surface, window->title);
+        if (window->class)
+          wl_shell_surface_set_class(window->wl_shell_surface, window->class);
+
+        wl_shell_surface_add_listener(window->wl_shell_surface,
+                                      &_wl_shell_surface_listener, window);
+        _ecore_wl2_window_type_set(window);
+     }
+   return;
+surf_err:
+   ERR("Failed to create surface for window: %m");
+}
+
 EAPI Ecore_Wl2_Window *
 ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h)
 {
@@ -284,60 +327,22 @@ ecore_wl2_window_surface_id_get(Ecore_Wl2_Window *window)
 EAPI void
 ecore_wl2_window_show(Ecore_Wl2_Window *window)
 {
-   Ecore_Wl2_Display *disp;
-
    EINA_SAFETY_ON_NULL_RETURN(window);
 
-   disp = window->display;
-
    if (!window->surface)
      {
         window->surface =
           wl_compositor_create_surface(window->display->wl.compositor);
+        if (!window->surface)
+          {
+             ERR("Failed to create surface for window: %m");
+             return;
+          }
      }
 
-   if ((window->type == ECORE_WL2_WINDOW_TYPE_DND) ||
-       (window->type == ECORE_WL2_WINDOW_TYPE_NONE))
-     goto type_set;
-
-   if ((disp->wl.xdg_shell) && (!window->xdg_surface))
-     {
-        window->xdg_surface =
-          xdg_shell_get_xdg_surface(disp->wl.xdg_shell, window->surface);
-        if (!window->xdg_surface) goto surf_err;
-
-        if (window->title)
-          xdg_surface_set_title(window->xdg_surface, window->title);
-        if (window->class)
-          xdg_surface_set_app_id(window->xdg_surface, window->class);
-
-        xdg_surface_set_user_data(window->xdg_surface, window);
-        xdg_surface_add_listener(window->xdg_surface,
-                                 &_xdg_surface_listener, window);
-
-        window->configure_ack = xdg_surface_ack_configure;
-     }
-   else if ((disp->wl.wl_shell) && (!window->wl_shell_surface))
-     {
-        window->wl_shell_surface =
-          wl_shell_get_shell_surface(disp->wl.wl_shell, window->surface);
-        if (!window->wl_shell_surface) goto surf_err;
-
-        if (window->title)
-          wl_shell_surface_set_title(window->wl_shell_surface, window->title);
-        if (window->class)
-          wl_shell_surface_set_class(window->wl_shell_surface, window->class);
-
-        wl_shell_surface_add_listener(window->wl_shell_surface,
-                                      &_wl_shell_surface_listener, window);
-     }
-
-type_set:
-   _ecore_wl2_window_type_set(window);
-   return;
-
-surf_err:
-   ERR("Failed to create surface for window: %m");
+   if ((window->type != ECORE_WL2_WINDOW_TYPE_DND) &&
+       (window->type != ECORE_WL2_WINDOW_TYPE_NONE))
+     _ecore_wl2_window_shell_surface_init(window);
 }
 
 EAPI void