[mutter] meta-window-actor: Refactor should_unredirect a bit more



commit 4041f96ed3699e25e17bb0fac5c9e0b2c3b04675
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jun 7 23:27:08 2012 -0400

    meta-window-actor: Refactor should_unredirect a bit more
    
    "Flat is better than nested"
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677657

 src/compositor/meta-window-actor.c |   48 ++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 23 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index d7c8891..14010a0 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1188,31 +1188,33 @@ meta_window_actor_should_unredirect (MetaWindowActor *self)
   MetaWindow *metaWindow = meta_window_actor_get_meta_window (self);
   MetaScreen *screen = meta_window_get_screen (metaWindow);
   MetaWindowActorPrivate *priv = self->priv;
+  int screen_width, screen_height;
+  MetaRectangle window_rect, monitor_rect;
+  int num_monitors = meta_screen_get_n_monitors (screen);
+  int i;
 
-  if (meta_window_is_override_redirect (metaWindow) && priv->opacity == 0xff && !priv->argb32)
-    {
-      int screen_width, screen_height;
-      MetaRectangle window_rect;
-      meta_screen_get_size (screen, &screen_width, &screen_height);
-      meta_window_get_outer_rect (metaWindow, &window_rect);
-
-      if (window_rect.x == 0 && window_rect.y == 0 &&
-          window_rect.width == screen_width && window_rect.height == screen_height)
-           return TRUE;
-      else
-        {
-          int num_monitors = meta_screen_get_n_monitors (screen);
-          int i;
-          MetaRectangle monitor_rect;
+  if (!meta_window_is_override_redirect (metaWindow))
+    return FALSE;
 
-          for (i = 0; i < num_monitors; i++)
-            {
-              meta_screen_get_monitor_geometry (screen , i, &monitor_rect);
-              if (monitor_rect.x == window_rect.x && monitor_rect.y == window_rect.y &&
-                  monitor_rect.width == window_rect.width && monitor_rect.height == window_rect.height)
-                    return TRUE;
-            }
-        }
+  if (priv->opacity != 0xff)
+    return FALSE;
+
+  if (priv->argb32)
+    return FALSE;
+
+  meta_screen_get_size (screen, &screen_width, &screen_height);
+  meta_window_get_outer_rect (metaWindow, &window_rect);
+
+  if (window_rect.x == 0 && window_rect.y == 0 &&
+      window_rect.width == screen_width && window_rect.height == screen_height)
+    return TRUE;
+
+  for (i = 0; i < num_monitors; i++)
+    {
+      meta_screen_get_monitor_geometry (screen , i, &monitor_rect);
+      if (monitor_rect.x == window_rect.x && monitor_rect.y == window_rect.y &&
+          monitor_rect.width == window_rect.width && monitor_rect.height == window_rect.height)
+        return TRUE;
     }
 
   return FALSE;



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