theme: move title_height to theme struct

title_height is a derived variable which needs both config and theme
variables (font height and title padding). The code is tidier calling
post_processing() for this from theme_init()
This commit is contained in:
Johan Malm 2021-04-15 20:13:49 +01:00
parent 85c775c3b1
commit 2f5a44d34d
5 changed files with 46 additions and 36 deletions

View file

@ -12,7 +12,6 @@
#include <wayland-server-core.h>
#include "common/dir.h"
#include "common/font.h"
#include "common/log.h"
#include "common/nodename.h"
#include "common/string-helpers.h"
@ -236,15 +235,6 @@ bind(const char *binding, const char *action, const char *command)
}
}
static void
set_title_height(void)
{
char buf[256];
snprintf(buf, sizeof(buf), "%s %d", rc.font_name_activewindow,
rc.font_size_activewindow);
rc.title_height = font_height(buf);
}
static void
post_processing(void)
{
@ -261,10 +251,6 @@ post_processing(void)
if (!rc.font_name_activewindow) {
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