allow noninteractive directional focus.

make keybinds noninteractive when the last key in the chain has no modifiers (i think this is what the code was supposed to do but failed.)

don't reset key chains during an interactive action. reset them after an interactive action finishes (honoring chroot)
so you can <C-t><C-Up>Stuff<//> and it'll do stuff as you hit C-Up, you dont have to keep hitting C-t
This commit is contained in:
Dana Jansens 2007-06-10 17:58:52 +00:00
parent 897c70e8dd
commit 220e568d75
3 changed files with 23 additions and 18 deletions

View file

@ -1831,6 +1831,7 @@ void action_directional_focus(union ActionData *data)
on us */ on us */
event_halt_focus_delay(); event_halt_focus_delay();
g_print("action\n");
focus_directional_cycle(data->interdiraction.direction, focus_directional_cycle(data->interdiraction.direction,
data->interdiraction.dock_windows, data->interdiraction.dock_windows,
data->interdiraction.desktop_windows, data->interdiraction.desktop_windows,

View file

@ -358,13 +358,13 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows,
static ObClient *first = NULL; static ObClient *first = NULL;
ObClient *ft = NULL; ObClient *ft = NULL;
if (!interactive) g_print("interactive %d dialog %d done %d cancel %d\n",
return; interactive, dialog, done, cancel);
if (cancel) { if (cancel) {
focus_cycle_target = NULL; focus_cycle_target = NULL;
goto done_cycle; goto done_cycle;
} else if (done) } else if (done && interactive)
goto done_cycle; goto done_cycle;
if (!focus_order) if (!focus_order)
@ -396,12 +396,12 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows,
ft = it->data; ft = it->data;
} }
if (ft) { if (ft && ft != focus_cycle_target) {/* prevents flicker */
if (ft != focus_cycle_target) {/* prevents flicker */
focus_cycle_target = ft; focus_cycle_target = ft;
if (!interactive)
goto done_cycle;
focus_cycle_draw_indicator(ft); focus_cycle_draw_indicator(ft);
} }
}
if (focus_cycle_target && dialog) if (focus_cycle_target && dialog)
/* same arguments as focus_target_valid */ /* same arguments as focus_target_valid */
focus_cycle_popup_single_show(focus_cycle_target, focus_cycle_popup_single_show(focus_cycle_target,

View file

@ -145,7 +145,6 @@ gboolean keyboard_bind(GList *keylist, ObAction *action)
{ {
KeyBindingTree *tree, *t; KeyBindingTree *tree, *t;
gboolean conflict; gboolean conflict;
gboolean mods = TRUE;
g_assert(keylist != NULL); g_assert(keylist != NULL);
g_assert(action != NULL); g_assert(action != NULL);
@ -166,17 +165,13 @@ gboolean keyboard_bind(GList *keylist, ObAction *action)
return FALSE; return FALSE;
} }
/* find if every key in this chain has modifiers, and also find the /* find the bottom node */
bottom node of the tree */ for (; t->first_child; t = t->first_child);
while (t->first_child) {
if (!t->state)
mods = FALSE;
t = t->first_child;
}
/* when there are no modifiers in the binding, then the action cannot /* when there are no modifiers in the binding, then the action cannot
be interactive */ be interactive */
if (!mods && action->data.any.interactive) { if (!t->state && action->data.any.interactive) {
g_print("not interactive\n");
action->data.any.interactive = FALSE; action->data.any.interactive = FALSE;
action->data.inter.final = TRUE; action->data.inter.final = TRUE;
} }
@ -208,6 +203,8 @@ static void keyboard_interactive_end(guint state, gboolean cancel, Time time,
alist = g_slist_append(NULL, istate.action); alist = g_slist_append(NULL, istate.action);
action_run_interactive(alist, istate.client, state, time, cancel, TRUE); action_run_interactive(alist, istate.client, state, time, cancel, TRUE);
g_slist_free(alist); g_slist_free(alist);
keyboard_reset_chains(0);
} }
static void keyboard_interactive_end_client(ObClient *client, gpointer data) static void keyboard_interactive_end_client(ObClient *client, gpointer data)
@ -311,6 +308,13 @@ void keyboard_event(ObClient *client, const XEvent *e)
} else if (p->chroot) /* an empty chroot */ } else if (p->chroot) /* an empty chroot */
set_curpos(p); set_curpos(p);
else { else {
GSList *it;
gboolean inter = FALSE;
for (it = p->actions; it && !inter; it = g_slist_next(it))
if (((ObAction*)it->data)->data.any.interactive)
inter = TRUE;
if (!inter) /* don't reset if the action is interactive */
keyboard_reset_chains(0); keyboard_reset_chains(0);
action_run_key(p->actions, client, e->xkey.state, action_run_key(p->actions, client, e->xkey.state,