From: Dana Jansens Date: Fri, 13 Jul 2007 20:49:26 +0000 (-0400) Subject: make cyclewindows action into nextwindow and previouswindow again X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=70a80ba763f804d3271d85c66234bb1b368f2aa4;p=chaz%2Fopenbox make cyclewindows action into nextwindow and previouswindow again --- diff --git a/openbox/actions/cyclewindows.c b/openbox/actions/cyclewindows.c index 23b2c516..a8c0c22c 100644 --- a/openbox/actions/cyclewindows.c +++ b/openbox/actions/cyclewindows.c @@ -17,6 +17,10 @@ typedef struct { static gboolean cycling = FALSE; static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); +static gpointer setup_forward_func(ObParseInst *i, xmlDocPtr doc, + xmlNodePtr node); +static gpointer setup_backward_func(ObParseInst *i, xmlDocPtr doc, + xmlNodePtr node); static void free_func(gpointer options); static gboolean run_func(ObActionsData *data, gpointer options); static gboolean i_input_func(guint initial_state, @@ -29,12 +33,10 @@ static void end_cycle(gboolean cancel, guint state, Options *o); void action_cyclewindows_startup() { - actions_register("CycleWindows", - setup_func, - free_func, - run_func, - i_input_func, - i_cancel_func); + 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); } static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) @@ -44,10 +46,7 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) o = g_new0(Options, 1); o->dialog = TRUE; - o->forward = TRUE; - if ((n = parse_find_node("forward", node))) - o->forward = parse_bool(doc, n); if ((n = parse_find_node("linear", node))) o->linear = parse_bool(doc, n); if ((n = parse_find_node("dialog", node))) @@ -69,6 +68,31 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) m = parse_find_node("action", m->next); } } + else { + o->actions = g_slist_prepend(o->actions, + actions_parse_string("Focus")); + o->actions = g_slist_prepend(o->actions, + actions_parse_string("Raise")); + o->actions = g_slist_prepend(o->actions, + actions_parse_string("Unshade")); + } + + return o; +} + +static gpointer setup_forward_func(ObParseInst *i, xmlDocPtr doc, + xmlNodePtr node) +{ + Options *o = setup_func(i, doc, node); + o->forward = TRUE; + return o; +} + +static gpointer setup_backward_func(ObParseInst *i, xmlDocPtr doc, + xmlNodePtr node) +{ + Options *o = setup_func(i, doc, node); + o->forward = FALSE; return o; } @@ -76,6 +100,11 @@ static void free_func(gpointer options) { Options *o = options; + while (o->actions) { + actions_act_unref(o->actions->data); + o->actions = g_slist_delete_link(o->actions, o->actions); + } + g_free(o); }