]> git.mdlowis.com Git - proto/labwc.git/commitdiff
theme: compensate the hover corner radius with padding
authorJens Peters <jp7677@gmail.com>
Wed, 11 Sep 2024 15:52:26 +0000 (17:52 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 11 Sep 2024 20:22:06 +0000 (21:22 +0100)
When padding.width is set, the corner radius of the rectangle
hover effect can be smaller since there is more space available.

src/theme.c

index 431b653ef9ea2d579c50d35d66a772c555f191b7..ab43a2e3953e760c6e62ddd5da079b26e3c80560 100644 (file)
@@ -167,6 +167,7 @@ create_hover_fallback(struct theme *theme, const char *icon_name,
        float overlay_color[4] = { 0.15f, 0.15f, 0.15f, 0.3f};
        int radius = MIN(width, height) / 2;
        enum corner corner = corner_from_icon_name(icon_name);
+       int corner_radius = MAX(rc.corner_radius - theme->padding_width, 0);
 
        switch (theme->window_button_hover_bg_shape) {
        case LAB_CIRCLE:
@@ -182,7 +183,7 @@ create_hover_fallback(struct theme *theme, const char *icon_name,
                } else {
                        struct rounded_corner_ctx rounded_ctx = {
                                .box = &(struct wlr_box){.width = width, .height = height},
-                               .radius = rc.corner_radius,
+                               .radius = corner_radius,
                                .line_width = theme->border_width,
                                .fill_color = overlay_color,
                                .border_color = overlay_color,