]> git.sur5r.net Git - i3/i3/commitdiff
previous commit: extend test and code to also work with floating windows
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 13 Oct 2013 15:57:50 +0000 (17:57 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 13 Oct 2013 15:59:29 +0000 (17:59 +0200)
src/tree.c
testcases/t/129-focus-after-close.t

index 65d709a557220489ab2b0f1c7a8ee4cc9f4af3aa..836183ec114439aa2b5c6cac9092abd3b095dd4d 100644 (file)
@@ -367,8 +367,8 @@ void tree_close_con(kill_window_t kill_window) {
     if (focused->type == CT_WORKSPACE) {
         DLOG("Workspaces cannot be close, closing all children instead\n");
         Con *child, *nextchild;
-        for (child = TAILQ_FIRST(&(focused->nodes_head)); child; ) {
-            nextchild = TAILQ_NEXT(child, nodes);
+        for (child = TAILQ_FIRST(&(focused->focus_head)); child; ) {
+            nextchild = TAILQ_NEXT(child, focused);
             DLOG("killing child=%p\n", child);
             tree_close(child, kill_window, false, false);
             child = nextchild;
index 8d9ccbb9e7662ecf9810a9fdd021ea06f0e60b17..2ebfd61022012c5a913b53a53f614ba260f91d68 100644 (file)
@@ -143,6 +143,31 @@ sync_with_i3;
 ($nodes, $focus) = get_ws_content($tmp);
 is(scalar @$nodes, 0, 'workspace is empty');
 
+################################################################################
+# check if killing a workspace also closes floating windows.
+################################################################################
+
+$tmp = fresh_workspace;
+
+$window = open_window;
+my $floating_window = open_floating_window;
+
+# one window opened on the current workspace
+($nodes, $focus) = get_ws_content($tmp);
+is(scalar @$focus, 2, 'workspace contains two nodes');
+
+# focus the workspace
+cmd "focus parent";
+cmd "focus parent";
+
+# try to kill the workspace
+cmd "kill";
+sync_with_i3;
+
+# the workspace should now be empty
+($nodes, $focus) = get_ws_content($tmp);
+is(scalar @$focus, 0, 'workspace is empty');
+
 ##############################################################
 # and now for something completely different:
 # check if the pointer position is relevant when restoring focus