Instead of hiding/showing the actors of hidden windows, reparent, it's more reliable

It's more awkward and error prone, considering plugin ininteractions, to simply
show/hide the actors of hidden windows, and it seems to be more reliable to
reparent them to a hidden group instead.
This commit is contained in:
Robert Bragg 2008-11-03 10:26:21 +00:00
parent 0058271aaa
commit 93b945ea42
2 changed files with 16 additions and 5 deletions

View File

@ -142,6 +142,7 @@ typedef struct _MetaCompScreen
MetaScreen *screen;
ClutterActor *stage, *window_group, *overlay_group;
ClutterActor *hidden_group;
GList *windows;
GHashTable *windows_by_xid;
MetaWindow *focus_window;
@ -1952,12 +1953,15 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
g_object_set_property (G_OBJECT (info->window_group),
"show-on-set-parent", FALSE);
info->overlay_group = clutter_group_new ();
info->hidden_group = clutter_group_new ();
clutter_container_add (CLUTTER_CONTAINER (info->stage),
info->window_group,
info->overlay_group,
info->hidden_group,
NULL);
clutter_actor_hide (info->hidden_group);
/*
* Must do this *before* creating the plugin manager, in case any of the
@ -2435,17 +2439,24 @@ clutter_cmp_set_window_hidden (MetaCompositor *compositor,
gboolean hidden)
{
MutterWindow *cw = window->compositor_private;
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
g_return_if_fail (cw);
if (hidden)
{
/* FIXME: There needs to be a way to queue this if there is an effect
* in progress for this window */
clutter_actor_hide (CLUTTER_ACTOR (cw));
if (clutter_actor_get_parent (CLUTTER_ACTOR (cw)) != info->hidden_group)
clutter_actor_reparent (CLUTTER_ACTOR (cw),
info->hidden_group);
}
else
clutter_actor_show (CLUTTER_ACTOR (cw));
{
if (clutter_actor_get_parent (CLUTTER_ACTOR (cw)) != info->window_group)
clutter_actor_reparent (CLUTTER_ACTOR (cw),
info->window_group);
}
}
static MetaCompositor comp_info = {

View File

@ -2254,12 +2254,12 @@ meta_window_show (MetaWindow *window)
{
meta_stack_freeze (window->screen->stack);
window->hidden = FALSE;
meta_stack_thaw (window->screen->stack);
/* Inform the compositor that the window isn't hidden */
meta_compositor_set_window_hidden (window->display->compositor,
window->screen,
window,
window->hidden);
meta_stack_thaw (window->screen->stack);
did_show = TRUE;
}
}
@ -2344,12 +2344,12 @@ meta_window_hide (MetaWindow *window)
meta_stack_freeze (window->screen->stack);
window->hidden = TRUE;
meta_stack_thaw (window->screen->stack);
/* Tell the compositor this window is now hidden */
meta_compositor_set_window_hidden (window->display->compositor,
window->screen,
window,
window->hidden);
meta_stack_thaw (window->screen->stack);
did_hide = TRUE;
}