create_workspace_on_output: send workspace init event

Fixes #3595
Like the issue mentions:
> instead of the newly created workspace (not referenced by variable
> here) the `"init"` event is fired with the current workspace (`ws`).

Plus, there was another issue where duplicate workspace init events
where being sent because of workspace_get().

304-ipc-workspace-init.t: Subtest "move workspace to output" fails with
current next.

Fixes #3631
No event was being sent here:
2d6e09a66a/src/randr.c (L487)

533-randr15.t: I confirmed that SKIP still works if the xrandr command
fails.
Added test fails with current next.
This commit is contained in:
Orestis Floros
2019-02-22 19:41:30 +02:00
parent 2d6e09a66a
commit 098b0e6976
3 changed files with 82 additions and 8 deletions

View File

@ -130,10 +130,16 @@ $tree = i3->get_tree->recv;
is_deeply(\@outputs, [ '__i3', 'default' ], 'outputs are __i3 and default');
SKIP: {
skip 'xrandr --setmonitor failed (xrandr too old?)', 1 unless
system(q|xrandr --setmonitor up2414q 3840/527x2160/296+1280+0 none|) == 0;
my @events = events_for(
sub {
skip 'xrandr --setmonitor failed (xrandr too old?)', 1
unless system(q|xrandr --setmonitor up2414q 3840/527x2160/296+1280+0 none|) == 0;
},
"workspace");
sync_with_i3;
my @init = grep { $_->{change} eq 'init' } @events;
is(scalar @init, 1, 'Received 1 workspace::init event');
is($init[0]->{current}->{output}, 'up2414q', 'Workspace initialized in up2414q');
$tree = i3->get_tree->recv;
@outputs = map { $_->{name} } @{$tree->{nodes}};