diff -r 3027df4b2c0d dwm.c --- a/dwm.c Thu Sep 27 20:08:21 2007 +0200 +++ b/dwm.c Sat Sep 29 13:20:10 2007 +0200 @@ -156,6 +156,7 @@ void mappingnotify(XEvent *e); void mappingnotify(XEvent *e); void maprequest(XEvent *e); void movemouse(Client *c); +void moveresize(const char *arg); Client *nexttiled(Client *c); void propertynotify(XEvent *e); void quit(const char *arg); @@ -1120,6 +1121,39 @@ movemouse(Client *c) { } } +void +moveresize(const char *arg) { + int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh; + char xAbs, yAbs, wAbs, hAbs; + int mx, my, dx, dy, nmx, nmy; + unsigned int dui; + Window dummy; + + if (layout->arrange != floating) + if (!sel || !sel->isfloating || !arg) + return; + if(sscanf(arg, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8) + return; + nx = xAbs == 'X' ? x : sel->x + x; + ny = yAbs == 'Y' ? y : sel->y + y; + nw = wAbs == 'W' ? w : sel->w + w; + nh = hAbs == 'H' ? h : sel->h + h; + + ox = sel->x; + oy = sel->y; + ow = sel->w; + oh = sel->h; + + Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &mx, &my, &dx, &dy, &dui); + resize(sel, nx, ny, nw, nh, True); + if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my) + { + nmx = mx-ox+sel->w-ow-1 < 0 ? 0 : mx-ox+sel->w-ow-1; + nmy = my-oy+sel->h-oh-1 < 0 ? 0 : my-oy+sel->h-oh-1; + XWarpPointer(dpy, None, sel->win, 0, 0, 0, 0, nmx, nmy); + } +} + Client * nexttiled(Client *c) { for(; c && (c->isfloating || !isvisible(c)); c = c->next);