mirror of
https://github.com/labwc/labwc.git
synced 2026-04-20 06:46:53 -04:00
Merge ecf7770704 into da37e97a45
This commit is contained in:
commit
c7190b0649
21 changed files with 1379 additions and 53 deletions
65
include/common/borderset.h
Normal file
65
include/common/borderset.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#include <stdint.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
|
||||
#ifndef LABWC_BORDERSET_H
|
||||
#define LABWC_BORDERSET_H
|
||||
|
||||
enum border_type {
|
||||
BORDER_NONE, BORDER_SINGLE, BORDER_DOUBLE, BORDER_INSET, BORDER_DOUBLE_INSET, BORDER_FLAT
|
||||
};
|
||||
|
||||
struct borderset {
|
||||
// Base colour, but could be used as a tracking hash for images or whatever in the future
|
||||
uint32_t id;
|
||||
// width (since I suspect a 2px border scaled up to 20px might look weird)
|
||||
int size;
|
||||
// Single or double bevel, etc.
|
||||
enum border_type type;
|
||||
// So we can disambiguate multiple possible designs cached together
|
||||
int bevelSize;
|
||||
int highlight;
|
||||
int lowlight;
|
||||
struct lab_data_buffer *top;
|
||||
struct lab_data_buffer *left;
|
||||
struct lab_data_buffer *right;
|
||||
struct lab_data_buffer *bottom;
|
||||
struct lab_data_buffer *tl;
|
||||
struct lab_data_buffer *tr;
|
||||
struct lab_data_buffer *bl;
|
||||
struct lab_data_buffer *br;
|
||||
struct borderset *next;
|
||||
};
|
||||
|
||||
struct bufferset {
|
||||
enum border_type type;
|
||||
int border_width;
|
||||
struct wlr_scene_buffer *top;
|
||||
struct wlr_scene_buffer *left;
|
||||
struct wlr_scene_buffer *right;
|
||||
struct wlr_scene_buffer *bottom;
|
||||
struct wlr_scene_buffer *tl;
|
||||
struct wlr_scene_buffer *tr;
|
||||
struct wlr_scene_buffer *bl;
|
||||
struct wlr_scene_buffer *br;
|
||||
|
||||
};
|
||||
|
||||
extern struct borderset *border_cache;
|
||||
|
||||
struct borderset *get_borders(uint32_t id, int size, enum border_type, int bevelSize,
|
||||
int highlight, int lowlight);
|
||||
|
||||
struct borderset *create_buffer(uint32_t id, int size, enum border_type, int bevelSize,
|
||||
int highlight, int lowlight);
|
||||
|
||||
struct bufferset *generate_bufferset(struct wlr_scene_tree *tree,
|
||||
struct borderset *borderset, int bw);
|
||||
|
||||
void renderBufferset(struct bufferset *bufferset, int width, int height, int y);
|
||||
|
||||
void renderBuffersetXY(struct bufferset *bufferset, int width, int height, int x, int y);
|
||||
|
||||
void clearborder_cache(struct borderset *borderset);
|
||||
|
||||
#endif /* LABWC_BORDERSET_H */
|
||||
|
|
@ -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,6 +13,10 @@ struct lab_scene_rect_options {
|
|||
float *bg_color; /* can be NULL */
|
||||
int width;
|
||||
int height;
|
||||
enum border_type border_type;
|
||||
int bevel_width;
|
||||
int highlight;
|
||||
int shadow;
|
||||
};
|
||||
|
||||
struct lab_scene_rect {
|
||||
|
|
|
|||
|
|
@ -65,4 +65,15 @@
|
|||
#define LAB_WLR_VERSION_AT_LEAST(major, minor, micro) \
|
||||
(WLR_VERSION_NUM >= (((major) << 16) | ((minor) << 8) | (micro)))
|
||||
|
||||
/**
|
||||
* PIXEL () - calculate pixel offset in an array
|
||||
*
|
||||
* @param x x-coordinate
|
||||
* @param y y-coordinate
|
||||
* @param size width of the buffer in pixes
|
||||
* Assumes "bw" was defined externally
|
||||
*/
|
||||
|
||||
#define PIXEL(x, y, size) (size * y + x)
|
||||
|
||||
#endif /* LABWC_MACROS_H */
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ struct ssd {
|
|||
struct scaled_font_buffer *title;
|
||||
struct wl_list buttons_left; /* ssd_button.link */
|
||||
struct wl_list buttons_right; /* ssd_button.link */
|
||||
struct bufferset *textured_borders;
|
||||
} subtrees[2]; /* indexed by enum ssd_active_state */
|
||||
} titlebar;
|
||||
|
||||
|
|
@ -115,6 +116,7 @@ struct ssd {
|
|||
struct ssd_border_subtree {
|
||||
struct wlr_scene_tree *tree;
|
||||
struct wlr_scene_rect *top, *bottom, *left, *right;
|
||||
struct bufferset *textured_borders;
|
||||
} subtrees[2]; /* indexed by enum ssd_active_state */
|
||||
} border;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <cairo.h>
|
||||
#include <stdbool.h>
|
||||
#include "common/node-type.h"
|
||||
#include "common/borderset.h"
|
||||
|
||||
struct lab_img;
|
||||
|
||||
|
|
@ -56,6 +57,12 @@ struct theme_background {
|
|||
float color_split_to[4];
|
||||
float color_to[4];
|
||||
float color_to_split_to[4];
|
||||
enum border_type border_type;
|
||||
int border_width;
|
||||
int bevel_width;
|
||||
int highlight;
|
||||
int shadow;
|
||||
bool exclusive;
|
||||
};
|
||||
|
||||
struct theme {
|
||||
|
|
@ -92,10 +99,21 @@ struct theme {
|
|||
|
||||
/* TODO: add toggled/hover/pressed/disabled colors for buttons */
|
||||
float button_colors[LAB_NODE_BUTTON_LAST + 1][4];
|
||||
enum border_type button_border_type;
|
||||
int button_border_width;
|
||||
int button_bevel_width;
|
||||
float button_border_color[4];
|
||||
float button_hover_border_color[4];
|
||||
int button_highlight;
|
||||
int button_shadow;
|
||||
|
||||
float border_color[4];
|
||||
float toggled_keybinds_color[4];
|
||||
float label_text_color[4];
|
||||
enum border_type border_type;
|
||||
int bevel_width;
|
||||
int highlight;
|
||||
int shadow;
|
||||
|
||||
/* window drop-shadows */
|
||||
int shadow_size;
|
||||
|
|
@ -142,6 +160,10 @@ struct theme {
|
|||
int menu_max_width;
|
||||
int menu_border_width;
|
||||
float menu_border_color[4];
|
||||
enum border_type menu_border_type;
|
||||
int menu_bevel_width;
|
||||
int menu_highlight;
|
||||
int menu_shadow;
|
||||
|
||||
int menu_items_padding_x;
|
||||
int menu_items_padding_y;
|
||||
|
|
@ -149,6 +171,18 @@ struct theme {
|
|||
float menu_items_text_color[4];
|
||||
float menu_items_active_bg_color[4];
|
||||
float menu_items_active_text_color[4];
|
||||
enum border_type menu_items_border_type;
|
||||
int menu_items_bevel_width;
|
||||
int menu_items_highlight;
|
||||
int menu_items_shadow;
|
||||
enum border_type menu_title_border_type;
|
||||
int menu_title_bevel_width;
|
||||
int menu_title_highlight;
|
||||
int menu_title_shadow;
|
||||
enum border_type menu_items_active_border_type;
|
||||
int menu_items_active_bevel_width;
|
||||
int menu_items_active_highlight;
|
||||
int menu_items_active_shadow;
|
||||
|
||||
int menu_separator_line_thickness;
|
||||
int menu_separator_padding_width;
|
||||
|
|
@ -164,6 +198,10 @@ 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;
|
||||
int osd_highlight;
|
||||
int osd_shadow;
|
||||
|
||||
struct window_switcher_classic_theme {
|
||||
int width;
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ struct view {
|
|||
int width, height;
|
||||
struct wlr_scene_tree *tree;
|
||||
struct wlr_scene_rect *border;
|
||||
struct bufferset *textured_borders;
|
||||
struct wlr_scene_rect *background;
|
||||
struct scaled_font_buffer *text;
|
||||
} resize_indicator;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue