From 67f972f7426503cd4307ffe53868453d19777efa Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Thu, 17 Aug 2023 03:53:33 +0300 Subject: Patched sticky, noborderflicker and resizecorners into master. PS: The new keybinds will be added after the huge patches. Changes to be committed: modified: dwm.c modified: dwm.c.orig renamed: patches_new/dwm-noborderflicker-20211227-8657affa2a61.diff -> patches/dwm-noborderflicker-20211227-8657affa2a61.diff renamed: patches_new/dwm-resizecorners-6.2.diff -> patches/dwm-resizecorners-6.2.diff renamed: patches_new/dwm-sticky-6.4.diff -> patches/dwm-sticky-6.4.diff --- dwm.c | 88 +++++++++++-- dwm.c.orig | 101 +++++++++++---- .../dwm-noborderflicker-20211227-8657affa2a61.diff | 42 ++++++ patches/dwm-resizecorners-6.2.diff | 68 ++++++++++ patches/dwm-sticky-6.4.diff | 141 +++++++++++++++++++++ .../dwm-noborderflicker-20211227-8657affa2a61.diff | 42 ------ patches_new/dwm-resizecorners-6.2.diff | 68 ---------- patches_new/dwm-sticky-6.4.diff | 141 --------------------- 8 files changed, 405 insertions(+), 286 deletions(-) create mode 100644 patches/dwm-noborderflicker-20211227-8657affa2a61.diff create mode 100644 patches/dwm-resizecorners-6.2.diff create mode 100644 patches/dwm-sticky-6.4.diff delete mode 100644 patches_new/dwm-noborderflicker-20211227-8657affa2a61.diff delete mode 100644 patches_new/dwm-resizecorners-6.2.diff delete mode 100644 patches_new/dwm-sticky-6.4.diff diff --git a/dwm.c b/dwm.c index 7b8b48a..40819b4 100644 --- a/dwm.c +++ b/dwm.c @@ -49,7 +49,7 @@ #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) -#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) +#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) #define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) @@ -61,7 +61,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { SchemeNorm, SchemeSel }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, - NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, @@ -92,7 +92,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky; Client *next; Client *snext; Monitor *mon; @@ -205,6 +205,7 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); +static void setsticky(Client *c, int sticky); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); @@ -218,6 +219,7 @@ static void tagtoprev(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglesticky(const Arg *arg); static void togglefullscr(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); @@ -245,6 +247,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); /* variables */ +static Client *lastfocused = NULL; static const char broken[] = "broken"; static char stext[256]; static int screen; @@ -557,6 +560,10 @@ clientmessage(XEvent *e) || cme->data.l[2] == netatom[NetWMFullscreen]) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); + + if (cme->data.l[1] == netatom[NetWMSticky] + || cme->data.l[2] == netatom[NetWMSticky]) + setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky))); } else if (cme->message_type == netatom[NetActiveWindow]) { if (c != selmon->sel && !c->isurgent) seturgent(c, 1); @@ -846,7 +853,11 @@ focus(Client *c) detachstack(c); attachstack(c); grabbuttons(c, 1); + /* set new focused border first to avoid flickering */ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + /* lastfocused may be us if another window was unmanaged */ + if (lastfocused && lastfocused != c) + XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeNorm][ColBorder].pixel); setfocus(c); } else { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); @@ -1417,9 +1428,14 @@ void resizemouse(const Arg *arg) { int ocx, ocy, nw, nh; + int ocx2, ocy2, nx, ny; Client *c; Monitor *m; XEvent ev; + int horizcorner, vertcorner; + int di; + unsigned int dui; + Window dummy; Time lasttime = 0; if (!(c = selmon->sel)) @@ -1429,10 +1445,18 @@ resizemouse(const Arg *arg) restack(selmon); ocx = c->x; ocy = c->y; + ocx2 = c->x + c->w; + ocy2 = c->y + c->h; if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) return; - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) + return; + horizcorner = nx < c->w / 2; + vertcorner = ny < c->h / 2; + XWarpPointer (dpy, None, c->win, 0, 0, 0, 0, + horizcorner ? (-c->bw) : (c->w + c->bw -1), + vertcorner ? (-c->bw) : (c->h + c->bw -1)); do { XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); switch(ev.type) { @@ -1446,8 +1470,11 @@ resizemouse(const Arg *arg) continue; lasttime = ev.xmotion.time; - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); + nx = horizcorner ? ev.xmotion.x : c->x; + ny = vertcorner ? ev.xmotion.y : c->y; + nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); + nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); + if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) { @@ -1456,11 +1483,13 @@ resizemouse(const Arg *arg) togglefloating(NULL); } if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) - resize(c, c->x, c->y, nw, nh, 1); + resize(c, nx, ny, nw, nh, 1); break; } } while (ev.type != ButtonRelease); - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, + horizcorner ? (-c->bw) : (c->w + c->bw - 1), + vertcorner ? (-c->bw) : (c->h + c->bw - 1)); XUngrabPointer(dpy, CurrentTime); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { @@ -1623,6 +1652,23 @@ setfullscreen(Client *c, int fullscreen) } } +void +setsticky(Client *c, int sticky) +{ + + if(sticky && !c->issticky) { + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1); + c->issticky = 1; + } else if(!sticky && c->issticky){ + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char *)0, 0); + c->issticky = 0; + arrange(c->mon); + } +} + + void setlayout(const Arg *arg) { @@ -1692,6 +1738,7 @@ setup(void) netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False); netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); @@ -1888,6 +1935,15 @@ togglefullscr(const Arg *arg) setfullscreen(selmon->sel, !selmon->sel->isfullscreen); } +void +togglesticky(const Arg *arg) +{ + if (!selmon->sel) + return; + setsticky(selmon->sel, !selmon->sel->issticky); + arrange(selmon); +} + void toggletag(const Arg *arg) { @@ -1945,7 +2001,7 @@ unfocus(Client *c, int setfocus) if (!c) return; grabbuttons(c, 0); - XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); + lastfocused = c; if (setfocus) { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XDeleteProperty(dpy, root, netatom[NetActiveWindow]); @@ -1972,6 +2028,8 @@ unmanage(Client *c, int destroyed) XSetErrorHandler(xerror); XUngrabServer(dpy); } + if (lastfocused == c) + lastfocused = NULL; free(c); focus(NULL); updateclientlist(); @@ -2202,10 +2260,13 @@ updatewindowtype(Client *c) Atom state = getatomprop(c, netatom[NetWMState]); Atom wtype = getatomprop(c, netatom[NetWMWindowType]); - if (state == netatom[NetWMFullscreen]) - setfullscreen(c, 1); - if (wtype == netatom[NetWMWindowTypeDialog]) - c->isfloating = 1; + if (state == netatom[NetWMFullscreen]) + setfullscreen(c, 1); + if (state == netatom[NetWMSticky]) { + setsticky(c, 1); + } + if (wtype == netatom[NetWMWindowTypeDialog]) + c->isfloating = 1; } void @@ -2378,3 +2439,4 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } + diff --git a/dwm.c.orig b/dwm.c.orig index bd0a69a..e5cbaa4 100644 --- a/dwm.c.orig +++ b/dwm.c.orig @@ -49,7 +49,7 @@ #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) -#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) +#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) #define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) @@ -61,7 +61,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { SchemeNorm, SchemeSel }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, - NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, @@ -92,7 +92,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky; Client *next; Client *snext; Monitor *mon; @@ -205,6 +205,7 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); +static void setsticky(Client *c, int sticky); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); @@ -218,6 +219,7 @@ static void tagtoprev(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglesticky(const Arg *arg); static void togglefullscr(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); @@ -446,7 +448,7 @@ attachstack(Client *c) void buttonpress(XEvent *e) { - unsigned int i, x, click; + unsigned int i, x, click, occ; Arg arg = {0}; Client *c; Monitor *m; @@ -460,9 +462,13 @@ buttonpress(XEvent *e) focus(NULL); } if (ev->window == selmon->barwin) { - i = x = 0; + i = x = occ = 0; + /* Bitmask of occupied tags */ + for (c = m->clients; c; c = c->next) + occ |= c->tags; + do - x += TEXTW(tags[i]); + x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]); while (ev->x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { click = ClkTagBar; @@ -553,6 +559,10 @@ clientmessage(XEvent *e) || cme->data.l[2] == netatom[NetWMFullscreen]) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); + + if (cme->data.l[1] == netatom[NetWMSticky] + || cme->data.l[2] == netatom[NetWMSticky]) + setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky))); } else if (cme->message_type == netatom[NetActiveWindow]) { if (c != selmon->sel && !c->isurgent) seturgent(c, 1); @@ -745,6 +755,7 @@ drawbar(Monitor *m) int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; + const char *tagtext; Client *c; if (!m->showbar) @@ -764,13 +775,10 @@ drawbar(Monitor *m) } x = 0; for (i = 0; i < LENGTH(tags); i++) { - w = TEXTW(tags[i]); - drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); - if (occ & 1 << i) - drw_rect(drw, x + boxs, boxs, boxw, boxw, - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, - urg & 1 << i); + tagtext = occ & 1 << i ? alttags[i] : tags[i]; + w = TEXTW(tagtext); + drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); + drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i); x += w; } w = TEXTW(m->ltsymbol); @@ -1415,9 +1423,14 @@ void resizemouse(const Arg *arg) { int ocx, ocy, nw, nh; + int ocx2, ocy2, nx, ny; Client *c; Monitor *m; XEvent ev; + int horizcorner, vertcorner; + int di; + unsigned int dui; + Window dummy; Time lasttime = 0; if (!(c = selmon->sel)) @@ -1427,10 +1440,18 @@ resizemouse(const Arg *arg) restack(selmon); ocx = c->x; ocy = c->y; + ocx2 = c->x + c->w; + ocy2 = c->y + c->h; if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) return; - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) + return; + horizcorner = nx < c->w / 2; + vertcorner = ny < c->h / 2; + XWarpPointer (dpy, None, c->win, 0, 0, 0, 0, + horizcorner ? (-c->bw) : (c->w + c->bw -1), + vertcorner ? (-c->bw) : (c->h + c->bw -1)); do { XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); switch(ev.type) { @@ -1444,8 +1465,11 @@ resizemouse(const Arg *arg) continue; lasttime = ev.xmotion.time; - nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); - nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); + nx = horizcorner ? ev.xmotion.x : c->x; + ny = vertcorner ? ev.xmotion.y : c->y; + nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); + nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); + if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) { @@ -1454,11 +1478,13 @@ resizemouse(const Arg *arg) togglefloating(NULL); } if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) - resize(c, c->x, c->y, nw, nh, 1); + resize(c, nx, ny, nw, nh, 1); break; } } while (ev.type != ButtonRelease); - XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, + horizcorner ? (-c->bw) : (c->w + c->bw - 1), + vertcorner ? (-c->bw) : (c->h + c->bw - 1)); XUngrabPointer(dpy, CurrentTime); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { @@ -1621,6 +1647,23 @@ setfullscreen(Client *c, int fullscreen) } } +void +setsticky(Client *c, int sticky) +{ + + if(sticky && !c->issticky) { + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1); + c->issticky = 1; + } else if(!sticky && c->issticky){ + XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, + PropModeReplace, (unsigned char *)0, 0); + c->issticky = 0; + arrange(c->mon); + } +} + + void setlayout(const Arg *arg) { @@ -1690,6 +1733,7 @@ setup(void) netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False); netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); @@ -1886,6 +1930,15 @@ togglefullscr(const Arg *arg) setfullscreen(selmon->sel, !selmon->sel->isfullscreen); } +void +togglesticky(const Arg *arg) +{ + if (!selmon->sel) + return; + setsticky(selmon->sel, !selmon->sel->issticky); + arrange(selmon); +} + void toggletag(const Arg *arg) { @@ -2200,10 +2253,13 @@ updatewindowtype(Client *c) Atom state = getatomprop(c, netatom[NetWMState]); Atom wtype = getatomprop(c, netatom[NetWMWindowType]); - if (state == netatom[NetWMFullscreen]) - setfullscreen(c, 1); - if (wtype == netatom[NetWMWindowTypeDialog]) - c->isfloating = 1; + if (state == netatom[NetWMFullscreen]) + setfullscreen(c, 1); + if (state == netatom[NetWMSticky]) { + setsticky(c, 1); + } + if (wtype == netatom[NetWMWindowTypeDialog]) + c->isfloating = 1; } void @@ -2376,3 +2432,4 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } + diff --git a/patches/dwm-noborderflicker-20211227-8657affa2a61.diff b/patches/dwm-noborderflicker-20211227-8657affa2a61.diff new file mode 100644 index 0000000..df2aeb3 --- /dev/null +++ b/patches/dwm-noborderflicker-20211227-8657affa2a61.diff @@ -0,0 +1,42 @@ +diff --git dwm.c dwm.c +index a96f33c..34d1321 100644 +--- dwm.c ++++ dwm.c +@@ -236,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); + + /* variables */ ++static Client *lastfocused = NULL; + static const char broken[] = "broken"; + static char stext[256]; + static int screen; +@@ -799,7 +800,11 @@ focus(Client *c) + detachstack(c); + attachstack(c); + grabbuttons(c, 1); ++ /* set new focused border first to avoid flickering */ + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); ++ /* lastfocused may be us if another window was unmanaged */ ++ if (lastfocused && lastfocused != c) ++ XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeNorm][ColBorder].pixel); + setfocus(c); + } else { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); +@@ -1758,7 +1763,7 @@ unfocus(Client *c, int setfocus) + if (!c) + return; + grabbuttons(c, 0); +- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); ++ lastfocused = c; + if (setfocus) { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +@@ -1784,6 +1789,8 @@ unmanage(Client *c, int destroyed) + XSetErrorHandler(xerror); + XUngrabServer(dpy); + } ++ if (lastfocused == c) ++ lastfocused = NULL; + free(c); + focus(NULL); + updateclientlist(); diff --git a/patches/dwm-resizecorners-6.2.diff b/patches/dwm-resizecorners-6.2.diff new file mode 100644 index 0000000..016351c --- /dev/null +++ b/patches/dwm-resizecorners-6.2.diff @@ -0,0 +1,68 @@ +diff -r -u a/dwm.c b/dwm.c +--- a/dwm.c 2019-02-02 07:55:28.000000000 -0500 ++++ b/dwm.c 2022-01-17 22:38:33.614493243 -0500 +@@ -1291,9 +1291,14 @@ + resizemouse(const Arg *arg) + { + int ocx, ocy, nw, nh; ++ int ocx2, ocy2, nx, ny; + Client *c; + Monitor *m; + XEvent ev; ++ int horizcorner, vertcorner; ++ int di; ++ unsigned int dui; ++ Window dummy; + Time lasttime = 0; + + if (!(c = selmon->sel)) +@@ -1303,10 +1308,18 @@ + restack(selmon); + ocx = c->x; + ocy = c->y; ++ ocx2 = c->x + c->w; ++ ocy2 = c->y + c->h; + if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, + None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) + return; +- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); ++ if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) ++ return; ++ horizcorner = nx < c->w / 2; ++ vertcorner = ny < c->h / 2; ++ XWarpPointer (dpy, None, c->win, 0, 0, 0, 0, ++ horizcorner ? (-c->bw) : (c->w + c->bw -1), ++ vertcorner ? (-c->bw) : (c->h + c->bw -1)); + do { + XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); + switch(ev.type) { +@@ -1320,8 +1333,11 @@ + continue; + lasttime = ev.xmotion.time; + +- nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); +- nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); ++ nx = horizcorner ? ev.xmotion.x : c->x; ++ ny = vertcorner ? ev.xmotion.y : c->y; ++ nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); ++ nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); ++ + if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww + && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) + { +@@ -1330,11 +1346,13 @@ + togglefloating(NULL); + } + if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) +- resize(c, c->x, c->y, nw, nh, 1); ++ resize(c, nx, ny, nw, nh, 1); + break; + } + } while (ev.type != ButtonRelease); +- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); ++ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, ++ horizcorner ? (-c->bw) : (c->w + c->bw - 1), ++ vertcorner ? (-c->bw) : (c->h + c->bw - 1)); + XUngrabPointer(dpy, CurrentTime); + while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); + if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { diff --git a/patches/dwm-sticky-6.4.diff b/patches/dwm-sticky-6.4.diff new file mode 100644 index 0000000..2c26343 --- /dev/null +++ b/patches/dwm-sticky-6.4.diff @@ -0,0 +1,141 @@ +From d47ba0b8aab26ffb2569c0d05df24fdd61b3f4b0 Mon Sep 17 00:00:00 2001 +From: aymey +Date: Mon, 5 Dec 2022 22:57:41 +1100 +Subject: [PATCH] Sticky windows respect EWMH + +--- + dwm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 44 insertions(+), 7 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 253aba7..a9157bf 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -49,7 +49,7 @@ + #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) + #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ + * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) +-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) ++#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) + #define LENGTH(X) (sizeof X / sizeof X[0]) + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) + #define WIDTH(X) ((X)->w + 2 * (X)->bw) +@@ -61,7 +61,7 @@ + enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ + enum { SchemeNorm, SchemeSel }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, NetWMCheck, +- NetWMFullscreen, NetActiveWindow, NetWMWindowType, ++ NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ + enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, +@@ -92,7 +92,7 @@ struct Client { + int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; + int bw, oldbw; + unsigned int tags; +- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; ++ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky; + Client *next; + Client *snext; + Monitor *mon; +@@ -200,6 +200,7 @@ static void sendmon(Client *c, Monitor *m); + static void setclientstate(Client *c, long state); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); ++static void setsticky(Client *c, int sticky); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); + static void setup(void); +@@ -212,6 +213,7 @@ static void tagmon(const Arg *arg); + static void tile(Monitor *m); + static void togglebar(const Arg *arg); + static void togglefloating(const Arg *arg); ++static void togglesticky(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); +@@ -526,6 +528,10 @@ clientmessage(XEvent *e) + || cme->data.l[2] == netatom[NetWMFullscreen]) + setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ + || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); ++ ++ if (cme->data.l[1] == netatom[NetWMSticky] ++ || cme->data.l[2] == netatom[NetWMSticky]) ++ setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky))); + } else if (cme->message_type == netatom[NetActiveWindow]) { + if (c != selmon->sel && !c->isurgent) + seturgent(c, 1); +@@ -1498,6 +1504,23 @@ setfullscreen(Client *c, int fullscreen) + } + } + ++void ++setsticky(Client *c, int sticky) ++{ ++ ++ if(sticky && !c->issticky) { ++ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, ++ PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1); ++ c->issticky = 1; ++ } else if(!sticky && c->issticky){ ++ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, ++ PropModeReplace, (unsigned char *)0, 0); ++ c->issticky = 0; ++ arrange(c->mon); ++ } ++} ++ ++ + void + setlayout(const Arg *arg) + { +@@ -1560,6 +1583,7 @@ setup(void) + netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); + netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); + netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); ++ netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False); + netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); + netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); + netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); +@@ -1719,6 +1743,15 @@ togglefloating(const Arg *arg) + arrange(selmon); + } + ++void ++togglesticky(const Arg *arg) ++{ ++ if (!selmon->sel) ++ return; ++ setsticky(selmon->sel, !selmon->sel->issticky); ++ arrange(selmon); ++} ++ + void + toggletag(const Arg *arg) + { +@@ -2009,10 +2042,13 @@ updatewindowtype(Client *c) + Atom state = getatomprop(c, netatom[NetWMState]); + Atom wtype = getatomprop(c, netatom[NetWMWindowType]); + +- if (state == netatom[NetWMFullscreen]) +- setfullscreen(c, 1); +- if (wtype == netatom[NetWMWindowTypeDialog]) +- c->isfloating = 1; ++ if (state == netatom[NetWMFullscreen]) ++ setfullscreen(c, 1); ++ if (state == netatom[NetWMSticky]) { ++ setsticky(c, 1); ++ } ++ if (wtype == netatom[NetWMWindowTypeDialog]) ++ c->isfloating = 1; + } + + void +@@ -2147,3 +2183,4 @@ main(int argc, char *argv[]) + XCloseDisplay(dpy); + return EXIT_SUCCESS; + } ++ +-- +2.38.1 + diff --git a/patches_new/dwm-noborderflicker-20211227-8657affa2a61.diff b/patches_new/dwm-noborderflicker-20211227-8657affa2a61.diff deleted file mode 100644 index df2aeb3..0000000 --- a/patches_new/dwm-noborderflicker-20211227-8657affa2a61.diff +++ /dev/null @@ -1,42 +0,0 @@ -diff --git dwm.c dwm.c -index a96f33c..34d1321 100644 ---- dwm.c -+++ dwm.c -@@ -236,6 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee); - static void zoom(const Arg *arg); - - /* variables */ -+static Client *lastfocused = NULL; - static const char broken[] = "broken"; - static char stext[256]; - static int screen; -@@ -799,7 +800,11 @@ focus(Client *c) - detachstack(c); - attachstack(c); - grabbuttons(c, 1); -+ /* set new focused border first to avoid flickering */ - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); -+ /* lastfocused may be us if another window was unmanaged */ -+ if (lastfocused && lastfocused != c) -+ XSetWindowBorder(dpy, lastfocused->win, scheme[SchemeNorm][ColBorder].pixel); - setfocus(c); - } else { - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); -@@ -1758,7 +1763,7 @@ unfocus(Client *c, int setfocus) - if (!c) - return; - grabbuttons(c, 0); -- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); -+ lastfocused = c; - if (setfocus) { - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - XDeleteProperty(dpy, root, netatom[NetActiveWindow]); -@@ -1784,6 +1789,8 @@ unmanage(Client *c, int destroyed) - XSetErrorHandler(xerror); - XUngrabServer(dpy); - } -+ if (lastfocused == c) -+ lastfocused = NULL; - free(c); - focus(NULL); - updateclientlist(); diff --git a/patches_new/dwm-resizecorners-6.2.diff b/patches_new/dwm-resizecorners-6.2.diff deleted file mode 100644 index 016351c..0000000 --- a/patches_new/dwm-resizecorners-6.2.diff +++ /dev/null @@ -1,68 +0,0 @@ -diff -r -u a/dwm.c b/dwm.c ---- a/dwm.c 2019-02-02 07:55:28.000000000 -0500 -+++ b/dwm.c 2022-01-17 22:38:33.614493243 -0500 -@@ -1291,9 +1291,14 @@ - resizemouse(const Arg *arg) - { - int ocx, ocy, nw, nh; -+ int ocx2, ocy2, nx, ny; - Client *c; - Monitor *m; - XEvent ev; -+ int horizcorner, vertcorner; -+ int di; -+ unsigned int dui; -+ Window dummy; - Time lasttime = 0; - - if (!(c = selmon->sel)) -@@ -1303,10 +1308,18 @@ - restack(selmon); - ocx = c->x; - ocy = c->y; -+ ocx2 = c->x + c->w; -+ ocy2 = c->y + c->h; - if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, - None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess) - return; -- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); -+ if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui)) -+ return; -+ horizcorner = nx < c->w / 2; -+ vertcorner = ny < c->h / 2; -+ XWarpPointer (dpy, None, c->win, 0, 0, 0, 0, -+ horizcorner ? (-c->bw) : (c->w + c->bw -1), -+ vertcorner ? (-c->bw) : (c->h + c->bw -1)); - do { - XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); - switch(ev.type) { -@@ -1320,8 +1333,11 @@ - continue; - lasttime = ev.xmotion.time; - -- nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); -- nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); -+ nx = horizcorner ? ev.xmotion.x : c->x; -+ ny = vertcorner ? ev.xmotion.y : c->y; -+ nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1); -+ nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1); -+ - if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww - && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh) - { -@@ -1330,11 +1346,13 @@ - togglefloating(NULL); - } - if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) -- resize(c, c->x, c->y, nw, nh, 1); -+ resize(c, nx, ny, nw, nh, 1); - break; - } - } while (ev.type != ButtonRelease); -- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); -+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, -+ horizcorner ? (-c->bw) : (c->w + c->bw - 1), -+ vertcorner ? (-c->bw) : (c->h + c->bw - 1)); - XUngrabPointer(dpy, CurrentTime); - while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); - if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { diff --git a/patches_new/dwm-sticky-6.4.diff b/patches_new/dwm-sticky-6.4.diff deleted file mode 100644 index 2c26343..0000000 --- a/patches_new/dwm-sticky-6.4.diff +++ /dev/null @@ -1,141 +0,0 @@ -From d47ba0b8aab26ffb2569c0d05df24fdd61b3f4b0 Mon Sep 17 00:00:00 2001 -From: aymey -Date: Mon, 5 Dec 2022 22:57:41 +1100 -Subject: [PATCH] Sticky windows respect EWMH - ---- - dwm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------- - 1 file changed, 44 insertions(+), 7 deletions(-) - -diff --git a/dwm.c b/dwm.c -index 253aba7..a9157bf 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -49,7 +49,7 @@ - #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) - #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \ - * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) --#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) -+#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]) || C->issticky) - #define LENGTH(X) (sizeof X / sizeof X[0]) - #define MOUSEMASK (BUTTONMASK|PointerMotionMask) - #define WIDTH(X) ((X)->w + 2 * (X)->bw) -@@ -61,7 +61,7 @@ - enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ - enum { SchemeNorm, SchemeSel }; /* color schemes */ - enum { NetSupported, NetWMName, NetWMState, NetWMCheck, -- NetWMFullscreen, NetActiveWindow, NetWMWindowType, -+ NetWMFullscreen, NetWMSticky, NetActiveWindow, NetWMWindowType, - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ - enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ - enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, -@@ -92,7 +92,7 @@ struct Client { - int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid; - int bw, oldbw; - unsigned int tags; -- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; -+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, issticky; - Client *next; - Client *snext; - Monitor *mon; -@@ -200,6 +200,7 @@ static void sendmon(Client *c, Monitor *m); - static void setclientstate(Client *c, long state); - static void setfocus(Client *c); - static void setfullscreen(Client *c, int fullscreen); -+static void setsticky(Client *c, int sticky); - static void setlayout(const Arg *arg); - static void setmfact(const Arg *arg); - static void setup(void); -@@ -212,6 +213,7 @@ static void tagmon(const Arg *arg); - static void tile(Monitor *m); - static void togglebar(const Arg *arg); - static void togglefloating(const Arg *arg); -+static void togglesticky(const Arg *arg); - static void toggletag(const Arg *arg); - static void toggleview(const Arg *arg); - static void unfocus(Client *c, int setfocus); -@@ -526,6 +528,10 @@ clientmessage(XEvent *e) - || cme->data.l[2] == netatom[NetWMFullscreen]) - setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ - || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); -+ -+ if (cme->data.l[1] == netatom[NetWMSticky] -+ || cme->data.l[2] == netatom[NetWMSticky]) -+ setsticky(c, (cme->data.l[0] == 1 || (cme->data.l[0] == 2 && !c->issticky))); - } else if (cme->message_type == netatom[NetActiveWindow]) { - if (c != selmon->sel && !c->isurgent) - seturgent(c, 1); -@@ -1498,6 +1504,23 @@ setfullscreen(Client *c, int fullscreen) - } - } - -+void -+setsticky(Client *c, int sticky) -+{ -+ -+ if(sticky && !c->issticky) { -+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, -+ PropModeReplace, (unsigned char *) &netatom[NetWMSticky], 1); -+ c->issticky = 1; -+ } else if(!sticky && c->issticky){ -+ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, -+ PropModeReplace, (unsigned char *)0, 0); -+ c->issticky = 0; -+ arrange(c->mon); -+ } -+} -+ -+ - void - setlayout(const Arg *arg) - { -@@ -1560,6 +1583,7 @@ setup(void) - netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); - netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); - netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); -+ netatom[NetWMSticky] = XInternAtom(dpy, "_NET_WM_STATE_STICKY", False); - netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); - netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); - netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); -@@ -1719,6 +1743,15 @@ togglefloating(const Arg *arg) - arrange(selmon); - } - -+void -+togglesticky(const Arg *arg) -+{ -+ if (!selmon->sel) -+ return; -+ setsticky(selmon->sel, !selmon->sel->issticky); -+ arrange(selmon); -+} -+ - void - toggletag(const Arg *arg) - { -@@ -2009,10 +2042,13 @@ updatewindowtype(Client *c) - Atom state = getatomprop(c, netatom[NetWMState]); - Atom wtype = getatomprop(c, netatom[NetWMWindowType]); - -- if (state == netatom[NetWMFullscreen]) -- setfullscreen(c, 1); -- if (wtype == netatom[NetWMWindowTypeDialog]) -- c->isfloating = 1; -+ if (state == netatom[NetWMFullscreen]) -+ setfullscreen(c, 1); -+ if (state == netatom[NetWMSticky]) { -+ setsticky(c, 1); -+ } -+ if (wtype == netatom[NetWMWindowTypeDialog]) -+ c->isfloating = 1; - } - - void -@@ -2147,3 +2183,4 @@ main(int argc, char *argv[]) - XCloseDisplay(dpy); - return EXIT_SUCCESS; - } -+ --- -2.38.1 - -- cgit v1.2.3