mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
ssd: add configurable drop-shadows for tiled windows
This commit is contained in:
parent
0908bb5dd1
commit
c5b9e2665d
5 changed files with 23 additions and 2 deletions
|
|
@ -1155,6 +1155,8 @@ entry(xmlNode *node, char *nodename, char *content, struct parser_state *state)
|
|||
set_bool(content, &rc.ssd_keep_border);
|
||||
} else if (!strcasecmp(nodename, "dropShadows.theme")) {
|
||||
set_bool(content, &rc.shadows_enabled);
|
||||
} else if (!strcasecmp(nodename, "dropShadowsOnTiled.theme")) {
|
||||
set_bool(content, &rc.shadows_on_tiled);
|
||||
} else if (!strcmp(nodename, "name.font.theme")) {
|
||||
fill_font(nodename, content, font_place);
|
||||
} else if (!strcmp(nodename, "size.font.theme")) {
|
||||
|
|
@ -1508,6 +1510,7 @@ rcxml_init(void)
|
|||
rc.ssd_keep_border = true;
|
||||
rc.corner_radius = 8;
|
||||
rc.shadows_enabled = false;
|
||||
rc.shadows_on_tiled = false;
|
||||
|
||||
rc.gap = 0;
|
||||
rc.adaptive_sync = LAB_ADAPTIVE_SYNC_DISABLED;
|
||||
|
|
|
|||
|
|
@ -284,9 +284,19 @@ ssd_shadow_update(struct ssd *ssd)
|
|||
assert(ssd->shadow.tree);
|
||||
|
||||
struct view *view = ssd->view;
|
||||
struct theme *theme = ssd->view->server->theme;
|
||||
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||
bool show_shadows =
|
||||
rc.shadows_enabled && !maximized && !view_is_tiled(ssd->view);
|
||||
bool tiled_shadows = false;
|
||||
if (rc.shadows_on_tiled) {
|
||||
if (rc.gap >= theme->window[THEME_ACTIVE].shadow_size
|
||||
&& rc.gap >= theme->window[THEME_INACTIVE].shadow_size) {
|
||||
tiled_shadows = true;
|
||||
} else {
|
||||
wlr_log(WLR_INFO, "gap size < shadow_size, ignore rc.shadows_ontiled");
|
||||
}
|
||||
};
|
||||
bool show_shadows = rc.shadows_enabled && !maximized
|
||||
&& (!view_is_tiled(ssd->view) || tiled_shadows);
|
||||
wlr_scene_node_set_enabled(&ssd->shadow.tree->node, show_shadows);
|
||||
if (show_shadows) {
|
||||
set_shadow_geometry(ssd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue