Bugfix: Correctly maintain focus when setting a workspace to floating

This commit is contained in:
Michael Stapelberg 2011-01-08 00:10:30 +01:00
parent b660769fe0
commit e4bb6d859e
1 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,8 @@
extern xcb_connection_t *conn; extern xcb_connection_t *conn;
void floating_enable(Con *con, bool automatic) { void floating_enable(Con *con, bool automatic) {
bool set_focus = true;
if (con_is_floating(con)) { if (con_is_floating(con)) {
LOG("Container is already in floating mode, not doing anything.\n"); LOG("Container is already in floating mode, not doing anything.\n");
return; return;
@ -58,6 +60,7 @@ void floating_enable(Con *con, bool automatic) {
con_focus(old_focused); con_focus(old_focused);
con = new; con = new;
set_focus = false;
} }
/* 1: detach the container from its parent */ /* 1: detach the container from its parent */
@ -121,7 +124,8 @@ void floating_enable(Con *con, bool automatic) {
TAILQ_INSERT_TAIL(&(nc->nodes_head), con, nodes); TAILQ_INSERT_TAIL(&(nc->nodes_head), con, nodes);
TAILQ_INSERT_TAIL(&(nc->focus_head), con, focused); TAILQ_INSERT_TAIL(&(nc->focus_head), con, focused);
// TODO: dont influence focus handling when Con was not focused before. // TODO: dont influence focus handling when Con was not focused before.
con_focus(con); if (set_focus)
con_focus(con);
} }
void floating_disable(Con *con, bool automatic) { void floating_disable(Con *con, bool automatic) {