]>
Dogcows Code - chaz/openbox/blob - openbox/actions/layer.c
1d522bbc87824e6b82ae5a9c6fccdbf5dc4292d8
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 gboolean
run_func(ObActionsData
*data
, gpointer options
);
13 /* 3.4-compatibility */
14 static gpointer
setup_sendtop_func(xmlNodePtr node
);
15 static gpointer
setup_sendbottom_func(xmlNodePtr node
);
16 static gpointer
setup_sendnormal_func(xmlNodePtr node
);
18 void action_layer_startup(void)
20 actions_register("ToggleAlwaysOnTop", setup_func_top
, g_free
,
21 run_func
, NULL
, NULL
);
22 actions_register("ToggleAlwaysOnBottom", setup_func_bottom
, g_free
,
23 run_func
, NULL
, NULL
);
24 actions_register("SendToLayer", setup_func_send
, g_free
,
25 run_func
, NULL
, NULL
);
26 /* 3.4-compatibility */
27 actions_register("SendToTopLayer", setup_sendtop_func
, g_free
,
28 run_func
, NULL
, NULL
);
29 actions_register("SendToBottomLayer", setup_sendbottom_func
, g_free
,
30 run_func
, NULL
, NULL
);
31 actions_register("SendToNormalLayer", setup_sendnormal_func
, g_free
,
32 run_func
, NULL
, NULL
);
35 static gpointer
setup_func_top(xmlNodePtr node
)
37 Options
*o
= g_new0(Options
, 1);
43 static gpointer
setup_func_bottom(xmlNodePtr node
)
45 Options
*o
= g_new0(Options
, 1);
51 static gpointer
setup_func_send(xmlNodePtr node
)
56 o
= g_new0(Options
, 1);
58 if ((n
= obt_parse_find_node(node
, "layer"))) {
59 gchar
*s
= obt_parse_node_string(n
);
60 if (!g_ascii_strcasecmp(s
, "above") ||
61 !g_ascii_strcasecmp(s
, "top"))
63 else if (!g_ascii_strcasecmp(s
, "below") ||
64 !g_ascii_strcasecmp(s
, "bottom"))
66 else if (!g_ascii_strcasecmp(s
, "normal") ||
67 !g_ascii_strcasecmp(s
, "middle"))
75 /* Always return FALSE because its not interactive */
76 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
81 ObClient
*c
= data
->client
;
83 actions_client_move(data
, TRUE
);
86 if (o
->toggle
|| !c
->below
)
87 client_set_layer(c
, c
->below
? 0 : -1);
89 else if (o
->layer
> 0) {
90 if (o
->toggle
|| !c
->above
)
91 client_set_layer(c
, c
->above
? 0 : 1);
93 else if (c
->above
|| c
->below
)
94 client_set_layer(c
, 0);
96 actions_client_move(data
, FALSE
);
102 /* 3.4-compatibility */
103 static gpointer
setup_sendtop_func(xmlNodePtr node
)
105 Options
*o
= g_new0(Options
, 1);
111 static gpointer
setup_sendbottom_func(xmlNodePtr node
)
113 Options
*o
= g_new0(Options
, 1);
119 static gpointer
setup_sendnormal_func(xmlNodePtr node
)
121 Options
*o
= g_new0(Options
, 1);
This page took 0.039564 seconds and 4 git commands to generate.