mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-10-27 18:24:16 +00:00
73 lines
2.5 KiB
Diff
73 lines
2.5 KiB
Diff
From 27b59e9ebea0f5f5de6e00c82dd93db108c7bd95 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 | 11 +++++++++--
|
|
2 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index 419e6ef4..caf86d6e 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -153,6 +153,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 8043bf98..cda25079 100644
|
|
--- a/dwl.c
|
|
+++ b/dwl.c
|
|
@@ -72,7 +72,7 @@
|
|
#define IDLE_NOTIFY_ACTIVITY wlr_idle_notify_activity(idle, seat), wlr_idle_notifier_v1_notify_activity(idle_notifier, seat)
|
|
|
|
/* enums */
|
|
-enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
|
+enum { CurNormal, CurPressed, CurMove, CurResize, Curmfact }; /* cursor */
|
|
enum { XDGShell, LayerShell, X11Managed, X11Unmanaged }; /* client types */
|
|
enum { LyrBg, LyrBottom, LyrTop, LyrOverlay, LyrTile, LyrFloat, LyrFS, LyrDragIcon, LyrBlock, NUM_LAYERS }; /* scene layers */
|
|
#ifdef XWAYLAND
|
|
@@ -1649,6 +1649,9 @@ motionnotify(uint32_t time)
|
|
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
|
.width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1);
|
|
return;
|
|
+ } else if (cursor_mode == Curmfact) {
|
|
+ selmon->mfact = cursor->x / selmon->m.width;
|
|
+ arrange(selmon);
|
|
}
|
|
|
|
/* Find the client under the pointer and send the event along. */
|
|
@@ -1698,14 +1701,15 @@ moveresize(const Arg *arg)
|
|
return;
|
|
|
|
/* Float the window and tell motionnotify to grab it */
|
|
- setfloating(grabc, 1);
|
|
switch (cursor_mode = arg->ui) {
|
|
case CurMove:
|
|
+ setfloating(grabc, 1);
|
|
grabcx = cursor->x - grabc->geom.x;
|
|
grabcy = cursor->y - grabc->geom.y;
|
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr, (cursor_image = "fleur"), cursor);
|
|
break;
|
|
case CurResize:
|
|
+ setfloating(grabc, 1);
|
|
/* Doesn't work for X11 output - the next absolute motion event
|
|
* returns the cursor to where it started */
|
|
wlr_cursor_warp_closest(cursor, NULL,
|
|
@@ -1714,6 +1718,9 @@ moveresize(const Arg *arg)
|
|
wlr_xcursor_manager_set_cursor_image(cursor_mgr,
|
|
(cursor_image = "bottom_right_corner"), cursor);
|
|
break;
|
|
+ case Curmfact:
|
|
+ selmon->mfact = cursor->x / selmon->m.width;
|
|
+ arrange(selmon);
|
|
}
|
|
}
|
|
|