]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: add <theme><cornerRadius>
authorJohan Malm <jgm323@gmail.com>
Tue, 30 Mar 2021 21:39:52 +0000 (22:39 +0100)
committerJohan Malm <jgm323@gmail.com>
Tue, 30 Mar 2021 21:39:52 +0000 (22:39 +0100)
docs/labwc-config.5.scd
include/config/rcxml.h
src/config/rcxml.c
src/ssd.c

index 72060973469cf47eba3ef0dde914599b3b46f310..525f551f9e6214685c25d9128f35255176a6ee7d 100644 (file)
@@ -28,6 +28,9 @@ This section contains settings which are not present in Openbox.
 *<theme><name>*
        The name of the Openbox theme to use. Default is Clearlooks-3.4
 
+*<theme><cornerRadius>*
+       The radius of server side decoration top corners. Default is 8.
+
 *<theme><font place="">*
        The font to use for a specific element of a window, menu or OSD.
        Place can be any of:
@@ -50,7 +53,7 @@ This section contains settings which are not present in Openbox.
 *<keyboard><keybind key=""><action name="">*
        Keybind action. See labwc-action(5)
 
-Default if no rc.xml is found:
+Default key-binds if no rc.xml is found:
 
 ```
 <keyboard>
index 2a4d9eef58f25f4048fdd6879d469e580292a6e9..985b6530c204a2e82e62400e63e601253837b31a 100644 (file)
@@ -10,6 +10,7 @@
 struct rcxml {
        bool xdg_shell_server_side_deco;
        char *theme_name;
+       int corner_radius;
        char *font_name_activewindow;
        int font_size_activewindow;
        struct wl_list keybinds;
index 7295068714e3e691533060dacb6aa8c484bb4987..96e4aa67280be0b2f4c61dde94050e60166ef539 100644 (file)
@@ -141,6 +141,8 @@ entry(xmlNode *node, char *nodename, char *content)
                rc.xdg_shell_server_side_deco = get_bool(content);
        } else if (!strcmp(nodename, "name.theme")) {
                rc.theme_name = strdup(content);
+       } else if (!strcmp(nodename, "cornerradius.theme")) {
+               rc.corner_radius = atoi(content);
        } else if (!strcmp(nodename, "name.font.theme")) {
                fill_font(nodename, content, font_place);
        } else if (!strcmp(nodename, "size.font.theme")) {
@@ -208,13 +210,6 @@ rcxml_parse_xml(struct buf *b)
        xmlCleanupParser();
 }
 
-static void
-pre_processing(void)
-{
-       rc.xdg_shell_server_side_deco = true;
-       rc.font_size_activewindow = 10;
-}
-
 static void
 rcxml_init()
 {
@@ -226,7 +221,9 @@ rcxml_init()
        has_run = true;
        LIBXML_TEST_VERSION
        wl_list_init(&rc.keybinds);
-       pre_processing();
+       rc.xdg_shell_server_side_deco = true;
+       rc.corner_radius = 8;
+       rc.font_size_activewindow = 10;
 }
 
 static void
@@ -273,6 +270,9 @@ post_processing(void)
                rc.font_name_activewindow = strdup("sans");
        }
        set_title_height();
+       if (rc.corner_radius >= rc.title_height) {
+               rc.corner_radius = rc.title_height - 1;
+       }
 }
 
 static void
index bb59ad1dbfd4e6e79876655880910c1f9ca72ee8..5dc8f836c3cf213a5dc480ad29061c914b8a94fa 100644 (file)
--- a/src/ssd.c
+++ b/src/ssd.c
@@ -272,7 +272,7 @@ ssd_create(struct view *view)
        part->box = ssd_box(view, part->type);
        struct rounded_corner_ctx ctx = {
                .box = &part->box,
-               .radius = 7.0, /* TODO: get from config */
+               .radius = rc.corner_radius,
                .line_width = theme->border_width,
                .fill_color = theme->window_active_title_bg_color,
                .border_color = theme->window_active_handle_bg_color,