Fix toplevel borders (#171)

* added check for smart

* expose gaps_to_edge

* add smart variable
This commit is contained in:
Evy Garden 2023-07-07 05:11:21 +02:00 committed by GitHub
parent ab8106add4
commit 061dfaa2e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -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); void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
bool gaps_to_edge(struct sway_view *view);
#endif #endif

View file

@ -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.y = state.y - output->ly;
clip_box.width = state.width; clip_box.width = state.width;
clip_box.height = state.height; 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 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.x += state.border_thickness;
clip_box.width -= state.border_thickness * 2; clip_box.width -= state.border_thickness * 2;

View file

@ -233,7 +233,7 @@ static bool view_is_only_visible(struct sway_view *view) {
return true; 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; struct side_gaps gaps = view->container->pending.workspace->current_gaps;
return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0; return gaps.top > 0 || gaps.right > 0 || gaps.bottom > 0 || gaps.left > 0;
} }