Gate beveled borders behind border.beveled theme option

This commit is contained in:
Jack Zeal 2026-03-23 22:14:28 -07:00
parent 12803b1aca
commit 4ff1832eb3
3 changed files with 226 additions and 186 deletions

View file

@ -60,6 +60,7 @@ struct theme_background {
struct theme { struct theme {
int border_width; int border_width;
bool beveled_border;
/* /*
* the space between title bar border and * the space between title bar border and

View file

@ -37,6 +37,22 @@ ssd_border_create(struct ssd *ssd)
wlr_scene_node_set_enabled(&parent->node, active); wlr_scene_node_set_enabled(&parent->node, active);
float *color = theme->window[active].border_color; float *color = theme->window[active].border_color;
subtree->left = lab_wlr_scene_rect_create(parent,
theme->border_width, height, color);
subtree->right = lab_wlr_scene_rect_create(parent,
theme->border_width, height, color);
subtree->bottom = lab_wlr_scene_rect_create(parent,
full_width, theme->border_width, color);
subtree->top = lab_wlr_scene_rect_create(parent,
MAX(width - 2 * corner_width, 0), theme->border_width, color);
if (theme->beveled_border) {
/* From Pull request 3382 */ /* From Pull request 3382 */
uint8_t r = color[0] * 255; uint8_t r = color[0] * 255;
uint8_t g = color[1] * 255; uint8_t g = color[1] * 255;
@ -133,19 +149,6 @@ ssd_border_create(struct ssd *ssd)
right_data[theme->border_width - 2] = bottom_data[theme->border_width - 2] = col0; right_data[theme->border_width - 2] = bottom_data[theme->border_width - 2] = col0;
subtree->left = lab_wlr_scene_rect_create(parent,
theme->border_width, height, color);
subtree->right = lab_wlr_scene_rect_create(parent,
theme->border_width, height, color);
subtree->bottom = lab_wlr_scene_rect_create(parent,
full_width, theme->border_width, color);
subtree->top = lab_wlr_scene_rect_create(parent,
MAX(width - 2 * corner_width, 0), theme->border_width, color);
struct lab_data_buffer *ttexture_buffer = struct lab_data_buffer *ttexture_buffer =
buffer_create_from_data(top_data, 1,theme->border_width, buffer_create_from_data(top_data, 1,theme->border_width,
4); 4);
@ -163,6 +166,7 @@ ssd_border_create(struct ssd *ssd)
4*theme->border_width); 4*theme->border_width);
subtree->ltexture = wlr_scene_buffer_create(parent, &ltexture_buffer->base); subtree->ltexture = wlr_scene_buffer_create(parent, &ltexture_buffer->base);
wlr_buffer_drop(&ltexture_buffer->base); wlr_buffer_drop(&ltexture_buffer->base);
struct lab_data_buffer *rtexture_buffer = struct lab_data_buffer *rtexture_buffer =
buffer_create_from_data(right_data, theme->border_width, 1, buffer_create_from_data(right_data, theme->border_width, 1,
4*theme->border_width); 4*theme->border_width);
@ -194,6 +198,21 @@ ssd_border_create(struct ssd *ssd)
4*theme->border_width); 4*theme->border_width);
subtree->brcorner = wlr_scene_buffer_create(parent, &brtexture_buffer->base); subtree->brcorner = wlr_scene_buffer_create(parent, &brtexture_buffer->base);
wlr_buffer_drop(&brtexture_buffer->base); wlr_buffer_drop(&brtexture_buffer->base);
}
if (!theme->beveled_border) {
wlr_scene_node_set_position(&subtree->left->node, 0, 0);
wlr_scene_node_set_position(&subtree->right->node,
theme->border_width + width, 0);
wlr_scene_node_set_position(&subtree->bottom->node,
0, height);
wlr_scene_node_set_position(&subtree->top->node,
theme->border_width + corner_width,
-(ssd->titlebar.height + theme->border_width));
}
} }
@ -278,6 +297,8 @@ ssd_border_update(struct ssd *ssd)
FOR_EACH_ACTIVE_STATE(active) { FOR_EACH_ACTIVE_STATE(active) {
struct ssd_border_subtree *subtree = &ssd->border.subtrees[active]; struct ssd_border_subtree *subtree = &ssd->border.subtrees[active];
if (theme->beveled_border) {
wlr_scene_buffer_set_dest_size(subtree->ttexture, wlr_scene_buffer_set_dest_size(subtree->ttexture,
full_width, theme->border_width); full_width, theme->border_width);
wlr_scene_node_set_position(&subtree->ttexture->node, wlr_scene_node_set_position(&subtree->ttexture->node,
@ -319,10 +340,24 @@ ssd_border_update(struct ssd *ssd)
theme->border_width, theme->border_width); theme->border_width, theme->border_width);
wlr_scene_node_set_position(&subtree->blcorner->node, wlr_scene_node_set_position(&subtree->blcorner->node,
0, height); 0, height);
} else {
wlr_scene_rect_set_size(subtree->left,
theme->border_width, side_height);
wlr_scene_node_set_position(&subtree->left->node,
0, side_y);
wlr_scene_rect_set_size(subtree->right,
theme->border_width, side_height);
wlr_scene_node_set_position(&subtree->right->node,
theme->border_width + width, side_y);
wlr_scene_rect_set_size(subtree->bottom,
full_width, theme->border_width);
wlr_scene_node_set_position(&subtree->bottom->node,
0, height);
wlr_scene_rect_set_size(subtree->top,
top_width, theme->border_width);
wlr_scene_node_set_position(&subtree->top->node,
top_x, -(ssd->titlebar.height + theme->border_width));
}
} }
} }

View file

@ -532,6 +532,7 @@ static void
theme_builtin(struct theme *theme) theme_builtin(struct theme *theme)
{ {
theme->border_width = 1; theme->border_width = 1;
theme->beveled_border = FALSE;
theme->window_titlebar_padding_height = 0; theme->window_titlebar_padding_height = 0;
theme->window_titlebar_padding_width = 0; theme->window_titlebar_padding_width = 0;
@ -695,6 +696,9 @@ entry(struct theme *theme, const char *key, const char *value)
theme->border_width = get_int_if_positive( theme->border_width = get_int_if_positive(
value, "border.width"); value, "border.width");
} }
if (match_glob(key, "border.beveled")) {
set_bool(value, &theme->beveled_border);
}
if (match_glob(key, "window.titlebar.padding.width")) { if (match_glob(key, "window.titlebar.padding.width")) {
theme->window_titlebar_padding_width = get_int_if_positive( theme->window_titlebar_padding_width = get_int_if_positive(
value, "window.titlebar.padding.width"); value, "window.titlebar.padding.width");