[wiki] [sites] [st][scrollback] Update -mouse* to latest master || Ivan Tham

From: <git_AT_suckless.org>
Date: Thu, 27 Apr 2017 06:07:17 +0200

commit edde3f754aad8de0f329117dc7848097ba57d97f
Author: Ivan Tham <pickfire_AT_riseup.net>
Date: Thu Apr 27 12:07:13 2017 +0800

    [st][scrollback] Update -mouse* to latest master

diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md
index c1a63a0..6024489 100644
--- a/st.suckless.org/patches/scrollback.md
+++ b/st.suckless.org/patches/scrollback.md
_AT_@ -15,7 +15,7 @@ Download
 Apply the following patch on top of the previous to allow scrolling
 using `Shift+MouseWheel`.
 
-* [st-scrollback-mouse-20161020-6e79e83.diff](st-scrollback-mouse-20161020-6e79e83.diff)
+* [st-scrollback-mouse-20170427-5a10aca.diff](st-scrollback-mouse-20170427-5a10aca.diff)
 
 Apply the following patch on top of the previous two to allow scrollback using
 mouse wheel only when not in `MODE_ALTSCREEN`. For example the content is being
_AT_@ -23,7 +23,7 @@ scrolled instead of the scrollback buffer in `less`. Consequently the Shift
 modifier for scrolling is not needed anymore. **Note: It might break other
 mkeys excluding scrolling functions.**
 
-* [st-scrollback-mouse-altscreen-20170213-c63a87c.diff](st-scrollback-mouse-altscreen-20170213-c63a87c.diff)
+* [st-scrollback-mouse-altscreen-20170427-5a10aca.diff](st-scrollback-mouse-altscreen-20170427-5a10aca.diff)
 
 Authors
 -------
diff --git a/st.suckless.org/patches/st-scrollback-mouse-20161020-6e79e83.diff b/st.suckless.org/patches/st-scrollback-mouse-20161020-6e79e83.diff
deleted file mode 100644
index 05b8b45..0000000
--- a/st.suckless.org/patches/st-scrollback-mouse-20161020-6e79e83.diff
+++ /dev/null
_AT_@ -1,62 +0,0 @@
-diff --git a/config.def.h b/config.def.h
-index eae969e..34ebb44 100644
---- a/config.def.h
-+++ b/config.def.h
-_AT_@ -152,8 +152,14 @@ static unsigned int defaultunderline = 7;
- */
- static MouseShortcut mshortcuts[] = {
- /* button mask string */
-- { Button4, XK_ANY_MOD, "" },
-- { Button5, XK_ANY_MOD, "" },
-+ { Button4, XK_NO_MOD, "" },
-+ { Button5, XK_NO_MOD, "" },
-+};
-+
-+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 233d301..c71b6e7 100644
---- a/st.c
-+++ b/st.c
-_AT_@ -299,6 +299,13 @@ typedef union {
- const void *v;
- } Arg;
-
-+typedef struct {
-+ uint b;
-+ uint mask;
-+ void (*func)(const Arg *);
-+ const Arg arg;
-+} MouseKey;
-+
- typedef struct {
- uint mod;
- KeySym keysym;
-_AT_@ -953,6 +960,7 @@ bpress(XEvent *e)
- {
- struct timespec now;
- MouseShortcut *ms;
-+ MouseKey *mk;
-
- if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
- mousereport(e);
-_AT_@ -967,6 +975,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);
-
diff --git a/st.suckless.org/patches/st-scrollback-mouse-20170427-5a10aca.diff b/st.suckless.org/patches/st-scrollback-mouse-20170427-5a10aca.diff
new file mode 100644
index 0000000..434aded
--- /dev/null
+++ b/st.suckless.org/patches/st-scrollback-mouse-20170427-5a10aca.diff
_AT_@ -0,0 +1,87 @@
+diff --git a/config.def.h b/config.def.h
+index 3e9cda5..a9c65a9 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -156,8 +156,14 @@ unsigned int defaultattr = 11;
+ */
+ 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.c b/st.c
+index b74b9dc..d33eb5b 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -237,6 +237,7 @@ static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
+ /* config.h array lengths */
+ size_t colornamelen = LEN(colorname);
+ size_t mshortcutslen = LEN(mshortcuts);
++size_t mkeyslen = LEN(mkeys);
+ size_t shortcutslen = LEN(shortcuts);
+ size_t selmaskslen = LEN(selmasks);
+
+diff --git a/st.h b/st.h
+index 2d9b028..ca90c31 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -182,6 +182,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 *);
+_AT_@ -271,6 +278,8 @@ extern unsigned int mousebg;
+ extern unsigned int defaultattr;
+ extern MouseShortcut mshortcuts[];
+ extern size_t mshortcutslen;
++extern MouseKey mkeys[];
++extern size_t mkeyslen;
+ extern Shortcut shortcuts[];
+ extern size_t shortcutslen;
+ extern uint forceselmod;
+diff --git a/x.c b/x.c
+index 495cd90..67dcfdc 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -248,6 +248,7 @@ bpress(XEvent *e)
+ {
+ struct timespec now;
+ MouseShortcut *ms;
++ MouseKey *mk;
+
+ if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+ mousereport(e);
+_AT_@ -262,6 +263,14 @@ bpress(XEvent *e)
+ }
+ }
+
++ for (mk = mkeys; mk < mkeys + mkeyslen; 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);
+
diff --git a/st.suckless.org/patches/st-scrollback-mouse-altscreen-20170213-c63a87c.diff b/st.suckless.org/patches/st-scrollback-mouse-altscreen-20170213-c63a87c.diff
deleted file mode 100644
index 7af3a8a..0000000
--- a/st.suckless.org/patches/st-scrollback-mouse-altscreen-20170213-c63a87c.diff
+++ /dev/null
_AT_@ -1,25 +0,0 @@
-diff --git a/st.c b/st.c
-index f13b540..523f4ce 100644
---- a/st.c
-+++ b/st.c
-_AT_@ -979,13 +979,14 @@ bpress(XEvent *e)
- return;
- }
-
-- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
-- if (e->xbutton.button == ms->b
-- && match(ms->mask, e->xbutton.state)) {
-- ttysend(ms->s, strlen(ms->s));
-- return;
-+ if (IS_SET(MODE_ALTSCREEN))
-+ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
-+ if (e->xbutton.button == ms->b
-+ && match(ms->mask, e->xbutton.state)) {
-+ ttysend(ms->s, strlen(ms->s));
-+ return;
-+ }
- }
-- }
-
- for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
- if (e->xbutton.button == mk->b
diff --git a/st.suckless.org/patches/st-scrollback-mouse-altscreen-20170427-5a10aca.diff b/st.suckless.org/patches/st-scrollback-mouse-altscreen-20170427-5a10aca.diff
new file mode 100644
index 0000000..ed451fe
--- /dev/null
+++ b/st.suckless.org/patches/st-scrollback-mouse-altscreen-20170427-5a10aca.diff
_AT_@ -0,0 +1,40 @@
+diff --git a/config.def.h b/config.def.h
+index a9c65a9..b709419 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -162,8 +162,8 @@ MouseShortcut mshortcuts[] = {
+
+ MouseKey mkeys[] = {
+ /* button mask function argument */
+- { Button4, ShiftMask, kscrollup, {.i = 1} },
+- { Button5, ShiftMask, kscrolldown, {.i = 1} },
++ { Button4, XK_ANY_MOD, kscrollup, {.i = 1} },
++ { Button5, XK_ANY_MOD, kscrolldown, {.i = 1} },
+ };
+
+ /* Internal keyboard shortcuts. */
+diff --git a/x.c b/x.c
+index 67dcfdc..45af5f2 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -255,13 +255,14 @@ bpress(XEvent *e)
+ return;
+ }
+
+- for (ms = mshortcuts; ms < mshortcuts + mshortcutslen; ms++) {
+- if (e->xbutton.button == ms->b
+- && match(ms->mask, e->xbutton.state)) {
+- ttysend(ms->s, strlen(ms->s));
+- return;
++ if (IS_SET(MODE_ALTSCREEN))
++ for (ms = mshortcuts; ms < mshortcuts + mshortcutslen; ms++) {
++ if (e->xbutton.button == ms->b
++ && match(ms->mask, e->xbutton.state)) {
++ ttysend(ms->s, strlen(ms->s));
++ return;
++ }
+ }
+- }
+
+ for (mk = mkeys; mk < mkeys + mkeyslen; mk++) {
+ if (e->xbutton.button == mk->b
Received on Thu Apr 27 2017 - 06:07:17 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 27 2017 - 06:12:24 CEST