create hide_edge_borders option
This commit is contained in:
committed by
Michael Stapelberg
parent
48f1e383ca
commit
f27735f620
38
src/con.c
38
src/con.c
@ -934,12 +934,32 @@ Con *con_descend_direction(Con *con, direction_t direction) {
|
||||
*
|
||||
*/
|
||||
Rect con_border_style_rect(Con *con) {
|
||||
adjacent_t adjacent_to = ADJ_NONE;
|
||||
Rect result;
|
||||
if (config.hide_edge_borders)
|
||||
adjacent_to = con_adjacent_borders(con);
|
||||
switch (con_border_style(con)) {
|
||||
case BS_NORMAL:
|
||||
return (Rect){2, 0, -(2 * 2), -2};
|
||||
result = (Rect){2, 0, -(2 * 2), -2};
|
||||
if (adjacent_to & ADJ_LEFT_SCREEN_EDGE) {
|
||||
result.x -= 2;
|
||||
result.width += 2;
|
||||
}
|
||||
if (adjacent_to & ADJ_RIGHT_SCREEN_EDGE) {
|
||||
result.width += 2;
|
||||
}
|
||||
return result;
|
||||
|
||||
case BS_1PIXEL:
|
||||
return (Rect){1, 1, -2, -2};
|
||||
result = (Rect){1, 1, -2, -2};
|
||||
if (adjacent_to & ADJ_LEFT_SCREEN_EDGE) {
|
||||
result.x -= 1;
|
||||
result.width += 1;
|
||||
}
|
||||
if (adjacent_to & ADJ_RIGHT_SCREEN_EDGE) {
|
||||
result.width += 1;
|
||||
}
|
||||
return result;
|
||||
|
||||
case BS_NONE:
|
||||
return (Rect){0, 0, 0, 0};
|
||||
@ -949,6 +969,20 @@ Rect con_border_style_rect(Con *con) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns adjacent borders of the window. We need this if hide_edge_borders is
|
||||
* enabled.
|
||||
*/
|
||||
adjacent_t con_adjacent_borders(Con *con) {
|
||||
adjacent_t result = ADJ_NONE;
|
||||
Con *output = con_get_output(con);
|
||||
if (con->rect.x == output->rect.x)
|
||||
result |= ADJ_LEFT_SCREEN_EDGE;
|
||||
if (con->rect.x + con->rect.width == output->rect.x + output->rect.width)
|
||||
result |= ADJ_RIGHT_SCREEN_EDGE;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use this function to get a container’s border style. This is important
|
||||
* because when inside a stack, the border style is always BS_NORMAL.
|
||||
|
Reference in New Issue
Block a user