]> git.sur5r.net Git - i3/i3/commitdiff
Prevent workspace change during global fullscreen
authorMats <d912e3@gmail.com>
Sat, 29 Nov 2014 17:22:56 +0000 (18:22 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 10 Dec 2014 19:24:32 +0000 (20:24 +0100)
While in global fullscreen, the workspace could be changed leaving the
fullscreen container still visible on top but losing its focus.

src/commands.c
testcases/t/100-fullscreen.t

index 95dcb7bb5a2c28064986b1f6f19575a4e05c68ea..48df5e3d32e480f6e982bf5a80dedb6850404bee 100644 (file)
@@ -958,6 +958,12 @@ void cmd_workspace(I3_CMD, char *which) {
 
     DLOG("which=%s\n", which);
 
+    if (con_get_fullscreen_con(croot, CF_GLOBAL)) {
+        LOG("Cannot switch workspace while in global fullscreen\n");
+        ysuccess(false);
+        return;
+    }
+
     if (strcmp(which, "next") == 0)
         ws = workspace_next();
     else if (strcmp(which, "prev") == 0)
@@ -986,6 +992,12 @@ void cmd_workspace(I3_CMD, char *which) {
 void cmd_workspace_number(I3_CMD, char *which) {
     Con *output, *workspace = NULL;
 
+    if (con_get_fullscreen_con(croot, CF_GLOBAL)) {
+        LOG("Cannot switch workspace while in global fullscreen\n");
+        ysuccess(false);
+        return;
+    }
+
     long parsed_num = ws_name_to_number(which);
 
     if (parsed_num == -1) {
@@ -1020,6 +1032,12 @@ void cmd_workspace_number(I3_CMD, char *which) {
  *
  */
 void cmd_workspace_back_and_forth(I3_CMD) {
+    if (con_get_fullscreen_con(croot, CF_GLOBAL)) {
+        LOG("Cannot switch workspace while in global fullscreen\n");
+        ysuccess(false);
+        return;
+    }
+
     workspace_back_and_forth();
 
     cmd_output->needs_tree_render = true;
@@ -1038,6 +1056,12 @@ void cmd_workspace_name(I3_CMD, char *name) {
         return;
     }
 
+    if (con_get_fullscreen_con(croot, CF_GLOBAL)) {
+        LOG("Cannot switch workspace while in global fullscreen\n");
+        ysuccess(false);
+        return;
+    }
+
     DLOG("should switch to workspace %s\n", name);
     if (maybe_back_and_forth(cmd_output, name))
         return;
index 206116ee171eed08091e3900ed30331c783a1a1f..bb9403b41ec4c44e5b1e0d64f4e3edcd5be88f6e 100644 (file)
@@ -191,6 +191,26 @@ is($x->input_focus, $window->id, 'fullscreen window focused');
 cmd 'focus left';
 is($x->input_focus, $window->id, 'fullscreen window still focused');
 
+################################################################################
+# Verify that changing workspace while in global fullscreen does not work.
+################################################################################
+
+$tmp = fresh_workspace;
+$window = open_window;
+
+cmd 'fullscreen global';
+is($x->input_focus, $window->id, 'window focused');
+is(focused_ws(), $tmp, 'workspace selected');
+
+$other = get_unused_workspace;
+cmd "workspace $other";
+is($x->input_focus, $window->id, 'window still focused');
+is(focused_ws(), $tmp, 'workspace still selected');
+
+# leave global fullscreen so that is does not interfere with the other tests
+$window->fullscreen(0);
+sync_with_i3;
+
 ################################################################################
 # Verify that fullscreening a window on a second workspace and moving it onto
 # the first workspace unfullscreens the first window.