discomfitor pushed a commit to branch master.

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

commit ab3ab4feaa5ce437473f709a7b11e8e84b4d51f9
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Tue Nov 17 18:24:09 2015 -0500

    ecore-wayland: rewrite maximize/fullscreen set functions for consistency
    
    * use safety macros for win struct param (should be the case for all fns 
here)
    * sanitize bool params
    * enforce window state flag setting
    * correctly detect window state using window flag instead of type
    
    @fix
    
    ref T2841
---
 src/lib/ecore_wayland/ecore_wl_window.c | 51 +++++++++++++++++----------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/lib/ecore_wayland/ecore_wl_window.c 
b/src/lib/ecore_wayland/ecore_wl_window.c
index 47f4172..40c833e 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -447,40 +447,34 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
 EAPI void
 ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
 {
+   Eina_Bool prev;
+
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
-   if (!win) return;
+   EINA_SAFETY_ON_NULL_RETURN(win);
+   prev = ecore_wl_window_maximized_get(win);
 
-   if ((win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED) == maximized) return;
+   maximized = !!maximized;
 
-   if (win->type == ECORE_WL_WINDOW_TYPE_TOPLEVEL)
+   if (prev == maximized) return;
+
+   if (maximized)
      {
         if (win->xdg_surface)
-          {
-             xdg_surface_set_maximized(win->xdg_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
-          }
+          xdg_surface_set_maximized(win->xdg_surface);
         else if (win->shell_surface)
-          {
-             wl_shell_surface_set_maximized(win->shell_surface, NULL);
-             win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
-          }
+          wl_shell_surface_set_maximized(win->shell_surface, NULL);
+        win->type = ECORE_WL_WINDOW_TYPE_MAXIMIZED;
      }
-   else if (win->type == ECORE_WL_WINDOW_TYPE_MAXIMIZED)
+   else
      {
         if (win->xdg_surface)
-          {
-             xdg_surface_unset_maximized(win->xdg_surface);
-             win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
-             _ecore_wl_window_configure_send(win, win->saved.w, win->saved.h, 
0);
-          }
+          xdg_surface_unset_maximized(win->xdg_surface);
         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);
-          }
+          wl_shell_surface_set_toplevel(win->shell_surface);
+        win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
      }
+   win->maximized = maximized;
 }
 
 EAPI Eina_Bool
@@ -496,10 +490,17 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
 EAPI void
 ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
 {
+   Eina_Bool prev;
+
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
-   if (!win) return;
-   if ((win->type == ECORE_WL_WINDOW_TYPE_FULLSCREEN) == fullscreen) return;
+   EINA_SAFETY_ON_NULL_RETURN(win);
+
+   prev = ecore_wl_window_fullscreen_get(win);
+
+   fullscreen = !!fullscreen;
+
+   if (prev == fullscreen) return;
    if (fullscreen)
      {
         win->type = ECORE_WL_WINDOW_TYPE_FULLSCREEN;
@@ -520,8 +521,8 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, 
Eina_Bool fullscreen)
           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);
      }
+   win->fullscreen = fullscreen;
 }
 
 EAPI Eina_Bool

-- 


Reply via email to