mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-26 09:44:21 +00:00
update scenefx for HEAD
This commit is contained in:
parent
7a5c342082
commit
6e3a57ffd1
@ -1,9 +1,9 @@
|
||||
From 1f7161a10ea24eb7aa4fbeb80034fdd459190c01 Mon Sep 17 00:00:00 2001
|
||||
From 781efcce5f0bc28c2cad7bc3214b927ba87594ae Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 10 Apr 2024 11:00:23 -0500
|
||||
Date: Thu, 11 Apr 2024 15:04:01 -0500
|
||||
Subject: [PATCH] implement wlrfx/scenefx
|
||||
|
||||
add options for shadow, blur, opacity and corner_radius
|
||||
add options for blur, shadows, opacity and corner radius
|
||||
---
|
||||
Makefile | 2 +-
|
||||
client.h | 11 +++-
|
||||
@ -12,11 +12,11 @@ add options for shadow, blur, opacity and corner_radius
|
||||
4 files changed, 198 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 6cde460..f235edf 100644
|
||||
index a67fdd3..bc8e9a1 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -9,7 +9,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unu
|
||||
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types
|
||||
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion
|
||||
|
||||
# CFLAGS / LDFLAGS
|
||||
-PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)
|
||||
@ -25,7 +25,7 @@ index 6cde460..f235edf 100644
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
|
||||
|
||||
diff --git a/client.h b/client.h
|
||||
index 71c7d76..6532e05 100644
|
||||
index 800b867..fd7c4c9 100644
|
||||
--- a/client.h
|
||||
+++ b/client.h
|
||||
@@ -131,7 +131,7 @@ client_get_appid(Client *c)
|
||||
@ -49,8 +49,8 @@ index 71c7d76..6532e05 100644
|
||||
clip->x = xdg_geom.x;
|
||||
clip->y = xdg_geom.y;
|
||||
+
|
||||
+ if (xdg_geom.width <= c->geom.width - c->bw
|
||||
+ && xdg_geom.height <= c->geom.height - c->bw) {
|
||||
+ if (xdg_geom.width <= c->geom.width - (int)c->bw
|
||||
+ && xdg_geom.height <= c->geom.height - (int)c->bw) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
@ -59,15 +59,15 @@ index 71c7d76..6532e05 100644
|
||||
|
||||
static inline void
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index db0babc..185765a 100644
|
||||
index 8847e58..4ff6bf0 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -11,7 +11,33 @@ static const float bordercolor[] = COLOR(0x444444ff);
|
||||
@@ -12,7 +12,33 @@ static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
||||
-static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */
|
||||
+static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 0.0}; /* You can also use glsl colors */
|
||||
/* 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.1f, 0.1f, 0.1f, 0.0f}; /* You can also use glsl colors */
|
||||
+
|
||||
+static const int opacity = 0; /* flag to enable opacity */
|
||||
+static const float opacity_inactive = 0.5;
|
||||
@ -83,22 +83,22 @@ index db0babc..185765a 100644
|
||||
+
|
||||
+static const int corner_radius = 0; /* 0 disables corner_radius */
|
||||
+
|
||||
+static const int blur = 0; /* flag to enable blur */
|
||||
+static const int blur = 1; /* flag to enable blur */
|
||||
+static const int blur_optimized = 1;
|
||||
+static const int blur_ignore_transparent = 1;
|
||||
+static const struct blur_data blur_data = {
|
||||
+ .radius = 5,
|
||||
+ .num_passes = 3,
|
||||
+ .noise = 0.02,
|
||||
+ .brightness = 0.9,
|
||||
+ .contrast = 0.9,
|
||||
+ .saturation = 1.1,
|
||||
+ .noise = (float)0.02,
|
||||
+ .brightness = (float)0.9,
|
||||
+ .contrast = (float)0.9,
|
||||
+ .saturation = (float)1.1,
|
||||
+};
|
||||
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
#define TAGCOUNT (9)
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ef27a1d..4e9614e 100644
|
||||
index bf763df..d038a5b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -9,6 +9,10 @@
|
||||
@ -112,15 +112,15 @@ index ef27a1d..4e9614e 100644
|
||||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend.h>
|
||||
@@ -37,7 +41,6 @@
|
||||
#include <wlr/types/wlr_presentation_time.h>
|
||||
@@ -40,7 +44,6 @@
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
||||
-#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/types/wlr_screencopy_v1.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
@@ -130,6 +133,10 @@ typedef struct {
|
||||
@@ -139,6 +142,10 @@ typedef struct {
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
@ -131,7 +131,7 @@ index ef27a1d..4e9614e 100644
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
@@ -327,6 +334,9 @@ static Monitor *xytomon(double x, double y);
|
||||
@@ -347,6 +354,9 @@ static Monitor *xytomon(double x, double y);
|
||||
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||
static void zoom(const Arg *arg);
|
||||
@ -141,22 +141,22 @@ index ef27a1d..4e9614e 100644
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
@@ -440,6 +450,14 @@ applyrules(Client *c)
|
||||
@@ -469,6 +479,14 @@ applyrules(Client *c)
|
||||
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;
|
||||
+ 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);
|
||||
+ }
|
||||
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
|
||||
+ }
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
||||
}
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
@@ -975,6 +993,13 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
@@ -977,6 +995,13 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
|
||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
||||
|
||||
@ -167,10 +167,10 @@ index ef27a1d..4e9614e 100644
|
||||
+ c->shadow_data.blur_sigma = shadow_blur_sigma;
|
||||
+ c->shadow_data.color = shadow_color;
|
||||
+
|
||||
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
|
||||
LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify);
|
||||
LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify);
|
||||
LISTEN(&xdg_surface->surface->events.unmap, &c->unmap, unmapnotify);
|
||||
@@ -1204,8 +1229,21 @@ focusclient(Client *c, int lift)
|
||||
@@ -1267,8 +1292,21 @@ focusclient(Client *c, int lift)
|
||||
|
||||
/* Don't change border color if there is an exclusive focus or we are
|
||||
* handling a drag operation */
|
||||
@ -193,7 +193,7 @@ index ef27a1d..4e9614e 100644
|
||||
}
|
||||
|
||||
/* Deactivate old client if focus is changing */
|
||||
@@ -1223,6 +1261,18 @@ focusclient(Client *c, int lift)
|
||||
@@ -1286,6 +1324,18 @@ focusclient(Client *c, int lift)
|
||||
* and probably other clients */
|
||||
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
||||
client_set_border_color(old_c, bordercolor);
|
||||
@ -212,18 +212,18 @@ index ef27a1d..4e9614e 100644
|
||||
|
||||
client_activate_surface(old, 0);
|
||||
}
|
||||
@@ -1518,6 +1568,8 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
: wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
|
||||
c->scene->node.data = c->scene_surface->node.data = c;
|
||||
@@ -1580,6 +1630,8 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
|
||||
client_get_geometry(c, &c->geom);
|
||||
|
||||
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers, c);
|
||||
+
|
||||
/* Handle unmanaged clients first so we can return prior create borders */
|
||||
if (client_is_unmanaged(c)) {
|
||||
client_get_geometry(c, &c->geom);
|
||||
@@ -1554,6 +1606,14 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
/* TODO: https://github.com/djpohly/dwl/pull/334#issuecomment-1330166324 */
|
||||
if (c->type == XDGShell && (p = client_get_parent(c))) {
|
||||
/* Unmanaged clients always are floating */
|
||||
@@ -1614,6 +1666,14 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
* try to apply rules for them */
|
||||
if ((p = client_get_parent(c))) {
|
||||
c->isfloating = 1;
|
||||
+ if (shadow && shadow_only_floating) {
|
||||
+ if (!in_shadow_ignore_list(client_get_appid(c))) {
|
||||
@ -233,10 +233,10 @@ index ef27a1d..4e9614e 100644
|
||||
+ }
|
||||
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
|
||||
+ }
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
||||
setmon(c, p->mon, p->tags);
|
||||
} else {
|
||||
@@ -1936,6 +1996,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
applyrules(c);
|
||||
@@ -2036,6 +2096,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
{
|
||||
struct wlr_box *bbox = interact ? &sgeom : &c->mon->w;
|
||||
struct wlr_box clip;
|
||||
@ -244,7 +244,7 @@ index ef27a1d..4e9614e 100644
|
||||
client_set_bounds(c, geo.width, geo.height);
|
||||
c->geom = geo;
|
||||
applybounds(c, bbox);
|
||||
@@ -1954,8 +2015,12 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
@@ -2054,8 +2115,12 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
/* this is a no-op if size hasn't changed */
|
||||
c->resize = client_set_size(c, c->geom.width - 2 * c->bw,
|
||||
c->geom.height - 2 * c->bw);
|
||||
@ -259,9 +259,9 @@ index ef27a1d..4e9614e 100644
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2048,6 +2113,14 @@ void
|
||||
setfloating(Client *c, int floating)
|
||||
@@ -2149,6 +2214,14 @@ setfloating(Client *c, int floating)
|
||||
{
|
||||
Client *p = client_get_parent(c);
|
||||
c->isfloating = floating;
|
||||
+ if (shadow && shadow_only_floating) {
|
||||
+ if (c->isfloating && !in_shadow_ignore_list(client_get_appid(c))) {
|
||||
@ -273,8 +273,8 @@ index ef27a1d..4e9614e 100644
|
||||
+ }
|
||||
if (!c->mon)
|
||||
return;
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen
|
||||
@@ -2192,11 +2265,15 @@ setup(void)
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
|
||||
@@ -2300,11 +2373,15 @@ setup(void)
|
||||
drag_icon = wlr_scene_tree_create(&scene->tree);
|
||||
wlr_scene_node_place_below(&drag_icon->node, &layers[LyrBlock]->node);
|
||||
|
||||
@ -291,9 +291,9 @@ index ef27a1d..4e9614e 100644
|
||||
die("couldn't create renderer");
|
||||
|
||||
/* Create shm, drm and linux_dmabuf interfaces by ourselves.
|
||||
@@ -2650,8 +2727,14 @@ urgent(struct wl_listener *listener, void *data)
|
||||
if (!c || c == focustop(selmon))
|
||||
return;
|
||||
@@ -2818,8 +2895,14 @@ urgent(struct wl_listener *listener, void *data)
|
||||
c->isurgent = 1;
|
||||
printstatus();
|
||||
|
||||
- if (client_surface(c)->mapped)
|
||||
+ if (client_surface(c)->mapped) {
|
||||
@ -304,10 +304,10 @@ index ef27a1d..4e9614e 100644
|
||||
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, iter_xdg_scene_buffers_shadow, c);
|
||||
+ }
|
||||
+ }
|
||||
c->isurgent = 1;
|
||||
printstatus();
|
||||
}
|
||||
@@ -2746,6 +2829,78 @@ zoom(const Arg *arg)
|
||||
|
||||
void
|
||||
@@ -2929,6 +3012,78 @@ zoom(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@ -388,4 +388,3 @@ index ef27a1d..4e9614e 100644
|
||||
activatex11(struct wl_listener *listener, void *data)
|
||||
--
|
||||
2.43.2
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user