]> git.sur5r.net Git - i3/i3/blobdiff - src/commands.c
Refined the fullscreen focus constraints.
[i3/i3] / src / commands.c
index 77d31f821a0040f47165ae71791e9b8bf479206d..b3c955e56d926e3b2fe8eab3e795f7c0d534356e 100644 (file)
@@ -1238,15 +1238,6 @@ void cmd_focus_level(I3_CMD, char *level) {
  */
 void cmd_focus(I3_CMD) {
     DLOG("current_match = %p\n", current_match);
-    if (focused &&
-        focused->type != CT_WORKSPACE &&
-        focused->fullscreen_mode != CF_NONE) {
-        LOG("Cannot change focus while in fullscreen mode.\n");
-        ysuccess(false);
-        return;
-    }
-
-    owindow *current;
 
     if (match_is_empty(current_match)) {
         ELOG("You have to specify which window/container should be focused.\n");
@@ -1263,6 +1254,7 @@ void cmd_focus(I3_CMD) {
     }
 
     int count = 0;
+    owindow *current;
     TAILQ_FOREACH(current, &owindows, owindows) {
         Con *ws = con_get_workspace(current->con);
         /* If no workspace could be found, this was a dock window.
@@ -1270,6 +1262,13 @@ void cmd_focus(I3_CMD) {
         if (!ws)
             continue;
 
+        /* Check the fullscreen focus constraints. */
+        if (!con_fullscreen_permits_focusing(current->con)) {
+            LOG("Cannot change focus while in fullscreen mode (fullscreen rules).\n");
+            ysuccess(false);
+            return;
+        }
+
         /* If the container is not on the current workspace,
          * workspace_show() will switch to a different workspace and (if
          * enabled) trigger a mouse pointer warp to the currently focused