From 9d9a1d9d2901cbb683d07c16f1276ce6e5e2cc8c Mon Sep 17 00:00:00 2001 From: Philipp Middendorf Date: Mon, 6 Aug 2012 18:39:38 +0200 Subject: [PATCH] Bugfix: Add deco_height only when in "normal" border mode. Also, use con_border_style_rect instead of hard-coded values to determine the border size. --- src/floating.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/floating.c b/src/floating.c index 16aab992..1f0925f3 100644 --- a/src/floating.c +++ b/src/floating.c @@ -175,11 +175,15 @@ void floating_enable(Con *con, bool automatic) { nc->rect.width = max(nc->rect.width, config.floating_minimum_width); } - /* add pixels for the decoration */ - /* TODO: don’t add them when the user automatically puts new windows into - * 1pixel/borderless mode */ - nc->rect.height += deco_height + 2; - nc->rect.width += 4; + /* Add pixels for the decoration. */ + Rect border_style_rect = con_border_style_rect(con); + + nc->rect.height -= border_style_rect.height; + nc->rect.width -= border_style_rect.width; + + /* Add some more pixels for the title bar */ + if(con_border_style(con) == BS_NORMAL) + nc->rect.height += deco_height; /* Honor the X11 border */ nc->rect.height += con->border_width * 2; -- 2.39.5