Skip to content

Commit 061dfaa

Browse files
authored
Fix toplevel borders (#171)
* added check for smart * expose gaps_to_edge * add smart variable
1 parent ab8106a commit 061dfaa

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

include/sway/tree/view.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,6 @@ bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
378378

379379
void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
380380

381+
bool gaps_to_edge(struct sway_view *view);
382+
381383
#endif

sway/desktop/render.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,14 @@ static void render_view_toplevels(struct sway_view *view, struct sway_output *ou
720720
clip_box.y = state.y - output->ly;
721721
clip_box.width = state.width;
722722
clip_box.height = state.height;
723+
724+
bool smart = config->hide_edge_borders_smart == ESMART_ON ||
725+
(config->hide_edge_borders_smart == ESMART_NO_GAPS &&
726+
!gaps_to_edge(view));
727+
723728
if (state.fullscreen_mode == FULLSCREEN_NONE
724-
&& (state.border == B_PIXEL || state.border == B_NORMAL)) {
729+
&& (state.border == B_PIXEL || state.border == B_NORMAL)
730+
&& !smart) {
725731
clip_box.x += state.border_thickness;
726732
clip_box.width -= state.border_thickness * 2;
727733

sway/tree/view.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static bool view_is_only_visible(struct sway_view *view) {
233233
return true;
234234
}
235235

236-
static bool gaps_to_edge(struct sway_view *view) {
236+
bool gaps_to_edge(struct sway_view *view) {
237237
struct side_gaps gaps = view->container->pending.workspace->current_gaps;
238238
return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0;
239239
}

0 commit comments

Comments
 (0)