floating_maybe_reassign_ws: only re-focus if previously focused

Fixes #3979
This commit is contained in:
Orestis Floros 2020-04-11 11:10:51 +02:00
parent e2b2a28625
commit 5eab604a10
No known key found for this signature in database
GPG Key ID: A09DBD7D3222C1C3
1 changed files with 8 additions and 2 deletions

View File

@ -514,9 +514,15 @@ bool floating_maybe_reassign_ws(Con *con) {
Con *content = output_get_content(output->con); Con *content = output_get_content(output->con);
Con *ws = TAILQ_FIRST(&(content->focus_head)); Con *ws = TAILQ_FIRST(&(content->focus_head));
DLOG("Moving con %p / %s to workspace %p / %s\n", con, con->name, ws, ws->name); DLOG("Moving con %p / %s to workspace %p / %s\n", con, con->name, ws, ws->name);
Con *needs_focus = con_descend_focused(con);
if (!con_inside_focused(needs_focus)) {
needs_focus = NULL;
}
con_move_to_workspace(con, ws, false, true, false); con_move_to_workspace(con, ws, false, true, false);
if (needs_focus) {
workspace_show(ws); workspace_show(ws);
con_activate(con_descend_focused(con)); con_activate(needs_focus);
}
return true; return true;
} }