all repos — openbox @ d18d9c9379e3387073fc9346e9857fdde077b985

openbox fork - make it a bit more like ryudo

Make it possible for an action name to choose whether it is interactive or not based on its options.

This way we can use the same name with options for an interactive action and a
non-interactive action.

Shorten the names of the ObActionsInteractive* functions to ObActionsI*

Add a ObActionsIPreFunc that is called for interactive actions
before the interactivity (key/mouse grab) is started.

Add a ObActionsIPostFunc that is called for interactive actions
after the interactiviti (key/mouse grab) has ended.
Dana Jansens danakj@orodu.net
commit

d18d9c9379e3387073fc9346e9857fdde077b985

parent

50d662681160c309ea86268c0d05794b87b75593

M openbox/actions.copenbox/actions.c

@@ -42,17 +42,23 @@ guint ref;

gchar *name; - ObActionsDataSetupFunc setup; + gboolean canbeinteractive; + union { + ObActionsIDataSetupFunc i; + ObActionsDataSetupFunc n; + } setup; ObActionsDataFreeFunc free; ObActionsRunFunc run; - ObActionsInteractiveInputFunc i_input; - ObActionsInteractiveCancelFunc i_cancel; }; struct _ObActionsAct { guint ref; ObActionsDefinition *def; + ObActionsIPreFunc i_pre; + ObActionsIInputFunc i_input; + ObActionsICancelFunc i_cancel; + ObActionsIPostFunc i_post; gpointer options; };

@@ -78,37 +84,55 @@ registered = g_slist_delete_link(registered, registered);

} } -gboolean actions_register(const gchar *name, - ObActionsDataSetupFunc setup, - ObActionsDataFreeFunc free, - ObActionsRunFunc run, - ObActionsInteractiveInputFunc i_input, - ObActionsInteractiveCancelFunc i_cancel) +ObActionsDefinition* do_register(const gchar *name, + ObActionsDataFreeFunc free, + ObActionsRunFunc run) { GSList *it; ObActionsDefinition *def; g_assert(run != NULL); - g_assert((i_input == NULL) == (i_cancel == NULL)); for (it = registered; it; it = g_slist_next(it)) { def = it->data; if (!g_ascii_strcasecmp(name, def->name)) /* already registered */ - return FALSE; + return NULL; } def = g_new(ObActionsDefinition, 1); def->ref = 1; def->name = g_strdup(name); - def->setup = setup; def->free = free; def->run = run; - def->i_input = i_input; - def->i_cancel = i_cancel; registered = g_slist_prepend(registered, def); + return def; +} - return TRUE; +gboolean actions_register_i(const gchar *name, + ObActionsIDataSetupFunc setup, + ObActionsDataFreeFunc free, + ObActionsRunFunc run) +{ + ObActionsDefinition *def = do_register(name, free, run); + if (def) { + def->canbeinteractive = TRUE; + def->setup.i = setup; + } + return def != NULL; +} + +gboolean actions_register(const gchar *name, + ObActionsDataSetupFunc setup, + ObActionsDataFreeFunc free, + ObActionsRunFunc run) +{ + ObActionsDefinition *def = do_register(name, free, run); + if (def) { + def->canbeinteractive = FALSE; + def->setup.n = setup; + } + return def != NULL; } static void actions_definition_ref(ObActionsDefinition *def)

@@ -144,6 +168,10 @@ act = g_new(ObActionsAct, 1);

act->ref = 1; act->def = def; actions_definition_ref(act->def); + act->i_pre = NULL; + act->i_input = NULL; + act->i_cancel = NULL; + act->i_post = NULL; act->options = NULL; } else g_message(_("Invalid action \"%s\" requested. No such action exists."),

@@ -156,9 +184,23 @@ ObActionsAct* actions_parse_string(const gchar *name)

{ ObActionsAct *act = NULL; - if ((act = actions_build_act_from_string(name))) - if (act->def->setup) - act->options = act->def->setup(NULL); + if ((act = actions_build_act_from_string(name))) { + if (act->def->canbeinteractive) { + if (act->def->setup.i) { + act->options = act->def->setup.i(NULL, + &act->i_pre, + &act->i_input, + &act->i_cancel, + &act->i_post); + g_assert(!!act->i_input == !!act->i_cancel); + } + } + else { + if (act->def->setup.n) + act->options = act->def->setup.n(NULL); + } + } + return act; }

@@ -169,11 +211,23 @@ gchar *name;

ObActionsAct *act = NULL; if (obt_parse_attr_string(node, "name", &name)) { - if ((act = actions_build_act_from_string(name))) + if ((act = actions_build_act_from_string(name))) { /* there is more stuff to parse here */ - if (act->def->setup) - act->options = act->def->setup(node->children); - + if (act->def->canbeinteractive) { + if (act->def->setup.i) { + act->options = act->def->setup.i(node->children, + &act->i_pre, + &act->i_input, + &act->i_cancel, + &act->i_post); + g_assert(!!act->i_input == !!act->i_cancel); + } + } + else { + if (act->def->setup.n) + act->options = act->def->setup.n(node->children); + } + } g_free(name); }

@@ -182,7 +236,7 @@ }

gboolean actions_act_is_interactive(ObActionsAct *act) { - return act->def->i_cancel != NULL; + return act->i_cancel != NULL; } void actions_act_ref(ObActionsAct *act)

@@ -253,6 +307,8 @@ if (actions_act_is_interactive(act)) {

/* cancel the old one */ if (interactive_act) actions_interactive_cancel_act(); + if (act->i_pre) + act->i_pre(act->options); ok = actions_interactive_begin_act(act, state); } }

@@ -264,7 +320,7 @@ if (actions_act_is_interactive(act))

actions_interactive_end_act(); } else { /* make sure its interactive if it returned TRUE */ - g_assert(act->def->i_cancel && act->def->i_input); + g_assert(act->i_cancel); /* no actions are run after the interactive one */ break;

@@ -281,7 +337,7 @@

void actions_interactive_cancel_act(void) { if (interactive_act) { - interactive_act->def->i_cancel(interactive_act->options); + interactive_act->i_cancel(interactive_act->options); actions_interactive_end_act(); } }

@@ -309,6 +365,9 @@ {

if (interactive_act) { ungrab_keyboard(); + if (interactive_act->i_post) + interactive_act->i_post(interactive_act->options); + actions_act_unref(interactive_act); interactive_act = NULL; }

@@ -318,8 +377,8 @@ gboolean actions_interactive_input_event(XEvent *e)

{ gboolean used = FALSE; if (interactive_act) { - if (!interactive_act->def->i_input(interactive_initial_state, e, - interactive_act->options, &used)) + if (!interactive_act->i_input(interactive_initial_state, e, + interactive_act->options, &used)) { used = TRUE; /* if it cancelled the action then it has to of been used */
M openbox/actions.hopenbox/actions.h

@@ -31,15 +31,24 @@ typedef struct _ObActionsGlobalData ObActionsGlobalData;

typedef struct _ObActionsClientData ObActionsClientData; typedef struct _ObActionsSelectorData ObActionsSelectorData; -typedef gpointer (*ObActionsDataSetupFunc)(xmlNodePtr node); typedef void (*ObActionsDataFreeFunc)(gpointer options); typedef gboolean (*ObActionsRunFunc)(ObActionsData *data, gpointer options); -typedef gboolean (*ObActionsInteractiveInputFunc)(guint initial_state, +typedef gpointer (*ObActionsDataSetupFunc)(xmlNodePtr node); + +/* functions for interactive actions */ +typedef void (*ObActionsIPreFunc)(gpointer options); +typedef void (*ObActionsIPostFunc)(gpointer options); +typedef gboolean (*ObActionsIInputFunc)(guint initial_state, XEvent *e, gpointer options, gboolean *used); -typedef void (*ObActionsInteractiveCancelFunc)(gpointer options); +typedef void (*ObActionsICancelFunc)(gpointer options); +typedef gpointer (*ObActionsIDataSetupFunc)(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post); struct _ObActionsData { ObUserAction uact;

@@ -55,14 +64,16 @@

void actions_startup(gboolean reconfigure); void actions_shutdown(gboolean reconfigure); -/*! If the action is interactive, then i_input and i_cancel are not NULL. - Otherwise, they should both be NULL. */ +/*! Use this if the actions created from this name may be interactive */ +gboolean actions_register_i(const gchar *name, + ObActionsIDataSetupFunc setup, + ObActionsDataFreeFunc free, + ObActionsRunFunc run); + gboolean actions_register(const gchar *name, ObActionsDataSetupFunc setup, ObActionsDataFreeFunc free, - ObActionsRunFunc run, - ObActionsInteractiveInputFunc i_input, - ObActionsInteractiveCancelFunc i_cancel); + ObActionsRunFunc run); ObActionsAct* actions_parse(xmlNodePtr node); ObActionsAct* actions_parse_string(const gchar *name);
M openbox/actions/addremovedesktop.copenbox/actions/addremovedesktop.c

@@ -19,20 +19,17 @@ static gpointer setup_removelast_func(xmlNodePtr node);

void action_addremovedesktop_startup(void) { - actions_register("AddDesktop", setup_add_func, g_free, run_func, - NULL, NULL); - actions_register("RemoveDesktop", setup_remove_func, g_free, run_func, - NULL, NULL); + actions_register("AddDesktop", setup_add_func, g_free, run_func); + actions_register("RemoveDesktop", setup_remove_func, g_free, run_func); /* 3.4-compatibility */ - actions_register("AddDesktopLast", setup_addlast_func, g_free, run_func, - NULL, NULL); - actions_register("RemoveDesktopLast", setup_removelast_func, g_free, run_func, - NULL, NULL); - actions_register("AddDesktopCurrent", setup_addcurrent_func, g_free, run_func, - NULL, NULL); - actions_register("RemoveDesktopCurrent", setup_removecurrent_func, g_free, run_func, - NULL, NULL); + actions_register("AddDesktopLast", setup_addlast_func, g_free, run_func); + actions_register("RemoveDesktopLast", setup_removelast_func, + g_free, run_func); + actions_register("AddDesktopCurrent", setup_addcurrent_func, + g_free, run_func); + actions_register("RemoveDesktopCurrent", setup_removecurrent_func, + g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/breakchroot.copenbox/actions/breakchroot.c

@@ -7,8 +7,7 @@ void action_breakchroot_startup(void)

{ actions_register("BreakChroot", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/close.copenbox/actions/close.c

@@ -7,8 +7,7 @@ void action_close_startup(void)

{ actions_register("Close", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/cyclewindows.copenbox/actions/cyclewindows.c

@@ -16,13 +16,28 @@ gboolean bar;

gboolean raise; ObFocusCyclePopupMode dialog_mode; GSList *actions; + + + /* options for after we're done */ + gboolean cancel; /* did the user cancel or not */ + guint state; /* keyboard state when finished */ } Options; -static gboolean cycling = FALSE; - -static gpointer setup_func(xmlNodePtr node); -static gpointer setup_forward_func(xmlNodePtr node); -static gpointer setup_backward_func(xmlNodePtr node); +static gpointer setup_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPreFunc *post); +static gpointer setup_forward_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPreFunc *post); +static gpointer setup_backward_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPreFunc *post); static void free_func(gpointer options); static gboolean run_func(ObActionsData *data, gpointer options); static gboolean i_input_func(guint initial_state,

@@ -30,18 +45,20 @@ XEvent *e,

gpointer options, gboolean *used); static void i_cancel_func(gpointer options); - -static void end_cycle(gboolean cancel, guint state, Options *o); +static void i_post_func(gpointer options); void action_cyclewindows_startup(void) { - actions_register("NextWindow", setup_forward_func, free_func, - run_func, i_input_func, i_cancel_func); - actions_register("PreviousWindow", setup_backward_func, free_func, - run_func, i_input_func, i_cancel_func); + actions_register_i("NextWindow", setup_forward_func, free_func, run_func); + actions_register_i("PreviousWindow", setup_backward_func, free_func, + run_func); } -static gpointer setup_func(xmlNodePtr node) +static gpointer setup_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPreFunc *post) { xmlNodePtr n; Options *o;

@@ -88,19 +105,30 @@ o->actions = g_slist_prepend(o->actions,

actions_parse_string("Unshade")); } + *input = i_input_func; + *cancel = i_cancel_func; + *post = i_post_func; return o; } -static gpointer setup_forward_func(xmlNodePtr node) +static gpointer setup_forward_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPreFunc *post) { - Options *o = setup_func(node); + Options *o = setup_func(node, pre, input, cancel, post); o->forward = TRUE; return o; } -static gpointer setup_backward_func(xmlNodePtr node) +static gpointer setup_backward_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPreFunc *post) { - Options *o = setup_func(node); + Options *o = setup_func(node, pre, input, cancel, post); o->forward = FALSE; return o; }

@@ -131,7 +159,6 @@ TRUE,

o->bar, o->dialog_mode, FALSE, FALSE); - cycling = TRUE; stacking_restore(); if (o->raise && ft) stacking_temp_raise(CLIENT_AS_WINDOW(ft));

@@ -144,10 +171,13 @@ XEvent *e,

gpointer options, gboolean *used) { + Options *o = options; + if (e->type == KeyPress) { /* Escape cancels no matter what */ if (ob_keycode_match(e->xkey.keycode, OB_KEY_ESCAPE)) { - end_cycle(TRUE, e->xkey.state, options); + o->cancel = TRUE; + o->state = e->xkey.state; return FALSE; }

@@ -155,7 +185,8 @@ /* There were no modifiers and they pressed enter */

else if (ob_keycode_match(e->xkey.keycode, OB_KEY_RETURN) && !initial_state) { - end_cycle(FALSE, e->xkey.state, options); + o->cancel = FALSE; + o->state = e->xkey.state; return FALSE; } }

@@ -163,7 +194,8 @@ /* They released the modifiers */

else if (e->type == KeyRelease && initial_state && (e->xkey.state & initial_state) == 0) { - end_cycle(FALSE, e->xkey.state, options); + o->cancel = FALSE; + o->state = e->xkey.state; return FALSE; }

@@ -172,14 +204,14 @@ }

static void i_cancel_func(gpointer options) { - /* we get cancelled when we move focus, but we're not cycling anymore, so - just ignore that */ - if (cycling) - end_cycle(TRUE, 0, options); + Options *o = options; + o->cancel = TRUE; + o->state = 0; } -static void end_cycle(gboolean cancel, guint state, Options *o) +static void i_post_func(gpointer options) { + Options *o = options; struct _ObClient *ft; ft = focus_cycle(o->forward,

@@ -190,12 +222,11 @@ o->linear,

TRUE, o->bar, o->dialog_mode, - TRUE, cancel); - cycling = FALSE; + TRUE, o->cancel); if (ft) actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY, - state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft); + o->state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft); stacking_restore(); }
M openbox/actions/debug.copenbox/actions/debug.c

@@ -11,7 +11,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_debug_startup(void) { - actions_register("Debug", setup_func, free_func, run_func, NULL, NULL); + actions_register("Debug", setup_func, free_func, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/decorations.copenbox/actions/decorations.c

@@ -7,10 +7,9 @@ static gboolean run_func_toggle(ObActionsData *data, gpointer options);

void action_decorations_startup(void) { - actions_register("Decorate", NULL, NULL, run_func_on, NULL, NULL); - actions_register("Undecorate", NULL, NULL, run_func_off, NULL, NULL); - actions_register("ToggleDecorations", NULL, NULL, run_func_toggle, - NULL, NULL); + actions_register("Decorate", NULL, NULL, run_func_on); + actions_register("Undecorate", NULL, NULL, run_func_off); + actions_register("ToggleDecorations", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */
M openbox/actions/desktop.copenbox/actions/desktop.c

@@ -49,43 +49,31 @@ static gpointer setup_send_down_func(xmlNodePtr node);

void action_desktop_startup(void) { - actions_register("GoToDesktop", setup_go_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktop", setup_send_func, g_free, run_func, - NULL, NULL); + actions_register("GoToDesktop", setup_go_func, g_free, run_func); + actions_register("SendToDesktop", setup_send_func, g_free, run_func); /* 3.4-compatibility */ - actions_register("DesktopLast", setup_go_last_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopLast", setup_send_last_func, g_free, run_func, - NULL, NULL); - actions_register("Desktop", setup_go_abs_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktop", setup_send_abs_func, g_free, run_func, - NULL, NULL); - actions_register("DesktopNext", setup_go_next_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopNext", setup_send_next_func, g_free, run_func, - NULL, NULL); - actions_register("DesktopPrevious", setup_go_prev_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopPrevious", setup_send_prev_func, g_free, run_func, - NULL, NULL); - actions_register("DesktopLeft", setup_go_left_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopLeft", setup_send_left_func, g_free, run_func, - NULL, NULL); - actions_register("DesktopRight", setup_go_right_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopRight", setup_send_right_func, g_free, run_func, - NULL, NULL); - actions_register("DesktopUp", setup_go_up_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopUp", setup_send_up_func, g_free, run_func, - NULL, NULL); - actions_register("DesktopDown", setup_go_down_func, g_free, run_func, - NULL, NULL); - actions_register("SendToDesktopDown", setup_send_down_func, g_free, run_func, - NULL, NULL); + actions_register("DesktopLast", setup_go_last_func, g_free, run_func); + actions_register("SendToDesktopLast", setup_send_last_func, + g_free, run_func); + actions_register("Desktop", setup_go_abs_func, g_free, run_func); + actions_register("SendToDesktop", setup_send_abs_func, g_free, run_func); + actions_register("DesktopNext", setup_go_next_func, g_free, run_func); + actions_register("SendToDesktopNext", setup_send_next_func, + g_free, run_func); + actions_register("DesktopPrevious", setup_go_prev_func, g_free, run_func); + actions_register("SendToDesktopPrevious", setup_send_prev_func, + g_free, run_func); + actions_register("DesktopLeft", setup_go_left_func, g_free, run_func); + actions_register("SendToDesktopLeft", setup_send_left_func, + g_free, run_func); + actions_register("DesktopRight", setup_go_right_func, g_free, run_func); + actions_register("SendToDesktopRight", setup_send_right_func, + g_free, run_func); + actions_register("DesktopUp", setup_go_up_func, g_free, run_func); + actions_register("SendToDesktopUp", setup_send_up_func, g_free, run_func); + actions_register("DesktopDown", setup_go_down_func, g_free, run_func); + actions_register("SendToDesktopDown", setup_send_down_func, + g_free, run_func); } static gpointer setup_go_func(xmlNodePtr node)
M openbox/actions/directionalwindows.copenbox/actions/directionalwindows.c

@@ -21,7 +21,11 @@

static gboolean cycling = FALSE; static gpointer setup_func(xmlNodePtr node); -static gpointer setup_cycle_func(xmlNodePtr node); +static gpointer setup_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post); static gpointer setup_target_func(xmlNodePtr node); static void free_func(gpointer options); static gboolean run_func(ObActionsData *data, gpointer options);

@@ -34,14 +38,46 @@

static void end_cycle(gboolean cancel, guint state, Options *o); /* 3.4-compatibility */ -static gpointer setup_north_cycle_func(xmlNodePtr node); -static gpointer setup_south_cycle_func(xmlNodePtr node); -static gpointer setup_east_cycle_func(xmlNodePtr node); -static gpointer setup_west_cycle_func(xmlNodePtr node); -static gpointer setup_northwest_cycle_func(xmlNodePtr node); -static gpointer setup_northeast_cycle_func(xmlNodePtr node); -static gpointer setup_southwest_cycle_func(xmlNodePtr node); -static gpointer setup_southeast_cycle_func(xmlNodePtr node); +static gpointer setup_north_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_south_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_east_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_west_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_northwest_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_northeast_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_southwest_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); +static gpointer setup_southeast_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *in, + ObActionsICancelFunc *c, + ObActionsIPostFunc *post); static gpointer setup_north_target_func(xmlNodePtr node); static gpointer setup_south_target_func(xmlNodePtr node); static gpointer setup_east_target_func(xmlNodePtr node);

@@ -53,43 +89,43 @@ static gpointer setup_southeast_target_func(xmlNodePtr node);

void action_directionalwindows_startup(void) { - actions_register("DirectionalCycleWindows", setup_cycle_func, free_func, - run_func, i_input_func, i_cancel_func); + actions_register_i("DirectionalCycleWindows", setup_cycle_func, free_func, + run_func); actions_register("DirectionalTargetWindow", setup_target_func, free_func, - run_func, NULL, NULL); + run_func); /* 3.4-compatibility */ - actions_register("DirectionalFocusNorth", setup_north_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusSouth", setup_south_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusWest", setup_west_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusEast", setup_east_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusNorthWest", setup_northwest_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusNorthEast", setup_northeast_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusSouthWest", setup_southwest_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); - actions_register("DirectionalFocusSouthEast", setup_southeast_cycle_func, - free_func, run_func, i_input_func, i_cancel_func); + actions_register_i("DirectionalFocusNorth", setup_north_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusSouth", setup_south_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusWest", setup_west_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusEast", setup_east_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusNorthWest", setup_northwest_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusNorthEast", setup_northeast_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusSouthWest", setup_southwest_cycle_func, + free_func, run_func); + actions_register_i("DirectionalFocusSouthEast", setup_southeast_cycle_func, + free_func, run_func); actions_register("DirectionalTargetNorth", setup_north_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetSouth", setup_south_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetWest", setup_west_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetEast", setup_east_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetNorthWest", setup_northwest_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetNorthEast", setup_northeast_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetSouthWest", setup_southwest_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); actions_register("DirectionalTargetSouthEast", setup_southeast_target_func, - free_func, run_func, i_input_func, i_cancel_func); + free_func, run_func); } static gpointer setup_func(xmlNodePtr node)

@@ -158,10 +194,16 @@

return o; } -static gpointer setup_cycle_func(xmlNodePtr node) +static gpointer setup_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { Options *o = setup_func(node); o->interactive = TRUE; + *input = i_input_func; + *cancel = i_cancel_func; return o; }

@@ -269,58 +311,90 @@ stacking_restore();

} /* 3.4-compatibility */ -static gpointer setup_north_cycle_func(xmlNodePtr node) +static gpointer setup_north_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_NORTH; return o; } -static gpointer setup_south_cycle_func(xmlNodePtr node) +static gpointer setup_south_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_SOUTH; return o; } -static gpointer setup_east_cycle_func(xmlNodePtr node) +static gpointer setup_east_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_EAST; return o; } -static gpointer setup_west_cycle_func(xmlNodePtr node) +static gpointer setup_west_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_WEST; return o; } -static gpointer setup_northwest_cycle_func(xmlNodePtr node) +static gpointer setup_northwest_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_NORTHWEST; return o; } -static gpointer setup_northeast_cycle_func(xmlNodePtr node) +static gpointer setup_northeast_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_EAST; return o; } -static gpointer setup_southwest_cycle_func(xmlNodePtr node) +static gpointer setup_southwest_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_SOUTHWEST; return o; } -static gpointer setup_southeast_cycle_func(xmlNodePtr node) +static gpointer setup_southeast_cycle_func(xmlNodePtr node, + ObActionsIPreFunc *pre, + ObActionsIInputFunc *input, + ObActionsICancelFunc *cancel, + ObActionsIPostFunc *post) { - Options *o = setup_cycle_func(node); + Options *o = setup_cycle_func(node, pre, input, cancel, post); o->direction = OB_DIRECTION_SOUTHEAST; return o; }
M openbox/actions/dockautohide.copenbox/actions/dockautohide.c

@@ -8,8 +8,7 @@ void action_dockautohide_startup(void)

{ actions_register("ToggleDockAutoHide", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/execute.copenbox/actions/execute.c

@@ -33,7 +33,7 @@ */

void action_execute_startup(void) { - actions_register("Execute", setup_func, free_func, run_func, NULL, NULL); + actions_register("Execute", setup_func, free_func, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/exit.copenbox/actions/exit.c

@@ -13,8 +13,8 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_exit_startup(void) { - actions_register("Exit", setup_func, NULL, run_func, NULL, NULL); - actions_register("SessionLogout", setup_func, NULL, run_func, NULL, NULL); + actions_register("Exit", setup_func, NULL, run_func); + actions_register("SessionLogout", setup_func, NULL, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/focus.copenbox/actions/focus.c

@@ -13,7 +13,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_focus_startup(void) { - actions_register("Focus", setup_func, g_free, run_func, NULL, NULL); + actions_register("Focus", setup_func, g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/focustobottom.copenbox/actions/focustobottom.c

@@ -5,7 +5,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_focustobottom_startup(void) { - actions_register("FocusToBottom", NULL, NULL, run_func, NULL, NULL); + actions_register("FocusToBottom", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/fullscreen.copenbox/actions/fullscreen.c

@@ -5,8 +5,7 @@ static gboolean run_func_toggle(ObActionsData *data, gpointer options);

void action_fullscreen_startup(void) { - actions_register("ToggleFullscreen", NULL, NULL, run_func_toggle, - NULL, NULL); + actions_register("ToggleFullscreen", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */
M openbox/actions/growtoedge.copenbox/actions/growtoedge.c

@@ -22,18 +22,14 @@

void action_growtoedge_startup(void) { actions_register("GrowToEdge", setup_func, - g_free, run_func, NULL, NULL); + g_free, run_func); actions_register("ShrinkToEdge", setup_shrink_func, - g_free, run_func, NULL, NULL); + g_free, run_func); /* 3.4-compatibility */ - actions_register("GrowToEdgeNorth", setup_north_func, g_free, run_func, - NULL, NULL); - actions_register("GrowToEdgeSouth", setup_south_func, g_free, run_func, - NULL, NULL); - actions_register("GrowToEdgeEast", setup_east_func, g_free, run_func, - NULL, NULL); - actions_register("GrowToEdgeWest", setup_west_func, g_free, run_func, - NULL, NULL); + actions_register("GrowToEdgeNorth", setup_north_func, g_free, run_func); + actions_register("GrowToEdgeSouth", setup_south_func, g_free, run_func); + actions_register("GrowToEdgeEast", setup_east_func, g_free, run_func); + actions_register("GrowToEdgeWest", setup_west_func, g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/iconify.copenbox/actions/iconify.c

@@ -7,8 +7,7 @@ void action_iconify_startup(void)

{ actions_register("Iconify", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/if.copenbox/actions/if.c

@@ -29,7 +29,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_if_startup(void) { - actions_register("If", setup_func, free_func, run_func, NULL, NULL); + actions_register("If", setup_func, free_func, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/kill.copenbox/actions/kill.c

@@ -7,8 +7,7 @@ void action_kill_startup(void)

{ actions_register("Kill", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/layer.copenbox/actions/layer.c

@@ -18,18 +18,18 @@

void action_layer_startup(void) { actions_register("ToggleAlwaysOnTop", setup_func_top, g_free, - run_func, NULL, NULL); + run_func); actions_register("ToggleAlwaysOnBottom", setup_func_bottom, g_free, - run_func, NULL, NULL); + run_func); actions_register("SendToLayer", setup_func_send, g_free, - run_func, NULL, NULL); + run_func); /* 3.4-compatibility */ actions_register("SendToTopLayer", setup_sendtop_func, g_free, - run_func, NULL, NULL); + run_func); actions_register("SendToBottomLayer", setup_sendbottom_func, g_free, - run_func, NULL, NULL); + run_func); actions_register("SendToNormalLayer", setup_sendnormal_func, g_free, - run_func, NULL, NULL); + run_func); } static gpointer setup_func_top(xmlNodePtr node)
M openbox/actions/lower.copenbox/actions/lower.c

@@ -8,8 +8,7 @@ void action_lower_startup(void)

{ actions_register("Lower", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/maximize.copenbox/actions/maximize.c

@@ -23,31 +23,28 @@ static gpointer setup_vert_func(xmlNodePtr node);

void action_maximize_startup(void) { - actions_register("Maximize", setup_func, g_free, run_func_on, - NULL, NULL); - actions_register("Unmaximize", setup_func, g_free, run_func_off, - NULL, NULL); - actions_register("ToggleMaximize", setup_func, g_free, run_func_toggle, - NULL, NULL); + actions_register("Maximize", setup_func, g_free, run_func_on); + actions_register("Unmaximize", setup_func, g_free, run_func_off); + actions_register("ToggleMaximize", setup_func, g_free, run_func_toggle); /* 3.4-compatibility */ actions_register("MaximizeFull", setup_both_func, g_free, - run_func_on, NULL, NULL); + run_func_on); actions_register("UnmaximizeFull", setup_both_func, g_free, - run_func_off, NULL, NULL); + run_func_off); actions_register("ToggleMaximizeFull", setup_both_func, g_free, - run_func_toggle, NULL, NULL); + run_func_toggle); actions_register("MaximizeHorz", setup_horz_func, g_free, - run_func_on, NULL, NULL); + run_func_on); actions_register("UnmaximizeHorz", setup_horz_func, g_free, - run_func_off, NULL, NULL); + run_func_off); actions_register("ToggleMaximizeHorz", setup_horz_func, g_free, - run_func_toggle, NULL, NULL); + run_func_toggle); actions_register("MaximizeVert", setup_vert_func, g_free, - run_func_on, NULL, NULL); + run_func_on); actions_register("UnmaximizeVert", setup_vert_func, g_free, - run_func_off, NULL, NULL); + run_func_off); actions_register("ToggleMaximizeVert", setup_vert_func, g_free, - run_func_toggle, NULL, NULL); + run_func_toggle); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/move.copenbox/actions/move.c

@@ -8,8 +8,7 @@ void action_move_startup(void)

{ actions_register("Move", NULL, NULL, - run_func, - NULL, NULL); + run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/moverelative.copenbox/actions/moverelative.c

@@ -14,7 +14,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_moverelative_startup(void) { - actions_register("MoveRelative", setup_func, g_free, run_func, NULL, NULL); + actions_register("MoveRelative", setup_func, g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/moveresizeto.copenbox/actions/moveresizeto.c

@@ -30,10 +30,9 @@ static gpointer setup_center_func(xmlNodePtr node);

void action_moveresizeto_startup(void) { - actions_register("MoveResizeTo", setup_func, g_free, run_func, NULL, NULL); -/* 3.4-compatibility */ - actions_register("MoveToCenter", setup_center_func, g_free, run_func, - NULL, NULL); + actions_register("MoveResizeTo", setup_func, g_free, run_func); + /* 3.4-compatibility */ + actions_register("MoveToCenter", setup_center_func, g_free, run_func); } static void parse_coord(xmlNodePtr n, gint *pos,
M openbox/actions/movetoedge.copenbox/actions/movetoedge.c

@@ -19,16 +19,12 @@ static gpointer setup_west_func(xmlNodePtr node);

void action_movetoedge_startup(void) { - actions_register("MoveToEdge", setup_func, g_free, run_func, NULL, NULL); + actions_register("MoveToEdge", setup_func, g_free, run_func); /* 3.4-compatibility */ - actions_register("MoveToEdgeNorth", setup_north_func, g_free, run_func, - NULL, NULL); - actions_register("MoveToEdgeSouth", setup_south_func, g_free, run_func, - NULL, NULL); - actions_register("MoveToEdgeEast", setup_east_func, g_free, run_func, - NULL, NULL); - actions_register("MoveToEdgeWest", setup_west_func, g_free, run_func, - NULL, NULL); + actions_register("MoveToEdgeNorth", setup_north_func, g_free, run_func); + actions_register("MoveToEdgeSouth", setup_south_func, g_free, run_func); + actions_register("MoveToEdgeEast", setup_east_func, g_free, run_func); + actions_register("MoveToEdgeWest", setup_west_func, g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/omnipresent.copenbox/actions/omnipresent.c

@@ -6,8 +6,7 @@ static gboolean run_func_toggle(ObActionsData *data, gpointer options);

void action_omnipresent_startup(void) { - actions_register("ToggleOmnipresent", NULL, NULL, run_func_toggle, - NULL, NULL); + actions_register("ToggleOmnipresent", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */
M openbox/actions/raise.copenbox/actions/raise.c

@@ -6,10 +6,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_raise_startup(void) { - actions_register("Raise", - NULL, NULL, - run_func, - NULL, NULL); + actions_register("Raise", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/raiselower.copenbox/actions/raiselower.c

@@ -5,10 +5,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_raiselower_startup(void) { - actions_register("RaiseLower", - NULL, NULL, - run_func, - NULL, NULL); + actions_register("RaiseLower", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/reconfigure.copenbox/actions/reconfigure.c

@@ -5,10 +5,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_reconfigure_startup(void) { - actions_register("Reconfigure", - NULL, NULL, - run_func, - NULL, NULL); + actions_register("Reconfigure", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/resize.copenbox/actions/resize.c

@@ -17,7 +17,7 @@ gboolean shaded);

void action_resize_startup(void) { - actions_register("Resize", setup_func, g_free, run_func, NULL, NULL); + actions_register("Resize", setup_func, g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/resizerelative.copenbox/actions/resizerelative.c

@@ -16,8 +16,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_resizerelative_startup(void) { - actions_register("ResizeRelative", setup_func, g_free, run_func, - NULL, NULL); + actions_register("ResizeRelative", setup_func, g_free, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/restart.copenbox/actions/restart.c

@@ -12,7 +12,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_restart_startup(void) { - actions_register("Restart", setup_func, free_func, run_func, NULL, NULL); + actions_register("Restart", setup_func, free_func, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/shade.copenbox/actions/shade.c

@@ -7,9 +7,9 @@ static gboolean run_func_toggle(ObActionsData *data, gpointer options);

void action_shade_startup(void) { - actions_register("Shade", NULL, NULL, run_func_on, NULL, NULL); - actions_register("Unshade", NULL, NULL, run_func_off, NULL, NULL); - actions_register("ToggleShade", NULL, NULL, run_func_toggle, NULL, NULL); + actions_register("Shade", NULL, NULL, run_func_on); + actions_register("Unshade", NULL, NULL, run_func_off); + actions_register("ToggleShade", NULL, NULL, run_func_toggle); } /* Always return FALSE because its not interactive */
M openbox/actions/shadelowerraise.copenbox/actions/shadelowerraise.c

@@ -7,8 +7,8 @@

void action_shadelowerraise_startup() { /* 3.4-compatibility */ - actions_register("ShadeLower", NULL, NULL, run_func_sl, NULL, NULL); - actions_register("UnshadeRaise", NULL, NULL, run_func_ur, NULL, NULL); + actions_register("ShadeLower", NULL, NULL, run_func_sl); + actions_register("UnshadeRaise", NULL, NULL, run_func_ur); } /* Always return FALSE because its not interactive */
M openbox/actions/showdesktop.copenbox/actions/showdesktop.c

@@ -5,10 +5,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_showdesktop_startup(void) { - actions_register("ToggleShowDesktop", - NULL, NULL, - run_func, - NULL, NULL); + actions_register("ToggleShowDesktop", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */
M openbox/actions/showmenu.copenbox/actions/showmenu.c

@@ -12,8 +12,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_showmenu_startup(void) { - actions_register("ShowMenu", setup_func, free_func, run_func, - NULL, NULL); + actions_register("ShowMenu", setup_func, free_func, run_func); } static gpointer setup_func(xmlNodePtr node)
M openbox/actions/unfocus.copenbox/actions/unfocus.c

@@ -5,7 +5,7 @@ static gboolean run_func(ObActionsData *data, gpointer options);

void action_unfocus_startup(void) { - actions_register("Unfocus", NULL, NULL, run_func, NULL, NULL); + actions_register("Unfocus", NULL, NULL, run_func); } /* Always return FALSE because its not interactive */