summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
authorrhp <rhp>2001-06-24 08:09:10 +0000
committerrhp <rhp>2001-06-24 08:09:10 +0000
commitbca589280cd2acf9ee6ca3863e071b4d7c8496f4 (patch)
tree6b5a6fc2c438f0808e45ede86c126f104a3f71b8 /src/stack.c
parent8025ecea02c9723e3a72795e4d5913ccc1e74785 (diff)
downloadmetacity-bca589280cd2acf9ee6ca3863e071b4d7c8496f4.tar.gz
metacity-bca589280cd2acf9ee6ca3863e071b4d7c8496f4.tar.bz2
...
Diffstat (limited to 'src/stack.c')
-rw-r--r--src/stack.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/stack.c b/src/stack.c
index 482a1e8..f1c6c8b 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -902,3 +902,40 @@ meta_stack_get_tab_next (MetaStack *stack,
return find_tab_forward (stack, NULL, -1);
}
+int
+meta_stack_windows_cmp (MetaStack *stack,
+ MetaWindow *window_a,
+ MetaWindow *window_b)
+{
+ g_return_val_if_fail (window_a->screen == window_b->screen, 0);
+
+ /* -1 means a below b */
+
+ if (window_a->layer < window_b->layer)
+ return -1;
+ else if (window_a->layer > window_b->layer)
+ return 1;
+ else
+ {
+ GList *tmp;
+
+ g_assert (window_a->layer == window_b->layer);
+
+ tmp = stack->layers[window_a->layer];
+ while (tmp != NULL)
+ {
+ /* earlier in list is higher in stack */
+ if (tmp->data == window_a)
+ return 1;
+ else if (tmp->data == window_b)
+ return -1;
+
+ tmp = tmp->next;
+ }
+
+ meta_bug ("Didn't find windows in layer in meta_stack_windows_cmp()\n");
+ }
+
+ /* not reached */
+ return 0;
+}