mirror of
https://github.com/labwc/labwc.git
synced 2026-02-20 01:40:22 -05:00
overlay: allow to draw both/either of filled/outlined rectangle
Filled/outlined rectangles shown as snapping overlay are now enabled/disabled independently with `snapping.overlay.[region|edge].bg.enabled` and `snapping.overlay.[region|edge].border.enabled`. To keep the default behavior, `*.bg.enabled` is yes and `*.border.enabled` is no for hardware-based renderers, while `*.bg.enabled` is no and `*.border.enabled` is yes for software-based (pixman) renderer. Users can now use a filled rectangle as an overlay even with pixman renderer. However, this may severely impact performance when used with translucent `snapping.overlay.[region|edge].bg.color`. This commit includes a refactor to use substruct `theme_snapping_overlay` inside `theme` in order to pass it to `create_overlay_rect()` in a cleaner way. Breaking changes is: - `snapping.overlay.[region|edge].fill` is now removed.
This commit is contained in:
parent
34290ef629
commit
b0ba585ff8
9 changed files with 160 additions and 122 deletions
|
|
@ -8,14 +8,13 @@
|
|||
#include "view.h"
|
||||
|
||||
struct overlay_rect {
|
||||
struct wlr_scene_node *node;
|
||||
bool fill;
|
||||
union {
|
||||
/* if fill is true */
|
||||
struct wlr_scene_rect *scene_rect;
|
||||
/* if fill is false */
|
||||
struct multi_rect *pixman_rect;
|
||||
};
|
||||
struct wlr_scene_tree *tree;
|
||||
|
||||
bool bg_enabled;
|
||||
struct wlr_scene_rect *bg_rect;
|
||||
|
||||
bool border_enabled;
|
||||
struct multi_rect *border_rect;
|
||||
};
|
||||
|
||||
struct overlay {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@ enum lab_justification {
|
|||
LAB_JUSTIFY_RIGHT,
|
||||
};
|
||||
|
||||
struct theme_snapping_overlay {
|
||||
bool bg_enabled;
|
||||
bool border_enabled;
|
||||
float bg_color[4];
|
||||
int border_width;
|
||||
float border_color[3][4];
|
||||
};
|
||||
|
||||
struct theme {
|
||||
int border_width;
|
||||
int padding_height;
|
||||
|
|
@ -82,16 +90,8 @@ struct theme {
|
|||
int osd_workspace_switcher_boxes_width;
|
||||
int osd_workspace_switcher_boxes_height;
|
||||
|
||||
bool snapping_overlay_region_fill;
|
||||
bool snapping_overlay_edge_fill;
|
||||
|
||||
float snapping_overlay_region_bg_color[4];
|
||||
float snapping_overlay_edge_bg_color[4];
|
||||
|
||||
int snapping_overlay_region_border_width;
|
||||
int snapping_overlay_edge_border_width;
|
||||
float snapping_overlay_region_border_color[3][4];
|
||||
float snapping_overlay_edge_border_color[3][4];
|
||||
struct theme_snapping_overlay
|
||||
snapping_overlay_region, snapping_overlay_edge;
|
||||
|
||||
/* textures */
|
||||
struct lab_data_buffer *button_close_active_unpressed;
|
||||
|
|
@ -128,13 +128,16 @@ struct theme {
|
|||
int osd_window_switcher_item_height;
|
||||
};
|
||||
|
||||
struct server;
|
||||
|
||||
/**
|
||||
* theme_init - read openbox theme and generate button textures
|
||||
* @theme: theme data
|
||||
* @server: server
|
||||
* @theme_name: theme-name in <theme-dir>/<theme-name>/openbox-3/themerc
|
||||
* Note <theme-dir> is obtained in theme-dir.c
|
||||
*/
|
||||
void theme_init(struct theme *theme, const char *theme_name);
|
||||
void theme_init(struct theme *theme, struct server *server, const char *theme_name);
|
||||
|
||||
/**
|
||||
* theme_finish - free button textures
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue