summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-05-21 19:58:11 +0200
committerbakkeby <[email protected]>2020-05-21 19:58:11 +0200
commitfc8434abd1218fc33a4418bcde31cef10c12ede7 (patch)
tree86b9dea5214acf443bb1da120ced4b6efe7ae411 /patch
parent2cb3e697e41c09059dbff9ec903875a95d019a7f (diff)
downloaddwm-flexipatch-fc8434abd1218fc33a4418bcde31cef10c12ede7.tar.gz
dwm-flexipatch-fc8434abd1218fc33a4418bcde31cef10c12ede7.zip
Adding moveplace patch
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/moveplace.c29
-rw-r--r--patch/moveplace.h3
4 files changed, 38 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c
index 0b696cf..dc516fe 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -70,6 +70,9 @@
#if MDPCONTROL_PATCH
#include "mdpcontrol.c"
#endif
+#if MOVEPLACE_PATCH
+#include "moveplace.c"
+#endif
#if MOVERESIZE_PATCH
#include "moveresize.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 38821fa..5164236 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -73,6 +73,9 @@
#if MDPCONTROL_PATCH
#include "mdpcontrol.h"
#endif
+#if MOVEPLACE_PATCH
+#include "moveplace.h"
+#endif
#if MOVERESIZE_PATCH
#include "moveresize.h"
#endif
diff --git a/patch/moveplace.c b/patch/moveplace.c
new file mode 100644
index 0000000..fb9c099
--- /dev/null
+++ b/patch/moveplace.c
@@ -0,0 +1,29 @@
+void
+moveplace(const Arg *arg)
+{
+ Client *c;
+ int nh, nw, nx, ny;
+ c = selmon->sel;
+ if (!c || (arg->ui >= 9))
+ return;
+ if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
+ togglefloating(NULL);
+ nh = (selmon->wh / 3) - (c->bw * 2);
+ nw = (selmon->ww / 3) - (c->bw * 2);
+ nx = (arg->ui % 3) -1;
+ ny = (arg->ui / 3) -1;
+ if (nx < 0)
+ nx = selmon->wx;
+ else if(nx > 0)
+ nx = selmon->wx + selmon->ww - nw - c->bw*2;
+ else
+ nx = selmon->wx + selmon->ww/2 - nw/2 - c->bw;
+ if (ny <0)
+ ny = selmon->wy;
+ else if(ny > 0)
+ ny = selmon->wy + selmon->wh - nh - c->bw*2;
+ else
+ ny = selmon->wy + selmon->wh/2 - nh/2 - c->bw;
+ resize(c, nx, ny, nw, nh, True);
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, nw/2, nh/2);
+} \ No newline at end of file
diff --git a/patch/moveplace.h b/patch/moveplace.h
new file mode 100644
index 0000000..f921b8e
--- /dev/null
+++ b/patch/moveplace.h
@@ -0,0 +1,3 @@
+enum { WIN_NW, WIN_N, WIN_NE, WIN_W, WIN_C, WIN_E, WIN_SW, WIN_S, WIN_SE };
+
+static void moveplace(const Arg *arg); \ No newline at end of file