meta-window-actor: Refactor should_unredirect a bit more

"Flat is better than nested"

https://bugzilla.gnome.org/show_bug.cgi?id=677657
This commit is contained in:
Jasper St. Pierre 2012-06-07 23:27:08 -04:00
parent 3a15d637da
commit 4041f96ed3

View File

@ -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)
if (!meta_window_is_override_redirect (metaWindow))
return FALSE;
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++)
{
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;
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;
}
}
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;