Skip to content

Commit

Permalink
Fix toplevel borders (WillPower3309#171)
Browse files Browse the repository at this point in the history
* added check for smart

* expose gaps_to_edge

* add smart variable
  • Loading branch information
EvysGarden authored and Rehan committed Jul 12, 2023
1 parent b862e60 commit 575e0d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/sway/tree/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,6 @@ bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);

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

bool gaps_to_edge(struct sway_view *view);

#endif
8 changes: 7 additions & 1 deletion sway/desktop/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,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;

Expand Down
2 changes: 1 addition & 1 deletion sway/tree/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 575e0d4

Please sign in to comment.