diff --git a/common.h b/common.h index d3edbeb..57158b9 100644 --- a/common.h +++ b/common.h @@ -55,6 +55,7 @@ struct model { struct vkcube { struct model model; + bool fullscreen; bool protected; int fd; @@ -66,6 +67,8 @@ struct vkcube { xcb_window_t window; xcb_atom_t atom_wm_protocols; xcb_atom_t atom_wm_delete_window; + xcb_atom_t atom_net_wm_state; + xcb_atom_t atom_net_wm_state_fullscreen; } xcb; #endif diff --git a/main.c b/main.c index 7bb4a7e..4c05cd4 100644 --- a/main.c +++ b/main.c @@ -75,6 +75,7 @@ enum display_mode { static enum display_mode display_mode = DISPLAY_MODE_AUTO; static uint32_t width = 1024, height = 768; static const char *arg_out_file = "./cube.png"; +static bool fullscreen = false; static bool protected_chain = false; void noreturn @@ -876,6 +877,18 @@ init_xcb(struct vkcube *vc) 8, // sizeof(char), strlen(title), title); + if (vc->fullscreen) { + vc->xcb.atom_net_wm_state = get_atom(vc->xcb.conn, "_NET_WM_STATE"), + vc->xcb.atom_net_wm_state_fullscreen = get_atom(vc->xcb.conn, "_NET_WM_STATE_FULLSCREEN"), + xcb_change_property(vc->xcb.conn, + XCB_PROP_MODE_REPLACE, + vc->xcb.window, + vc->xcb.atom_net_wm_state, + XCB_ATOM_ATOM, + 32, + 1, &vc->xcb.atom_net_wm_state_fullscreen); + } + xcb_map_window(vc->xcb.conn, vc->xcb.window); xcb_flush(vc->xcb.conn); @@ -1645,7 +1658,7 @@ parse_args(int argc, char *argv[]) * The initial ':' in the optstring makes getopt return ':' when an option * is missing a required argument. */ - static const char *optstring = "+:nm:w:h:o:k:p"; + static const char *optstring = "+:nm:w:h:o:k:fp"; int opt; bool found_arg_headless = false; @@ -1684,6 +1697,9 @@ parse_args(int argc, char *argv[]) case 'o': arg_out_file = xstrdup(optarg); break; + case 'f': + fullscreen = true; + break; case 'p': protected_chain = true; break; @@ -1813,6 +1829,7 @@ int main(int argc, char *argv[]) #endif vc.width = width; vc.height = height; + vc.fullscreen = fullscreen; vc.protected = protected_chain; gettimeofday(&vc.start_tv, NULL);