[mutter] window: Centralize WM_STATE management



commit c78089437d0f1bfeed864c12d82ab768c483f1ca
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Feb 1 19:03:33 2014 -0500

    window: Centralize WM_STATE management

 src/core/window.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 936fa76..8c518e7 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -77,8 +77,7 @@ static void     invalidate_work_areas     (MetaWindow     *window);
 static void     set_wm_state_on_xwindow   (MetaDisplay    *display,
                                            Window          xwindow,
                                            int             state);
-static void     set_wm_state              (MetaWindow     *window,
-                                           int             state);
+static void     set_wm_state              (MetaWindow     *window);
 static void     set_net_wm_state          (MetaWindow     *window);
 static void     meta_window_set_above     (MetaWindow     *window,
                                            gboolean        new_value);
@@ -1406,7 +1405,7 @@ meta_window_new (MetaDisplay   *display,
       /* FIXME we have a tendency to set this then immediately
        * change it again.
        */
-      set_wm_state (window, window->iconic ? IconicState : NormalState);
+      set_wm_state (window);
       set_net_wm_state (window);
     }
 
@@ -1807,7 +1806,7 @@ meta_window_unmanage (MetaWindow  *window,
       XDeleteProperty (window->display->xdisplay,
                        window->xwindow,
                        window->display->atom__NET_WM_FULLSCREEN_MONITORS);
-      set_wm_state (window, WithdrawnState);
+      set_wm_state (window);
       meta_error_trap_pop (window->display);
     }
   else
@@ -1818,7 +1817,7 @@ meta_window_unmanage (MetaWindow  *window,
       if (!window->minimized)
         {
           meta_error_trap_push (window->display);
-          set_wm_state (window, NormalState);
+          set_wm_state (window);
           meta_error_trap_pop (window->display);
         }
 
@@ -1968,11 +1967,16 @@ set_wm_state_on_xwindow (MetaDisplay *display,
 }
 
 static void
-set_wm_state (MetaWindow *window,
-              int         state)
+set_wm_state (MetaWindow *window)
 {
-  meta_verbose ("Setting wm state %s on %s\n",
-                wm_state_to_string (state), window->desc);
+  int state;
+
+  if (window->withdrawn)
+    state = WithdrawnState;
+  else if (window->iconic)
+    state = IconicState;
+  else
+    state = NormalState;
 
   set_wm_state_on_xwindow (window->display, window->xwindow, state);
 }
@@ -3087,7 +3091,7 @@ meta_window_show (MetaWindow *window)
       if (!window->iconic)
         {
           window->iconic = TRUE;
-          set_wm_state (window, IconicState);
+          set_wm_state (window);
         }
     }
   else
@@ -3106,7 +3110,7 @@ meta_window_show (MetaWindow *window)
       if (window->iconic)
         {
           window->iconic = FALSE;
-          set_wm_state (window, NormalState);
+          set_wm_state (window);
         }
     }
 
@@ -3256,7 +3260,7 @@ meta_window_hide (MetaWindow *window)
   if (!window->iconic)
     {
       window->iconic = TRUE;
-      set_wm_state (window, IconicState);
+      set_wm_state (window);
     }
 
   toplevel_now_mapped = meta_window_toplevel_is_mapped (window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]