]> git.sur5r.net Git - i3/i3/commitdiff
implement con_toggle_fullscreen
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 17 Apr 2010 15:40:41 +0000 (17:40 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 17 Apr 2010 15:40:41 +0000 (17:40 +0200)
include/con.h
src/con.c

index 2b01475aaed33c2671ef3d6db381bbda59a517f8..076a5cf5c31977a012f541533392d313d8c2d0a5 100644 (file)
@@ -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
index 2f61363b1459d909bb7abed54635addae6379b52..83e89631db83bd375032102e13dc2d2f2920a362 100644 (file)
--- 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);
+}