diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-01-13 20:57:40 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-01-13 20:57:40 +0200 |
| commit | d2032b4c979883e10192283a5efc41d23ca2de81 (patch) | |
| tree | f7f994434478286330612b95de8783c22593c7b3 /monsterwm.c | |
| parent | a0591a0cb96436686462ab42da12d967c5bced20 (diff) | |
windows can be resized freelly
Diffstat (limited to 'monsterwm.c')
| -rw-r--r-- | monsterwm.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/monsterwm.c b/monsterwm.c index 8a71e8d..5537ef1 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -86,6 +86,7 @@ static void maprequest(XEvent *e); static void move_down(); static void move_up(); static void mousemove(const Arg *arg); +static void mouseresize(const Arg *arg); static void next_win(); static void prev_win(); static void propertynotify(XEvent *e); @@ -409,6 +410,32 @@ void mousemove(const Arg *arg) { XUngrabPointer(dis, CurrentTime); } +void mouseresize(const Arg *arg) { + if (!current || !arg) return; + static XWindowAttributes wa; + XGetWindowAttributes(dis, current->win, &wa); + + if (XGrabPointer(dis, root, False, BUTTONMASK|PointerMotionMask, GrabModeAsync, + GrabModeAsync, None, None, CurrentTime) != GrabSuccess) return; + int x, y, z; unsigned int v; Window w; + XQueryPointer(dis, root, &w, &w, &x, &y, &z, &z, &v); + + XEvent ev; + do { + XMaskEvent(dis, BUTTONMASK|PointerMotionMask|SubstructureRedirectMask, &ev); + switch (ev.type) { + case ConfigureRequest: + case MapRequest: + events[ev.type](&ev); + break; + case MotionNotify: + XResizeWindow(dis, current->win, wa.width + ev.xmotion.x - x, wa.height + ev.xmotion.y - y); + break; + } + } while(ev.type != ButtonRelease); + XUngrabPointer(dis, CurrentTime); +} + /* move the current client, to current->next * and current->next to current client's position */ |
