[wiki] [sites] [st][patch] swapmouse - new patch for st || Ashish Kumar Yadav

From: <git_AT_suckless.org>
Date: Mon, 20 Jul 2020 10:10:30 +0200

commit c454207a99aa74e8ea7041760822b00cd507eba6
Author: Ashish Kumar Yadav <ashishkumar.yadav_AT_students.iiserpune.ac.in>
Date: Mon Jul 20 13:38:05 2020 +0530

    [st][patch] swapmouse - new patch for st
    
    changes mouse shape to global default in programs subscribed for mouse events.

diff --git a/st.suckless.org/patches/swapmouse/index.md b/st.suckless.org/patches/swapmouse/index.md
new file mode 100644
index 00000000..06e0633d
--- /dev/null
+++ b/st.suckless.org/patches/swapmouse/index.md
_AT_@ -0,0 +1,17 @@
+swapmouse
+===============
+
+Description
+-----------
+
+This patch changes the mouse shape to the global default when the running
+program subscribes for mouse events, for instance, in programs like ranger and
+fzf. It emulates the behaviour shown by vte terminals like termite.
+
+Download
+--------
+* [st-swapmouse-0.8.4.diff](st-swapmouse-0.8.4.diff)
+
+Authors
+-------
+* Ashish Kumar Yadav - <ashishkumar.yadav_AT_students.iiserpune.ac.in>
diff --git a/st.suckless.org/patches/swapmouse/st-swapmouse-0.8.4.diff b/st.suckless.org/patches/swapmouse/st-swapmouse-0.8.4.diff
new file mode 100644
index 00000000..d948dae6
--- /dev/null
+++ b/st.suckless.org/patches/swapmouse/st-swapmouse-0.8.4.diff
_AT_@ -0,0 +1,37 @@
+diff -up st-0.8.4-ori/x.c st-0.8.4/x.c
+--- st-0.8.4-ori/x.c 2020-06-19 14:59:45.000000000 +0530
++++ st-0.8.4/x.c 2020-07-20 03:39:56.260922736 +0530
+_AT_@ -254,6 +254,9 @@ static char *opt_title = NULL;
+
+ static int oldbutton = 3; /* button event on startup: 3 = release */
+
++static Cursor cursor;
++static XColor xmousefg, xmousebg;
++
+ void
+ clipcopy(const Arg *dummy)
+ {
+_AT_@ -1099,10 +1102,8 @@ void
+ xinit(int cols, int rows)
+ {
+ XGCValues gcvalues;
+- Cursor cursor;
+ Window parent;
+ pid_t thispid = getpid();
+- XColor xmousefg, xmousebg;
+
+ if (!(xw.dpy = XOpenDisplay(NULL)))
+ die("can't open display
");
+_AT_@ -1683,6 +1684,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();
+ }
Received on Mon Jul 20 2020 - 10:10:30 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 20 2020 - 10:12:48 CEST