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,22 +1188,26 @@ meta_window_actor_should_unredirect (MetaWindowActor *self)
MetaWindow *metaWindow = meta_window_actor_get_meta_window (self); MetaWindow *metaWindow = meta_window_actor_get_meta_window (self);
MetaScreen *screen = meta_window_get_screen (metaWindow); MetaScreen *screen = meta_window_get_screen (metaWindow);
MetaWindowActorPrivate *priv = self->priv; MetaWindowActorPrivate *priv = self->priv;
if (meta_window_is_override_redirect (metaWindow) && priv->opacity == 0xff && !priv->argb32)
{
int screen_width, screen_height; int screen_width, screen_height;
MetaRectangle window_rect; MetaRectangle window_rect, monitor_rect;
int num_monitors = meta_screen_get_n_monitors (screen);
int i;
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_screen_get_size (screen, &screen_width, &screen_height);
meta_window_get_outer_rect (metaWindow, &window_rect); meta_window_get_outer_rect (metaWindow, &window_rect);
if (window_rect.x == 0 && window_rect.y == 0 && if (window_rect.x == 0 && window_rect.y == 0 &&
window_rect.width == screen_width && window_rect.height == screen_height) window_rect.width == screen_width && window_rect.height == screen_height)
return TRUE; return TRUE;
else
{
int num_monitors = meta_screen_get_n_monitors (screen);
int i;
MetaRectangle monitor_rect;
for (i = 0; i < num_monitors; i++) for (i = 0; i < num_monitors; i++)
{ {
@ -1212,8 +1216,6 @@ meta_window_actor_should_unredirect (MetaWindowActor *self)
monitor_rect.width == window_rect.width && monitor_rect.height == window_rect.height) monitor_rect.width == window_rect.width && monitor_rect.height == window_rect.height)
return TRUE; return TRUE;
} }
}
}
return FALSE; return FALSE;
} }