diff --git a/include/common/lab-scene-rect.h b/include/common/lab-scene-rect.h index ebf243c7..9bab96b2 100644 --- a/include/common/lab-scene-rect.h +++ b/include/common/lab-scene-rect.h @@ -2,6 +2,7 @@ #ifndef LABWC_LAB_SCENE_RECT_H #define LABWC_LAB_SCENE_RECT_H #include +#include "common/borderset.h" struct wlr_scene_tree; @@ -12,7 +13,8 @@ struct lab_scene_rect_options { float *bg_color; /* can be NULL */ int width; int height; - bool beveled; + enum border_type border_type; + int bevel_width; }; struct lab_scene_rect { diff --git a/include/theme.h b/include/theme.h index 1ab6e323..df487aa5 100644 --- a/include/theme.h +++ b/include/theme.h @@ -169,6 +169,8 @@ struct theme { float osd_bg_color[4]; float osd_border_color[4]; float osd_label_text_color[4]; + enum border_type osd_border_type; + int osd_border_bevel_width; struct window_switcher_classic_theme { int width; diff --git a/src/common/lab-scene-rect.c b/src/common/lab-scene-rect.c index 4b45eeec..a5107e42 100644 --- a/src/common/lab-scene-rect.c +++ b/src/common/lab-scene-rect.c @@ -6,6 +6,7 @@ #include "common/scene-helpers.h" #include "common/macros.h" #include "common/borderset.h" +#include "theme.h" #include "buffer.h" #include @@ -48,14 +49,14 @@ lab_scene_rect_create(struct wlr_scene_tree *parent, border->bottom = lab_wlr_scene_rect_create(border->tree, 0, 0, color); border->left = lab_wlr_scene_rect_create(border->tree, 0, 0, color); - if (opts->beveled) { + if (opts->border_type) { float r = color[0]; float g = color[1]; float b = color[2]; float a = color[3]; int bw = rect->border_width; uint32_t colour32 = (uint32_t)(a*255) << 24 | (uint32_t)(r*255) << 16 | (uint32_t)(g*255) << 8 | (uint32_t)(b*255); - struct borderset * renderedborders = getBorders(colour32, bw, BORDER_SINGLE, 0); + struct borderset * renderedborders = getBorders(colour32, bw, opts->border_type, opts->bevel_width); border->texturedBorders = generateBufferset(border->tree, renderedborders, bw); } else { border->texturedBorders = NULL; diff --git a/src/cycle/cycle.c b/src/cycle/cycle.c index 28978792..0c3643f9 100644 --- a/src/cycle/cycle.c +++ b/src/cycle/cycle.c @@ -37,7 +37,8 @@ update_preview_outlines(struct view *view) }, .nr_borders = 3, .border_width = theme->osd_window_switcher_preview_border_width, - .beveled = true, + .border_type = theme->osd_border_type, + .bevel_width = theme->osd_border_bevel_width }; rect = lab_scene_rect_create(&server.scene->tree, &opts); wlr_scene_node_place_above(&rect->tree->node, diff --git a/src/cycle/osd-classic.c b/src/cycle/osd-classic.c index 074de8f8..28590de7 100644 --- a/src/cycle/osd-classic.c +++ b/src/cycle/osd-classic.c @@ -120,7 +120,8 @@ cycle_osd_classic_init(struct cycle_osd_output *osd_output) .bg_color = bg_color, .width = w, .height = h, - .beveled = true, + .border_type = theme->osd_border_type, + .bevel_width = theme->osd_border_bevel_width }; lab_scene_rect_create(osd_output->tree, &bg_opts); @@ -203,7 +204,8 @@ cycle_osd_classic_init(struct cycle_osd_output *osd_output) .bg_color = active_bg_color, .width = w - 2 * padding, .height = switcher_theme->item_height, - .beveled = 1, + .border_type = theme->osd_border_type, + .bevel_width = theme->osd_border_bevel_width }; struct lab_scene_rect *highlight_rect = lab_scene_rect_create( item->active_tree, &highlight_opts); diff --git a/src/cycle/osd-scroll.c b/src/cycle/osd-scroll.c index b8b579a2..e51428be 100644 --- a/src/cycle/osd-scroll.c +++ b/src/cycle/osd-scroll.c @@ -3,7 +3,9 @@ #include #include "common/lab-scene-rect.h" #include "common/scene-helpers.h" +#include "config/rcxml.h" #include "labwc.h" +#include "theme.h" #include "cycle.h" #include "output.h" @@ -12,6 +14,9 @@ cycle_osd_scroll_init(struct cycle_osd_output *osd_output, struct wlr_box bar_ar int delta_y, int nr_cols, int nr_rows, int nr_visible_rows, float *border_color, float *bg_color) { + + struct theme *theme = rc.theme; + if (nr_visible_rows >= nr_rows) { /* OSD doesn't have so many windows to scroll through */ return; @@ -35,7 +40,8 @@ cycle_osd_scroll_init(struct cycle_osd_output *osd_output, struct wlr_box bar_ar .bg_color = bg_color, .width = bar_area.width, .height = bar_area.height * nr_visible_rows / nr_rows, - .beveled = true, + .border_type = theme->osd_border_type, + .bevel_width = theme->osd_border_bevel_width }; scroll->bar = lab_scene_rect_create(scroll->bar_tree, &scrollbar_opts); } diff --git a/src/cycle/osd-thumbnail.c b/src/cycle/osd-thumbnail.c index 1e7ca8e2..8dfd530f 100644 --- a/src/cycle/osd-thumbnail.c +++ b/src/cycle/osd-thumbnail.c @@ -150,7 +150,8 @@ create_item_scene(struct wlr_scene_tree *parent, struct view *view, .bg_color = switcher_theme->item_active_bg_color, .width = switcher_theme->item_width, .height = switcher_theme->item_height, - .beveled = true, + .border_type = theme->osd_border_type, + .bevel_width = theme->osd_border_bevel_width }; item->active_bg = lab_scene_rect_create(tree, &opts); @@ -283,7 +284,8 @@ cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output) .bg_color = theme->osd_bg_color, .width = items_width + 2 * padding, .height = items_height + 2 * padding, - .beveled = true, + .border_type = theme->osd_border_type, + .bevel_width = theme->osd_border_bevel_width }; struct lab_scene_rect *bg = lab_scene_rect_create(osd_output->tree, &bg_opts); diff --git a/src/menu/menu.c b/src/menu/menu.c index 056294a0..d94f69d4 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -504,7 +504,7 @@ menu_create_scene(struct menu *menu) .border_width = theme->menu_border_width, .width = menu->size.width, .height = menu->size.height, - .beveled = true, + //.beveled = true, }; struct lab_scene_rect *bg_rect = lab_scene_rect_create(menu->scene_tree, &opts); diff --git a/src/theme.c b/src/theme.c index 9e517a2d..857cfed8 100644 --- a/src/theme.c +++ b/src/theme.c @@ -651,6 +651,8 @@ theme_builtin(struct theme *theme) theme->osd_border_width = INT_MIN; theme->osd_border_color[0] = FLT_MIN; theme->osd_label_text_color[0] = FLT_MIN; + theme->osd_border_type = BORDER_FLAT; + theme->osd_border_bevel_width = 0; if (wlr_renderer_is_pixman(server.renderer)) { /* Draw only outlined overlay by default to save CPU resource */ @@ -1003,6 +1005,13 @@ entry(struct theme *theme, const char *key, const char *value) if (match_glob(key, "osd.border.color")) { parse_color(value, theme->osd_border_color); } + + if (match_glob(key, "osd.border.type")) { + theme->osd_border_type = parse_border_type(value); + } + if (match_glob(key, "osd.border.bevel-width")) { + theme->osd_border_bevel_width = get_int_if_positive(value, "osd.border.bevel-width"); + } /* classic window switcher */ if (match_glob(key, "osd.window-switcher.style-classic.width") || match_glob(key, "osd.window-switcher.width")) {