[wiki] [sites] [dwm] Add windowmap patch. || parazyd

From: <git_AT_suckless.org>
Date: Wed, 26 Oct 2022 20:45:58 +0200

commit 1ad35b21552a3c1da0407c2664b1d26c9e17d0f2
Author: parazyd <parazyd_AT_dyne.org>
Date: Wed Oct 26 11:10:33 2022 +0200

    [dwm] Add windowmap patch.

diff --git a/dwm.suckless.org/patches/windowmap/dwm-windowmap-20221026.diff b/dwm.suckless.org/patches/windowmap/dwm-windowmap-20221026.diff
new file mode 100644
index 00000000..db04e417
--- /dev/null
+++ b/dwm.suckless.org/patches/windowmap/dwm-windowmap-20221026.diff
_AT_@ -0,0 +1,83 @@
+diff --git a/dwm.c b/dwm.c
+index e5efb6a..eaf0333 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -228,6 +228,9 @@ static void updatetitle(Client *c);
+ static void updatewindowtype(Client *c);
+ static void updatewmhints(Client *c);
+ static void view(const Arg *arg);
++static void window_set_state(Display *dpy, Window win, long state);
++static void window_map(Display *dpy, Client *c, int deiconify);
++static void window_unmap(Display *dpy, Window win, Window root, int iconify);
+ static Client *wintoclient(Window w);
+ static Monitor *wintomon(Window w);
+ static int xerror(Display *dpy, XErrorEvent *ee);
+_AT_@ -1617,14 +1620,12 @@ showhide(Client *c)
+ return;
+ if (ISVISIBLE(c)) {
+ /* show clients top down */
+- XMoveWindow(dpy, c->win, c->x, c->y);
+- if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
+- resize(c, c->x, c->y, c->w, c->h, 0);
++ window_map(dpy, c, 1);
+ showhide(c->snext);
+ } else {
+ /* hide clients bottom up */
+ showhide(c->snext);
+- XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
++ window_unmap(dpy, c->win, root, 1);
+ }
+ }
+
+_AT_@ -2032,6 +2033,51 @@ updatewmhints(Client *c)
+ }
+ }
+
++void
++window_set_state(Display *dpy, Window win, long state)
++{
++ long data[] = { state, None };
++
++ XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
++ PropModeReplace, (unsigned char*)data, 2);
++}
++
++void
++window_map(Display *dpy, Client *c, int deiconify)
++{
++ Window win = c->win;
++
++ if (deiconify)
++ window_set_state(dpy, win, NormalState);
++
++ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
++ XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
++ XMapWindow(dpy, win);
++}
++
++void
++window_unmap(Display *dpy, Window win, Window root, int iconify)
++{
++ static XWindowAttributes ca, ra;
++
++ XGrabServer(dpy);
++ XGetWindowAttributes(dpy, root, &ra);
++ XGetWindowAttributes(dpy, win, &ca);
++
++ /* Prevent UnmapNotify events */
++ XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
++ XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
++
++ XUnmapWindow(dpy, win);
++
++ if (iconify)
++ window_set_state(dpy, win, IconicState);
++
++ XSelectInput(dpy, root, ra.your_event_mask);
++ XSelectInput(dpy, win, ca.your_event_mask);
++ XUngrabServer(dpy);
++}
++
+ void
+ view(const Arg *arg)
+ {
diff --git a/dwm.suckless.org/patches/windowmap/index.md b/dwm.suckless.org/patches/windowmap/index.md
new file mode 100644
index 00000000..b7a7256d
--- /dev/null
+++ b/dwm.suckless.org/patches/windowmap/index.md
_AT_@ -0,0 +1,18 @@
+windowmap
+=========
+
+Description
+-----------
+
+The windowmap patch makes the windows get mapped or unmapped in Xorg.
+This results in certain behaviour being enabled, for example when you
+use a compositor like picom - your windows will fade in and out when
+you switch dwm tags.
+
+Download
+--------
+* [dwm-windowmap-20221026.diff](dwm-windowmap-20221026.diff)
+
+Authors
+-------
+* Ivan J. <parazyd_AT_dyne.org>
Received on Wed Oct 26 2022 - 20:45:58 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 26 2022 - 20:48:48 CEST