1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
13 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
14 static void free_func(gpointer options);
15 static gboolean run_func(ObActionsData *data, gpointer options);
17 void action_directionaldesktop_startup()
19 actions_register("DirectionalDesktop",
26 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
31 o = g_new0(Options, 1);
33 o->dir = OB_DIRECTION_EAST;
36 if ((n = parse_find_node("wrap", node)))
37 o->wrap = parse_bool(doc, n);
38 if ((n = parse_find_node("direction", node))) {
39 gchar *s = parse_string(doc, n);
40 if (!g_ascii_strcasecmp(s, "next")) {
42 o->dir = OB_DIRECTION_EAST;
44 else if (!g_ascii_strcasecmp(s, "previous")) {
46 o->dir = OB_DIRECTION_WEST;
48 else if (!g_ascii_strcasecmp(s, "north") ||
49 !g_ascii_strcasecmp(s, "up"))
50 o->dir = OB_DIRECTION_NORTH;
51 else if (!g_ascii_strcasecmp(s, "south") ||
52 !g_ascii_strcasecmp(s, "down"))
53 o->dir = OB_DIRECTION_SOUTH;
54 else if (!g_ascii_strcasecmp(s, "west") ||
55 !g_ascii_strcasecmp(s, "left"))
56 o->dir = OB_DIRECTION_WEST;
57 else if (!g_ascii_strcasecmp(s, "east") ||
58 !g_ascii_strcasecmp(s, "right"))
59 o->dir = OB_DIRECTION_EAST;
62 if ((n = parse_find_node("send", node)))
63 o->send = parse_bool(doc, n);
64 if ((n = parse_find_node("follow", node)))
65 o->follow = parse_bool(doc, n);
70 static void free_func(gpointer options)
77 /* Always return FALSE because its not interactive */
78 static gboolean run_func(ObActionsData *data, gpointer options)
83 d = screen_cycle_desktop(o->dir,
87 if (d < screen_num_desktops && d != screen_desktop) {
88 gboolean go = !o->send;
90 if (data->client && client_normal(data->client)) {
91 client_set_desktop(data->client, d, o->follow, FALSE);
96 screen_set_desktop(d, TRUE);