Fix annoying Xinerama pointer constraint bug.

This commit is contained in:
Kris Maglione 2008-12-09 19:23:34 -05:00
parent a434beeb0b
commit c9150fb99a
3 changed files with 7 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -10,7 +10,7 @@ PREFIX = /usr/local
# Includes and libs
INCPATH = .:$(ROOT)/include:$(INCLUDE):/usr/include
LIBS = -L/usr/lib -L$(ROOT)/lib
LIBS = -L$(ROOT)/lib -L/usr/lib
# Flags
include $(ROOT)/mk/gcc.mk