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(xmlNodePtr node
);
10 static gpointer
setup_func_bottom(xmlNodePtr node
);
11 static gpointer
setup_func_send(xmlNodePtr node
);
12 static void free_func(gpointer o
);
13 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
14 /* 3.4-compatibility */
15 static gpointer
setup_sendtop_func(xmlNodePtr node
);
16 static gpointer
setup_sendbottom_func(xmlNodePtr node
);
17 static gpointer
setup_sendnormal_func(xmlNodePtr node
);
19 void action_layer_startup(void)
21 actions_register("ToggleAlwaysOnTop", setup_func_top
, free_func
,
23 actions_register("ToggleAlwaysOnBottom", setup_func_bottom
, free_func
,
25 actions_register("SendToLayer", setup_func_send
, free_func
,
27 /* 3.4-compatibility */
28 actions_register("SendToTopLayer", setup_sendtop_func
, free_func
,
30 actions_register("SendToBottomLayer", setup_sendbottom_func
, free_func
,
32 actions_register("SendToNormalLayer", setup_sendnormal_func
, free_func
,
36 static gpointer
setup_func_top(xmlNodePtr node
)
38 Options
*o
= g_slice_new0(Options
);
44 static gpointer
setup_func_bottom(xmlNodePtr node
)
46 Options
*o
= g_slice_new0(Options
);
52 static gpointer
setup_func_send(xmlNodePtr node
)
57 o
= g_slice_new0(Options
);
59 if ((n
= obt_xml_find_node(node
, "layer"))) {
60 gchar
*s
= obt_xml_node_string(n
);
61 if (!g_ascii_strcasecmp(s
, "above") ||
62 !g_ascii_strcasecmp(s
, "top"))
64 else if (!g_ascii_strcasecmp(s
, "below") ||
65 !g_ascii_strcasecmp(s
, "bottom"))
67 else if (!g_ascii_strcasecmp(s
, "normal") ||
68 !g_ascii_strcasecmp(s
, "middle"))
76 static void free_func(gpointer o
)
78 g_slice_free(Options
, o
);
81 /* Always return FALSE because its not interactive */
82 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
87 ObClient
*c
= data
->client
;
89 actions_client_move(data
, TRUE
);
92 if (o
->toggle
|| !c
->below
)
93 client_set_layer(c
, c
->below
? 0 : -1);
95 else if (o
->layer
> 0) {
96 if (o
->toggle
|| !c
->above
)
97 client_set_layer(c
, c
->above
? 0 : 1);
99 else if (c
->above
|| c
->below
)
100 client_set_layer(c
, 0);
102 actions_client_move(data
, FALSE
);
108 /* 3.4-compatibility */
109 static gpointer
setup_sendtop_func(xmlNodePtr node
)
111 Options
*o
= g_slice_new0(Options
);
117 static gpointer
setup_sendbottom_func(xmlNodePtr node
)
119 Options
*o
= g_slice_new0(Options
);
125 static gpointer
setup_sendnormal_func(xmlNodePtr node
)
127 Options
*o
= g_slice_new0(Options
);