[wiki] [sites] added resizecorners patch || dusty

From: <git_AT_suckless.org>
Date: Wed, 13 May 2015 01:45:07 +0200

commit 527df0bff04911131a9b95109fbc71cd5d403986
Author: dusty <dusty_AT_teknik.io>
Date: Tue May 12 23:44:32 2015 +0000

    added resizecorners patch

diff --git a/dwm.suckless.org/patches/dwm-6.0-resizecorners.diff b/dwm.suckless.org/patches/dwm-6.0-resizecorners.diff
new file mode 100644
index 0000000..1ff8bda
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.0-resizecorners.diff
_AT_@ -0,0 +1,69 @@
+diff -up dwm-6.0/dwm.c dwm-6.0-resizecorners/dwm.c
+--- dwm-6.0/dwm.c 2011-12-19 15:02:46.000000000 +0000
++++ dwm-6.0-resizecorners/dwm.c 2015-05-12 23:31:10.803508011 +0000
+_AT_@ -1364,20 +1364,35 @@ resizeclient(Client *c, int x, int y, in
+ void
+ resizemouse(const Arg *arg) {
+ int ocx, ocy;
++ int ocx2, ocy2;
++ int nx, ny;
+ int nw, nh;
+ Client *c;
+ Monitor *m;
+ XEvent ev;
++ int horizcorner, vertcorner;
++ int di;
++ unsigned int dui;
++ Window dummy;
+
+ if(!(c = selmon->sel))
+ return;
+ restack(selmon);
+ ocx = c->x;
+ ocy = c->y;
++ ocx2 = c->x + c->w;
++ ocy2 = c->y + c->h;
+ if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
+ None, cursor[CurResize], CurrentTime) != GrabSuccess)
+ return;
+- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
++ if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui))
++ return;
++ horizcorner = nx < c->w / 2;
++ vertcorner = ny < c->h / 2;
++ XWarpPointer (dpy, None, c->win, 0, 0, 0, 0,
++ horizcorner ? (-c->bw) : (c->w + c->bw - 1),
++ vertcorner ? (-c->bw) : (c->h + c->bw - 1));
++
+ do {
+ XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
+ switch(ev.type) {
+_AT_@ -1387,8 +1402,10 @@ resizemouse(const Arg *arg) {
+ handler[ev.type](&ev);
+ break;
+ case MotionNotify:
+- nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
+- nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
++ nx = horizcorner ? ev.xmotion.x : c->x;
++ ny = vertcorner ? ev.xmotion.y : c->y;
++ nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1);
++ nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1);
+ if(c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
+ && c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
+ {
+_AT_@ -1397,11 +1414,13 @@ resizemouse(const Arg *arg) {
+ togglefloating(NULL);
+ }
+ if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
+- resize(c, c->x, c->y, nw, nh, True);
++ resize(c, nx, ny, nw, nh, True);
+ break;
+ }
+ } while(ev.type != ButtonRelease);
+- XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
++ XWarpPointer (dpy, None, c->win, 0, 0, 0, 0,
++ horizcorner ? (-c->bw) : (c->w + c->bw - 1),
++ vertcorner ? (-c->bw) : (c->h + c->bw - 1));
+ XUngrabPointer(dpy, CurrentTime);
+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+ if((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
diff --git a/dwm.suckless.org/patches/resizecorners.md b/dwm.suckless.org/patches/resizecorners.md
new file mode 100644
index 0000000..ee1eb26
--- /dev/null
+++ b/dwm.suckless.org/patches/resizecorners.md
_AT_@ -0,0 +1,13 @@
+# resizecorners
+
+## Description
+
+By default, windows only from the bottom right corner. With this Patch, the mouse is warped to the nearest corner and you resize from there.
+
+## Download
+
+ * [dwm-6.0-resizecorners.diff](dwm-6.0-resizecorners.diff) (12.05.2015)
+
+## Author
+
+ * dusty - <dusty_AT_teknik.io>
Received on Wed May 13 2015 - 01:45:07 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:40:21 CEST