From 58e02e84e24a7a04b97c2f76633c2a41cd85e3d3 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 3 Jun 2011 01:48:55 +0200 Subject: [PATCH] =?utf8?q?Bugfix:=20Don=E2=80=99t=20break=20focus=20stack?= =?utf8?q?=20when=20inplace=20restarting=20with=20fullscreen=20windows=20(?= =?utf8?q?Thanks=20mike)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/manage.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/manage.c b/src/manage.c index 3c6f48a6..85beb4cb 100644 --- a/src/manage.c +++ b/src/manage.c @@ -264,8 +264,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki * focused (fullscreen) con. This way, the new container will be * focused after we return from fullscreen mode */ Con *first = TAILQ_FIRST(&(nc->parent->focus_head)); - TAILQ_REMOVE(&(nc->parent->focus_head), nc, focused); - TAILQ_INSERT_AFTER(&(nc->parent->focus_head), first, nc, focused); + if (first != nc) { + /* We only modify the focus stack if the container is not already + * the first one. This can happen when existing containers swallow + * new windows, for example when restarting. */ + TAILQ_REMOVE(&(nc->parent->focus_head), nc, focused); + TAILQ_INSERT_AFTER(&(nc->parent->focus_head), first, nc, focused); + } } /* set floating if necessary */ -- 2.39.5