[wiki] [sites] [st] [patch] ported scrollback-mouse to version 0.8.2 || jacobprosser8

From: <git_AT_suckless.org>
Date: Fri, 26 Apr 2019 09:37:25 +0200

commit 40b3ca5266edc22d17d4d2b7ea7c4fd7a33d4cea
Author: jacobprosser8 <jacobprosser8_AT_gmail.com>
Date: Fri Apr 26 17:37:18 2019 +1000

    [st] [patch] ported scrollback-mouse to version 0.8.2

diff --git a/st.suckless.org/patches/scrollback/index.md b/st.suckless.org/patches/scrollback/index.md
index 4180dfc3..23cf19dd 100644
--- a/st.suckless.org/patches/scrollback/index.md
+++ b/st.suckless.org/patches/scrollback/index.md
_AT_@ -27,6 +27,7 @@ other than scrolling functions.**
 
 * [st-scrollback-mouse-altscreen-20170427-5a10aca.diff](st-scrollback-mouse-altscreen-20170427-5a10aca.diff)
 * [st-scrollback-mouse-altscreen-0.8.diff](st-scrollback-mouse-altscreen-0.8.diff)
+* [st-scrollback-mouse-altscreen-0.8.2.diff](st-scrollback-mouse-altscreen-0.8.2.diff)
 * [st-scrollback-mouse-altscreen-20190131-e23acb9.diff](st-scrollback-mouse-altscreen-20190131-e23acb9.diff)
 
 Notes
diff --git a/st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.2.diff b/st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.2.diff
new file mode 100644
index 00000000..c49bf896
--- /dev/null
+++ b/st.suckless.org/patches/scrollback/st-scrollback-mouse-0.8.2.diff
_AT_@ -0,0 +1,85 @@
+From 315f69069017122ca69d0319d0ad9481113fe5c8 Mon Sep 17 00:00:00 2001
+From: Jacob Prosser <jacoblouisprosser_AT_protonmail.com>
+Date: Fri, 26 Apr 2019 17:23:27 +1000
+Subject: [PATCH] Scrollback-Mouse for 0.8.2
+
+---
+ config.def.h | 10 ++++++++--
+ st.h | 8 ++++++++
+ x.c | 9 +++++++++
+ 3 files changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 7326a74..ad20c4c 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -156,8 +156,14 @@ static unsigned int defaultattr = 11;
+ */
+ static MouseShortcut mshortcuts[] = {
+ /* button mask string */
+- { Button4, XK_ANY_MOD, "" },
+- { Button5, XK_ANY_MOD, "" },
++ { Button4, XK_NO_MOD, "" },
++ { Button5, XK_NO_MOD, "" },
++};
++
++MouseKey mkeys[] = {
++ /* button mask function argument */
++ { Button4, ShiftMask, kscrollup, {.i = 1} },
++ { Button5, ShiftMask, kscrolldown, {.i = 1} },
+ };
+
+ /* Internal keyboard shortcuts. */
+diff --git a/st.h b/st.h
+index 17a79e0..3ac7f57 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -76,6 +76,13 @@ typedef union {
+ const void *v;
+ } Arg;
+
++typedef struct {
++ uint b;
++ uint mask;
++ void (*func)(const Arg *);
++ const Arg arg;
++} MouseKey;
++
+ void die(const char *, ...);
+ void redraw(void);
+ void draw(void);
+_AT_@ -122,3 +129,4 @@ extern char *termname;
+ extern unsigned int tabspaces;
+ extern unsigned int defaultfg;
+ extern unsigned int defaultbg;
++extern MouseKey mkeys[];
+diff --git a/x.c b/x.c
+index 0422421..e9fd6e9 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -409,6 +409,7 @@ bpress(XEvent *e)
+ {
+ struct timespec now;
+ MouseShortcut *ms;
++ MouseKey *mk;
+ int snap;
+
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+_AT_@ -424,6 +425,14 @@ bpress(XEvent *e)
+ }
+ }
+
++ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
++ if (e->xbutton.button == mk->b
++ && match(mk->mask, e->xbutton.state)) {
++ mk->func(&mk->arg);
++ return;
++ }
++ }
++
+ if (e->xbutton.button == Button1) {
+ /*
+ * If the user clicks below predefined timeouts specific
+--
+2.21.0
+
Received on Fri Apr 26 2019 - 09:37:25 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 26 2019 - 09:48:28 CEST