swm

sigma window manager
git clone git://wolog.xyz/swm
Log | Files | Refs | README | LICENSE

commit a3e20c184b294b88dbeb978f519b7bb84cc911b9
parent 1073f6ffa01102a29355993fe37c2f3da11d10d8
Author: Raymond Cole <rc@wolog.xyz>
Date:   Mon,  4 Nov 2024 07:24:26 +0000

Tidy PropertyNotify event handler

Diffstat:
Mevt.c | 41++++++++++++++++-------------------------
1 file changed, 16 insertions(+), 25 deletions(-)

diff --git a/evt.c b/evt.c @@ -235,33 +235,24 @@ propertynotify(XEvent *e) Client *c; Window dw; - if (ev->state == PropertyDelete) + if (ev->state == PropertyDelete || !(c = wintoclient(ev->window))) return; - if ((c = wintoclient(ev->window))) { - switch(ev->atom) { - case XA_WM_TRANSIENT_FOR: - if (XGetTransientForHint(dpy, c->win, &dw)) - setfloating(c, 1); - break; - case XA_WM_NORMAL_HINTS: - c->hintsvalid = 0; - parrange(c->mon); - break; - case XA_WM_HINTS: - updatewmhints(c); + if (ev->atom == XA_WM_HINTS) { + updatewmhints(c); + } else if (ev->atom == XA_WM_NORMAL_HINTS) { + c->hintsvalid = 0; + parrange(c->mon); + if (c == c->mon->sel) pdrawbar(c->mon); - break; - default: - if (ev->atom == netatom[NetWMName] - || ev->atom == XA_WM_NAME) { - updatetitle(c); - if (c == c->mon->sel) - pdrawbar(c->mon); - } else if (ev->atom == netatom[NetWMWindowType]) { - updatewindowtype(c); - } - break; - } + } else if (ev->atom == XA_WM_TRANSIENT_FOR) { + if (XGetTransientForHint(dpy, c->win, &dw)) + setfloating(c, 1); + } else if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { + updatetitle(c); + if (c == c->mon->sel) + pdrawbar(c->mon); + } else if (ev->atom == netatom[NetWMWindowType]) { + updatewindowtype(c); } }