workspace_move_to_output: Avoid operations when workspace already at destination

Closes #3635.
Probably the bug can still happen when a tree_close_internal happens
inside a workspace_show but modifying the code to avoid them seems to
not be worth it.
This commit is contained in:
Orestis Floros 2019-03-22 00:55:30 +02:00
parent 7fc3bf660e
commit d4e4cbfd25
No known key found for this signature in database
GPG Key ID: E9AD9F32E401E38F
1 changed files with 5 additions and 0 deletions

View File

@ -969,6 +969,11 @@ void workspace_move_to_output(Con *ws, Output *output) {
Con *content = output_get_content(output->con); Con *content = output_get_content(output->con);
DLOG("got output %p with content %p\n", output, content); DLOG("got output %p with content %p\n", output, content);
if (ws->parent == content) {
DLOG("Nothing to do, workspace already there\n");
return;
}
Con *previously_visible_ws = TAILQ_FIRST(&(content->focus_head)); Con *previously_visible_ws = TAILQ_FIRST(&(content->focus_head));
if (previously_visible_ws) { if (previously_visible_ws) {
DLOG("Previously visible workspace = %p / %s\n", previously_visible_ws, previously_visible_ws->name); DLOG("Previously visible workspace = %p / %s\n", previously_visible_ws, previously_visible_ws->name);