Simplify relationship between mapping and visibility

Previously, changes to the visibility of a window could be indicated
by meta_compositor_map_window(), meta_compositor_unminimize_window(),
meta_compositor_set_window_hidden(), etc, with the exact behavior
depending on the 'live_hidden_windows' preference.

Simplify this so that visibility is controlled by:

 meta_compositor_show_window()
 meta_compositor_hide_window()

With an 'effect' parameter provided to indicate the appropriate
effect (CREATE/UNMINIMIZE/MINIMIZE/DESTROY/NONE.)

The map state of the window is signalled separately by:

 meta_compositor_map_window()
 meta_compositor_unmap_window()

And is used only to control resource handling.

Other changes:

 * The desired effect on show/hide is explicitly stored in
   MetaWindow, avoiding the need for the was_minimized flag.
   At idle, once we calculate the window state, we pass the
   effect to the compositor if it matches the new window
   state, and then clear the effect to start over for future
   map state changes.

 * meta_compositor_switch_workspace() is called before any windows
   are hidden or shown, allowing the compositor to avoid hiding
   or showing an effect for windows involved in the switch.
   http://bugzilla.gnome.org/show_bug.cgi?id=582341

 * Handling of post-effect cleanups for MutterWindow are
   simplified - instead of trying to do different things based
   on the individual needs of different effects, we just wait until
   all effects complete and sync the window state to what it
   should be.

 * On unmap, once we destroy the pixmap, we tell ClutterX11Pixmap
   that we've done so, so it can clean up and unbind. (The
   unbinding doesn't seem to be working properly because of
   ClutterGLXPixmap or video driver issues.)

http://bugzilla.gnome.org/show_bug.cgi?id=587251
This commit is contained in:
Owen W. Taylor
2009-06-28 17:10:40 -04:00
parent cd048be932
commit 6726fcd25d
8 changed files with 483 additions and 621 deletions

View File

@ -433,19 +433,7 @@ meta_workspace_queue_calc_showing (MetaWorkspace *workspace)
tmp = workspace->windows;
while (tmp != NULL)
{
if (meta_prefs_get_live_hidden_windows ())
{
/*
* When we hide rather than unmap windows, we need the show/hide
* status of the window to be recalculated *before* we call the
* compositor switch_workspace hook.
*/
meta_window_calc_showing (tmp->data);
}
else
{
meta_window_queue (tmp->data, META_QUEUE_CALC_SHOWING);
}
meta_window_queue (tmp->data, META_QUEUE_CALC_SHOWING);
tmp = tmp->next;
}
@ -520,23 +508,8 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
/* Removes window from other spaces */
meta_window_change_workspace (move_window, workspace);
if (focus_this)
{
meta_window_focus (focus_this, timestamp);
meta_window_raise (focus_this);
}
else if (move_window)
{
meta_window_raise (move_window);
}
else
{
meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace\n");
meta_workspace_focus_default_window (workspace, NULL, timestamp);
}
/*
* Notify the compositor that the active workspace changed.
* Notify the compositor that the active workspace is changing.
*/
screen = workspace->screen;
display = meta_screen_get_display (screen);
@ -582,6 +555,26 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
meta_compositor_switch_workspace (comp, screen, old, workspace, direction);
/* This needs to be done after telling the compositor we are switching
* workspaces since focusing a window will cause it to be immediately
* shown and that would confuse the compositor if it didn't know we
* were in a workspace switch.
*/
if (focus_this)
{
meta_window_focus (focus_this, timestamp);
meta_window_raise (focus_this);
}
else if (move_window)
{
meta_window_raise (move_window);
}
else
{
meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace\n");
meta_workspace_focus_default_window (workspace, NULL, timestamp);
}
/* Emit switched signal from screen.c */
meta_screen_workspace_switched (screen, current_space, new_space, direction);
}