1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
10 static gpointer setup_func(xmlNodePtr node);
11 static gpointer setup_add_func(xmlNodePtr node);
12 static gpointer setup_remove_func(xmlNodePtr node);
13 static gboolean run_func(ObActionsData *data, gpointer options);
14 /* 3.4-compatibility */
15 static gpointer setup_addcurrent_func(xmlNodePtr node);
16 static gpointer setup_addlast_func(xmlNodePtr node);
17 static gpointer setup_removecurrent_func(xmlNodePtr node);
18 static gpointer setup_removelast_func(xmlNodePtr node);
20 void action_addremovedesktop_startup(void)
22 actions_register("AddDesktop", setup_add_func, g_free, run_func,
24 actions_register("RemoveDesktop", setup_remove_func, g_free, run_func,
27 /* 3.4-compatibility */
28 actions_register("AddDesktopLast", setup_addlast_func, g_free, run_func,
30 actions_register("RemoveDesktopLast", setup_removelast_func, g_free, run_func,
32 actions_register("AddDesktopCurrent", setup_addcurrent_func, g_free, run_func,
34 actions_register("RemoveDesktopCurrent", setup_removecurrent_func, g_free, run_func,
38 static gpointer setup_func(xmlNodePtr node)
43 o = g_new0(Options, 1);
45 if ((n = obt_parse_find_node(node, "where"))) {
46 gchar *s = obt_parse_node_string(n);
47 if (!g_ascii_strcasecmp(s, "last"))
49 else if (!g_ascii_strcasecmp(s, "current"))
57 static gpointer setup_add_func(xmlNodePtr node)
59 Options *o = setup_func(node);
64 static gpointer setup_remove_func(xmlNodePtr node)
66 Options *o = setup_func(node);
71 /* Always return FALSE because its not interactive */
72 static gboolean run_func(ObActionsData *data, gpointer options)
76 actions_client_move(data, TRUE);
79 screen_add_desktop(o->current);
81 screen_remove_desktop(o->current);
83 actions_client_move(data, FALSE);
88 /* 3.4-compatibility */
89 static gpointer setup_addcurrent_func(xmlNodePtr node)
91 Options *o = setup_add_func(node);
96 static gpointer setup_addlast_func(xmlNodePtr node)
98 Options *o = setup_add_func(node);
103 static gpointer setup_removecurrent_func(xmlNodePtr node)
105 Options *o = setup_remove_func(node);
110 static gpointer setup_removelast_func(xmlNodePtr node)
112 Options *o = setup_remove_func(node);