]> git.mdlowis.com Git - proto/labwc.git/commitdiff
ssd: add configurable drop-shadows for tiled windows
authordd <26994007+diredocks@users.noreply.github.com>
Thu, 5 Jun 2025 20:46:58 +0000 (04:46 +0800)
committerGitHub <noreply@github.com>
Thu, 5 Jun 2025 20:46:58 +0000 (22:46 +0200)
docs/labwc-config.5.scd
docs/rc.xml.all
include/config/rcxml.h
src/config/rcxml.c
src/ssd/ssd-shadow.c

index 52198062a0594f7bda0f95ba6bd5056290e6f251..24956f123c6d75c24213b5eaa58b24e6e3908d81 100644 (file)
@@ -522,6 +522,12 @@ extending outward from the snapped edge.
 *<theme><dropShadows>* [yes|no]
        Should drop-shadows be rendered behind windows. Default is no.
 
+*<theme><dropShadowsOnTiled>* [yes|no]
+       Should drop-shadows be rendered behind tiled windows. This won't take
+       effect if <core><gap> is smaller than window.active.shadow.size in theme.
+
+       Default is no.
+
 *<theme><font place="">*
        The font to use for a specific element of a window, menu or OSD.
        Places can be any of:
index b45252232e9277d810b602cd510ad61b73d10a90..0bb9182d7c2ad7bfa9095c74847bc61f058121fd 100644 (file)
@@ -38,6 +38,7 @@
     <cornerRadius>8</cornerRadius>
     <keepBorder>yes</keepBorder>
     <dropShadows>no</dropShadows>
+    <dropShadowsOnTiled>no</dropShadowsOnTiled>
     <font place="ActiveWindow">
       <name>sans</name>
       <size>10</size>
index 3867618eee56b9f889592b7b3d81082223240f2a..23312f7943b99b07ed31f3c9373cede57d52e6a0 100644 (file)
@@ -92,6 +92,7 @@ struct rcxml {
        bool title_layout_loaded;
        bool ssd_keep_border;
        bool shadows_enabled;
+       bool shadows_on_tiled;
        struct font font_activewindow;
        struct font font_inactivewindow;
        struct font font_menuheader;
index eab3f65b95af876ec5a431c0dbaeae546fbcc079..a3e8f85e67f347bdf5cc3fe461eab4f4d195580e 100644 (file)
@@ -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;
index 0559628c0b91d41915d95060483a2913c26e44af..29ee1ca2d5a9f720745cea80b00a6fb8284add79 100644 (file)
@@ -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);