Allow moving fullscreen windows between monitors
[openbox.git] / openbox / actions / showdesktop.c
blob3c3b2d1006e931f6e71641875e644298475d6f05
1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
4 typedef struct {
5 /* If true, windows are unable to be shown while in the showing-desktop
6 state. */
7 gboolean strict;
8 } Options;
10 static gpointer setup_func(xmlNodePtr node);
11 static void free_func(gpointer o);
12 static gboolean run_func(ObActionsData *data, gpointer options);
14 void action_showdesktop_startup(void)
16 actions_register("ToggleShowDesktop", setup_func, free_func, run_func);
19 static gpointer setup_func(xmlNodePtr node)
21 xmlNodePtr n;
22 Options *o = g_slice_new0(Options);
23 o->strict = FALSE;
25 if ((n = obt_xml_find_node(node, "strict")))
26 o->strict = obt_xml_node_bool(n);
28 return o;
31 static void free_func(gpointer o)
33 g_slice_free(Options, o);
36 /* Always return FALSE because its not interactive */
37 static gboolean run_func(ObActionsData *data, gpointer options)
39 Options *o = options;
41 ObScreenShowDestopMode show_mode;
42 if (screen_showing_desktop())
43 show_mode = SCREEN_SHOW_DESKTOP_NO;
44 else if (!o->strict)
45 show_mode = SCREEN_SHOW_DESKTOP_UNTIL_WINDOW;
46 else
47 show_mode = SCREEN_SHOW_DESKTOP_UNTIL_TOGGLE;
49 screen_show_desktop(show_mode, NULL);
51 return FALSE;