Applied the dragmfact patch

This commit is contained in:
Micah Gorrell 2023-05-12 08:42:20 -06:00
parent 071750b575
commit bce3b51fd2
3 changed files with 82 additions and 3 deletions

View File

@ -152,6 +152,6 @@ static const Key keys[] = {
static const Button buttons[] = { static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} }, { MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} }, { MODKEY, BTN_MIDDLE, moveresize, {.ui = Curmfact} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, { MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
}; };

11
dwl.c
View File

@ -72,7 +72,7 @@
#define IDLE_NOTIFY_ACTIVITY wlr_idle_notify_activity(idle, seat), wlr_idle_notifier_v1_notify_activity(idle_notifier, seat) #define IDLE_NOTIFY_ACTIVITY wlr_idle_notify_activity(idle, seat), wlr_idle_notifier_v1_notify_activity(idle_notifier, seat)
/* enums */ /* enums */
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */ enum { CurNormal, CurPressed, CurMove, CurResize, Curmfact }; /* cursor */
enum { XDGShell, LayerShell, X11Managed, X11Unmanaged }; /* client types */ enum { XDGShell, LayerShell, X11Managed, X11Unmanaged }; /* client types */
enum { LyrBg, LyrBottom, LyrTop, LyrOverlay, LyrTile, LyrFloat, LyrFS, LyrDragIcon, LyrBlock, NUM_LAYERS }; /* scene layers */ enum { LyrBg, LyrBottom, LyrTop, LyrOverlay, LyrTile, LyrFloat, LyrFS, LyrDragIcon, LyrBlock, NUM_LAYERS }; /* scene layers */
#ifdef XWAYLAND #ifdef XWAYLAND
@ -1738,6 +1738,9 @@ motionnotify(uint32_t time)
resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y, 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); .width = cursor->x - grabc->geom.x, .height = cursor->y - grabc->geom.y}, 1);
return; 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. */ /* Find the client under the pointer and send the event along. */
@ -1787,14 +1790,15 @@ moveresize(const Arg *arg)
return; return;
/* Float the window and tell motionnotify to grab it */ /* Float the window and tell motionnotify to grab it */
setfloating(grabc, 1);
switch (cursor_mode = arg->ui) { switch (cursor_mode = arg->ui) {
case CurMove: case CurMove:
setfloating(grabc, 1);
grabcx = cursor->x - grabc->geom.x; grabcx = cursor->x - grabc->geom.x;
grabcy = cursor->y - grabc->geom.y; grabcy = cursor->y - grabc->geom.y;
wlr_xcursor_manager_set_cursor_image(cursor_mgr, (cursor_image = "fleur"), cursor); wlr_xcursor_manager_set_cursor_image(cursor_mgr, (cursor_image = "fleur"), cursor);
break; break;
case CurResize: case CurResize:
setfloating(grabc, 1);
/* Doesn't work for X11 output - the next absolute motion event /* Doesn't work for X11 output - the next absolute motion event
* returns the cursor to where it started */ * returns the cursor to where it started */
wlr_cursor_warp_closest(cursor, NULL, wlr_cursor_warp_closest(cursor, NULL,
@ -1803,6 +1807,9 @@ moveresize(const Arg *arg)
wlr_xcursor_manager_set_cursor_image(cursor_mgr, wlr_xcursor_manager_set_cursor_image(cursor_mgr,
(cursor_image = "bottom_right_corner"), cursor); (cursor_image = "bottom_right_corner"), cursor);
break; break;
case Curmfact:
selmon->mfact = cursor->x / selmon->m.width;
arrange(selmon);
} }
} }

72
patches/dragmfact.patch Normal file
View File

@ -0,0 +1,72 @@
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);
}
}