void x_draw_decoration(Con *con) {
Con *parent = con->parent;
bool leaf = con_is_leaf(con);
- adjacent_t adjacent_to = ADJ_NONE;
- if (config.hide_edge_borders)
- adjacent_to = con_adjacent_borders(con);
+
/* This code needs to run for:
* • leaf containers
* • non-leaf containers which are in a stacked/tabbed container
*
* It does not need to run for:
+ * • direct children of outputs
* • floating containers (they don’t have a decoration)
*/
if ((!leaf &&
parent->layout != L_STACKED &&
parent->layout != L_TABBED) ||
+ parent->type == CT_OUTPUT ||
con->type == CT_FLOATING_CON)
return;
/* 3: draw a rectangle in border color around the client */
if (p->border_style != BS_NONE && p->con_is_leaf) {
+ /* We might hide some borders adjacent to the screen-edge */
+ adjacent_t borders_to_hide = ADJ_NONE;
+ borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders;
+
Rect br = con_border_style_rect(con);
#if 0
DLOG("con->rect spans %d x %d\n", con->rect.width, con->rect.height);
* rectangle because some childs are not freely resizable and we want
* their background color to "shine through". */
xcb_change_gc(conn, con->pm_gc, XCB_GC_FOREGROUND, (uint32_t[]){ p->color->background });
- if (!(adjacent_to & ADJ_LEFT_SCREEN_EDGE)) {
+ if (!(borders_to_hide & ADJ_LEFT_SCREEN_EDGE)) {
xcb_rectangle_t leftline = { 0, 0, br.x, r->height };
xcb_poly_fill_rectangle(conn, con->pixmap, con->pm_gc, 1, &leftline);
}
- if (!(adjacent_to & ADJ_RIGHT_SCREEN_EDGE)) {
+ if (!(borders_to_hide & ADJ_RIGHT_SCREEN_EDGE)) {
xcb_rectangle_t rightline = { r->width + br.width + br.x, 0, r->width, r->height };
xcb_poly_fill_rectangle(conn, con->pixmap, con->pm_gc, 1, &rightline);
}
- xcb_rectangle_t bottomline = { 0, r->height + br.height + br.y, r->width, r->height };
- xcb_poly_fill_rectangle(conn, con->pixmap, con->pm_gc, 1, &bottomline);
+ if (!(borders_to_hide & ADJ_LOWER_SCREEN_EDGE)) {
+ xcb_rectangle_t bottomline = { 0, r->height + br.height + br.y, r->width, r->height };
+ xcb_poly_fill_rectangle(conn, con->pixmap, con->pm_gc, 1, &bottomline);
+ }
/* 1pixel border needs an additional line at the top */
- if (p->border_style == BS_1PIXEL) {
+ if (p->border_style == BS_1PIXEL && !(borders_to_hide & ADJ_UPPER_SCREEN_EDGE)) {
xcb_rectangle_t topline = { br.x, 0, con->rect.width + br.width + br.x, br.y };
xcb_poly_fill_rectangle(conn, con->pixmap, con->pm_gc, 1, &topline);
}