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

@ -289,6 +289,7 @@ Con *create_workspace_on_output(Output *output, Con *content) {
ws->workspace_layout = config.default_layout;
_workspace_apply_default_orientation(ws);
ipc_send_workspace_event("init", ws, NULL);
return ws;
}
@ -1004,13 +1005,11 @@ bool workspace_move_to_output(Con *ws, Output *output) {
break;
}
/* if we couldn't create the workspace using an assignment, create
* it on the output */
/* if we couldn't create the workspace using an assignment, create it on
* the output. Workspace init IPC events are sent either by
* workspace_get or create_workspace_on_output. */
if (!used_assignment)
create_workspace_on_output(current_output, ws->parent);
/* notify the IPC listeners */
ipc_send_workspace_event("init", ws, NULL);
}
DLOG("Detaching\n");