Bugfix: Restore focus after changing layout (Thanks fernandotcl)

This commit is contained in:
Michael Stapelberg
2010-11-28 01:39:47 +01:00
parent 2c157283ea
commit d0de3f403d
2 changed files with 53 additions and 0 deletions

View File

@ -567,6 +567,10 @@ void con_set_layout(Con *con, int layout) {
* container. */
new->orientation = HORIZ;
Con *old_focused = TAILQ_FIRST(&(con->focus_head));
if (old_focused == TAILQ_END(&(con->focus_head)))
old_focused = NULL;
/* 4: move the existing cons of this workspace below the new con */
DLOG("Moving cons\n");
Con *child;
@ -580,6 +584,9 @@ void con_set_layout(Con *con, int layout) {
DLOG("Attaching new split to ws\n");
con_attach(new, con);
if (old_focused)
con_focus(old_focused);
return;
}