From: Johan Malm Date: Tue, 30 Mar 2021 21:39:52 +0000 (+0100) Subject: config: add X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=a5139815d6fbbdec8d51aaf40ee483d53c33cebb;p=proto%2Flabwc.git config: add --- diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 72060973..525f551f 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -28,6 +28,9 @@ This section contains settings which are not present in Openbox. ** The name of the Openbox theme to use. Default is Clearlooks-3.4 +** + The radius of server side decoration top corners. Default is 8. + ** 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. ** Keybind action. See labwc-action(5) -Default if no rc.xml is found: +Default key-binds if no rc.xml is found: ``` diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 2a4d9eef..985b6530 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -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; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 72950687..96e4aa67 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -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 diff --git a/src/ssd.c b/src/ssd.c index bb59ad1d..5dc8f836 100644 --- 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,