From: Michael Stapelberg Date: Sun, 9 May 2010 21:20:49 +0000 (+0200) Subject: bugfix: don’t clean up workspace when switching to the same workspace X-Git-Tag: tree-pr1~227 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=65e9036837f18f39135d4f8dcaa1104b8ea46d79;p=i3%2Fi3 bugfix: don’t clean up workspace when switching to the same workspace --- diff --git a/src/workspace.c b/src/workspace.c index 9b5593d6..1829370c 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -101,6 +101,8 @@ void workspace_show(const char *num) { old = con_get_workspace(focused); workspace = workspace_get(num); + if (workspace == old) + return; workspace->fullscreen_mode = CF_OUTPUT; /* disable fullscreen */ TAILQ_FOREACH(current, &(workspace->parent->nodes_head), nodes) diff --git a/testcases/t/17-workspace.t b/testcases/t/17-workspace.t index c350d9d9..bb30bd02 100644 --- a/testcases/t/17-workspace.t +++ b/testcases/t/17-workspace.t @@ -4,7 +4,7 @@ # Tests whether we can switch to a non-existant workspace # (necessary for further tests) # -use i3test tests => 2; +use i3test tests => 3; use v5.10; my $i3 = i3("/tmp/nestedcons"); @@ -33,4 +33,9 @@ diag("Other temporary workspace name: $otmp\n"); $i3->command("workspace $otmp")->recv; ok(!workspace_exists($tmp), 'old workspace cleaned up'); +# Switch to the same workspace again to make sure it doesn’t get cleaned up +$i3->command("workspace $otmp")->recv; +$i3->command("workspace $otmp")->recv; +ok(workspace_exists($otmp), 'other workspace still exists'); + diag( "Testing i3, Perl $], $^X" );