1 #include "openbox/actions.h"
2 #include "openbox/client.h"
5 gint layer; /*!< -1 for below, 0 for normal, and 1 for above */
9 static gpointer setup_func_top(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
10 static gpointer setup_func_bottom(ObParseInst *i, xmlDocPtr doc,
12 static gpointer setup_sendtop_func(ObParseInst *i,
13 xmlDocPtr doc, xmlNodePtr node);
14 static gpointer setup_sendbottom_func(ObParseInst *i,
15 xmlDocPtr doc, xmlNodePtr node);
16 static gpointer setup_sendnormal_func(ObParseInst *i,
17 xmlDocPtr doc, xmlNodePtr node);
18 static gboolean run_func(ObActionsData *data, gpointer options);
20 void action_layer_startup()
22 actions_register("ToggleAlwaysOnTop", setup_func_top, g_free,
23 run_func, NULL, NULL);
24 actions_register("ToggleAlwaysOnBottom", setup_func_bottom, g_free,
25 run_func, NULL, NULL);
26 actions_register("SendToTopLayer", setup_sendtop_func, g_free,
27 run_func, NULL, NULL);
28 actions_register("SendToBottomLayer", setup_sendbottom_func, g_free,
29 run_func, NULL, NULL);
30 actions_register("SendToNormalLayer", setup_sendnormal_func, g_free,
31 run_func, NULL, NULL);
34 static gpointer setup_func_top(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
36 Options *o = g_new0(Options, 1);
42 static gpointer setup_func_bottom(ObParseInst *i, xmlDocPtr doc,
45 Options *o = g_new0(Options, 1);
51 static gpointer setup_sendtop_func(ObParseInst *i,
52 xmlDocPtr doc, xmlNodePtr node)
54 Options *o = g_new0(Options, 1);
60 static gpointer setup_sendbottom_func(ObParseInst *i,
61 xmlDocPtr doc, xmlNodePtr node)
63 Options *o = g_new0(Options, 1);
69 static gpointer setup_sendnormal_func(ObParseInst *i,
70 xmlDocPtr doc, xmlNodePtr node)
72 Options *o = g_new0(Options, 1);
78 /* Always return FALSE because its not interactive */
79 static gboolean run_func(ObActionsData *data, gpointer options)
84 ObClient *c = data->client;
86 actions_client_move(data, TRUE);
89 if (o->toggle || !c->below)
90 client_set_layer(c, c->below ? 0 : -1);
92 else if (o->layer > 0) {
93 if (o->toggle || !c->above)
94 client_set_layer(c, c->above ? 0 : 1);
96 else if (c->above || c->below)
97 client_set_layer(c, 0);
99 actions_client_move(data, FALSE);