diff options
author | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2022-11-07 19:01:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 19:01:58 +0100 |
commit | 14795c303c09777c5037088b3813b39a0164db3c (patch) | |
tree | 4b1a4e74a741a546b23723ca3c34d5a48a9ac60d | |
parent | e6a28b9475e90805806bbe5e4c3dcdcc28d49f4b (diff) | |
download | i3-14795c303c09777c5037088b3813b39a0164db3c.tar.gz i3-14795c303c09777c5037088b3813b39a0164db3c.zip |
fix title bar rendering with hide_edge_borders smart (#5260)
related to https://github.com/i3/i3/pull/5245
fixes https://github.com/i3/i3/issues/5254
-rw-r--r-- | src/con.c | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -1706,13 +1706,7 @@ bool con_draw_decoration_into_frame(Con *con) { con->parent->layout != L_STACKED)); } -/* - * Returns a "relative" Rect which contains the amount of pixels that need to - * be added to the original Rect to get the final position (obviously the - * amount of pixels for normal, 1pixel and borderless are different). - * - */ -Rect con_border_style_rect(Con *con) { +static Rect con_border_style_rect_without_title(Con *con) { if ((config.smart_borders == SMART_BORDERS_ON && con_num_visible_children(con_get_workspace(con)) <= 1) || (config.smart_borders == SMART_BORDERS_NO_GAPS && !has_outer_gaps(calculate_effective_gaps(con))) || (config.hide_edge_borders == HEBM_SMART && con_num_visible_children(con_get_workspace(con)) <= 1) || @@ -1738,16 +1732,7 @@ Rect con_border_style_rect(Con *con) { if (border_style == BS_NONE) return (Rect){0, 0, 0, 0}; if (border_style == BS_NORMAL) { - const int deco_height = render_deco_height(); result = (Rect){border_width, 0, -(2 * border_width), -(border_width)}; - if (con_draw_decoration_into_frame(con)) { - result = (Rect){ - .x = border_width /* left */, - .y = deco_height, - .width = -(border_width /* left */ + border_width /* right */), - .height = -(border_width /* bottom */ + deco_height), - }; - } } else { result = (Rect){border_width, border_width, -(2 * border_width), -(2 * border_width)}; } @@ -1777,6 +1762,23 @@ Rect con_border_style_rect(Con *con) { } /* + * Returns a "relative" Rect which contains the amount of pixels that need to + * be added to the original Rect to get the final position (obviously the + * amount of pixels for normal, 1pixel and borderless are different). + * + */ +Rect con_border_style_rect(Con *con) { + Rect result = con_border_style_rect_without_title(con); + if (con_border_style(con) == BS_NORMAL && + con_draw_decoration_into_frame(con)) { + const int deco_height = render_deco_height(); + result.y += deco_height; + result.height -= deco_height; + } + return result; +} + +/* * Returns adjacent borders of the window. We need this if hide_edge_borders is * enabled. */ |