From 061dfaa2e7dcc823c1313d64ddd06000f0d7ab30 Mon Sep 17 00:00:00 2001 From: Evy Garden <92547295+EvysGarden@users.noreply.github.com> Date: Fri, 7 Jul 2023 05:11:21 +0200 Subject: Fix toplevel borders (#171) * added check for smart * expose gaps_to_edge * add smart variable --- sway/desktop/render.c | 8 +++++++- sway/tree/view.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'sway') diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 50f7d70b..8510cf68 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -720,8 +720,14 @@ static void render_view_toplevels(struct sway_view *view, struct sway_output *ou clip_box.y = state.y - output->ly; clip_box.width = state.width; clip_box.height = state.height; + + bool smart = config->hide_edge_borders_smart == ESMART_ON || + (config->hide_edge_borders_smart == ESMART_NO_GAPS && + !gaps_to_edge(view)); + if (state.fullscreen_mode == FULLSCREEN_NONE - && (state.border == B_PIXEL || state.border == B_NORMAL)) { + && (state.border == B_PIXEL || state.border == B_NORMAL) + && !smart) { clip_box.x += state.border_thickness; clip_box.width -= state.border_thickness * 2; diff --git a/sway/tree/view.c b/sway/tree/view.c index b66dc2f8..272967f4 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -233,7 +233,7 @@ static bool view_is_only_visible(struct sway_view *view) { return true; } -static bool gaps_to_edge(struct sway_view *view) { +bool gaps_to_edge(struct sway_view *view) { struct side_gaps gaps = view->container->pending.workspace->current_gaps; return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0; } -- cgit v1.2.3