diff --git a/dwm.c b/dwm.c index 6cc26d6..e3dbc7b 100644 --- a/dwm.c +++ b/dwm.c @@ -613,15 +613,14 @@ applyrules(Client *c) c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2); } #endif // SCRATCHPADS_PATCH | SCRATCHPAD_KEEP_POSITION_AND_SIZE_PATCH + for (m = mons; m && m->num != r->monitor; m = m->next); + if (m) + c->mon = m; #if FLOATPOS_PATCH if (c->isfloating && r->floatpos) setfloatpos(c, r->floatpos); #endif // FLOATPOS_PATCH - for (m = mons; m && m->num != r->monitor; m = m->next); - if (m) - c->mon = m; - #if SWITCHTAG_PATCH #if SWALLOW_PATCH if (r->switchtag && (c->noswallow || !termforwin(c))) @@ -2236,6 +2235,13 @@ manage(Window w, XWindowAttributes *wa) if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { c->mon = t->mon; c->tags = t->tags; + #if FLOATPOS_PATCH + #if SETBORDERPX_PATCH + c->bw = c->mon->borderpx; + #else + c->bw = borderpx; + #endif // SETBORDERPX_PATCH + #endif // FLOATPOS_PATCH } else { c->mon = selmon; #if FLOATPOS_PATCH @@ -2278,6 +2284,9 @@ manage(Window w, XWindowAttributes *wa) XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); #endif // FLOAT_BORDER_COLOR_PATCH configure(c); /* propagates border_width, if size doesn't change */ + #if !FLOATPOS_PATCH + updatesizehints(c); + #endif // FLOATPOS_PATCH if (getatomprop(c, netatom[NetWMState]) == netatom[NetWMFullscreen]) setfullscreen(c, 1); updatewmhints(c); diff --git a/patch/floatpos.c b/patch/floatpos.c index 0f9c57a..33f5bb6 100644 --- a/patch/floatpos.c +++ b/patch/floatpos.c @@ -100,10 +100,7 @@ getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp, case 'Z': // fixed client right-hand position (position + size) if (pos == -1) break; - if (pos > max_s) - pos = max_s; - if (pos < 0) - pos = 0; + pos = MAX(MIN(pos, max_s), 0); if (pCh == 'Z') cs = abs((cp + cs) - (min_p + pos)); else if (pCh == 'C') @@ -125,7 +122,7 @@ getfloatpos(int pos, char pCh, int size, char sCh, int min_p, int max_s, int cp, break; cp = min_p + delta * (size - 1); } else { - for (i = 0; i < pos -1 && cp >= min_p + delta * i + (i > pos - rest ? i + rest - pos + 1 : 0); i++); + for (i = 0; i < pos && cp >= min_p + delta * i + (i > pos - rest ? i + rest - pos + 1 : 0); i++); cp = min_p + delta * (MAX(MIN(i + size, pos), 1) - 1) + (i > pos - rest ? i + rest - pos + 1 : 0); } break;