#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"
}
}
-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)
{
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
{
struct theme *theme = view->server->theme;
struct border border = {
- .top = rc.title_height + theme->border_width,
+ .top = theme->title_height + theme->border_width,
.bottom = theme->border_width,
.left = theme->border_width,
.right = theme->border_width,
{
struct theme *theme = view->server->theme;
struct wlr_box box = { 0 };
- int corner_square = rc.title_height + theme->border_width;
+ int corner_square = theme->title_height + theme->border_width;
assert(view);
switch (type) {
case LAB_SSD_BUTTON_CLOSE:
- box.x = view->x + view->w - rc.title_height;
- box.y = view->y - rc.title_height;
- box.width = rc.title_height;
- box.height = rc.title_height;
+ box.x = view->x + view->w - theme->title_height;
+ box.y = view->y - theme->title_height;
+ box.width = theme->title_height;
+ box.height = theme->title_height;
break;
case LAB_SSD_BUTTON_MAXIMIZE:
- box.x = view->x + view->w - rc.title_height * 2;
- box.y = view->y - rc.title_height;
- box.width = rc.title_height;
- box.height = rc.title_height;
+ box.x = view->x + view->w - theme->title_height * 2;
+ box.y = view->y - theme->title_height;
+ box.width = theme->title_height;
+ box.height = theme->title_height;
break;
case LAB_SSD_BUTTON_ICONIFY:
- box.x = view->x + view->w - rc.title_height * 3;
- box.y = view->y - rc.title_height;
- box.width = rc.title_height;
- box.height = rc.title_height;
+ box.x = view->x + view->w - theme->title_height * 3;
+ box.y = view->y - theme->title_height;
+ box.width = theme->title_height;
+ box.height = theme->title_height;
break;
case LAB_SSD_PART_TITLE:
- box.x = view->x + rc.title_height;
- box.y = view->y - rc.title_height;
- box.width = view->w - 2 * rc.title_height;
- box.height = rc.title_height;
+ box.x = view->x + theme->title_height;
+ box.y = view->y - theme->title_height;
+ box.width = view->w - 2 * theme->title_height;
+ box.height = theme->title_height;
break;
case LAB_SSD_PART_TOP:
- box.x = view->x + rc.title_height;
+ box.x = view->x + theme->title_height;
box.y = view->y - corner_square;
- box.width = view->w - 2 * rc.title_height;
+ box.width = view->w - 2 * theme->title_height;
box.height = theme->border_width;
break;
case LAB_SSD_PART_RIGHT:
box.height = corner_square;
break;
case LAB_SSD_PART_CORNER_TOP_RIGHT:
- box.x = view->x + view->w - rc.title_height;
+ box.x = view->x + view->w - theme->title_height;
box.y = view->y - corner_square;
box.width = corner_square;
box.height = corner_square;
#include <string.h>
#include "common/dir.h"
+#include "common/font.h"
#include "common/log.h"
#include "common/string-helpers.h"
#include "common/zfree.h"
+#include "config/rcxml.h"
#include "theme.h"
#include "xbm/xbm.h"
void theme_builtin(struct theme *theme)
{
theme->border_width = 1;
+ theme->padding_height = 3;
parse_hexstr("#dddad6", theme->window_active_border_color);
parse_hexstr("#f6f5f4", theme->window_inactive_border_color);
if (match(key, "border.width")) {
theme->border_width = atoi(value);
}
+ if (match(key, "padding.height")) {
+ theme->padding_height = atoi(value);
+ }
if (match(key, "window.active.border.color")) {
parse_hexstr(value, theme->window_active_border_color);
fclose(stream);
}
+static void
+post_processing(struct theme *theme)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "%s %d", rc.font_name_activewindow,
+ rc.font_size_activewindow);
+ theme->title_height = font_height(buf) + 2 * theme->padding_height;
+
+ if (rc.corner_radius >= theme->title_height) {
+ theme->title_height = rc.corner_radius + 1;
+ }
+
+}
+
void
theme_init(struct theme *theme, struct wlr_renderer *renderer,
const char *theme_name)
{
theme_read(theme, theme_name);
xbm_load(theme, renderer);
+ post_processing(theme);
}
void