1 #include "openbox/actions.h"
2 #include "openbox/event.h"
3 #include "openbox/focus_cycle.h"
4 #include "openbox/openbox.h"
5 #include "openbox/misc.h"
10 gboolean dock_windows;
11 gboolean desktop_windows;
12 ObDirection direction;
16 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
17 static void free_func(gpointer options);
18 static gboolean run_func(ObActionsData *data, gpointer options);
20 void action_directionaltargetwindow_startup()
22 actions_register("DirectionalTargetWindow",
29 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
34 o = g_new0(Options, 1);
37 if ((n = parse_find_node("dialog", node)))
38 o->dialog = parse_bool(doc, n);
39 if ((n = parse_find_node("panels", node)))
40 o->dock_windows = parse_bool(doc, n);
41 if ((n = parse_find_node("desktop", node)))
42 o->desktop_windows = parse_bool(doc, n);
43 if ((n = parse_find_node("direction", node))) {
44 gchar *s = parse_string(doc, n);
45 if (!g_ascii_strcasecmp(s, "north"))
46 o->direction = OB_DIRECTION_NORTH;
47 else if (!g_ascii_strcasecmp(s, "northwest"))
48 o->direction = OB_DIRECTION_NORTHWEST;
49 else if (!g_ascii_strcasecmp(s, "northeast"))
50 o->direction = OB_DIRECTION_NORTHEAST;
51 else if (!g_ascii_strcasecmp(s, "west"))
52 o->direction = OB_DIRECTION_WEST;
53 else if (!g_ascii_strcasecmp(s, "east"))
54 o->direction = OB_DIRECTION_EAST;
55 else if (!g_ascii_strcasecmp(s, "south"))
56 o->direction = OB_DIRECTION_NORTH;
57 else if (!g_ascii_strcasecmp(s, "southwest"))
58 o->direction = OB_DIRECTION_NORTHWEST;
59 else if (!g_ascii_strcasecmp(s, "southeast"))
60 o->direction = OB_DIRECTION_NORTHEAST;
64 if ((n = parse_find_node("actions", node))) {
67 m = parse_find_node("action", n->xmlChildrenNode);
69 ObActionsAct *action = actions_parse(i, doc, m);
70 if (action) o->actions = g_slist_prepend(o->actions, action);
71 m = parse_find_node("action", m->next);
77 static void free_func(gpointer options)
84 static gboolean run_func(ObActionsData *data, gpointer options)
89 /* if using focus_delay, stop the timer now so that focus doesn't go moving
91 event_halt_focus_delay();
93 ft = focus_directional_cycle(o->direction,
101 actions_run_acts(o->actions, data->uact, data->state,
102 data->x, data->y, data->button, data->context, ft);