summaryrefslogtreecommitdiff
path: root/openbox/focus_cycle.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2012-10-01 22:32:59 -0400
committerDana Jansens <danakj@orodu.net>2012-10-06 22:30:02 -0400
commit1869e4e830d08acd5f7801acd8910ce99806f53b (patch)
tree3cc34928f80aa19470cedbed6f44893e06349331 /openbox/focus_cycle.c
parentd0ba8806689ea80b6a739122aaf8dac81d2a3e5c (diff)
Allow non-interactive focus cycling.
Adds an <interactive>bool</interactive> option to the NextWindow and PreviousWindow actions. When it is false, the action is not interactive and will immediately switch focus to whatever the next focus target is. Removing the "interactive" flag from the focus_cycle() method, as it was unused previously, and the new code does not make use of it either. In order to be non-interactive it simply starts a focus_cycle then immediately ends it when the action ends. The "interactive" flag in focus_cycle() forced a linear cycling order which may not be what you want, so the new method is preferrable anyhow.
Diffstat (limited to 'openbox/focus_cycle.c')
-rw-r--r--openbox/focus_cycle.c53
1 files changed, 19 insertions, 34 deletions
diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c
index 93a9a993..de176501 100644
--- a/openbox/focus_cycle.c
+++ b/openbox/focus_cycle.c
@@ -93,7 +93,7 @@ void focus_cycle_reorder()
focus_cycle_update_indicator(focus_cycle_target);
if (!focus_cycle_target)
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
- TRUE, TRUE, OB_FOCUS_CYCLE_POPUP_MODE_NONE,
+ TRUE, OB_FOCUS_CYCLE_POPUP_MODE_NONE,
TRUE, TRUE);
}
}
@@ -101,8 +101,8 @@ void focus_cycle_reorder()
ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
gboolean nonhilite_windows,
gboolean dock_windows, gboolean desktop_windows,
- gboolean linear, gboolean interactive,
- gboolean showbar, ObFocusCyclePopupMode mode,
+ gboolean linear, gboolean showbar,
+ ObFocusCyclePopupMode mode,
gboolean done, gboolean cancel)
{
static GList *order = NULL;
@@ -110,23 +110,17 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
ObClient *ft = NULL;
ObClient *ret = NULL;
- if (interactive) {
- if (cancel) {
- focus_cycle_target = NULL;
- goto done_cycle;
- } else if (done)
- goto done_cycle;
+ if (cancel) {
+ focus_cycle_target = NULL;
+ goto done_cycle;
+ } else if (done)
+ goto done_cycle;
- if (!focus_order)
- goto done_cycle;
+ if (!focus_order)
+ goto done_cycle;
- if (linear) list = client_list;
- else list = focus_order;
- } else {
- if (!focus_order)
- goto done_cycle;
- list = client_list;
- }
+ if (linear) list = client_list;
+ else list = focus_order;
if (focus_cycle_target == NULL) {
focus_cycle_linear = linear;
@@ -153,21 +147,14 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
}
ft = it->data;
if (focus_cycle_valid(ft)) {
- if (interactive) {
- if (ft != focus_cycle_target) { /* prevents flicker */
- focus_cycle_target = ft;
- focus_cycle_type = OB_CYCLE_NORMAL;
- focus_cycle_draw_indicator(showbar ? ft : NULL);
- }
- /* same arguments as focus_target_valid */
- focus_cycle_popup_show(ft, mode, focus_cycle_linear);
- return focus_cycle_target;
- } else if (ft != focus_cycle_target) {
+ if (ft != focus_cycle_target) { /* prevents flicker */
focus_cycle_target = ft;
focus_cycle_type = OB_CYCLE_NORMAL;
- done = TRUE;
- break;
+ focus_cycle_draw_indicator(showbar ? ft : NULL);
}
+ /* same arguments as focus_target_valid */
+ focus_cycle_popup_show(ft, mode, focus_cycle_linear);
+ return focus_cycle_target;
}
} while (it != start);
@@ -179,10 +166,8 @@ done_cycle:
g_list_free(order);
order = NULL;
- if (interactive) {
- focus_cycle_draw_indicator(NULL);
- focus_cycle_popup_hide();
- }
+ focus_cycle_draw_indicator(NULL);
+ focus_cycle_popup_hide();
return ret;
}