summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2021-02-16 09:43:44 +0100
committerbakkeby <[email protected]>2021-02-16 09:43:44 +0100
commit009b84cbdc0495807c054564d45c66bda601dd3f (patch)
tree7360498fa791d48eb5c710dc3749ce469db6d0a5
parent9fcfa8d6ce45d7c7530f447c200ab8977c997e78 (diff)
downloaddwm-flexipatch-009b84cbdc0495807c054564d45c66bda601dd3f.tar.gz
dwm-flexipatch-009b84cbdc0495807c054564d45c66bda601dd3f.zip
placemouse: upgrade to include moveorplace function
-rw-r--r--config.def.h10
-rw-r--r--patch/placemouse.c10
-rw-r--r--patch/placemouse.h1
3 files changed, 18 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h
index 58e6b1a..ecd9036 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1171,14 +1171,20 @@ static Button buttons[] = {
#else
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
#endif // BAR_STATUSCMD_PATCH
- { ClkClientWin, MODKEY, Button1, movemouse, {0} },
#if PLACEMOUSE_PATCH
/* placemouse options, choose which feels more natural:
* 0 - tiled position is relative to mouse cursor
* 1 - tiled postiion is relative to window center
* 2 - mouse pointer warps to window center
+ *
+ * The moveorplace uses movemouse or placemouse depending on the floating state
+ * of the selected client. Set up individual keybindings for the two if you want
+ * to control these separately (i.e. to retain the feature to move a tiled window
+ * into a floating position).
*/
- { ClkClientWin, MODKEY|ControlMask, Button1, placemouse, {.i = 1} },
+ { ClkClientWin, MODKEY, Button1, moveorplace, {.i = 1} },
+ #else
+ { ClkClientWin, MODKEY, Button1, movemouse, {0} },
#endif // PLACEMOUSE_PATCH
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
diff --git a/patch/placemouse.c b/patch/placemouse.c
index f8f61eb..4f8fcc3 100644
--- a/patch/placemouse.c
+++ b/patch/placemouse.c
@@ -1,4 +1,12 @@
void
+moveorplace(const Arg *arg) {
+ if ((!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating))
+ movemouse(arg);
+ else
+ placemouse(arg);
+}
+
+void
placemouse(const Arg *arg)
{
int x, y, px, py, ocx, ocy, nx = -9999, ny = -9999, freemove = 0;
@@ -117,9 +125,9 @@ placemouse(const Arg *arg)
attach(c);
attachstack(c);
selmon = m;
- focus(c);
}
+ focus(c);
c->beingmoved = 0;
if (nx != -9999)
diff --git a/patch/placemouse.h b/patch/placemouse.h
index 50acece..8687ae3 100644
--- a/patch/placemouse.h
+++ b/patch/placemouse.h
@@ -1,5 +1,6 @@
#define INTERSECTC(x,y,w,h,z) (MAX(0, MIN((x)+(w),(z)->x+(z)->w) - MAX((x),(z)->x)) \
* MAX(0, MIN((y)+(h),(z)->y+(z)->h) - MAX((y),(z)->y)))
+static void moveorplace(const Arg *arg);
static void placemouse(const Arg *arg);
static Client *recttoclient(int x, int y, int w, int h);