diff options
author | rsc <devnull@localhost> | 2004-03-21 23:24:28 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-21 23:24:28 +0000 |
commit | e62ba5ec0bd3245fb70b033d3e4969b00db91452 (patch) | |
tree | e0650b08518cf74a54dff913e2767b3fd7f9daf5 /src/cmd/rio/grab.c | |
parent | 64044a070aab10224b1ccfc1a974887d5ec0c7aa (diff) | |
download | plan9port-e62ba5ec0bd3245fb70b033d3e4969b00db91452.tar.gz plan9port-e62ba5ec0bd3245fb70b033d3e4969b00db91452.tar.bz2 plan9port-e62ba5ec0bd3245fb70b033d3e4969b00db91452.zip |
Fix lots of warnings.
Incorporate changes from Andrey Mirtchovski.
Diffstat (limited to 'src/cmd/rio/grab.c')
-rw-r--r-- | src/cmd/rio/grab.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/cmd/rio/grab.c b/src/cmd/rio/grab.c index 233233d8..bcc14005 100644 --- a/src/cmd/rio/grab.c +++ b/src/cmd/rio/grab.c @@ -63,7 +63,6 @@ menuhit(XButtonEvent *e, Menu *m) XEvent ev; int i, n, cur, old, wide, high, status, drawn, warp; int x, y, dx, dy, xmax, ymax; - int tx, ty; ScreenInfo *s; if (font == 0) @@ -231,10 +230,12 @@ sweepcalc(Client *c, int x, int y) dx = x - c->x; dy = y - c->y; sx = sy = 1; + x += dx; if (dx < 0) { dx = -dx; sx = -1; } + y += dy; if (dy < 0) { dy = -dy; sy = -1; @@ -268,8 +269,8 @@ sweepcalc(Client *c, int x, int y) void dragcalc(Client *c, int x, int y) { - c->x = x; - c->y = y; + c->x += x; + c->y += y; } static void @@ -366,9 +367,12 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int)) c->dx += 2*BORDER; c->dy += 2*BORDER; if (e0) { + getmouse(&c->x, &c->y, c->screen); +/* c->x = cx = e0->x; c->y = cy = e0->y; recalc(c, e0->x, e0->y); +*/ } else getmouse(&cx, &cy, c->screen); @@ -387,7 +391,10 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int)) XGrabServer(dpy); idle = 0; } - recalc(c, rx, ry); + if(e0) + recalc(c, rx, ry); + else + recalc(c, rx-cx, ry-cy); cx = rx; cy = ry; drawbound(c, 1); @@ -405,7 +412,6 @@ sweepdrag(Client *c, XButtonEvent *e0, void (*recalc)(Client*, int, int)) XUngrabServer(dpy); if (e->button != Button3 && c->init) goto bad; - recalc(c, ev.xbutton.x, ev.xbutton.y); if (c->dx < 0) { c->x += c->dx; c->dx = -c->dx; @@ -466,13 +472,6 @@ drag(Client *c) ScreenInfo *s; s = c->screen; - if (c->init) - setmouse(c->x-BORDER, c->y-BORDER, s); - else { - getmouse(&c->x, &c->y, s); /* start at current mouse pos */ - c->x += BORDER; - c->y += BORDER; - } status = grab(s->root, s->root, ButtonMask, s->boxcurs, 0); if (status != GrabSuccess) { graberror("drag", status); /* */ |