commit 535af11c2d36a31478558c2eb5b675d011b55a5d
parent bddc8b04d690887ea6f8da6ff9aee7f9785e7e84
Author: siduck <siduck@tutanota.com>
Date: Sat, 31 Aug 2024 12:12:09 +0530
add swapmouse patch
Diffstat:
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -72,7 +72,7 @@ Add `st.url = "github:siduck/st";` to your inputs and install `inputs.st.package
- xresources
- sync patch ( Better draw timing to reduce flicker/tearing and improve animation smoothness )
- live reload ( change colors/fonts on the fly )
- and more...
+- st-swapmouse
<br>
## Xresources live-reload
diff --git a/x.c b/x.c
@@ -269,6 +269,9 @@ static char *opt_title = NULL;
static int oldbutton = 3; /* button event on startup: 3 = release */
static int cursorblinks = 0;
+static Cursor cursor;
+static XColor xmousefg, xmousebg;
+
void
clipcopy(const Arg *dummy)
{
@@ -1216,10 +1219,8 @@ void
xinit(int cols, int rows)
{
XGCValues gcvalues;
- Cursor cursor;
Window parent;
pid_t thispid = getpid();
- XColor xmousefg, xmousebg;
XWindowAttributes attr;
XVisualInfo vis;
@@ -1875,6 +1876,12 @@ xsetmode(int set, unsigned int flags)
{
int mode = win.mode;
MODBIT(win.mode, set, flags);
+ if (flags & MODE_MOUSE) {
+ if (win.mode & MODE_MOUSE)
+ XUndefineCursor(xw.dpy, xw.win);
+ else
+ XDefineCursor(xw.dpy, xw.win, cursor);
+ }
if ((win.mode & MODE_REVERSE) != (mode & MODE_REVERSE))
redraw();
}