From b808cc5d188f7cf54872bf05666d1913efab0ef5 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 10 Nov 2011 20:30:51 +0000 Subject: [PATCH] Bugfix: Render floating windows after rendering all outputs (Thanks mw) Fixes #548 See the comment on why this is necessary. --- src/render.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/render.c b/src/render.c index 63c3b4d9..d85d16a7 100644 --- a/src/render.c +++ b/src/render.c @@ -221,10 +221,29 @@ void render_con(Con *con, bool render_fullscreen) { if (con->layout == L_OUTPUT) { render_l_output(con); } else if (con->type == CT_ROOT) { - Con *child; - TAILQ_FOREACH(child, &(con->nodes_head), nodes) { - render_con(child, false); + Con *output; + TAILQ_FOREACH(output, &(con->nodes_head), nodes) { + render_con(output, false); } + + /* We need to render floating windows after rendering all outputs’ + * tiling windows because they need to be on top of *every* output at + * all times. This is important when the user places floating + * windows/containers so that they overlap on another output. */ + DLOG("Rendering floating windows:\n"); + TAILQ_FOREACH(output, &(con->nodes_head), nodes) { + /* Get the active workspace of that output */ + Con *content = output_get_content(output); + Con *workspace = TAILQ_FIRST(&(content->focus_head)); + + Con *child; + TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) { + DLOG("floating child at (%d,%d) with %d x %d\n", child->rect.x, child->rect.y, child->rect.width, child->rect.height); + x_raise_con(child); + render_con(child, false); + } + } + } else { /* FIXME: refactor this into separate functions: */ @@ -339,11 +358,4 @@ void render_con(Con *con, bool render_fullscreen) { x_raise_con(con); } } - - Con *child; - TAILQ_FOREACH(child, &(con->floating_head), floating_windows) { - DLOG("floating child at (%d,%d) with %d x %d\n", child->rect.x, child->rect.y, child->rect.width, child->rect.height); - x_raise_con(child); - render_con(child, false); - } }