Skip to content

Instantly share code, notes, and snippets.

@betaboon
Created December 4, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaboon/b48dcee52c92c4b083806c28a9a294a2 to your computer and use it in GitHub Desktop.
Save betaboon/b48dcee52c92c4b083806c28a9a294a2 to your computer and use it in GitHub Desktop.
diff --git a/src/con.c b/src/con.c
index 21d2f097..702ad101 100644
--- a/src/con.c
+++ b/src/con.c
@@ -1721,6 +1721,12 @@ int con_border_style(Con *con) {
return BS_NONE;
}
+ if (config.hide_edge_borders == HEBM_SMART && con_num_windows(con_get_workspace(con)) <= 1) {
+ DLOG("this is a lonely window! overriding BS_NONE\n");
+ if (!con_is_floating(con))
+ return BS_NONE;
+ }
+
if (con->parent->layout == L_STACKED)
return (con_num_children(con->parent) == 1 ? con->border_style : BS_NORMAL);
diff --git a/src/handlers.c b/src/handlers.c
index b9677917..36d7f310 100644
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -323,7 +323,7 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
/* we actually need to apply the size/position changes to the *parent*
* container */
Rect bsr = con_border_style_rect(con);
- if (con->border_style == BS_NORMAL) {
+ if (con_border_style(con) == BS_NORMAL) {
bsr.y += deco_height;
bsr.height -= deco_height;
}
@@ -1301,7 +1301,7 @@ static bool handle_motif_hints_change(void *data, xcb_connection_t *conn, uint8_
border_style_t motif_border_style;
window_update_motif_hints(con->window, prop, &motif_border_style);
- if (motif_border_style != con->border_style && motif_border_style != BS_NORMAL) {
+ if (motif_border_style != con_border_style(con) && motif_border_style != BS_NORMAL) {
DLOG("Update border style of con %p to %d\n", con, motif_border_style);
con_set_border_style(con, motif_border_style, con->current_border_width);
diff --git a/src/render.c b/src/render.c
index d8bffc61..cff27b05 100644
--- a/src/render.c
+++ b/src/render.c
@@ -394,7 +394,7 @@ static void render_con_split(Con *con, Con *child, render_params *p, int i) {
/* first we have the decoration, if this is a leaf node */
if (con_is_leaf(child)) {
- if (child->border_style == BS_NORMAL) {
+ if (con_border_style(child) == BS_NORMAL) {
/* TODO: make a function for relative coords? */
child->deco_rect.x = child->rect.x - con->rect.x;
child->deco_rect.y = child->rect.y - con->rect.y;
@@ -426,7 +426,7 @@ static void render_con_stacked(Con *con, Con *child, render_params *p, int i) {
child->deco_rect.width = child->rect.width;
child->deco_rect.height = p->deco_height;
- if (p->children > 1 || (child->border_style != BS_PIXEL && child->border_style != BS_NONE)) {
+ if (p->children > 1 || (con_border_style(child) != BS_PIXEL && con_border_style(child) != BS_NONE)) {
child->rect.y += (p->deco_height * p->children);
child->rect.height -= (p->deco_height * p->children);
}
@@ -450,12 +450,12 @@ static void render_con_tabbed(Con *con, Con *child, render_params *p, int i) {
child->deco_rect.width += (child->rect.width - (child->deco_rect.x + child->deco_rect.width));
}
- if (p->children > 1 || (child->border_style != BS_PIXEL && child->border_style != BS_NONE)) {
+ if (p->children > 1 || (con_border_style(child) != BS_PIXEL && con_border_style(child) != BS_NONE)) {
child->rect.y += p->deco_height;
child->rect.height -= p->deco_height;
child->deco_rect.height = p->deco_height;
} else {
- child->deco_rect.height = (child->border_style == BS_PIXEL ? 1 : 0);
+ child->deco_rect.height = (con_border_style(child) == BS_PIXEL ? 1 : 0);
}
}
diff --git a/src/x.c b/src/x.c
index 5b54d145..028d4f0e 100644
--- a/src/x.c
+++ b/src/x.c
@@ -807,7 +807,7 @@ void x_push_node(Con *con) {
/* The pixmap of a borderless leaf container will not be used except
* for the titlebar in a stack or tabs (issue #1013). */
- bool is_pixmap_needed = (con->border_style != BS_NONE ||
+ bool is_pixmap_needed = (con_border_style(con) != BS_NONE ||
!con_is_leaf(con) ||
con->parent->layout == L_STACKED ||
con->parent->layout == L_TABBED);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment