sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit edde3f754aad8de0f329117dc7848097ba57d97f
parent 82d41d9ac96b80bc4f091c0036ec4e10f28a0887
Author: Ivan Tham <pickfire@riseup.net>
Date:   Thu, 27 Apr 2017 12:07:13 +0800

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

Diffstat:
Mst.suckless.org/patches/scrollback.md | 4++--
Dst.suckless.org/patches/st-scrollback-mouse-20161020-6e79e83.diff | 62--------------------------------------------------------------
Ast.suckless.org/patches/st-scrollback-mouse-20170427-5a10aca.diff | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-scrollback-mouse-altscreen-20170213-c63a87c.diff | 25-------------------------
Ast.suckless.org/patches/st-scrollback-mouse-altscreen-20170427-5a10aca.diff | 40++++++++++++++++++++++++++++++++++++++++
5 files changed, 129 insertions(+), 89 deletions(-)

diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md @@ -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 @@ -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 @@ -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 -@@ -152,8 +152,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 233d301..c71b6e7 100644 ---- a/st.c -+++ b/st.c -@@ -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; -@@ -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); -@@ -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 @@ -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 +@@ -156,8 +156,14 @@ unsigned int defaultattr = 11; + */ + 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" }, ++}; ++ ++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 +@@ -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 +@@ -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 *); +@@ -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 +@@ -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); +@@ -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 @@ -1,25 +0,0 @@ -diff --git a/st.c b/st.c -index f13b540..523f4ce 100644 ---- a/st.c -+++ b/st.c -@@ -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 @@ -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 +@@ -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 +@@ -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