mirror of
https://github.com/labwc/labwc.git
synced 2026-03-24 09:06:09 -04:00
Merge pull request #2189 from johanmalm/window-button-height
Titlebar related breaking changes
This commit is contained in:
commit
1f1ac27bf5
8 changed files with 87 additions and 71 deletions
|
|
@ -50,20 +50,14 @@ labwc-config(5).
|
||||||
Line width (integer) of border drawn around window frames.
|
Line width (integer) of border drawn around window frames.
|
||||||
Default is 1.
|
Default is 1.
|
||||||
|
|
||||||
*padding.width*
|
*window.titlebar.padding.width*
|
||||||
Horizontal padding size, in pixels, between border and first
|
Horizontal titlebar padding size, in pixels, between border and first
|
||||||
button on the left/right.
|
button on the left/right.
|
||||||
Default is 0.
|
Default is 0.
|
||||||
|
|
||||||
*padding.height*
|
*window.titlebar.padding.height*
|
||||||
Vertical padding size, in pixels, used for spacing out elements
|
Vertical titlebar padding size, in pixels.
|
||||||
in the window decorations.
|
Default is 0.
|
||||||
Default is 3.
|
|
||||||
|
|
||||||
*titlebar.height*
|
|
||||||
Window title bar height.
|
|
||||||
Default equals the vertical font extents of the title plus 2x
|
|
||||||
padding.height.
|
|
||||||
|
|
||||||
*menu.items.padding.x*
|
*menu.items.padding.x*
|
||||||
Horizontal padding of menu text entries in pixels.
|
Horizontal padding of menu text entries in pixels.
|
||||||
|
|
|
||||||
11
docs/themerc
11
docs/themerc
|
|
@ -7,12 +7,13 @@
|
||||||
|
|
||||||
# general
|
# general
|
||||||
border.width: 1
|
border.width: 1
|
||||||
padding.width: 0
|
|
||||||
padding.height: 3
|
|
||||||
|
|
||||||
# The following options has no default, but fallbacks back to
|
#
|
||||||
# font-height + 2x padding.height if not set.
|
# We do not support the global padding.{width,height} of openbox because
|
||||||
# titlebar.height:
|
# the default labwc button geometry has deviates from that of openbox
|
||||||
|
#
|
||||||
|
window.titlebar.padding.width: 0
|
||||||
|
window.titlebar.padding.height: 0
|
||||||
|
|
||||||
# window border
|
# window border
|
||||||
window.active.border.color: #e1dedb
|
window.active.border.color: #e1dedb
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ struct ssd_part *add_scene_buffer(
|
||||||
struct wlr_scene_tree *parent, struct wlr_buffer *buffer, int x, int y);
|
struct wlr_scene_tree *parent, struct wlr_buffer *buffer, int x, int y);
|
||||||
struct ssd_part *add_scene_button(struct wl_list *part_list,
|
struct ssd_part *add_scene_button(struct wl_list *part_list,
|
||||||
enum ssd_part_type type, struct wlr_scene_tree *parent,
|
enum ssd_part_type type, struct wlr_scene_tree *parent,
|
||||||
struct lab_data_buffer *buffers[LAB_BS_ALL + 1], int x,
|
struct lab_data_buffer *buffers[LAB_BS_ALL + 1], int x, int y,
|
||||||
struct view *view);
|
struct view *view);
|
||||||
void update_window_icon_buffer(struct wlr_scene_node *button_node,
|
void update_window_icon_buffer(struct wlr_scene_node *button_node,
|
||||||
struct lab_data_buffer *buffer);
|
struct lab_data_buffer *buffer);
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ struct theme {
|
||||||
* the space between title bar border and
|
* the space between title bar border and
|
||||||
* buttons on the left/right/top
|
* buttons on the left/right/top
|
||||||
*/
|
*/
|
||||||
int padding_width;
|
int window_titlebar_padding_width;
|
||||||
int padding_height;
|
int window_titlebar_padding_height;
|
||||||
|
|
||||||
int title_height;
|
int title_height;
|
||||||
int menu_overlap_x;
|
int menu_overlap_x;
|
||||||
|
|
@ -67,10 +67,11 @@ struct theme {
|
||||||
enum lab_justification window_label_text_justify;
|
enum lab_justification window_label_text_justify;
|
||||||
enum lab_justification menu_title_text_justify;
|
enum lab_justification menu_title_text_justify;
|
||||||
|
|
||||||
/* button width */
|
/* buttons */
|
||||||
int window_button_width;
|
int window_button_width;
|
||||||
/* the space between buttons */
|
int window_button_height;
|
||||||
int window_button_spacing;
|
int window_button_spacing;
|
||||||
|
|
||||||
/* the shape of the hover effect */
|
/* the shape of the hover effect */
|
||||||
enum lab_shape window_button_hover_bg_shape;
|
enum lab_shape window_button_hover_bg_shape;
|
||||||
|
|
||||||
|
|
@ -155,7 +156,10 @@ struct theme {
|
||||||
struct lab_data_buffer *shadow_corner_bottom_inactive;
|
struct lab_data_buffer *shadow_corner_bottom_inactive;
|
||||||
struct lab_data_buffer *shadow_edge_inactive;
|
struct lab_data_buffer *shadow_edge_inactive;
|
||||||
|
|
||||||
/* not set in rc.xml/themerc, but derived from font & padding_height */
|
/*
|
||||||
|
* Not set in rc.xml/themerc, but derived from the tallest titlebar
|
||||||
|
* object plus 2 * window_titlebar_padding_height
|
||||||
|
*/
|
||||||
int osd_window_switcher_item_height;
|
int osd_window_switcher_item_height;
|
||||||
|
|
||||||
/* magnifier */
|
/* magnifier */
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ update_window_icon_buffer(struct wlr_scene_node *button_node,
|
||||||
|
|
||||||
struct wlr_box icon_geo = get_scale_box(buffer,
|
struct wlr_box icon_geo = get_scale_box(buffer,
|
||||||
rc.theme->window_button_width,
|
rc.theme->window_button_width,
|
||||||
rc.theme->title_height);
|
rc.theme->window_button_height);
|
||||||
|
|
||||||
wlr_scene_buffer_set_buffer(scene_buffer, &buffer->base);
|
wlr_scene_buffer_set_buffer(scene_buffer, &buffer->base);
|
||||||
wlr_scene_buffer_set_dest_size(scene_buffer,
|
wlr_scene_buffer_set_dest_size(scene_buffer,
|
||||||
|
|
@ -109,17 +109,17 @@ struct ssd_part *
|
||||||
add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
|
add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
|
||||||
struct wlr_scene_tree *parent,
|
struct wlr_scene_tree *parent,
|
||||||
struct lab_data_buffer *buffers[LAB_BS_ALL + 1],
|
struct lab_data_buffer *buffers[LAB_BS_ALL + 1],
|
||||||
int x, struct view *view)
|
int x, int y, struct view *view)
|
||||||
{
|
{
|
||||||
struct ssd_part *button_root = add_scene_part(part_list, type);
|
struct ssd_part *button_root = add_scene_part(part_list, type);
|
||||||
parent = wlr_scene_tree_create(parent);
|
parent = wlr_scene_tree_create(parent);
|
||||||
button_root->node = &parent->node;
|
button_root->node = &parent->node;
|
||||||
wlr_scene_node_set_position(button_root->node, x, 0);
|
wlr_scene_node_set_position(button_root->node, x, y);
|
||||||
|
|
||||||
/* Hitbox */
|
/* Hitbox */
|
||||||
float invisible[4] = { 0, 0, 0, 0 };
|
float invisible[4] = { 0, 0, 0, 0 };
|
||||||
add_scene_rect(part_list, type, parent,
|
add_scene_rect(part_list, type, parent,
|
||||||
rc.theme->window_button_width, rc.theme->title_height, 0, 0,
|
rc.theme->window_button_width, rc.theme->window_button_height, 0, 0,
|
||||||
invisible);
|
invisible);
|
||||||
|
|
||||||
/* Icons */
|
/* Icons */
|
||||||
|
|
@ -130,7 +130,7 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
|
||||||
}
|
}
|
||||||
struct lab_data_buffer *icon_buffer = buffers[state_set];
|
struct lab_data_buffer *icon_buffer = buffers[state_set];
|
||||||
struct wlr_box icon_geo = get_scale_box(icon_buffer,
|
struct wlr_box icon_geo = get_scale_box(icon_buffer,
|
||||||
rc.theme->window_button_width, rc.theme->title_height);
|
rc.theme->window_button_width, rc.theme->window_button_height);
|
||||||
struct ssd_part *icon_part = add_scene_buffer(part_list, type,
|
struct ssd_part *icon_part = add_scene_buffer(part_list, type,
|
||||||
parent, &icon_buffer->base, icon_geo.x, icon_geo.y);
|
parent, &icon_buffer->base, icon_geo.x, icon_geo.y);
|
||||||
/* Make sure big icons are scaled down if necessary */
|
/* Make sure big icons are scaled down if necessary */
|
||||||
|
|
|
||||||
|
|
@ -74,22 +74,26 @@ ssd_titlebar_create(struct ssd *ssd)
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
struct title_button *b;
|
struct title_button *b;
|
||||||
int x = theme->padding_width;
|
int x = theme->window_titlebar_padding_width;
|
||||||
|
|
||||||
|
/* Center vertically within titlebar */
|
||||||
|
int y = (theme->title_height - theme->window_button_height) / 2;
|
||||||
|
|
||||||
wl_list_for_each(b, &rc.title_buttons_left, link) {
|
wl_list_for_each(b, &rc.title_buttons_left, link) {
|
||||||
struct lab_data_buffer **buffers =
|
struct lab_data_buffer **buffers =
|
||||||
theme->window[active].buttons[b->type];
|
theme->window[active].buttons[b->type];
|
||||||
add_scene_button(&subtree->parts, b->type, parent,
|
add_scene_button(&subtree->parts, b->type, parent,
|
||||||
buffers, x, view);
|
buffers, x, y, view);
|
||||||
x += theme->window_button_width + theme->window_button_spacing;
|
x += theme->window_button_width + theme->window_button_spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = width - theme->padding_width + theme->window_button_spacing;
|
x = width - theme->window_titlebar_padding_width + theme->window_button_spacing;
|
||||||
wl_list_for_each_reverse(b, &rc.title_buttons_right, link) {
|
wl_list_for_each_reverse(b, &rc.title_buttons_right, link) {
|
||||||
x -= theme->window_button_width + theme->window_button_spacing;
|
x -= theme->window_button_width + theme->window_button_spacing;
|
||||||
struct lab_data_buffer **buffers =
|
struct lab_data_buffer **buffers =
|
||||||
theme->window[active].buttons[b->type];
|
theme->window[active].buttons[b->type];
|
||||||
add_scene_button(&subtree->parts, b->type, parent,
|
add_scene_button(&subtree->parts, b->type, parent,
|
||||||
buffers, x, view);
|
buffers, x, y, view);
|
||||||
}
|
}
|
||||||
} FOR_EACH_END
|
} FOR_EACH_END
|
||||||
|
|
||||||
|
|
@ -207,7 +211,7 @@ static void
|
||||||
update_visible_buttons(struct ssd *ssd)
|
update_visible_buttons(struct ssd *ssd)
|
||||||
{
|
{
|
||||||
struct view *view = ssd->view;
|
struct view *view = ssd->view;
|
||||||
int width = view->current.width - (2 * view->server->theme->padding_width);
|
int width = view->current.width - (2 * view->server->theme->window_titlebar_padding_width);
|
||||||
int button_width = view->server->theme->window_button_width;
|
int button_width = view->server->theme->window_button_width;
|
||||||
int button_spacing = view->server->theme->window_button_spacing;
|
int button_spacing = view->server->theme->window_button_spacing;
|
||||||
int button_count_left = wl_list_length(&rc.title_buttons_left);
|
int button_count_left = wl_list_length(&rc.title_buttons_left);
|
||||||
|
|
@ -293,6 +297,8 @@ ssd_titlebar_update(struct ssd *ssd)
|
||||||
|
|
||||||
update_visible_buttons(ssd);
|
update_visible_buttons(ssd);
|
||||||
|
|
||||||
|
/* Center buttons vertically within titlebar */
|
||||||
|
int y = (theme->title_height - theme->window_button_height) / 2;
|
||||||
int x;
|
int x;
|
||||||
struct ssd_part *part;
|
struct ssd_part *part;
|
||||||
struct ssd_sub_tree *subtree;
|
struct ssd_sub_tree *subtree;
|
||||||
|
|
@ -304,10 +310,10 @@ ssd_titlebar_update(struct ssd *ssd)
|
||||||
wlr_scene_rect_from_node(part->node),
|
wlr_scene_rect_from_node(part->node),
|
||||||
width - bg_offset * 2, theme->title_height);
|
width - bg_offset * 2, theme->title_height);
|
||||||
|
|
||||||
x = theme->padding_width;
|
x = theme->window_titlebar_padding_width;
|
||||||
wl_list_for_each(b, &rc.title_buttons_left, link) {
|
wl_list_for_each(b, &rc.title_buttons_left, link) {
|
||||||
part = ssd_get_part(&subtree->parts, b->type);
|
part = ssd_get_part(&subtree->parts, b->type);
|
||||||
wlr_scene_node_set_position(part->node, x, 0);
|
wlr_scene_node_set_position(part->node, x, y);
|
||||||
x += theme->window_button_width + theme->window_button_spacing;
|
x += theme->window_button_width + theme->window_button_spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -315,11 +321,11 @@ ssd_titlebar_update(struct ssd *ssd)
|
||||||
part = ssd_get_part(&subtree->parts, LAB_SSD_PART_TITLEBAR_CORNER_RIGHT);
|
part = ssd_get_part(&subtree->parts, LAB_SSD_PART_TITLEBAR_CORNER_RIGHT);
|
||||||
wlr_scene_node_set_position(part->node, x, -rc.theme->border_width);
|
wlr_scene_node_set_position(part->node, x, -rc.theme->border_width);
|
||||||
|
|
||||||
x = width - theme->padding_width + theme->window_button_spacing;
|
x = width - theme->window_titlebar_padding_width + theme->window_button_spacing;
|
||||||
wl_list_for_each_reverse(b, &rc.title_buttons_right, link) {
|
wl_list_for_each_reverse(b, &rc.title_buttons_right, link) {
|
||||||
part = ssd_get_part(&subtree->parts, b->type);
|
part = ssd_get_part(&subtree->parts, b->type);
|
||||||
x -= theme->window_button_width + theme->window_button_spacing;
|
x -= theme->window_button_width + theme->window_button_spacing;
|
||||||
wlr_scene_node_set_position(part->node, x, 0);
|
wlr_scene_node_set_position(part->node, x, y);
|
||||||
}
|
}
|
||||||
} FOR_EACH_END
|
} FOR_EACH_END
|
||||||
|
|
||||||
|
|
@ -426,7 +432,7 @@ get_title_offsets(struct ssd *ssd, int *offset_left, int *offset_right)
|
||||||
struct ssd_sub_tree *subtree = &ssd->titlebar.active;
|
struct ssd_sub_tree *subtree = &ssd->titlebar.active;
|
||||||
int button_width = ssd->view->server->theme->window_button_width;
|
int button_width = ssd->view->server->theme->window_button_width;
|
||||||
int button_spacing = ssd->view->server->theme->window_button_spacing;
|
int button_spacing = ssd->view->server->theme->window_button_spacing;
|
||||||
int padding_width = ssd->view->server->theme->padding_width;
|
int padding_width = ssd->view->server->theme->window_titlebar_padding_width;
|
||||||
*offset_left = padding_width;
|
*offset_left = padding_width;
|
||||||
*offset_right = padding_width;
|
*offset_right = padding_width;
|
||||||
|
|
||||||
|
|
@ -603,7 +609,7 @@ ssd_update_window_icon(struct ssd *ssd)
|
||||||
*/
|
*/
|
||||||
int hpad = theme->window_button_width / 10;
|
int hpad = theme->window_button_width / 10;
|
||||||
int icon_size = MIN(theme->window_button_width - 2 * hpad,
|
int icon_size = MIN(theme->window_button_width - 2 * hpad,
|
||||||
theme->title_height - 2 * theme->padding_height);
|
theme->window_button_height);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load/render icons at the max scale of any usable output (at
|
* Load/render icons at the max scale of any usable output (at
|
||||||
|
|
|
||||||
75
src/theme.c
75
src/theme.c
|
|
@ -91,7 +91,7 @@ copy_icon_buffer(struct theme *theme, struct lab_data_buffer *icon_buffer)
|
||||||
int icon_height = cairo_image_surface_get_height(icon.surface);
|
int icon_height = cairo_image_surface_get_height(icon.surface);
|
||||||
|
|
||||||
int width = theme->window_button_width;
|
int width = theme->window_button_width;
|
||||||
int height = theme->title_height;
|
int height = theme->window_button_height;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Proportionately increase size of hover_buffer if the non-hover
|
* Proportionately increase size of hover_buffer if the non-hover
|
||||||
|
|
@ -139,7 +139,7 @@ create_hover_fallback(struct theme *theme,
|
||||||
assert(!*hover_buffer);
|
assert(!*hover_buffer);
|
||||||
|
|
||||||
int width = theme->window_button_width;
|
int width = theme->window_button_width;
|
||||||
int height = theme->title_height;
|
int height = theme->window_button_height;
|
||||||
|
|
||||||
*hover_buffer = copy_icon_buffer(theme, icon_buffer);
|
*hover_buffer = copy_icon_buffer(theme, icon_buffer);
|
||||||
cairo_t *cairo = (*hover_buffer)->cairo;
|
cairo_t *cairo = (*hover_buffer)->cairo;
|
||||||
|
|
@ -171,17 +171,19 @@ create_rounded_buffer(struct theme *theme, enum corner corner,
|
||||||
cairo_t *cairo = (*rounded_buffer)->cairo;
|
cairo_t *cairo = (*rounded_buffer)->cairo;
|
||||||
|
|
||||||
int width = theme->window_button_width;
|
int width = theme->window_button_width;
|
||||||
int height = theme->title_height;
|
int height = theme->window_button_height;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Round the hover overlay of corner buttons by
|
* Round the corner button by cropping the region within the window
|
||||||
* cropping the region within the window border.
|
* border. See the picture in #2189 for reference.
|
||||||
*/
|
*/
|
||||||
|
int margin_x = theme->window_titlebar_padding_width;
|
||||||
|
int margin_y = (theme->title_height - theme->window_button_height) / 2;
|
||||||
float white[4] = {1, 1, 1, 1};
|
float white[4] = {1, 1, 1, 1};
|
||||||
struct rounded_corner_ctx rounded_ctx = {
|
struct rounded_corner_ctx rounded_ctx = {
|
||||||
.box = &(struct wlr_box){
|
.box = &(struct wlr_box){
|
||||||
.width = theme->padding_width + width,
|
.width = margin_x + width,
|
||||||
.height = height,
|
.height = margin_y + height,
|
||||||
},
|
},
|
||||||
.radius = rc.corner_radius,
|
.radius = rc.corner_radius,
|
||||||
.line_width = theme->border_width,
|
.line_width = theme->border_width,
|
||||||
|
|
@ -189,16 +191,11 @@ create_rounded_buffer(struct theme *theme, enum corner corner,
|
||||||
.border_color = white,
|
.border_color = white,
|
||||||
.corner = corner,
|
.corner = corner,
|
||||||
};
|
};
|
||||||
int mask_offset;
|
|
||||||
if (corner == LAB_CORNER_TOP_LEFT) {
|
|
||||||
mask_offset = -theme->padding_width;
|
|
||||||
} else {
|
|
||||||
mask_offset = 0;
|
|
||||||
}
|
|
||||||
struct lab_data_buffer *mask_buffer = rounded_rect(&rounded_ctx);
|
struct lab_data_buffer *mask_buffer = rounded_rect(&rounded_ctx);
|
||||||
cairo_set_operator(cairo, CAIRO_OPERATOR_DEST_IN);
|
cairo_set_operator(cairo, CAIRO_OPERATOR_DEST_IN);
|
||||||
cairo_set_source_surface(cairo,
|
cairo_set_source_surface(cairo, cairo_get_target(mask_buffer->cairo),
|
||||||
cairo_get_target(mask_buffer->cairo), mask_offset, 0);
|
(corner == LAB_CORNER_TOP_LEFT) ? -margin_x : 0,
|
||||||
|
-margin_y);
|
||||||
cairo_paint(cairo);
|
cairo_paint(cairo);
|
||||||
|
|
||||||
cairo_surface_flush(cairo_get_target(cairo));
|
cairo_surface_flush(cairo_get_target(cairo));
|
||||||
|
|
@ -246,7 +243,7 @@ load_button(struct theme *theme, struct button *b, int active)
|
||||||
|
|
||||||
zdrop(buffer);
|
zdrop(buffer);
|
||||||
|
|
||||||
int size = theme->title_height - 2 * theme->padding_height;
|
int size = theme->window_button_height;
|
||||||
float scale = 1; /* TODO: account for output scale */
|
float scale = 1; /* TODO: account for output scale */
|
||||||
|
|
||||||
/* PNG */
|
/* PNG */
|
||||||
|
|
@ -573,7 +570,8 @@ static void
|
||||||
theme_builtin(struct theme *theme, struct server *server)
|
theme_builtin(struct theme *theme, struct server *server)
|
||||||
{
|
{
|
||||||
theme->border_width = 1;
|
theme->border_width = 1;
|
||||||
theme->padding_height = 3;
|
theme->window_titlebar_padding_height = 0;
|
||||||
|
theme->window_titlebar_padding_width = 0;
|
||||||
theme->title_height = INT_MIN;
|
theme->title_height = INT_MIN;
|
||||||
theme->menu_overlap_x = 0;
|
theme->menu_overlap_x = 0;
|
||||||
theme->menu_overlap_y = 0;
|
theme->menu_overlap_y = 0;
|
||||||
|
|
@ -591,8 +589,8 @@ theme_builtin(struct theme *theme, struct server *server)
|
||||||
theme->window_label_text_justify = parse_justification("Center");
|
theme->window_label_text_justify = parse_justification("Center");
|
||||||
theme->menu_title_text_justify = parse_justification("Center");
|
theme->menu_title_text_justify = parse_justification("Center");
|
||||||
|
|
||||||
theme->padding_width = 0;
|
|
||||||
theme->window_button_width = 26;
|
theme->window_button_width = 26;
|
||||||
|
theme->window_button_height = 26;
|
||||||
theme->window_button_spacing = 0;
|
theme->window_button_spacing = 0;
|
||||||
theme->window_button_hover_bg_shape = LAB_RECTANGLE;
|
theme->window_button_hover_bg_shape = LAB_RECTANGLE;
|
||||||
|
|
||||||
|
|
@ -706,17 +704,13 @@ entry(struct theme *theme, const char *key, const char *value)
|
||||||
theme->border_width = get_int_if_positive(
|
theme->border_width = get_int_if_positive(
|
||||||
value, "border.width");
|
value, "border.width");
|
||||||
}
|
}
|
||||||
if (match_glob(key, "padding.width")) {
|
if (match_glob(key, "window.titlebar.padding.width")) {
|
||||||
theme->padding_width = get_int_if_positive(
|
theme->window_titlebar_padding_width = get_int_if_positive(
|
||||||
value, "padding.width");
|
value, "window.titlebar.padding.width");
|
||||||
}
|
}
|
||||||
if (match_glob(key, "padding.height")) {
|
if (match_glob(key, "window.titlebar.padding.height")) {
|
||||||
theme->padding_height = get_int_if_positive(
|
theme->window_titlebar_padding_height = get_int_if_positive(
|
||||||
value, "padding.height");
|
value, "window.titlebar.padding.height");
|
||||||
}
|
|
||||||
if (match_glob(key, "titlebar.height")) {
|
|
||||||
theme->title_height = get_int_if_positive(
|
|
||||||
value, "titlebar.height");
|
|
||||||
}
|
}
|
||||||
if (match_glob(key, "menu.items.padding.x")) {
|
if (match_glob(key, "menu.items.padding.x")) {
|
||||||
theme->menu_item_padding_x = get_int_if_positive(
|
theme->menu_item_padding_x = get_int_if_positive(
|
||||||
|
|
@ -779,6 +773,14 @@ entry(struct theme *theme, const char *key, const char *value)
|
||||||
theme->window_button_width = 1;
|
theme->window_button_width = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (match_glob(key, "window.button.height")) {
|
||||||
|
theme->window_button_height = atoi(value);
|
||||||
|
if (theme->window_button_height < 1) {
|
||||||
|
wlr_log(WLR_ERROR, "window.button.height cannot "
|
||||||
|
"be less than 1, clamping it to 1.");
|
||||||
|
theme->window_button_height = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (match_glob(key, "window.button.spacing")) {
|
if (match_glob(key, "window.button.spacing")) {
|
||||||
theme->window_button_spacing = get_int_if_positive(
|
theme->window_button_spacing = get_int_if_positive(
|
||||||
value, "window.button.spacing");
|
value, "window.button.spacing");
|
||||||
|
|
@ -1461,13 +1463,22 @@ fill_colors_with_osd_theme(struct theme *theme, float colors[3][4])
|
||||||
memcpy(colors[2], theme->osd_bg_color, sizeof(colors[2]));
|
memcpy(colors[2], theme->osd_bg_color, sizeof(colors[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
get_titlebar_height(struct theme *theme)
|
||||||
|
{
|
||||||
|
int h = MAX(font_height(&rc.font_activewindow),
|
||||||
|
font_height(&rc.font_inactivewindow));
|
||||||
|
if (h < theme->window_button_height) {
|
||||||
|
h = theme->window_button_height;
|
||||||
|
}
|
||||||
|
h += 2 * theme->window_titlebar_padding_height;
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
post_processing(struct theme *theme)
|
post_processing(struct theme *theme)
|
||||||
{
|
{
|
||||||
int h = MAX(font_height(&rc.font_activewindow), font_height(&rc.font_inactivewindow));
|
theme->title_height = get_titlebar_height(theme);
|
||||||
if (theme->title_height < h) {
|
|
||||||
theme->title_height = h + 2 * theme->padding_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
theme->menu_item_height = font_height(&rc.font_menuitem)
|
theme->menu_item_height = font_height(&rc.font_menuitem)
|
||||||
+ 2 * theme->menu_item_padding_y;
|
+ 2 * theme->menu_item_padding_y;
|
||||||
|
|
|
||||||
|
|
@ -2284,7 +2284,7 @@ view_get_min_width(void)
|
||||||
return (rc.theme->window_button_width * (button_count_left + button_count_right)) +
|
return (rc.theme->window_button_width * (button_count_left + button_count_right)) +
|
||||||
(rc.theme->window_button_spacing * MAX((button_count_right - 1), 0)) +
|
(rc.theme->window_button_spacing * MAX((button_count_right - 1), 0)) +
|
||||||
(rc.theme->window_button_spacing * MAX((button_count_left - 1), 0)) +
|
(rc.theme->window_button_spacing * MAX((button_count_left - 1), 0)) +
|
||||||
(2 * rc.theme->padding_width);
|
(2 * rc.theme->window_titlebar_padding_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue