Skip to content

Commit ec6a40a

Browse files
fix: acrylic effect
1 parent 287ab3c commit ec6a40a

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/shell/config.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ struct config {
4848
float scrollbar_radius = 3;
4949
float hotkey_padding = 4;
5050

51-
std::string acrylic_color_light = "#fefefe00";
52-
std::string acrylic_color_dark = "#28282800";
51+
std::string acrylic_color_light = "#fefefebb";
52+
std::string acrylic_color_dark = "#282828bb";
5353

54-
bool use_self_drawn_border = true;
5554
// These values are used when use_self_drawn_border is true
5655
paint_color border_color_light =
5756
paint_color::from_string("#00000022");
@@ -72,7 +71,7 @@ struct config {
7271
// unused, only for backward compatibility
7372
float acrylic_opacity = 0.1;
7473
bool use_dwm_if_available = true;
75-
74+
bool use_self_drawn_border = true;
7675
struct animation {
7776
struct main {
7877
animated_float_conf y;

src/shell/widgets/background_widget.cc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ void background_widget::render(ui::nanovg_context ctx) {
7979
auto &theme = config::current->context_menu.theme;
8080
bool light = is_light_mode();
8181

82-
bool use_self_drawn_border = theme.use_self_drawn_border;
83-
84-
float boarder_width = use_self_drawn_border ? theme.border_width : 0.0f;
85-
if (use_self_drawn_border) {
82+
float border_width = theme.border_width;
83+
// Draw shadow and border
84+
{
8685
float shadow_size = theme.shadow_size,
8786
shadow_offset_x = theme.shadow_offset_x,
8887
shadow_offset_y = theme.shadow_offset_y;
@@ -107,13 +106,13 @@ void background_widget::render(ui::nanovg_context ctx) {
107106

108107
ctx.beginPath();
109108
if (theme.inset_border) {
110-
ctx.roundedRect(*x + boarder_width / 2, *y + boarder_width / 2,
111-
*width - boarder_width, *height - boarder_width,
109+
ctx.roundedRect(*x + border_width / 2, *y + border_width / 2,
110+
*width - border_width, *height - border_width,
112111
corner_radius);
113112
} else {
114113
ctx.roundedRect(*x, *y, *width, *height, corner_radius);
115114
}
116-
ctx.strokeWidth(boarder_width);
115+
ctx.strokeWidth(border_width);
117116
auto border_color =
118117
light ? theme.border_color_light : theme.border_color_dark;
119118
border_color.apply_to_ctx(ctx, *x, *y, *width, *height);
@@ -125,9 +124,9 @@ void background_widget::render(ui::nanovg_context ctx) {
125124
auto cl = nvgRGBAf(0, 0, 0, 1 - *opacity / 255.f);
126125
ctx.fillColor(cl);
127126
if (theme.inset_border)
128-
ctx.fillRoundedRect(*x + boarder_width, *y + boarder_width,
129-
*width - boarder_width * 2,
130-
*height - boarder_width * 2, *radius);
127+
ctx.fillRoundedRect(*x + border_width, *y + border_width,
128+
*width - border_width * 2,
129+
*height - border_width * 2, *radius);
131130
else
132131
ctx.fillRoundedRect(*x, *y, *width, *height, *radius);
133132
}

0 commit comments

Comments
 (0)