1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
From 435cdf673e5a8080123109dbf874aac2ccef1498 Mon Sep 17 00:00:00 2001
From: Palanix <palanixyt@gmail.com>
Date: Fri, 25 Mar 2022 23:45:10 +0100
Subject: [PATCH] Change mfact using Middle mouse
---
config.def.h | 2 +-
dwl.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 9009517..3c26522 100644
--- a/config.def.h
+++ b/config.def.h
@@ -166,6 +166,6 @@ static const Key keys[] = {
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
- { MODKEY, BTN_MIDDLE, togglefloating, {0} },
+ { MODKEY, BTN_MIDDLE, moveresize, {.ui = Curmfact} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};
diff --git a/dwl.c b/dwl.c
index fa76db2..528e102 100644
--- a/dwl.c
+++ b/dwl.c
@@ -76,7 +76,7 @@
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
/* enums */
-enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
+enum { CurNormal, CurPressed, CurMove, CurResize, Curmfact }; /* cursor */
enum { XDGShell, LayerShell, X11 }; /* client types */
enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrFS, LyrTop, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */
#ifdef XWAYLAND
@@ -1639,6 +1639,9 @@ motionnotify(uint32_t time)
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
.width = ROUND(cursor->x) - grabc->geom.x, .height = ROUND(cursor->y) - grabc->geom.y}, 1);
return;
+ } else if (cursor_mode == Curmfact && time) {
+ selmon->mfact = (float) (cursor->x / selmon->m.width);
+ arrange(selmon);
}
/* Find the client under the pointer and send the event along. */
@@ -1701,6 +1704,10 @@ moveresize(const Arg *arg)
grabc->geom.y + grabc->geom.height);
wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
break;
+ case Curmfact:
+ setfloating(grabc, 0);
+ selmon->mfact = (float) (cursor->x / selmon->m.width);
+ arrange(selmon);
}
}
--
2.43.2
|