fixed client-opacity patch

This commit is contained in:
yukiisen 2025-10-25 20:22:00 +01:00
parent 4263f5be4d
commit 6d8fef0bc1

View File

@ -1,27 +1,21 @@
From ba3172875d379ff4f2db69753f50067cecfc8293 Mon Sep 17 00:00:00 2001 From 3c0b58478736e5ac5d867b3f24b38b157d38b00a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= From: yukiisen <ahmad.redhorn@gmail.com>
<leohdz172@proton.me> Date: Sat, 25 Oct 2025 20:08:36 +0100
Date: Tue, 25 Jul 2023 12:48:22 -0600 Subject: [PATCH] fixed client-opacity patch
Subject: [PATCH] add default transparency for windows and rules for override
the transparency
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
--- ---
config.def.h | 9 ++++++--- config.def.h | 9 ++++++---
dwl.c | 39 +++++++++++++++++++++++++++++++++++++++ dwl.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-) 2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 22d2171d..0eb86874 100644 index 95c2afa..808242a 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff); @@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff); static const float urgentcolor[] = COLOR(0xff0000ff);
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
+static const float default_opacity = 0.75; +static const float default_opacity = 0.75;
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
@ -50,7 +44,7 @@ index 22d2171d..0eb86874 100644
{ MODKEY, XKB_KEY_Tab, view, {0} }, { MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index ad21e1ba..0554fcdf 100644 index 12f441e..f547148 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -138,6 +138,7 @@ typedef struct { @@ -138,6 +138,7 @@ typedef struct {
@ -85,7 +79,7 @@ index ad21e1ba..0554fcdf 100644
static void setpsel(struct wl_listener *listener, void *data); static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data); static void setsel(struct wl_listener *listener, void *data);
static void setup(void); static void setup(void);
@@ -491,6 +495,7 @@ applyrules(Client *c) @@ -490,6 +494,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title)) if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) { && (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
@ -93,26 +87,7 @@ index ad21e1ba..0554fcdf 100644
newtags |= r->tags; newtags |= r->tags;
i = 0; i = 0;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@@ -499,6 +504,8 @@ applyrules(Client *c) @@ -1127,6 +1132,7 @@ createnotify(struct wl_listener *listener, void *data)
}
}
}
+ if (c->scene_surface)
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
setmon(c, mon, newtags);
}
@@ -874,6 +881,9 @@ commitnotify(struct wl_listener *listener, void *data)
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
+ if (c->scene_surface)
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
+
/* mark a pending resize as completed */
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
c->resize = 0;
@@ -1120,6 +1130,7 @@ createnotify(struct wl_listener *listener, void *data)
c = toplevel->base->data = ecalloc(1, sizeof(*c)); c = toplevel->base->data = ecalloc(1, sizeof(*c));
c->surface.xdg = toplevel->base; c->surface.xdg = toplevel->base;
c->bw = borderpx; c->bw = borderpx;
@ -120,7 +95,16 @@ index ad21e1ba..0554fcdf 100644
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify); LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify); LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
@@ -2285,6 +2296,15 @@ run(char *startup_cmd) @@ -2159,6 +2165,8 @@ rendermon(struct wl_listener *listener, void *data)
/* Render if no XDG clients have an outstanding resize and are visible on
* this monitor. */
wl_list_for_each(c, &clients, link) {
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
+
if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c))
goto skip;
}
@@ -2295,6 +2303,15 @@ run(char *startup_cmd)
wl_display_run(dpy); wl_display_run(dpy);
} }
@ -136,7 +120,7 @@ index ad21e1ba..0554fcdf 100644
void void
setcursor(struct wl_listener *listener, void *data) setcursor(struct wl_listener *listener, void *data)
{ {
@@ -2353,6 +2373,7 @@ setfullscreen(Client *c, int fullscreen) @@ -2363,6 +2380,7 @@ setfullscreen(Client *c, int fullscreen)
* client positions are set by the user and cannot be recalculated */ * client positions are set by the user and cannot be recalculated */
resize(c, c->prev, 0); resize(c, c->prev, 0);
} }
@ -144,7 +128,7 @@ index ad21e1ba..0554fcdf 100644
arrange(c->mon); arrange(c->mon);
printstatus(); printstatus();
} }
@@ -2409,6 +2430,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags) @@ -2419,6 +2437,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
} }
@ -168,7 +152,7 @@ index ad21e1ba..0554fcdf 100644
void void
setpsel(struct wl_listener *listener, void *data) setpsel(struct wl_listener *listener, void *data)
{ {
@@ -3120,6 +3158,7 @@ createnotifyx11(struct wl_listener *listener, void *data) @@ -3130,6 +3165,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
c->surface.xwayland = xsurface; c->surface.xwayland = xsurface;
c->type = X11; c->type = X11;
c->bw = client_is_unmanaged(c) ? 0 : borderpx; c->bw = client_is_unmanaged(c) ? 0 : borderpx;
@ -177,5 +161,5 @@ index ad21e1ba..0554fcdf 100644
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11); LISTEN(&xsurface->events.associate, &c->associate, associatex11);
-- --
2.48.0 2.51.0