mirror of
https://github.com/labwc/labwc.git
synced 2026-04-07 08:21:20 -04:00
Add osd.border.type and osd.border.bevel-width options
This commit is contained in:
parent
773996f1ee
commit
362c3e1b47
9 changed files with 35 additions and 10 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef LABWC_LAB_SCENE_RECT_H
|
||||
#define LABWC_LAB_SCENE_RECT_H
|
||||
#include <wayland-server-core.h>
|
||||
#include "common/borderset.h"
|
||||
|
||||
struct wlr_scene_tree;
|
||||
|
||||
|
|
@ -12,7 +13,8 @@ struct lab_scene_rect_options {
|
|||
float *bg_color; /* can be NULL */
|
||||
int width;
|
||||
int height;
|
||||
bool beveled;
|
||||
enum border_type border_type;
|
||||
int bevel_width;
|
||||
};
|
||||
|
||||
struct lab_scene_rect {
|
||||
|
|
|
|||
|
|
@ -169,6 +169,8 @@ struct theme {
|
|||
float osd_bg_color[4];
|
||||
float osd_border_color[4];
|
||||
float osd_label_text_color[4];
|
||||
enum border_type osd_border_type;
|
||||
int osd_border_bevel_width;
|
||||
|
||||
struct window_switcher_classic_theme {
|
||||
int width;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "common/scene-helpers.h"
|
||||
#include "common/macros.h"
|
||||
#include "common/borderset.h"
|
||||
#include "theme.h"
|
||||
#include "buffer.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -48,14 +49,14 @@ lab_scene_rect_create(struct wlr_scene_tree *parent,
|
|||
border->bottom = lab_wlr_scene_rect_create(border->tree, 0, 0, color);
|
||||
border->left = lab_wlr_scene_rect_create(border->tree, 0, 0, color);
|
||||
|
||||
if (opts->beveled) {
|
||||
if (opts->border_type) {
|
||||
float r = color[0];
|
||||
float g = color[1];
|
||||
float b = color[2];
|
||||
float a = color[3];
|
||||
int bw = rect->border_width;
|
||||
uint32_t colour32 = (uint32_t)(a*255) << 24 | (uint32_t)(r*255) << 16 | (uint32_t)(g*255) << 8 | (uint32_t)(b*255);
|
||||
struct borderset * renderedborders = getBorders(colour32, bw, BORDER_SINGLE, 0);
|
||||
struct borderset * renderedborders = getBorders(colour32, bw, opts->border_type, opts->bevel_width);
|
||||
border->texturedBorders = generateBufferset(border->tree, renderedborders, bw);
|
||||
} else {
|
||||
border->texturedBorders = NULL;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ update_preview_outlines(struct view *view)
|
|||
},
|
||||
.nr_borders = 3,
|
||||
.border_width = theme->osd_window_switcher_preview_border_width,
|
||||
.beveled = true,
|
||||
.border_type = theme->osd_border_type,
|
||||
.bevel_width = theme->osd_border_bevel_width
|
||||
};
|
||||
rect = lab_scene_rect_create(&server.scene->tree, &opts);
|
||||
wlr_scene_node_place_above(&rect->tree->node,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ cycle_osd_classic_init(struct cycle_osd_output *osd_output)
|
|||
.bg_color = bg_color,
|
||||
.width = w,
|
||||
.height = h,
|
||||
.beveled = true,
|
||||
.border_type = theme->osd_border_type,
|
||||
.bevel_width = theme->osd_border_bevel_width
|
||||
};
|
||||
lab_scene_rect_create(osd_output->tree, &bg_opts);
|
||||
|
||||
|
|
@ -203,7 +204,8 @@ cycle_osd_classic_init(struct cycle_osd_output *osd_output)
|
|||
.bg_color = active_bg_color,
|
||||
.width = w - 2 * padding,
|
||||
.height = switcher_theme->item_height,
|
||||
.beveled = 1,
|
||||
.border_type = theme->osd_border_type,
|
||||
.bevel_width = theme->osd_border_bevel_width
|
||||
};
|
||||
struct lab_scene_rect *highlight_rect = lab_scene_rect_create(
|
||||
item->active_tree, &highlight_opts);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
#include <wlr/types/wlr_scene.h>
|
||||
#include "common/lab-scene-rect.h"
|
||||
#include "common/scene-helpers.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "labwc.h"
|
||||
#include "theme.h"
|
||||
#include "cycle.h"
|
||||
#include "output.h"
|
||||
|
||||
|
|
@ -12,6 +14,9 @@ cycle_osd_scroll_init(struct cycle_osd_output *osd_output, struct wlr_box bar_ar
|
|||
int delta_y, int nr_cols, int nr_rows, int nr_visible_rows,
|
||||
float *border_color, float *bg_color)
|
||||
{
|
||||
|
||||
struct theme *theme = rc.theme;
|
||||
|
||||
if (nr_visible_rows >= nr_rows) {
|
||||
/* OSD doesn't have so many windows to scroll through */
|
||||
return;
|
||||
|
|
@ -35,7 +40,8 @@ cycle_osd_scroll_init(struct cycle_osd_output *osd_output, struct wlr_box bar_ar
|
|||
.bg_color = bg_color,
|
||||
.width = bar_area.width,
|
||||
.height = bar_area.height * nr_visible_rows / nr_rows,
|
||||
.beveled = true,
|
||||
.border_type = theme->osd_border_type,
|
||||
.bevel_width = theme->osd_border_bevel_width
|
||||
};
|
||||
scroll->bar = lab_scene_rect_create(scroll->bar_tree, &scrollbar_opts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,8 @@ create_item_scene(struct wlr_scene_tree *parent, struct view *view,
|
|||
.bg_color = switcher_theme->item_active_bg_color,
|
||||
.width = switcher_theme->item_width,
|
||||
.height = switcher_theme->item_height,
|
||||
.beveled = true,
|
||||
.border_type = theme->osd_border_type,
|
||||
.bevel_width = theme->osd_border_bevel_width
|
||||
};
|
||||
item->active_bg = lab_scene_rect_create(tree, &opts);
|
||||
|
||||
|
|
@ -283,7 +284,8 @@ cycle_osd_thumbnail_init(struct cycle_osd_output *osd_output)
|
|||
.bg_color = theme->osd_bg_color,
|
||||
.width = items_width + 2 * padding,
|
||||
.height = items_height + 2 * padding,
|
||||
.beveled = true,
|
||||
.border_type = theme->osd_border_type,
|
||||
.bevel_width = theme->osd_border_bevel_width
|
||||
};
|
||||
struct lab_scene_rect *bg =
|
||||
lab_scene_rect_create(osd_output->tree, &bg_opts);
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ menu_create_scene(struct menu *menu)
|
|||
.border_width = theme->menu_border_width,
|
||||
.width = menu->size.width,
|
||||
.height = menu->size.height,
|
||||
.beveled = true,
|
||||
//.beveled = true,
|
||||
};
|
||||
struct lab_scene_rect *bg_rect =
|
||||
lab_scene_rect_create(menu->scene_tree, &opts);
|
||||
|
|
|
|||
|
|
@ -651,6 +651,8 @@ theme_builtin(struct theme *theme)
|
|||
theme->osd_border_width = INT_MIN;
|
||||
theme->osd_border_color[0] = FLT_MIN;
|
||||
theme->osd_label_text_color[0] = FLT_MIN;
|
||||
theme->osd_border_type = BORDER_FLAT;
|
||||
theme->osd_border_bevel_width = 0;
|
||||
|
||||
if (wlr_renderer_is_pixman(server.renderer)) {
|
||||
/* Draw only outlined overlay by default to save CPU resource */
|
||||
|
|
@ -1003,6 +1005,13 @@ entry(struct theme *theme, const char *key, const char *value)
|
|||
if (match_glob(key, "osd.border.color")) {
|
||||
parse_color(value, theme->osd_border_color);
|
||||
}
|
||||
|
||||
if (match_glob(key, "osd.border.type")) {
|
||||
theme->osd_border_type = parse_border_type(value);
|
||||
}
|
||||
if (match_glob(key, "osd.border.bevel-width")) {
|
||||
theme->osd_border_bevel_width = get_int_if_positive(value, "osd.border.bevel-width");
|
||||
}
|
||||
/* classic window switcher */
|
||||
if (match_glob(key, "osd.window-switcher.style-classic.width")
|
||||
|| match_glob(key, "osd.window-switcher.width")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue