#include "common/buf.h"
#include "config/libinput.h"
+#include "theme.h"
struct rcxml {
int font_size_activewindow;
int font_size_menuitem;
int font_size_osd;
+ /* Pointer to current theme */
+ struct theme *theme;
/* keyboard */
int repeat_rate;
#include "buffer.h"
#include <wlr/util/box.h>
-#define SSD_HEIGHT 26 /* TODO: use theme->title_height */
#define BUTTON_COUNT 4
#define BUTTON_WIDTH 26
#define EXTENDED_AREA 8
struct theme theme = { 0 };
theme_init(&theme, rc.theme_name);
+ rc.theme = &theme;
server.theme = &theme;
menu_init_rootmenu(&server);
#include "theme.h"
#include "ssd.h"
-/* TODO: use theme->title_height instead of SSD_HEIGHT */
struct border
ssd_thickness(struct view *view)
{
struct theme *theme = view->server->theme;
struct border border = {
- .top = SSD_HEIGHT,
+ .top = theme->title_height,
.bottom = theme->border_width,
.left = theme->border_width,
.right = theme->border_width,
0, height, color);
add_scene_rect(&subtree->parts, LAB_SSD_PART_TOP, parent,
full_width - 2 * BUTTON_WIDTH, theme->border_width,
- BUTTON_WIDTH, -SSD_HEIGHT, color);
+ BUTTON_WIDTH, -theme->title_height, color);
} FOR_EACH_END
}
full_width - 2 * BUTTON_WIDTH,
theme->border_width);
wlr_scene_node_set_position(part->node,
- BUTTON_WIDTH, -SSD_HEIGHT);
+ BUTTON_WIDTH, -theme->title_height);
continue;
default:
continue;
struct wl_list *part_list = &view->ssd.extents.parts;
int width = view->w;
int height = view->h;
- int full_height = height + theme->border_width + SSD_HEIGHT;
+ int full_height = height + theme->border_width + theme->title_height;
int full_width = width + 2 * theme->border_width;
int extended_area = EXTENDED_AREA;
int corner_size = extended_area + theme->border_width + BUTTON_WIDTH / 2;
wlr_scene_node_set_enabled(parent, false);
}
wl_list_init(&view->ssd.extents.parts);
- wlr_scene_node_set_position(parent,
- -(theme->border_width + extended_area), -(SSD_HEIGHT + extended_area));
+ wlr_scene_node_set_position(parent, -(theme->border_width + extended_area),
+ -(theme->title_height + extended_area));
/* Top */
add_scene_rect(part_list, LAB_SSD_PART_CORNER_TOP_LEFT, parent,
int width = view->w;
int height = view->h;
- int full_height = height + theme->border_width + SSD_HEIGHT;
+ int full_height = height + theme->border_width + theme->title_height;
int full_width = width + 2 * theme->border_width;
int extended_area = EXTENDED_AREA;
int corner_size = extended_area + theme->border_width + BUTTON_WIDTH / 2;
/* Icon */
add_scene_buffer(part_list, type, parent, icon_buffer,
(BUTTON_WIDTH - icon_buffer->width) / 2,
- (SSD_HEIGHT - icon_buffer->height) / 2);
+ (rc.theme->title_height - icon_buffer->height) / 2);
/* Hover overlay */
struct ssd_part *hover_part;
hover_part = add_scene_rect(part_list, type, parent,
- BUTTON_WIDTH, SSD_HEIGHT, 0, 0, hover_bg);
+ BUTTON_WIDTH, rc.theme->title_height, 0, 0, hover_bg);
wlr_scene_node_set_enabled(hover_part->node, false);
}
struct ssd_part *part;
/* Background */
part = add_scene_rect(part_list, type, parent,
- BUTTON_WIDTH, SSD_HEIGHT, x, 0, bg_color);
+ BUTTON_WIDTH, rc.theme->title_height, x, 0, bg_color);
finish_scene_button(part_list, type, part->node, icon_buffer);
return part;
}
FOR_EACH_STATE(view, subtree) {
subtree->tree = wlr_scene_tree_create(&view->ssd.tree->node);
parent = &subtree->tree->node;
- wlr_scene_node_set_position(parent, -theme->border_width, -SSD_HEIGHT);
+ wlr_scene_node_set_position(parent,
+ -theme->border_width, -theme->title_height);
if (subtree == &view->ssd.titlebar.active) {
color = theme->window_active_title_bg_color;
corner_top_left = &theme->corner_top_left_active_normal->base;
/* Title */
add_scene_rect(&subtree->parts, LAB_SSD_PART_TITLEBAR, parent,
- full_width - BUTTON_WIDTH * BUTTON_COUNT, SSD_HEIGHT,
+ full_width - BUTTON_WIDTH * BUTTON_COUNT, theme->title_height,
BUTTON_WIDTH, 0, color);
/* Buttons */
add_scene_button_corner(&subtree->parts, LAB_SSD_BUTTON_WINDOW_MENU,
if (width == view->ssd.state.width) {
return;
}
- int full_width = width + 2 * view->server->theme->border_width;
+ struct theme *theme = view->server->theme;
+ int full_width = width + 2 * theme->border_width;
struct ssd_part *part;
struct ssd_sub_tree *subtree;
switch (part->type) {
case LAB_SSD_PART_TITLEBAR:
wlr_scene_rect_set_size(lab_wlr_scene_get_rect(part->node),
- full_width - BUTTON_WIDTH * BUTTON_COUNT, SSD_HEIGHT);
+ full_width - BUTTON_WIDTH * BUTTON_COUNT,
+ theme->title_height);
continue;
case LAB_SSD_BUTTON_ICONIFY:
if (is_direct_child(part->node, subtree)) {
}
x = 0;
- y = (SSD_HEIGHT - part->buffer->base.height) / 2;
+ y = (theme->title_height - part->buffer->base.height) / 2;
rect = lab_wlr_scene_get_rect(part->node->parent);
if (rect->width <= 0) {
wlr_scene_node_set_position(part->node, x, y);
.x = 0,
.y = 0,
.width = BUTTON_WIDTH,
- .height = SSD_HEIGHT,
+ .height = theme->title_height,
};
struct rounded_corner_ctx ctx = {