From: Michael Stapelberg Date: Sun, 24 Jul 2011 13:00:09 +0000 (+0200) Subject: ipc: make 'focused' a bool X-Git-Tag: 4.0~14^2~63 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=34eb9b2664955ec7eda06dea62842bfc233d71d0;p=i3%2Fi3 ipc: make 'focused' a bool --- diff --git a/src/ipc.c b/src/ipc.c index ca341dc7..b2cd482c 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -201,7 +201,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { y(bool, con->urgent); ystr("focused"); - y(integer, (con == focused)); + y(bool, (con == focused)); ystr("layout"); switch (con->layout) { diff --git a/testcases/t/16-nestedcons.t b/testcases/t/16-nestedcons.t index 9bcff8c6..7763ce79 100644 --- a/testcases/t/16-nestedcons.t +++ b/testcases/t/16-nestedcons.t @@ -28,7 +28,7 @@ my $expected = { percent => undef, layout => 'default', focus => ignore(), - focused => 0, + focused => JSON::XS::false, urgent => JSON::XS::false, border => 'normal', 'floating_nodes' => ignore(), diff --git a/testcases/t/29-focus-after-close.t b/testcases/t/29-focus-after-close.t index 5f5ef4af..fa9d86b5 100644 --- a/testcases/t/29-focus-after-close.t +++ b/testcases/t/29-focus-after-close.t @@ -22,10 +22,10 @@ cmd 'split v'; my ($nodes, $focus) = get_ws_content($tmp); -is($nodes->[1]->{focused}, 0, 'split container not focused'); +ok(!$nodes->[1]->{focused}, 'split container not focused'); cmd 'focus parent'; ($nodes, $focus) = get_ws_content($tmp); -is($nodes->[1]->{focused}, 1, 'split container focused after focus parent'); +ok($nodes->[1]->{focused}, 'split container focused after focus parent'); my $third = open_empty_con($i3); @@ -50,7 +50,7 @@ cmd 'kill'; sleep 0.25; ($nodes, $focus) = get_ws_content($tmp); is($nodes->[1]->{nodes}->[0]->{id}, $second, 'second container found'); -is($nodes->[1]->{nodes}->[0]->{focused}, 1, 'second container focused'); +ok($nodes->[1]->{nodes}->[0]->{focused}, 'second container focused'); ############################################################## # another case, using a slightly different layout (regression) diff --git a/testcases/t/32-move-workspace.t b/testcases/t/32-move-workspace.t index 93bd4f8f..8730cdfb 100644 --- a/testcases/t/32-move-workspace.t +++ b/testcases/t/32-move-workspace.t @@ -35,7 +35,7 @@ my ($nodes, $focus) = get_ws_content($tmp2); is($focus->[0], $second, 'same container on different ws'); ($nodes, $focus) = get_ws_content($tmp); -is($nodes->[0]->{focused}, 1, 'first container focused on first ws'); +ok($nodes->[0]->{focused}, 'first container focused on first ws'); ################################################################### # check if floating cons are moved to new workspaces properly