sync scenefx patch with latest dwl and latest scenefx pkg

This commit is contained in:
wochap 2024-07-09 10:57:04 -05:00
parent ff57f0b2e7
commit 3a3efa39b0
No known key found for this signature in database
GPG Key ID: FE4CF844E73095E1

View File

@ -1,31 +1,30 @@
From 781efcce5f0bc28c2cad7bc3214b927ba87594ae Mon Sep 17 00:00:00 2001 From 2d4fb60abd6284236ce4ba0b9c3b562165937963 Mon Sep 17 00:00:00 2001
From: wochap <gean.marroquin@gmail.com> From: wochap <gean.marroquin@gmail.com>
Date: Thu, 11 Apr 2024 15:04:01 -0500 Date: Fri, 5 Jul 2024 11:45:43 -0500
Subject: [PATCH] implement wlrfx/scenefx Subject: [PATCH] implement scenefx
add options for blur, shadows, opacity and corner radius
--- ---
Makefile | 2 +- Makefile | 2 +-
client.h | 11 +++- client.h | 11 +++-
config.def.h | 28 ++++++++- config.def.h | 28 ++++++++-
dwl.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++++-- dwl.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 198 insertions(+), 10 deletions(-) 4 files changed, 191 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile diff --git a/Makefile b/Makefile
index a67fdd3..bc8e9a1 100644 index 0d651e7..0ae18a7 100644
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -9,7 +9,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unu @@ -12,7 +12,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement \
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion -Wfloat-conversion
# CFLAGS / LDFLAGS # CFLAGS / LDFLAGS
-PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS) -PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)
+PKGS = scenefx wlroots wayland-server xkbcommon libinput $(XLIBS) +PKGS = scenefx wlroots wayland-server xkbcommon libinput $(XLIBS)
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS) DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
diff --git a/client.h b/client.h diff --git a/client.h b/client.h
index 800b867..fd7c4c9 100644 index 42f225f..f75b3ff 100644
--- a/client.h --- a/client.h
+++ b/client.h +++ b/client.h
@@ -131,7 +131,7 @@ client_get_appid(Client *c) @@ -131,7 +131,7 @@ client_get_appid(Client *c)
@ -59,7 +58,7 @@ index 800b867..fd7c4c9 100644
static inline void static inline void
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 8847e58..4ff6bf0 100644 index 22d2171..d28e698 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -12,7 +12,33 @@ static const float bordercolor[] = COLOR(0x444444ff); @@ -12,7 +12,33 @@ static const float bordercolor[] = COLOR(0x444444ff);
@ -98,21 +97,21 @@ index 8847e58..4ff6bf0 100644
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9) #define TAGCOUNT (9)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index bf763df..d038a5b 100644 index dc0437e..d69054a 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -9,6 +9,10 @@ @@ -10,6 +10,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
+#include <scenefx/fx_renderer/fx_renderer.h> +#include <scenefx/render/fx_renderer/fx_renderer.h>
+#include <scenefx/types/fx/blur_data.h> +#include <scenefx/types/fx/blur_data.h>
+#include <scenefx/types/fx/shadow_data.h> +#include <scenefx/types/fx/shadow_data.h>
+#include <scenefx/types/wlr_scene.h> +#include <scenefx/types/wlr_scene.h>
#include <unistd.h> #include <unistd.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/backend.h> #include <wlr/backend.h>
@@ -40,7 +44,6 @@ @@ -42,7 +46,6 @@
#include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_primary_selection_v1.h> #include <wlr/types/wlr_primary_selection_v1.h>
#include <wlr/types/wlr_relative_pointer_v1.h> #include <wlr/types/wlr_relative_pointer_v1.h>
@ -120,7 +119,7 @@ index bf763df..d038a5b 100644
#include <wlr/types/wlr_screencopy_v1.h> #include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_server_decoration.h> #include <wlr/types/wlr_server_decoration.h>
@@ -139,6 +142,10 @@ typedef struct { @@ -140,6 +143,10 @@ typedef struct {
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
@ -131,7 +130,7 @@ index bf763df..d038a5b 100644
} Client; } Client;
typedef struct { typedef struct {
@@ -347,6 +354,9 @@ static Monitor *xytomon(double x, double y); @@ -351,6 +358,9 @@ static Monitor *xytomon(double x, double y);
static void xytonode(double x, double y, struct wlr_surface **psurface, static void xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny); Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg); static void zoom(const Arg *arg);
@ -141,22 +140,7 @@ index bf763df..d038a5b 100644
/* variables */ /* variables */
static const char broken[] = "broken"; static const char broken[] = "broken";
@@ -469,6 +479,14 @@ applyrules(Client *c) @@ -1045,6 +1055,13 @@ createnotify(struct wl_listener *listener, void *data)
mon = m;
}
}
+ if (shadow && shadow_only_floating) {
+ if (c->isfloating && !in_shadow_ignore_list(appid)) {
+ c->shadow_data.enabled = 1;
+ } else {
+ c->shadow_data.enabled = 0;
+ }
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
+ }
}
setmon(c, mon, newtags);
}
@@ -977,6 +995,13 @@ createnotify(struct wl_listener *listener, void *data)
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel, wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
@ -170,7 +154,7 @@ index bf763df..d038a5b 100644
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify); LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify); LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify);
LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify); LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify);
@@ -1267,8 +1292,21 @@ focusclient(Client *c, int lift) @@ -1346,8 +1363,21 @@ focusclient(Client *c, int lift)
/* Don't change border color if there is an exclusive focus or we are /* Don't change border color if there is an exclusive focus or we are
* handling a drag operation */ * handling a drag operation */
@ -193,7 +177,7 @@ index bf763df..d038a5b 100644
} }
/* Deactivate old client if focus is changing */ /* Deactivate old client if focus is changing */
@@ -1286,6 +1324,18 @@ focusclient(Client *c, int lift) @@ -1365,6 +1395,18 @@ focusclient(Client *c, int lift)
* and probably other clients */ * and probably other clients */
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) { } else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
client_set_border_color(old_c, bordercolor); client_set_border_color(old_c, bordercolor);
@ -212,7 +196,7 @@ index bf763df..d038a5b 100644
client_activate_surface(old, 0); client_activate_surface(old, 0);
} }
@@ -1580,6 +1630,8 @@ mapnotify(struct wl_listener *listener, void *data) @@ -1653,6 +1695,8 @@ mapnotify(struct wl_listener *listener, void *data)
client_get_geometry(c, &c->geom); client_get_geometry(c, &c->geom);
@ -221,30 +205,31 @@ index bf763df..d038a5b 100644
/* Handle unmanaged clients first so we can return prior create borders */ /* Handle unmanaged clients first so we can return prior create borders */
if (client_is_unmanaged(c)) { if (client_is_unmanaged(c)) {
/* Unmanaged clients always are floating */ /* Unmanaged clients always are floating */
@@ -1614,6 +1666,14 @@ mapnotify(struct wl_listener *listener, void *data) @@ -1692,6 +1736,15 @@ mapnotify(struct wl_listener *listener, void *data)
* try to apply rules for them */ }
if ((p = client_get_parent(c))) { printstatus();
c->isfloating = 1;
+ if (shadow && shadow_only_floating) { + if (shadow && shadow_only_floating) {
+ if (!in_shadow_ignore_list(client_get_appid(c))) { + if (c->isfloating && !in_shadow_ignore_list(client_get_appid(c))) {
+ c->shadow_data.enabled = 1; + c->shadow_data.enabled = 1;
+ } else { + } else {
+ c->shadow_data.enabled = 0; + c->shadow_data.enabled = 0;
+ }
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
+ } + }
setmon(c, p->mon, p->tags); + wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
} else { + }
applyrules(c); +
@@ -2036,6 +2096,7 @@ resize(Client *c, struct wlr_box geo, int interact) unset_fullscreen:
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
wl_list_for_each(w, &clients, link) {
@@ -2132,6 +2185,7 @@ resize(Client *c, struct wlr_box geo, int interact)
{ {
struct wlr_box *bbox = interact ? &sgeom : &c->mon->w; struct wlr_box *bbox;
struct wlr_box clip; struct wlr_box clip;
+ int should_clip; + int should_clip;
client_set_bounds(c, geo.width, geo.height);
c->geom = geo; if (!c->mon || !c->scene)
applybounds(c, bbox); return;
@@ -2054,8 +2115,12 @@ resize(Client *c, struct wlr_box geo, int interact) @@ -2156,8 +2210,12 @@ resize(Client *c, struct wlr_box geo, int interact)
/* this is a no-op if size hasn't changed */ /* this is a no-op if size hasn't changed */
c->resize = client_set_size(c, c->geom.width - 2 * c->bw, c->resize = client_set_size(c, c->geom.width - 2 * c->bw,
c->geom.height - 2 * c->bw); c->geom.height - 2 * c->bw);
@ -259,7 +244,7 @@ index bf763df..d038a5b 100644
} }
void void
@@ -2149,6 +2214,14 @@ setfloating(Client *c, int floating) @@ -2258,6 +2316,14 @@ setfloating(Client *c, int floating)
{ {
Client *p = client_get_parent(c); Client *p = client_get_parent(c);
c->isfloating = floating; c->isfloating = floating;
@ -271,16 +256,16 @@ index bf763df..d038a5b 100644
+ } + }
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c); + wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
+ } + }
if (!c->mon) /* If in floating layout do not change the client's layer */
if (!c->mon || !client_surface(c)->mapped || !c->mon->lt[c->mon->sellt]->arrange)
return; return;
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen || @@ -2407,11 +2473,15 @@ setup(void)
@@ -2300,11 +2373,15 @@ setup(void)
drag_icon = wlr_scene_tree_create(&scene->tree); drag_icon = wlr_scene_tree_create(&scene->tree);
wlr_scene_node_place_below(&drag_icon->node, &layers[LyrBlock]->node); wlr_scene_node_place_below(&drag_icon->node, &layers[LyrBlock]->node);
+ if (blur) { + // if (blur) {
+ wlr_scene_set_blur_data(scene, blur_data); + // wlr_scene_set_blur_data(scene, blur_data);
+ } + // }
+ +
/* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The user /* Autocreates a renderer, either Pixman, GLES2 or Vulkan for us. The user
* can also specify a renderer using the WLR_RENDERER env var. * can also specify a renderer using the WLR_RENDERER env var.
@ -291,7 +276,7 @@ index bf763df..d038a5b 100644
die("couldn't create renderer"); die("couldn't create renderer");
/* Create shm, drm and linux_dmabuf interfaces by ourselves. /* Create shm, drm and linux_dmabuf interfaces by ourselves.
@@ -2818,8 +2895,14 @@ urgent(struct wl_listener *listener, void *data) @@ -2888,8 +2958,14 @@ urgent(struct wl_listener *listener, void *data)
c->isurgent = 1; c->isurgent = 1;
printstatus(); printstatus();
@ -307,7 +292,7 @@ index bf763df..d038a5b 100644
} }
void void
@@ -2929,6 +3012,78 @@ zoom(const Arg *arg) @@ -3001,6 +3077,78 @@ zoom(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
@ -352,11 +337,11 @@ index bf763df..d038a5b 100644
+ wlr_scene_buffer_set_shadow_data(buffer, c->shadow_data); + wlr_scene_buffer_set_shadow_data(buffer, c->shadow_data);
+ } + }
+ +
+ if (blur) { + // if (blur) {
+ wlr_scene_buffer_set_backdrop_blur(buffer, 1); + // wlr_scene_buffer_set_backdrop_blur(buffer, 1);
+ wlr_scene_buffer_set_backdrop_blur_optimized(buffer, blur_optimized); + // wlr_scene_buffer_set_backdrop_blur_optimized(buffer, blur_optimized);
+ wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, blur_ignore_transparent); + // wlr_scene_buffer_set_backdrop_blur_ignore_transparent(buffer, blur_ignore_transparent);
+ } + // }
+ } + }
+ } + }
+} +}
@ -387,4 +372,4 @@ index bf763df..d038a5b 100644
void void
activatex11(struct wl_listener *listener, void *data) activatex11(struct wl_listener *listener, void *data)
-- --
2.43.2 2.45.1