blob: 3c3b2d1006e931f6e71641875e644298475d6f05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "openbox/actions.h"
#include "openbox/screen.h"
typedef struct {
/* If true, windows are unable to be shown while in the showing-desktop
state. */
gboolean strict;
} Options;
static gpointer setup_func(xmlNodePtr node);
static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_showdesktop_startup(void)
{
actions_register("ToggleShowDesktop", setup_func, free_func, run_func);
}
static gpointer setup_func(xmlNodePtr node)
{
xmlNodePtr n;
Options *o = g_slice_new0(Options);
o->strict = FALSE;
if ((n = obt_xml_find_node(node, "strict")))
o->strict = obt_xml_node_bool(n);
return o;
}
static void free_func(gpointer o)
{
g_slice_free(Options, o);
}
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
Options *o = options;
ObScreenShowDestopMode show_mode;
if (screen_showing_desktop())
show_mode = SCREEN_SHOW_DESKTOP_NO;
else if (!o->strict)
show_mode = SCREEN_SHOW_DESKTOP_UNTIL_WINDOW;
else
show_mode = SCREEN_SHOW_DESKTOP_UNTIL_TOGGLE;
screen_show_desktop(show_mode, NULL);
return FALSE;
}
|