From 32f9a73c0dd8ecdeae93f9f2a7b08b7da024cf4b Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 13 Sep 2020 14:22:31 +0200 Subject: [PATCH] scratchtags: allow moving / resizing scratchtag window to another monitor + minor comment --- dwm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dwm.c b/dwm.c index e71f305..0b8f83a 100644 --- a/dwm.c +++ b/dwm.c @@ -1297,7 +1297,7 @@ configurerequest(XEvent *e) c->h = ev->height; } if ((c->x + c->w) > m->mx + m->mw && c->isfloating) - c->x = m->mx + (m->mw / 2 - WIDTH(c) / 2); /* center in x direction */ + c->x = m->mx + (m->mw / 2 - WIDTH(c) / 2); /* center in x direction */ if ((c->y + c->h) > m->my + m->mh && c->isfloating) c->y = m->my + (m->mh / 2 - HEIGHT(c) / 2); /* center in y direction */ if ((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))) @@ -2363,6 +2363,12 @@ movemouse(const Arg *arg) } while (ev.type != ButtonRelease); XUngrabPointer(dpy, CurrentTime); if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { + #if SCRATCHPADS_PATCH + if (c->tags & SPTAGMASK) { + c->mon->tagset[c->mon->seltags] ^= (c->tags & SPTAGMASK); + m->tagset[m->seltags] |= (c->tags & SPTAGMASK); + } + #endif // SCRATCHPADS_PATCH sendmon(c, m); selmon = m; focus(NULL); @@ -2554,6 +2560,11 @@ resizeclient(Client *c, int x, int y, int w, int h) configure(c); #if FAKEFULLSCREEN_CLIENT_PATCH if (c->fakefullscreen == 1) + /* Exception: if the client was in actual fullscreen and we exit out to fake fullscreen + * mode, then the focus would drift to whichever window is under the mouse cursor at the + * time. To avoid this we pass True to XSync which will make the X server disregard any + * other events in the queue thus cancelling the EnterNotify event that would otherwise + * have changed focus. */ XSync(dpy, True); else XSync(dpy, False); @@ -2689,6 +2700,12 @@ resizemouse(const Arg *arg) XUngrabPointer(dpy, CurrentTime); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) { + #if SCRATCHPADS_PATCH + if (c->tags & SPTAGMASK) { + c->mon->tagset[c->mon->seltags] ^= (c->tags & SPTAGMASK); + m->tagset[m->seltags] |= (c->tags & SPTAGMASK); + } + #endif // SCRATCHPADS_PATCH sendmon(c, m); selmon = m; focus(NULL);