sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 4d98b02f8b47d584723aa52a256b0c61cb3ad60c
parent 9350f7d4bf0d0b6750b4c2d6b36084b2d6e54c08
Author: Ivan Tham <pickfire@riseup.net>
Date:   Thu,  5 Nov 2015 22:46:47 +0800

Update mouse patch

Diffstat:
Mst.suckless.org/patches/scrollback.md | 4++--
Dst.suckless.org/patches/st-git-20151006-scrollback-mouse.diff | 73-------------------------------------------------------------------------
Ast.suckless.org/patches/st-git-20151104-scrollback-mouse.diff | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 75 deletions(-)

diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md @@ -14,12 +14,12 @@ Download Apply the following patch on top of the previous to allow scrolling using Shift+MouseWheel. -* [st-git-20151006-scrollback-mouse.diff](st-git-20151006-scrollback-mouse.diff) +* [st-git-20151104-scrollback-mouse.diff](st-git-20151104-scrollback-mouse.diff) Authors ------- * Jochen Sprickerhof - dwm@jochen.sprickerhof.de * M Farkas-Dyck - strake888@gmail.com - * Ivan Tham - pickfire@riseup.net (mouse scrolling, st-git-20150920 port) + * Ivan Tham - pickfire@riseup.net (mouse scrolling, st-git-2015\* port) * Laslo Hunhold - dev@frign.de (unscrambling, st-git-20150917 port) diff --git a/st.suckless.org/patches/st-git-20151006-scrollback-mouse.diff b/st.suckless.org/patches/st-git-20151006-scrollback-mouse.diff @@ -1,73 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 4ab9a68..6ea816b 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -135,10 +135,16 @@ static unsigned int defaultunderline = 7; - * Internal mouse shortcuts. - * Beware that overloading Button1 will disable the selection. - */ --static Mousekey mshortcuts[] = { -+static Mousekey mkeys[] = { - /* 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[] = { -+ /* 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 30ea2c3..0528117 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; -+} MouseShortcut; -+ -+typedef struct { - uint mod; - KeySym keysym; - void (*func)(const Arg *); -@@ -951,13 +958,14 @@ bpress(XEvent *e) - { - struct timespec now; - Mousekey *mk; -+ MouseShortcut *ms; - - if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { - mousereport(e); - return; - } - -- for (mk = mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) { -+ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { - if (e->xbutton.button == mk->b - && match(mk->mask, e->xbutton.state)) { - ttysend(mk->s, strlen(mk->s)); -@@ -965,6 +973,14 @@ 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); -+ return; -+ } -+ } -+ - if (e->xbutton.button == Button1) { - clock_gettime(CLOCK_MONOTONIC, &now); - diff --git a/st.suckless.org/patches/st-git-20151104-scrollback-mouse.diff b/st.suckless.org/patches/st-git-20151104-scrollback-mouse.diff @@ -0,0 +1,61 @@ +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; + } + }