From 6bf55dc35664ad1cfb9d12950b76327856682bbd Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 17 Apr 2010 17:40:41 +0200 Subject: [PATCH] implement con_toggle_fullscreen --- include/con.h | 1 + src/con.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/con.h b/include/con.h index 2b01475a..076a5cf5 100644 --- a/include/con.h +++ b/include/con.h @@ -17,5 +17,6 @@ void con_detach(Con *con); enum { WINDOW_ADD = 0, WINDOW_REMOVE = 1 }; void con_fix_percent(Con *con, int action); +void con_toggle_fullscreen(Con *con); #endif diff --git a/src/con.c b/src/con.c index 2f61363b..83e89631 100644 --- a/src/con.c +++ b/src/con.c @@ -268,3 +268,25 @@ void con_fix_percent(Con *con, int action) { child->percent *= fix; } } + +void con_toggle_fullscreen(Con *con) { + Con *workspace, *fullscreen; + LOG("toggling fullscreen for %p / %s\n", con, con->name); + if (con->fullscreen_mode == CF_NONE) { + /* 1: check if there already is a fullscreen con */ + workspace = con_get_workspace(con); + if ((fullscreen = con_get_fullscreen_con(workspace)) != NULL) { + LOG("Not entering fullscreen mode, container (%p/%s) " + "already is in fullscreen mode\n", + fullscreen, fullscreen->name); + return; + } + + /* 2: enable fullscreen */ + con->fullscreen_mode = CF_OUTPUT; + } else { + /* 1: disable fullscreen */ + con->fullscreen_mode = CF_NONE; + } + LOG("mode now: %d\n", con->fullscreen_mode); +} -- 2.39.5