Skip to content

Commit 622b94f

Browse files
committed
Merge branch 'master' into next
2 parents 1f2c930 + 74cd4d2 commit 622b94f

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/con.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,7 @@ static void con_on_remove_child(Con *con) {
10611061

10621062
/* For workspaces, close them only if they're not visible anymore */
10631063
if (con->type == CT_WORKSPACE) {
1064-
int children = con_num_children(con);
1065-
if (children == 0 && !workspace_is_visible(con)) {
1064+
if (TAILQ_EMPTY(&(con->focus_head)) && !workspace_is_visible(con)) {
10661065
LOG("Closing old workspace (%p / %s), it is empty\n", con, con->name);
10671066
tree_close(con, DONT_KILL_WINDOW, false, false);
10681067
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"empty\"}");

testcases/t/136-floating-ws-empty.t

+27
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,31 @@ my $otmp = fresh_workspace;
2525
ok(workspace_exists($otmp), "new workspace $otmp exists");
2626
ok(workspace_exists($tmp), "old workspace $tmp still exists");
2727

28+
################################################################################
29+
# 2: Similar test: Have two floating windows on a workspace, close one of them.
30+
# The workspace should not be closed. Regression present until (including) commit
31+
# 1f2c9306a27cced83ad960e929bb9e9a163b7843
32+
################################################################################
33+
34+
$tmp = fresh_workspace;
35+
36+
ok(workspace_exists($tmp), "workspace $tmp exists");
37+
38+
# Create a floating window which is smaller than the minimum enforced size of i3
39+
my $first = open_floating_window;
40+
my $second = open_floating_window;
41+
ok($first->mapped, 'Window is mapped');
42+
ok($second->mapped, 'Window is mapped');
43+
44+
$otmp = fresh_workspace;
45+
46+
ok(workspace_exists($otmp), "new workspace $otmp exists");
47+
ok(workspace_exists($tmp), "old workspace $tmp still exists");
48+
49+
$first->unmap;
50+
wait_for_unmap $first;
51+
52+
ok(workspace_exists($otmp), "new workspace $otmp exists");
53+
ok(workspace_exists($tmp), "old workspace $tmp still exists");
54+
2855
done_testing;

0 commit comments

Comments
 (0)