config: add <theme><cornerRadius>

This commit is contained in:
Johan Malm 2021-03-30 22:39:52 +01:00
parent cd313fd97a
commit a5139815d6
4 changed files with 14 additions and 10 deletions

View 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>

View 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;

View 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

View file

@ -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,