]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'fix-fullscreen-focus'
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 17 Dec 2011 15:28:25 +0000 (15:28 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 17 Dec 2011 15:28:25 +0000 (15:28 +0000)
src/cmdparse.y
testcases/t/100-fullscreen.t

index 7ce5c2dfcdc581bff4defa299148ba9d15144e37..d01ca23232807ddf6af0739eb779826c39533c31 100644 (file)
@@ -436,6 +436,13 @@ restart:
 focus:
     TOK_FOCUS
     {
+        if (focused &&
+            focused->type != CT_WORKSPACE &&
+            focused->fullscreen_mode != CF_NONE) {
+            LOG("Cannot change focus while in fullscreen mode.\n");
+            break;
+        }
+
         owindow *current;
 
         if (match_is_empty(&current_match)) {
@@ -486,6 +493,13 @@ focus:
     }
     | TOK_FOCUS direction
     {
+        if (focused &&
+            focused->type != CT_WORKSPACE &&
+            focused->fullscreen_mode != CF_NONE) {
+            LOG("Cannot change focus while in fullscreen mode.\n");
+            break;
+        }
+
         int direction = $2;
         switch (direction) {
             case TOK_LEFT:
@@ -513,6 +527,13 @@ focus:
     }
     | TOK_FOCUS window_mode
     {
+        if (focused &&
+            focused->type != CT_WORKSPACE &&
+            focused->fullscreen_mode != CF_NONE) {
+            LOG("Cannot change focus while in fullscreen mode.\n");
+            break;
+        }
+
         printf("should focus: ");
 
         if ($2 == TOK_TILING)
@@ -545,6 +566,13 @@ focus:
     }
     | TOK_FOCUS level
     {
+        if (focused &&
+            focused->type != CT_WORKSPACE &&
+            focused->fullscreen_mode != CF_NONE) {
+            LOG("Cannot change focus while in fullscreen mode.\n");
+            break;
+        }
+
         if ($2 == TOK_PARENT)
             level_up();
         else level_down();
index ae8c63f67de6789e0e366878a7dc4702a155f578..06c1411a9c625f8a5bbcb359d486397717793c17 100644 (file)
@@ -169,4 +169,22 @@ is(fullscreen_windows(), 0, 'amount of fullscreen windows after fullscreen comma
 # clean up the workspace so that it will be cleaned when switching away
 cmd 'kill' for (@{get_ws_content($tmp)});
 
+################################################################################
+# Verify that changing focus while in fullscreen does not work.
+################################################################################
+
+$tmp = fresh_workspace;
+
+my $other = open_window;
+is($x->input_focus, $other->id, 'other window focused');
+
+$window = open_window;
+is($x->input_focus, $window->id, 'window focused');
+
+cmd 'fullscreen';
+is($x->input_focus, $window->id, 'fullscreen window focused');
+
+cmd 'focus left';
+is($x->input_focus, $window->id, 'fullscreen window still focused');
+
 done_testing;