scratchtags: allow moving / resizing scratchtag window to another monitor + minor comment

pull/48/head
bakkeby 4 years ago
parent fada5790a2
commit 32f9a73c0d

19
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);

Loading…
Cancel
Save