From 4f98bbf5ffc18a7b53c5545ce403e4667d75a703 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 30 Jan 2012 16:03:51 +0000 Subject: [PATCH] Bugfix: Obey workspace_layout when re-inserting floating containers (+test) (Thanks aksr) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The code wasn’t using con_attach and therefore didn’t obey workspace_layout. Fixes: #631 --- src/floating.c | 5 ++--- testcases/t/167-workspace_layout.t | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/floating.c b/src/floating.c index f7dd2ebc..0637521f 100644 --- a/src/floating.c +++ b/src/floating.c @@ -238,11 +238,10 @@ void floating_disable(Con *con, bool automatic) { /* con_fix_percent will adjust the percent value */ con->percent = 0.0; - TAILQ_INSERT_TAIL(&(con->parent->nodes_head), con, nodes); - TAILQ_INSERT_TAIL(&(con->parent->focus_head), con, focused); - con->floating = FLOATING_USER_OFF; + con_attach(con, con->parent, false); + con_fix_percent(con->parent); // TODO: don’t influence focus handling when Con was not focused before. con_focus(con); diff --git a/testcases/t/167-workspace_layout.t b/testcases/t/167-workspace_layout.t index e4b18adf..6a714124 100644 --- a/testcases/t/167-workspace_layout.t +++ b/testcases/t/167-workspace_layout.t @@ -122,6 +122,24 @@ is($content[1]->{layout}, 'stacked', 'layout stacked'); is(@content, 1, 'one con on target workspace'); is($content[0]->{layout}, 'stacked', 'layout stacked'); +##################################################################### +# 7: toggle floating mode and check that we have a stacked con when +# re-inserting a floating container. +##################################################################### + +$tmp = fresh_workspace; + +$first = open_window; +cmd 'floating toggle'; +cmd 'floating toggle'; + +$second = open_window; + +is($x->input_focus, $second->id, 'second window focused'); +@content = @{get_ws_content($tmp)}; +ok(@content == 1, 'one con at workspace level'); +is($content[0]->{layout}, 'stacked', 'layout stacked'); + exit_gracefully($pid); done_testing; -- 2.39.5