Preserve stacking order across restarts.

2007-04-15  Elijah Newren  <newren gmail com>

	Preserve stacking order across restarts.

	* src/display.c (meta_display_unmanage_windows_for_screen):
	unmap windows in stacking order so that stacking is preserved upon
	shutdown

	* src/display.[ch] (meta_display_stack_cmp):
	* src/session.c (stack_cmp, save_state):
	rename stack_cmp() -> meta_display_stack_cmp() and move it to a
	different function so that it can be used in both
	session.c:save_state() and
	meta_display_unmanage_windows_for_screen()

svn path=/trunk/; revision=3197
This commit is contained in:
Elijah Newren 2007-04-16 04:57:32 +00:00 committed by Elijah Newren
parent 6de7271ab6
commit 3f7d729978
4 changed files with 39 additions and 19 deletions

View File

@ -1,3 +1,18 @@
2007-04-15 Elijah Newren <newren gmail com>
Preserve stacking order across restarts.
* src/display.c (meta_display_unmanage_windows_for_screen):
unmap windows in stacking order so that stacking is preserved upon
shutdown
* src/display.[ch] (meta_display_stack_cmp):
* src/session.c (stack_cmp, save_state):
rename stack_cmp() -> meta_display_stack_cmp() and move it to a
different function so that it can be used in both
session.c:save_state() and
meta_display_unmanage_windows_for_screen()
2007-04-15 Elijah Newren <newren gmail com> 2007-04-15 Elijah Newren <newren gmail com>
Remove incorrect usage of window.h from menu.c. See #426791 & Remove incorrect usage of window.h from menu.c. See #426791 &

View File

@ -4702,6 +4702,7 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
GSList *winlist; GSList *winlist;
winlist = meta_display_list_windows (display); winlist = meta_display_list_windows (display);
winlist = g_slist_sort (winlist, meta_display_stack_cmp);
/* Unmanage all windows */ /* Unmanage all windows */
tmp = winlist; tmp = winlist;
@ -4714,6 +4715,24 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
g_slist_free (winlist); g_slist_free (winlist);
} }
int
meta_display_stack_cmp (const void *a,
const void *b)
{
MetaWindow *aw = (void*) a;
MetaWindow *bw = (void*) b;
if (aw->screen == bw->screen)
return meta_stack_windows_cmp (aw->screen->stack, aw, bw);
/* Then assume screens are stacked by number */
else if (aw->screen->number < bw->screen->number)
return -1;
else if (aw->screen->number > bw->screen->number)
return 1;
else
return 0; /* not reached in theory, if windows on same display */
}
void void
meta_display_devirtualize_modifiers (MetaDisplay *display, meta_display_devirtualize_modifiers (MetaDisplay *display,
MetaVirtualModifier modifiers, MetaVirtualModifier modifiers,

View File

@ -416,6 +416,10 @@ void meta_display_unmanage_windows_for_screen (MetaDisplay *display,
MetaScreen *screen, MetaScreen *screen,
guint32 timestamp); guint32 timestamp);
/* Utility function to compare the stacking of two windows */
int meta_display_stack_cmp (const void *a,
const void *b);
/* A given MetaWindow may have various X windows that "belong" /* A given MetaWindow may have various X windows that "belong"
* to it, such as the frame window. * to it, such as the frame window.
*/ */

View File

@ -801,24 +801,6 @@ decode_text_from_utf8 (const char *text)
return g_string_free (str, FALSE); return g_string_free (str, FALSE);
} }
static int
stack_cmp (const void *a,
const void *b)
{
MetaWindow *aw = (void*) a;
MetaWindow *bw = (void*) b;
if (aw->screen == bw->screen)
return meta_stack_windows_cmp (aw->screen->stack, aw, bw);
/* Then assume screens are stacked by number */
else if (aw->screen->number < bw->screen->number)
return -1;
else if (aw->screen->number > bw->screen->number)
return 1;
else
return 0; /* not reached in theory, if windows on same display */
}
static void static void
save_state (void) save_state (void)
{ {
@ -891,7 +873,7 @@ save_state (void)
int stack_position; int stack_position;
windows = meta_display_list_windows (display_iter->data); windows = meta_display_list_windows (display_iter->data);
windows = g_slist_sort (windows, stack_cmp); windows = g_slist_sort (windows, meta_display_stack_cmp);
stack_position = 0; stack_position = 0;
tmp = windows; tmp = windows;