mirror of https://github.com/0intro/wmii
Fix annoying Xinerama pointer constraint bug.
This commit is contained in:
parent
a434beeb0b
commit
c9150fb99a
|
@ -647,7 +647,7 @@ constrain(Rectangle r, int inset) {
|
|||
inset = Dy(screen->brect);
|
||||
/*
|
||||
* FIXME: This will cause problems for windows with
|
||||
* D(r) < 2 * isect
|
||||
* D(r) < 2 * inset
|
||||
*/
|
||||
|
||||
SET(best);
|
||||
|
@ -658,7 +658,7 @@ constrain(Rectangle r, int inset) {
|
|||
isect = rect_intersection(r, insetrect(s->r, inset));
|
||||
if(Dx(isect) >= 0 && Dy(isect) >= 0)
|
||||
return r;
|
||||
if(Dx(isect) < 0 && Dy(isect) < 0)
|
||||
if(Dx(isect) <= 0 && Dy(isect) <= 0)
|
||||
n = max(Dx(isect), Dy(isect));
|
||||
else
|
||||
n = min(Dx(isect), Dy(isect));
|
||||
|
@ -669,9 +669,10 @@ constrain(Rectangle r, int inset) {
|
|||
}
|
||||
|
||||
isect = insetrect(sbest->r, inset);
|
||||
p.x = min(r.max.x - isect.min.x, 0);
|
||||
p = ZP;
|
||||
p.x -= min(r.max.x - isect.min.x, 0);
|
||||
p.x -= max(r.min.x - isect.max.x, 0);
|
||||
p.y = min(r.max.y - isect.min.y, 0);
|
||||
p.y -= min(r.max.y - isect.min.y, 0);
|
||||
p.y -= max(r.min.y - isect.max.y, 0);
|
||||
return rectaddpt(r, p);
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ motion_event(Window *w, XMotionEvent *e) {
|
|||
Rectangle r, r2;
|
||||
|
||||
r = rectsetorigin(Rect(0, 0, 1, 1), Pt(e->x_root, e->y_root));
|
||||
r2 = constrain(r, 1);
|
||||
r2 = constrain(r, 0);
|
||||
if(!eqrect(r, r2))
|
||||
warppointer(r2.min);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue