From: Michael Stapelberg Date: Thu, 2 Jun 2011 23:48:55 +0000 (+0200) Subject: Bugfix: Don’t break focus stack when inplace restarting with fullscreen windows ... X-Git-Tag: tree-pr4~96 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=58e02e84e24a7a04b97c2f76633c2a41cd85e3d3;p=i3%2Fi3 Bugfix: Don’t break focus stack when inplace restarting with fullscreen windows (Thanks mike) --- 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 */