commit a26367dc403b3a459d6f6b2b6bfe98925c687e98
parent 20de838b33949bac21c0ad556ad4f7c8da0f5de5
Author: wh1tepearl <wh1tepearl@gmail.com>
Date: Mon, 2 Feb 2026 20:55:09 +0000
Support for changing cursor based on resized side in better resize
Diffstat:
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/modules.def.h b/modules.def.h
@@ -4,7 +4,8 @@
/* vxwm compile-time options */
/* Move/Resize */
-#define BETTER_RESIZE 1 // yeah it's better resize support.
+#define BETTER_RESIZE 1 // Enables 8 sided window resize.
+#define BR_CHANGE_CURSOR 1 // When resizing windows while having BETTER_RESIZE set to 1, the cursor will change depending on from which side you are resizing.
#define LOCK_MOVE_RESIZE_REFRESH_RATE 1 // Recomended to use on every pc, because cpu (software) rendered apps like ST will lagg when resizing even if you have a good pc.
#define USE_RESIZECLIENT_FUNC 0 // Use resizeclient function of instead of resize function which ignores window's resize hints, not recommended.
diff --git a/vxwm.c b/vxwm.c
@@ -54,7 +54,13 @@ Solved issues:
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
-enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+enum { CurNormal, CurResize, CurMove,
+#if BETTER_RESIZE && BR_CHANGE_CURSOR
+ CurNW, CurNE, CurSW, CurSE, // corner cursors
+ CurN, CurS, CurE, CurW, // edge cursors
+#endif
+ CurLast }; /* cursor */
+
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
@@ -1513,9 +1519,20 @@ resizemouse(const Arg *arg)
int right = rx > orig_w * 2 / 3;
int top = ry < orig_h / 3;
int bottom = ry > orig_h * 2 / 3;
-
- Cursor cur = cursor[CurResize]->cursor;
-
+#if BR_CHANGE_CURSOR
+ Cursor cur;
+ if (top && left) cur = cursor[CurNW]->cursor;
+ else if (top && right) cur = cursor[CurNE]->cursor;
+ else if (bottom && left) cur = cursor[CurSW]->cursor;
+ else if (bottom && right) cur = cursor[CurSE]->cursor;
+ else if (top) cur = cursor[CurN]->cursor;
+ else if (bottom) cur = cursor[CurS]->cursor;
+ else if (left) cur = cursor[CurW]->cursor;
+ else if (right) cur = cursor[CurE]->cursor;
+ else cur = cursor[CurResize]->cursor; // fallback
+#else
+ Cursor cur = cursor[CurResize]->cursor;
+#endif
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cur, CurrentTime) != GrabSuccess)
return;
@@ -1915,6 +1932,16 @@ setup(void)
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
+#if BETTER_RESIZE && BR_CHANGE_CURSOR
+ cursor[CurNW] = drw_cur_create(drw, XC_top_left_corner);
+ cursor[CurNE] = drw_cur_create(drw, XC_top_right_corner);
+ cursor[CurSW] = drw_cur_create(drw, XC_bottom_left_corner);
+ cursor[CurSE] = drw_cur_create(drw, XC_bottom_right_corner);
+ cursor[CurN] = drw_cur_create(drw, XC_top_side);
+ cursor[CurS] = drw_cur_create(drw, XC_bottom_side);
+ cursor[CurE] = drw_cur_create(drw, XC_right_side);
+ cursor[CurW] = drw_cur_create(drw, XC_left_side);
+#endif
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)