ecore_wayland: added code to handle the window style 40/92740/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 18 Oct 2016 10:57:39 +0000 (19:57 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Tue, 18 Oct 2016 11:01:16 +0000 (04:01 -0700)
Change-Id: I0d9247c3e1ed9b3e16ea309988139e68659c8cff

src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl_private.h
src/lib/ecore_wayland/ecore_wl_window.c

index d16c037..cb44040 100644 (file)
@@ -120,6 +120,13 @@ enum _Ecore_Wl_Window_Type
    ECORE_WL_WINDOW_TYPE_UTILITY
 };
 
+enum _Ecore_Wl_Window_Style
+{
+   ECORE_WL_WINDOW_STYLE_NONE,
+   ECORE_WL_WINDOW_STYLE_FULLSCREEN,
+   ECORE_WL_WINDOW_STYLE_MAXIMIZED,
+};
+
 enum _Ecore_Wl_Window_Buffer_Type
 {
    ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW,
@@ -189,6 +196,7 @@ enum _Ecore_Wl_Window_Stack_Mode
 };
 
 typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
+typedef enum _Ecore_Wl_Window_Style Ecore_Wl_Window_Style;
 typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
 typedef enum _Ecore_Wl_Window_Keygrab_Mode Ecore_Wl_Window_Keygrab_Mode;
 typedef enum _Ecore_Wl_Conformant_Part_Type Ecore_Wl_Conformant_Part_Type;
index f311496..9ec85d9 100644 (file)
@@ -237,6 +237,7 @@ struct _Ecore_Wl_Window
    Eina_Bool conformant : 1;
 
    Ecore_Wl_Window_Type type;
+   Ecore_Wl_Window_Style style;
    Ecore_Wl_Window_Buffer_Type buffer_type;
 
    Ecore_Wl_Input *pointer_device;
index 1537082..fac0f01 100644 (file)
@@ -266,29 +266,6 @@ _ecore_wl_window_shell_surface_init(Ecore_Wl_Window *win)
 
    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)
           {
@@ -312,15 +289,44 @@ _ecore_wl_window_shell_surface_init(Ecore_Wl_Window *win)
                                      win->allocation.x, win->allocation.y, 0);
         break;
       case ECORE_WL_WINDOW_TYPE_TOPLEVEL:
+        if (win->shell_surface)
+          wl_shell_surface_set_toplevel(win->shell_surface);
+        break;
+      default:
+        break;
+     }
+
+   switch (win->style)
+     {
+      case ECORE_WL_WINDOW_STYLE_FULLSCREEN:
         if (win->xdg_surface)
-          xdg_surface_set_parent(win->xdg_surface, NULL);
+          xdg_surface_set_fullscreen(win->xdg_surface, NULL);
         else if (win->shell_surface)
-          wl_shell_surface_set_toplevel(win->shell_surface);
+          wl_shell_surface_set_fullscreen(win->shell_surface,
+                                          WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
+                                          0, NULL);
+        break;
+      case ECORE_WL_WINDOW_STYLE_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;
       default:
         break;
      }
 
+   if (win->parent)
+     {
+        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);
+     }
+
    if (!win->visible)
      {
         _ecore_wl_window_show_send(win);
@@ -354,10 +360,7 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
    win->configured.h = h;
    win->configured.edges = 0;
    win->transparent = EINA_FALSE;
-   if (parent)
-     win->type = ECORE_WL_WINDOW_TYPE_TRANSIENT;
-   else
-     win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+   win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
    win->buffer_type = buffer_type;
    win->id = _win_id++;
    win->rotation = 0;
@@ -684,27 +687,27 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
 
    if (!win) return;
 
-   if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return;
+   if ((win->style == ECORE_WL_WINDOW_STYLE_MAXIMIZED) == maximized) return;
 
-   if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
+   if (win->style == ECORE_WL_WINDOW_STYLE_NONE)
      {
         if (win->xdg_surface)
           {
              xdg_surface_set_maximized(win->xdg_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
+             win->style = ECORE_WL_WINDOW_STYLE_MAXIMIZED;
           }
         else if (win->shell_surface)
           {
              wl_shell_surface_set_maximized(win->shell_surface, NULL);
-             win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
+             win->style = ECORE_WL_WINDOW_STYLE_MAXIMIZED;
           }
      }
-   else if (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED)
+   else if (win->style == ECORE_WL_WINDOW_STYLE_MAXIMIZED)
      {
         if (win->xdg_surface)
           {
              xdg_surface_unset_maximized(win->xdg_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+             win->style = ECORE_WL_WINDOW_STYLE_NONE;
              _ecore_wl_window_configure_send(win,
                                              win->saved.w,
                                              win->saved.h,
@@ -713,7 +716,7 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
         else if (win->shell_surface)
           {
              wl_shell_surface_set_toplevel(win->shell_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+             win->style = ECORE_WL_WINDOW_STYLE_NONE;
              _ecore_wl_window_configure_send(win,
                                              win->saved.w,
                                              win->saved.h,
@@ -729,7 +732,7 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
 
    if (!win) return EINA_FALSE;
 
-   return (win->maximized) || (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED);
+   return (win->maximized) || (win->style == ECORE_WL_WINDOW_STYLE_MAXIMIZED);
 }
 
 EAPI void
@@ -738,10 +741,10 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    if (!win) return;
-   if ((win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN) == fullscreen) return;
+   if ((win->style == ECORE_WL_WINDOW_STYLE_FULLSCREEN) == fullscreen) return;
    if (fullscreen)
      {
-        win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
+        win->style = ECORE_WL_WINDOW_STYLE_FULLSCREEN;
 
         if (win->xdg_surface)
           xdg_surface_set_fullscreen(win->xdg_surface, NULL);
@@ -758,7 +761,7 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
         else if (win->shell_surface)
           wl_shell_surface_set_toplevel(win->shell_surface);
 
-        win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+        win->style = ECORE_WL_WINDOW_STYLE_NONE;
         _ecore_wl_window_configure_send(win,
                                         win->saved.w, win->saved.h, 0);
      }
@@ -771,7 +774,7 @@ ecore_wl_window_fullscreen_get(Ecore_Wl_Window *win)
 
    if (!win) return EINA_FALSE;
 
-   return win->fullscreen || (win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN);
+   return win->fullscreen || (win->style == ECORE_WL_WINDOW_STYLE_FULLSCREEN);
 }
 
 EAPI void
@@ -1000,7 +1003,6 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
    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)
@@ -1011,7 +1013,6 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
      }
    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)
@@ -1693,7 +1694,6 @@ _ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_B
           }
         else if (win->xdg_surface)
           {
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
              wl_array_init(&states);
              s = wl_array_add(&states, sizeof(*s));
              *s = XDG_SURFACE_STATE_ACTIVATED;
@@ -1703,7 +1703,6 @@ _ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified, Eina_B
         else if (win->shell_surface)
           {
              wl_shell_surface_set_toplevel(win->shell_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
              _ecore_wl_window_configure_send(win,
                                              win->saved.w, win->saved.h, 0);
           }