cvsimport

* refs/heads/master:
  Ensure client stays inbound on key-based resize; based on logic existing in key-based client move; from Vadim Vygonets.
  When a window has a user or program specified position, ensure the edge of the final position is at least viewable and warp'able by the difference of bwidth; prevents mapping windows completely off the virtual screen.
This commit is contained in:
okan 2017-01-05 21:18:20 +00:00
commit b6a5b876e7
2 changed files with 17 additions and 11 deletions

View File

@ -736,17 +736,19 @@ client_placecalc(struct client_ctx *cc)
int xslack, yslack; int xslack, yslack;
if (cc->hint.flags & (USPosition | PPosition)) { if (cc->hint.flags & (USPosition | PPosition)) {
/* int wmax, hmax;
* Ignore XINERAMA screens, just make sure it's somewhere
* in the virtual desktop. else it stops people putting xterms wmax = DisplayWidth(X_Dpy, sc->which);
* at startup in the screen the mouse doesn't start in *sigh*. hmax = DisplayHeight(X_Dpy, sc->which);
* XRandR bits mean that {x,y}max shouldn't be outside what's
* currently there. if (cc->geom.x + ((int)cc->bwidth * 2) >= wmax)
*/ cc->geom.x = wmax - (cc->bwidth * 2);
xslack = sc->view.w - cc->geom.w - cc->bwidth * 2; if (cc->geom.x + cc->geom.w - ((int)cc->bwidth * 2) < 0)
yslack = sc->view.h - cc->geom.h - cc->bwidth * 2; cc->geom.x = -cc->geom.w;
cc->geom.x = MIN(cc->geom.x, xslack); if (cc->geom.y + ((int)cc->bwidth * 2) >= hmax)
cc->geom.y = MIN(cc->geom.y, yslack); cc->geom.y = hmax - (cc->bwidth * 2);
if (cc->geom.y + cc->geom.h - ((int)cc->bwidth * 2) < 0)
cc->geom.y = -cc->geom.h;
} else { } else {
struct geom area; struct geom area;
int xmouse, ymouse; int xmouse, ymouse;

View File

@ -156,6 +156,10 @@ kbfunc_client_resize(void *ctx, union arg *arg, enum xev xev)
cc->geom.w = cc->hint.minw; cc->geom.w = cc->hint.minw;
if ((cc->geom.h += my * cc->hint.inch) < cc->hint.minh) if ((cc->geom.h += my * cc->hint.inch) < cc->hint.minh)
cc->geom.h = cc->hint.minh; cc->geom.h = cc->hint.minh;
if (cc->geom.x + cc->geom.w < 0)
cc->geom.x = -cc->geom.w;
if (cc->geom.y + cc->geom.h < 0)
cc->geom.y = -cc->geom.h;
client_resize(cc, 1); client_resize(cc, 1);
/* Make sure the pointer stays within the window. */ /* Make sure the pointer stays within the window. */