From 7ebc5c797f0435286f25f077e8329ec821fc5e53 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 5 Apr 2003 22:20:14 +0000 Subject: linear focus cycling of the gods --- openbox/action.c | 16 ++++++++++++++-- openbox/action.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'openbox') diff --git a/openbox/action.c b/openbox/action.c index 0e41e2eb..fccabfcd 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1,4 +1,5 @@ #include "client.h" +#include "focus.h" #include "stacking.h" #include "frame.h" #include "screen.h" @@ -666,9 +667,16 @@ void action_showmenu(union ActionData *data) void action_cycle_windows(union ActionData *data) { if (data->cycle.linear) { - if (!data->cycle.final) { + static Client *first = NULL; + static Client *t = NULL; + + if (data->cycle.cancel) { + if (first) client_focus(first); + } else if (!data->cycle.final) { GList *it, *start; + t = NULL; + first = focus_client; start = it = g_list_find(client_list, data->cycle.c); do { if (data->cycle.forward) { @@ -678,9 +686,13 @@ void action_cycle_windows(union ActionData *data) it = it->prev; if (it == NULL) it = g_list_last(client_list); } - if (client_focus(it->data)) + if (client_focus(it->data)) { + t = it->data; break; + } } while (it != start); + } else { + if (t) stacking_raise(t); } } else { } diff --git a/openbox/action.h b/openbox/action.h index 0fe42f64..a5b1708e 100644 --- a/openbox/action.h +++ b/openbox/action.h @@ -73,6 +73,7 @@ struct CycleWindows { gboolean linear; gboolean forward; gboolean final; + gboolean cancel; }; union ActionData { -- cgit v1.2.3