From 7fca7f029f27847e0e4c3c15773fa1c2db118ffe Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 26 Aug 2011 03:17:41 +0200 Subject: [PATCH] Correctly render containers when a split container is focused --- include/con.h | 6 ++++++ src/con.c | 12 ++++++++++++ src/x.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/con.h b/include/con.h index d8bad7de..93497404 100644 --- a/include/con.h +++ b/include/con.h @@ -68,6 +68,12 @@ bool con_is_floating(Con *con); */ Con *con_inside_floating(Con *con); +/** + * Checks if the given container is inside a focused container. + * + */ +Con *con_inside_focused(Con *con); + /** * Returns the container with the given client window ID or NULL if no such * container exists. diff --git a/src/con.c b/src/con.c index a115ad7b..9cef302f 100644 --- a/src/con.c +++ b/src/con.c @@ -358,6 +358,18 @@ Con *con_inside_floating(Con *con) { return con_inside_floating(con->parent); } +/* + * Checks if the given container is inside a focused container. + * + */ +Con *con_inside_focused(Con *con) { + if (con == focused) + return true; + if (!con->parent) + return false; + return con_inside_focused(con->parent); +} + /* * Returns the container with the given client window ID or NULL if no such * container exists. diff --git a/src/x.c b/src/x.c index abfcebef..f0307abf 100644 --- a/src/x.c +++ b/src/x.c @@ -290,7 +290,7 @@ void x_draw_decoration(Con *con) { /* find out which colors to use */ if (con->urgent) p->color = &config.client.urgent; - else if (con == focused) + else if (con == focused || con_inside_focused(con)) p->color = &config.client.focused; else if (con == TAILQ_FIRST(&(parent->focus_head))) p->color = &config.client.focused_inactive;