summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
authorrhp <rhp>2001-06-24 03:41:44 +0000
committerrhp <rhp>2001-06-24 03:41:44 +0000
commit1b3a58c951f08548d94420c68882b8dacbefda40 (patch)
tree2f6035f76d95203908b9676a32e85f3d1b0025d0 /src/stack.c
parentbeaac99991700466a367a70c13fade581c175f7d (diff)
downloadmetacity-1b3a58c951f08548d94420c68882b8dacbefda40.tar.gz
metacity-1b3a58c951f08548d94420c68882b8dacbefda40.tar.bz2
...
Diffstat (limited to 'src/stack.c')
-rw-r--r--src/stack.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/stack.c b/src/stack.c
index be6784d..632e7fc 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -760,3 +760,63 @@ meta_stack_get_below (MetaStack *stack,
else
return find_prev_below_layer (stack, window->layer);
}
+
+MetaWindow*
+meta_stack_get_tab_next (MetaStack *stack,
+ MetaWindow *window,
+ gboolean backward)
+{
+ int i;
+
+ if (stack->windows->len == 0)
+ return NULL;
+
+ if (window != NULL)
+ {
+ i = 0;
+ while (i < stack->windows->len)
+ {
+ Window w;
+
+ w = g_array_index (stack->windows, Window, i);
+
+ if (w == window->xwindow)
+ {
+ if (backward && i == 0)
+ goto out;
+ else if (!backward && i == (stack->windows->len - 1))
+ goto out;
+ else
+ {
+ if (backward)
+ --i;
+ else
+ ++i;
+
+ return meta_display_lookup_x_window (stack->screen->display,
+ g_array_index (stack->windows,
+ Window,
+ i));
+ }
+ }
+
+ ++i;
+ }
+ }
+
+ out:
+
+ /* window may be NULL, or maybe the origin window was already the last/first
+ * window and we need to wrap around
+ */
+ if (backward)
+ return meta_display_lookup_x_window (stack->screen->display,
+ g_array_index (stack->windows,
+ Window,
+ stack->windows->len - 1));
+ else
+ return meta_display_lookup_x_window (stack->screen->display,
+ g_array_index (stack->windows,
+ Window,
+ 0));
+}