]>
Dogcows Code - chaz/openbox/blob - openbox/actions/layer.c
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_func_send(ObParseInst
*i
, xmlDocPtr doc
,
14 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
16 void action_layer_startup(void)
18 actions_register("ToggleAlwaysOnTop", setup_func_top
, g_free
,
19 run_func
, NULL
, NULL
);
20 actions_register("ToggleAlwaysOnBottom", setup_func_bottom
, g_free
,
21 run_func
, NULL
, NULL
);
22 actions_register("SendToLayer", setup_func_send
, g_free
,
23 run_func
, NULL
, NULL
);
26 static gpointer
setup_func_top(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
)
28 Options
*o
= g_new0(Options
, 1);
34 static gpointer
setup_func_bottom(ObParseInst
*i
, xmlDocPtr doc
,
37 Options
*o
= g_new0(Options
, 1);
43 static gpointer
setup_func_send(ObParseInst
*i
, xmlDocPtr doc
,
49 o
= g_new0(Options
, 1);
51 if ((n
= parse_find_node("layer", node
))) {
52 gchar
*s
= parse_string(doc
, n
);
53 if (!g_ascii_strcasecmp(s
, "above") ||
54 !g_ascii_strcasecmp(s
, "top"))
56 else if (!g_ascii_strcasecmp(s
, "below") ||
57 !g_ascii_strcasecmp(s
, "bottom"))
59 else if (!g_ascii_strcasecmp(s
, "normal") ||
60 !g_ascii_strcasecmp(s
, "middle"))
68 /* Always return FALSE because its not interactive */
69 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
74 ObClient
*c
= data
->client
;
76 actions_client_move(data
, TRUE
);
79 if (o
->toggle
|| !c
->below
)
80 client_set_layer(c
, c
->below
? 0 : -1);
82 else if (o
->layer
> 0) {
83 if (o
->toggle
|| !c
->above
)
84 client_set_layer(c
, c
->above
? 0 : 1);
86 else if (c
->above
|| c
->below
)
87 client_set_layer(c
, 0);
89 actions_client_move(data
, FALSE
);
This page took 0.040021 seconds and 4 git commands to generate.