Re-works the approach to supporting live preview to handle stacking.

We can't easily use a metacity layer to hide windows as that means we
loose our original stacking position. (Metacity's stack positions are
only valid within a single layer) We now have a "guard window" per
screen that is a fullscreen override redirect that is lowered to the
bottom of the stack. Hidden windows now remain in their original layer
so the stacking position remains valid, but all hidden windows get
XRestacked under the guard window.

A new compositor hook is also added to inform it when a window becomes
hidden/unhidded, this lets us map/unmap the corresponding actor.

missing files in preview commit (TODO: rebase -i and squash this later)
This commit is contained in:
Robert Bragg
2008-11-03 14:50:22 +00:00
parent cfa45beee1
commit 0058271aaa
9 changed files with 217 additions and 65 deletions

View File

@@ -311,6 +311,38 @@ reload_xinerama_infos (MetaScreen *screen)
g_assert (screen->xinerama_infos != NULL);
}
/* The guard window allows us to leave minimized windows mapped so
* that compositor code may provide live previews of them.
* Instead of being unmapped/withdrawn, they get pushed underneath
* the guard window. */
static Window
create_guard_window (Display *xdisplay, MetaScreen *screen)
{
XSetWindowAttributes attributes;
Window guard_window;
attributes.event_mask = NoEventMask;
attributes.override_redirect = True;
attributes.background_pixel = BlackPixel (xdisplay, screen->number);
guard_window =
XCreateWindow (xdisplay,
screen->xroot,
0, /* x */
0, /* y */
screen->rect.width,
screen->rect.height,
0, /* border width */
CopyFromParent, /* depth */
CopyFromParent, /* class */
CopyFromParent, /* visual */
CWEventMask|CWOverrideRedirect|CWBackPixel,
&attributes);
XLowerWindow (xdisplay, guard_window);
XMapWindow (xdisplay, guard_window);
return guard_window;
}
MetaScreen*
meta_screen_new (MetaDisplay *display,
int number,
@@ -490,6 +522,8 @@ meta_screen_new (MetaDisplay *display,
screen->vertical_workspaces = FALSE;
screen->starting_corner = META_SCREEN_TOPLEFT;
screen->compositor_data = NULL;
screen->guard_window = create_guard_window (xdisplay, screen);
{
XFontStruct *font_info;
@@ -760,6 +794,7 @@ meta_screen_manage_all_windows (MetaScreen *screen)
info->xwindow == screen->flash_window ||
#ifdef HAVE_COMPOSITE_EXTENSIONS
info->xwindow == screen->wm_cm_selection_window ||
info->xwindow == screen->guard_window ||
#endif
info->xwindow == screen->wm_sn_selection_window) {
meta_verbose ("Not managing our own windows\n");