aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-07-30 09:43:03 -0400
committerGitHub <noreply@github.com>2016-07-30 09:43:03 -0400
commite3104a48e387a91b12952089595f447f286f3fea (patch)
tree2bb69da49ca0499b938192899b7d1e4c2f16d7c5
parent3f83968d304c4295705d1cfb33ac723959519f23 (diff)
parentc33e0ee629e263bcf158df59bff01c1289d18d0a (diff)
Merge pull request #804 from thejan2009/misc-border-fix
Misc border fix
-rw-r--r--include/border.h1
-rw-r--r--sway/border.c20
-rw-r--r--sway/layout.c10
3 files changed, 22 insertions, 9 deletions
diff --git a/include/border.h b/include/border.h
index eb7fc656..b629ba46 100644
--- a/include/border.h
+++ b/include/border.h
@@ -20,5 +20,6 @@ void render_view_borders(wlc_handle view);
void update_view_border(swayc_t *view);
void map_update_view_border(swayc_t *view, void *data);
int get_font_text_height(const char *font);
+bool should_hide_top_border(swayc_t *con, double y);
#endif
diff --git a/sway/border.c b/sway/border.c
index d17d8d0c..c1a62bc6 100644
--- a/sway/border.c
+++ b/sway/border.c
@@ -332,10 +332,12 @@ void update_view_border(swayc_t *view) {
}
};
cr = create_border_buffer(view, g, &surface);
+
+ bool render_top = !should_hide_top_border(view, view->y);
if (view == focused) {
- render_borders(view, cr, &config->border_colors.focused, false);
+ render_borders(view, cr, &config->border_colors.focused, render_top);
} else {
- render_borders(view, cr, &config->border_colors.focused_inactive, false);
+ render_borders(view, cr, &config->border_colors.focused_inactive, render_top);
}
// generate container titles
@@ -418,3 +420,17 @@ void render_view_borders(wlc_handle view) {
wlc_pixels_write(WLC_RGBA8888, &c->border->geometry, c->border->buffer);
}
}
+
+bool should_hide_top_border(swayc_t *con, double y) {
+ // returns true if container is child of tabbed/stacked layout and is
+ // sharing top border with tabbed titlebar
+ swayc_t *par = con->parent;
+ while (par->type != C_WORKSPACE) {
+ if (par->layout == L_TABBED || par->layout == L_STACKED) {
+ return con->y == y;
+ }
+ con = par;
+ par = par->parent;
+ }
+ return false;
+}
diff --git a/sway/layout.c b/sway/layout.c
index db9787f3..6502d930 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -579,21 +579,17 @@ void update_geometry(swayc_t *container) {
border_left = 0;
}
- if (geometry.origin.x + geometry.size.w == size.w ||
- geometry.size.w == container->x + container->width) {
- // should work for swaybar at right
+ if (geometry.origin.x + geometry.size.w == workspace->x + workspace->width) {
border_right = 0;
}
}
if (config->hide_edge_borders == E_VERTICAL || config->hide_edge_borders == E_BOTH) {
- if (geometry.origin.y == workspace->y) {
+ if (geometry.origin.y == workspace->y || should_hide_top_border(container, geometry.origin.y)) {
border_top = 0;
}
- if (geometry.origin.y + geometry.size.h == size.h ||
- geometry.size.h == container->y + container->height) {
- // this works for swaybar at bottom
+ if (geometry.origin.y + geometry.size.h == workspace->y + workspace->height) {
border_bottom = 0;
}
}