commit 65946acfd6c946798e9f8a7babc62445fb4b505f
parent 9aa5a8f486f1857fad863624fe794b32b5d6d1b6
Author: Aleksei Kozadaev <akozadaev at yahoo com>
Date: Mon, 23 Feb 2026 13:09:03 +0000
[dwm][patches][systray] patch for dwm 6.8 (adjusting for the lastest fix of getatomprop)
Diffstat:
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/dwm.suckless.org/patches/systray/dwm-systray-6.8.diff b/dwm.suckless.org/patches/systray/dwm-systray-6.8.diff
@@ -26,7 +26,7 @@ index 81c3fc0..364b394 100644
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
diff --git a/dwm.c b/dwm.c
-index fc4232e..1d04490 100644
+index 0a67103..fc4dfc4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -56,12 +56,27 @@
@@ -57,20 +57,19 @@ index fc4232e..1d04490 100644
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
-@@ -140,6 +155,12 @@ typedef struct {
+@@ -140,6 +155,11 @@ typedef struct {
int monitor;
} Rule;
-+typedef struct Systray Systray;
-+struct Systray {
++typedef struct {
+ Window win;
+ Client *icons;
-+};
++} Systray;
+
/* function declarations */
static void applyrules(Client *c);
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
-@@ -171,6 +192,7 @@ static void focusstack(const Arg *arg);
+@@ -171,6 +191,7 @@ static void focusstack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
@@ -78,7 +77,7 @@ index fc4232e..1d04490 100644
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void grabkeys(void);
-@@ -188,13 +210,16 @@ static void pop(Client *c);
+@@ -188,13 +209,16 @@ static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
@@ -96,7 +95,7 @@ index fc4232e..1d04490 100644
static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
-@@ -205,6 +230,7 @@ static void setup(void);
+@@ -205,6 +229,7 @@ static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void spawn(const Arg *arg);
@@ -104,7 +103,7 @@ index fc4232e..1d04490 100644
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
-@@ -222,18 +248,23 @@ static int updategeom(void);
+@@ -222,18 +247,23 @@ static int updategeom(void);
static void updatenumlockmask(void);
static void updatesizehints(Client *c);
static void updatestatus(void);
@@ -128,7 +127,7 @@ index fc4232e..1d04490 100644
static const char broken[] = "broken";
static char stext[256];
static int screen;
-@@ -256,9 +287,10 @@ static void (*handler[LASTEvent]) (XEvent *) = {
+@@ -256,9 +286,10 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[MapRequest] = maprequest,
[MotionNotify] = motionnotify,
[PropertyNotify] = propertynotify,
@@ -140,7 +139,7 @@ index fc4232e..1d04490 100644
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
-@@ -440,7 +472,7 @@ buttonpress(XEvent *e)
+@@ -440,7 +471,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
click = ClkLtSymbol;
@@ -149,7 +148,7 @@ index fc4232e..1d04490 100644
click = ClkStatusText;
else
click = ClkWinTitle;
-@@ -483,6 +515,13 @@ cleanup(void)
+@@ -483,6 +514,13 @@ cleanup(void)
XUngrabKey(dpy, AnyKey, AnyModifier, root);
while (mons)
cleanupmon(mons);
@@ -163,7 +162,7 @@ index fc4232e..1d04490 100644
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++)
-@@ -514,9 +553,58 @@ cleanupmon(Monitor *mon)
+@@ -514,9 +552,58 @@ cleanupmon(Monitor *mon)
void
clientmessage(XEvent *e)
{
@@ -222,7 +221,7 @@ index fc4232e..1d04490 100644
if (!c)
return;
if (cme->message_type == netatom[NetWMState]) {
-@@ -569,7 +657,7 @@ configurenotify(XEvent *e)
+@@ -569,7 +656,7 @@ configurenotify(XEvent *e)
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
resizeclient(c, m->mx, m->my, m->mw, m->mh);
@@ -231,7 +230,7 @@ index fc4232e..1d04490 100644
}
focus(NULL);
arrange(NULL);
-@@ -654,6 +742,11 @@ destroynotify(XEvent *e)
+@@ -654,6 +741,11 @@ destroynotify(XEvent *e)
if ((c = wintoclient(ev->window)))
unmanage(c, 1);
@@ -243,7 +242,7 @@ index fc4232e..1d04490 100644
}
void
-@@ -697,7 +790,7 @@ dirtomon(int dir)
+@@ -697,7 +789,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
@@ -252,7 +251,7 @@ index fc4232e..1d04490 100644
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
-@@ -706,13 +799,17 @@ drawbar(Monitor *m)
+@@ -706,13 +798,17 @@ drawbar(Monitor *m)
if (!m->showbar)
return;
@@ -272,7 +271,7 @@ index fc4232e..1d04490 100644
for (c = m->clients; c; c = c->next) {
occ |= c->tags;
if (c->isurgent)
-@@ -733,7 +830,7 @@ drawbar(Monitor *m)
+@@ -733,7 +829,7 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
@@ -281,7 +280,7 @@ index fc4232e..1d04490 100644
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
-@@ -744,7 +841,7 @@ drawbar(Monitor *m)
+@@ -744,7 +840,7 @@ drawbar(Monitor *m)
drw_rect(drw, x, 0, w, bh, 1, 1);
}
}
@@ -290,7 +289,7 @@ index fc4232e..1d04490 100644
}
void
-@@ -781,8 +878,11 @@ expose(XEvent *e)
+@@ -781,8 +877,11 @@ expose(XEvent *e)
Monitor *m;
XExposeEvent *ev = &e->xexpose;
@@ -303,7 +302,7 @@ index fc4232e..1d04490 100644
}
void
-@@ -868,15 +968,32 @@ getatomprop(Client *c, Atom prop)
+@@ -868,15 +967,33 @@ getatomprop(Client *c, Atom prop)
unsigned char *p = NULL;
Atom da, atom = None;
@@ -315,12 +314,11 @@ index fc4232e..1d04490 100644
+ req = xatom[XembedInfo];
+
+ if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req,
- &da, &di, &nitems, &dl, &p) == Success && p) {
-- if (nitems > 0)
-- atom = *(Atom *)p;
-+ atom = *(Atom *)p;
-+ if (da == xatom[XembedInfo] && nitems == 2)
-+ atom = ((Atom *)p)[1];
+ &da, &format, &nitems, &dl, &p) == Success && p) {
+ if (nitems > 0 && format == 32)
+ atom = *(long *)p;
++ if (da == xatom[XembedInfo] && nitems == 2 && format == 32)
++ atom = ((long *)p)[1];
XFree(p);
}
return atom;