X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fkeyboard.c;h=65d2f2e072f22a1891965a907b599ff2cb4445be;hb=b8e4eecc9f6b69bfc69b694360fb427e6ec800ad;hp=1f509f77ff8c5e61aa0544690053f95faea16b3d;hpb=506fa94dc74c34ee90af19353184029a76d206e4;p=chaz%2Fopenbox diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 1f509f77..65d2f2e0 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -133,6 +133,8 @@ void keyboard_interactive_grab(guint state, ObClient *client, { ObInteractiveState *s; + g_assert(action->data.any.interactive); + if (!interactive_states) { if (!grab_keyboard(TRUE)) return; @@ -179,19 +181,18 @@ gboolean keyboard_process_interactive_grab(const XEvent *e, cancel = done = TRUE; } if (done) { - g_assert(s->action->data.any.interactive); - - s->action->data.inter.cancel = cancel; - s->action->data.inter.final = TRUE; - - s->action->func(&s->action->data); - - grab_keyboard(FALSE); - grab_pointer(FALSE, OB_CURSOR_NONE); - keyboard_reset_chains(); + action_run_interactive(s->action, s->client, + e->xkey.state, cancel, TRUE); g_free(s); + interactive_states = g_slist_delete_link(interactive_states, it); + if (!interactive_states) { + grab_keyboard(FALSE); + grab_pointer(FALSE, OB_CURSOR_NONE); + keyboard_reset_chains(); + } + handled = TRUE; } } @@ -218,7 +219,8 @@ void keyboard_event(ObClient *client, const XEvent *e) p = curpos->first_child; while (p) { if (p->key == e->xkey.keycode && - p->state == e->xkey.state) { + p->state == e->xkey.state) + { if (p->first_child != NULL) { /* part of a chain */ ob_main_loop_timeout_remove(ob_main_loop, chain_timeout); /* 5 second timeout for chains */ @@ -229,32 +231,10 @@ void keyboard_event(ObClient *client, const XEvent *e) grab_keys(TRUE); } else { GSList *it; - for (it = p->actions; it; it = it->next) { - ObAction *act = it->data; - if (act->func != NULL) { - act->data.any.c = client; - - if (act->func == action_moveresize) { - screen_pointer_pos(&act->data.moveresize.x, - &act->data.moveresize.y); - } - - if (act->data.any.interactive) { - act->data.inter.cancel = FALSE; - act->data.inter.final = FALSE; - keyboard_interactive_grab(e->xkey.state, client, - 0, act); - } - - if (act->func == action_showmenu) { - act->data.showmenu.x = e->xkey.x_root; - act->data.showmenu.y = e->xkey.y_root; - } - - act->data.any.c = client; - act->func(&act->data); - } - } + + for (it = p->actions; it; it = it->next) + action_run_key(it->data, client, e->xkey.state, + e->xkey.x_root, e->xkey.y_root); keyboard_reset_chains(); }