summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren gmail com>2007-04-16 04:57:32 +0000
committerElijah Newren <newren@src.gnome.org>2007-04-16 04:57:32 +0000
commit3f7d729978be9032d31c3e25c7c4cef4dffe610f (patch)
tree485707358954f1696c9eb7da203286a36113ba3d
parent6de7271ab6aed15f349f61e7d3a5a46d0734a201 (diff)
downloadmetacity-3f7d729978be9032d31c3e25c7c4cef4dffe610f.tar.gz
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
-rw-r--r--ChangeLog15
-rw-r--r--src/display.c19
-rw-r--r--src/display.h4
-rw-r--r--src/session.c20
4 files changed, 39 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index a9a0987d..af46ec15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
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>
+
Remove incorrect usage of window.h from menu.c. See #426791 &
#382962.
diff --git a/src/display.c b/src/display.c
index 637e60b9..15f42395 100644
--- a/src/display.c
+++ b/src/display.c
@@ -4702,6 +4702,7 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
GSList *winlist;
winlist = meta_display_list_windows (display);
+ winlist = g_slist_sort (winlist, meta_display_stack_cmp);
/* Unmanage all windows */
tmp = winlist;
@@ -4714,6 +4715,24 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
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
meta_display_devirtualize_modifiers (MetaDisplay *display,
MetaVirtualModifier modifiers,
diff --git a/src/display.h b/src/display.h
index b934d718..14bd4eee 100644
--- a/src/display.h
+++ b/src/display.h
@@ -416,6 +416,10 @@ void meta_display_unmanage_windows_for_screen (MetaDisplay *display,
MetaScreen *screen,
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"
* to it, such as the frame window.
*/
diff --git a/src/session.c b/src/session.c
index dc2d6fd5..4c247509 100644
--- a/src/session.c
+++ b/src/session.c
@@ -801,24 +801,6 @@ decode_text_from_utf8 (const char *text)
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
save_state (void)
{
@@ -891,7 +873,7 @@ save_state (void)
int stack_position;
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;
tmp = windows;