ecore wayland: added code to handle parent window when the parent window is set 38/62238/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 15 Mar 2016 04:22:17 +0000 (13:22 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 15 Mar 2016 06:31:09 +0000 (23:31 -0700)
Change-Id: Ie0c2723d30a58eb2cc0f8366382100621c33e554

src/lib/ecore_wayland/ecore_wl_window.c

index 0d8b38e..f8d4726 100644 (file)
@@ -374,7 +374,10 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
    win->saved.w = w;
    win->saved.h = h;
    win->transparent = EINA_FALSE;
-   win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+   if (parent)
+     win->type = ECORE_WL_WINDOW_TYPE_TRANSIENT;
+   else
+     win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
    win->buffer_type = buffer_type;
    win->id = _win_id++;
    win->rotation = 0;
@@ -1000,6 +1003,25 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    win->parent = parent;
+   if (win->parent)
+     {
+        win->type = 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);
+     }
+   else
+     {
+        win->type = 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);
+     }
 }
 
 EAPI void