commit 0a76d06856177ee9f912af987fb5e756ac57b73c
parent b4c5902a8f0a46ea5f41b7c445ba9ea7475b67cf
Author: Ivan Tham <pickfire@riseup.net>
Date: Fri, 6 Nov 2015 16:31:23 +0800
Fix my own stupid patch
Diffstat:
3 files changed, 63 insertions(+), 62 deletions(-)
diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md
@@ -14,7 +14,7 @@ Download
Apply the following patch on top of the previous to allow scrolling
using Shift+MouseWheel.
-* [st-git-20151104-scrollback-mouse.diff](st-git-20151104-scrollback-mouse.diff)
+* [st-git-20151106-scrollback-mouse.diff](st-git-20151106-scrollback-mouse.diff)
Authors
-------
diff --git a/st.suckless.org/patches/st-git-20151104-scrollback-mouse.diff b/st.suckless.org/patches/st-git-20151104-scrollback-mouse.diff
@@ -1,61 +0,0 @@
-diff --cc config.def.h
-index 35060d7,6ea816b..0000000
---- a/config.def.h
-+++ b/config.def.h
-@@@ -135,10 -135,16 +135,16 @@@ static unsigned int defaultunderline =
- * Internal mouse shortcuts.
- * Beware that overloading Button1 will disable the selection.
- */
- -static Mousekey mkeys[] = {
- +static MouseShortcut mshortcuts[] = {
- /* button mask string */
-- { Button4, XK_ANY_MOD, "\031" },
-- { Button5, XK_ANY_MOD, "\005" },
-+ { Button4, XK_NO_MOD, "\031" },
-+ { Button5, XK_NO_MOD, "\005" },
-+ };
-+
- -static MouseShortcut mshortcuts[] = {
-++static MouseKey mkeys[] = {
-+ /* button mask function argument */
-+ { Button4, ShiftMask, kscrollup, { .i = 1 } },
-+ { Button5, ShiftMask, kscrolldown, { .i = 1 } },
- };
-
- /* Internal keyboard shortcuts. */
-diff --git a/st.c b/st.c
-index 00ea0dc..91d4230 100644
---- a/st.c
-+++ b/st.c
-@@ -326,7 +326,7 @@ typedef struct {
- uint mask;
- void (*func)(const Arg *);
- const Arg arg;
--} MouseShortcut;
-+} MouseKey;
-
- typedef struct {
- uint mod;
-@@ -959,6 +959,7 @@ bpress(XEvent *e)
- {
- struct timespec now;
- MouseShortcut *ms;
-+ MouseKey *mk;
-
- if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
- mousereport(e);
-@@ -973,10 +974,10 @@ bpress(XEvent *e)
- }
- }
-
-- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
-- if (e->xbutton.button == ms->b
-- && match(ms->mask, e->xbutton.state)) {
-- ms->func(&ms->arg);
-+ 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;
- }
- }
diff --git a/st.suckless.org/patches/st-git-20151106-scrollback-mouse.diff b/st.suckless.org/patches/st-git-20151106-scrollback-mouse.diff
@@ -0,0 +1,62 @@
+diff --git a/config.def.h b/config.def.h
+index 35060d7..30fa7a6 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -137,8 +137,14 @@ static unsigned int defaultunderline = 7;
+ */
+ static MouseShortcut mshortcuts[] = {
+ /* button mask string */
+- { Button4, XK_ANY_MOD, "\031" },
+- { Button5, XK_ANY_MOD, "\005" },
++ { Button4, XK_NO_MOD, "\031" },
++ { Button5, XK_NO_MOD, "\005" },
++};
++
++static MouseKey mkeys[] = {
++ /* button mask function argument */
++ { Button4, ShiftMask, kscrollup, {.i = 1} },
++ { Button5, ShiftMask, kscrolldown, {.i = 1} },
+ };
+
+ /* Internal keyboard shortcuts. */
+diff --git a/st.c b/st.c
+index 03b9473..91d4230 100644
+--- a/st.c
++++ b/st.c
+@@ -322,6 +322,13 @@ typedef union {
+ } Arg;
+
+ typedef struct {
++ uint b;
++ uint mask;
++ void (*func)(const Arg *);
++ const Arg arg;
++} MouseKey;
++
++typedef struct {
+ uint mod;
+ KeySym keysym;
+ void (*func)(const Arg *);
+@@ -952,6 +959,7 @@ bpress(XEvent *e)
+ {
+ struct timespec now;
+ MouseShortcut *ms;
++ MouseKey *mk;
+
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+ mousereport(e);
+@@ -966,6 +974,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) {
+ clock_gettime(CLOCK_MONOTONIC, &now);
+