all repos — openbox @ eb51015bc39dead34d041ab48fec51a56ba99e7a

openbox fork - make it a bit more like ryudo

dont run actions immediately. put them in the queue. add action_run_string for niternal use
Dana Jansens danakj@orodu.net
commit

eb51015bc39dead34d041ab48fec51a56ba99e7a

parent

87430acf3461a071a1ac48738290513f2fe44951

2 files changed, 42 insertions(+), 5 deletions(-)

jump to
M openbox/action.copenbox/action.c

@@ -30,6 +30,7 @@ #include "grab.h"

#include "keyboard.h" #include "event.h" #include "config.h" +#include "mainloop.h" #include <glib.h>

@@ -92,6 +93,21 @@ else if (a->func == action_showmenu)

g_free(a->data.showmenu.name); g_free(a); +} + +ObAction* action_copy(const ObAction *src) +{ + ObAction *a = action_new(src->func); + + a->data = src->data; + + /* deal with pointers */ + if (a->func == action_execute || a->func == action_restart) + a->data.execute.path = g_strdup(a->data.execute.path); + else if (a->func == action_showmenu) + a->data.showmenu.name = g_strdup(a->data.showmenu.name); + + return a; } void setup_action_directional_focus_north(ObAction **a, ObUserAction uact)

@@ -346,7 +362,8 @@ {

(*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS; (*a)->data.moveresize.move = TRUE; (*a)->data.moveresize.keyboard = - (uact == OB_USER_ACTION_KEYBOARD_KEY || + (uact == OB_USER_ACTION_NONE || + uact == OB_USER_ACTION_KEYBOARD_KEY || uact == OB_USER_ACTION_MENU_SELECTION); }

@@ -355,7 +372,8 @@ {

(*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS; (*a)->data.moveresize.move = FALSE; (*a)->data.moveresize.keyboard = - (uact == OB_USER_ACTION_KEYBOARD_KEY || + (uact == OB_USER_ACTION_NONE || + uact == OB_USER_ACTION_KEYBOARD_KEY || uact == OB_USER_ACTION_MENU_SELECTION); }

@@ -903,9 +921,22 @@ if (!(cancel || done))

keyboard_interactive_grab(state, a->data.any.c, a); } - a->func(&a->data); + ob_main_loop_queue_action(ob_main_loop, a); } } +} + +void action_run_string(const gchar *name, struct _ObClient *c) +{ + ObAction *a; + GSList *l; + + a = action_from_string(name, OB_USER_ACTION_NONE); + g_assert(a); + + l = g_slist_append(NULL, a); + + action_run(l, c, 0); } void action_execute(union ActionData *data)
M openbox/action.hopenbox/action.h

@@ -174,11 +174,13 @@ action_resize_relative_horz - the delta

action_resize_relative_vert - the delta */ -ObAction *action_from_string(const gchar *name, ObUserAction uact); -ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, +ObAction* action_from_string(const gchar *name, ObUserAction uact); +ObAction* action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, ObUserAction uact); void action_ref(ObAction *a); void action_unref(ObAction *a); + +ObAction* action_copy(const ObAction *a); /*! Executes a list of actions. @param c The client associated with the action. Can be NULL.

@@ -206,6 +208,10 @@ action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, x, y, FALSE, FALSE)

#define action_run(a, c, s) \ action_run_list(a, c, OB_FRAME_CONTEXT_NONE, s, 0, -1, -1, FALSE, FALSE) + +/*! This is only for internal usage, i.e. not meant for user bindings and + such! */ +void action_run_string(const gchar *name, struct _ObClient *c); /* Execute */ void action_execute(union ActionData *data);