ipc: make 'focused' a bool

This commit is contained in:
Michael Stapelberg 2011-07-24 15:00:09 +02:00
parent b09bb0fc2a
commit 34eb9b2664
4 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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(),

View File

@ -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)

View File

@ -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