commit e3e899245a69420b9081dea2d96660d3dcc74953
Author: Ivan Tham <[email protected]>
Date:   Tue Oct 6 10:35:57 2015 +0800

    [st] Update scrollback mouse and scrollback.md

diff --git a/st.suckless.org/patches/scrollback.md 
b/st.suckless.org/patches/scrollback.md
index 84a8ca7..6b95189 100644
--- a/st.suckless.org/patches/scrollback.md
+++ b/st.suckless.org/patches/scrollback.md
@@ -11,10 +11,10 @@ Download
 
 * [st-git-20150920-scrollback.diff](st-git-20150920-scrollback.diff)
 
-Apply the following patch on top of the previous to additionally
-allow scrolling using Shift+MouseWheel.
+Apply the following patch on top of the previous to allow scrolling
+using Shift+MouseWheel.
 
-* 
[st-git-20150917-scrollback-mouse.diff](st-git-20150917-scrollback-mouse.diff)
+* 
[st-git-20151006-scrollback-mouse.diff](st-git-20151006-scrollback-mouse.diff)
 
 Authors
 -------
diff --git a/st.suckless.org/patches/st-git-20150917-scrollback-mouse.diff 
b/st.suckless.org/patches/st-git-20150917-scrollback-mouse.diff
deleted file mode 100644
index f4d9649..0000000
--- a/st.suckless.org/patches/st-git-20150917-scrollback-mouse.diff
+++ /dev/null
@@ -1,73 +0,0 @@
-diff --git a/config.def.h b/config.def.h
-index c3636fc..6c98b36 100644
---- a/config.def.h
-+++ b/config.def.h
-@@ -133,10 +133,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,     "" },
--      { Button5,              XK_ANY_MOD,     "" },
-+      { Button4,              XK_NO_MOD,      "" },
-+      { Button5,              XK_NO_MOD,      "" },
-+};
-+
-+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 3aaeb86..7a35166 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-20151006-scrollback-mouse.diff 
b/st.suckless.org/patches/st-git-20151006-scrollback-mouse.diff
new file mode 100644
index 0000000..c9c05e1
--- /dev/null
+++ b/st.suckless.org/patches/st-git-20151006-scrollback-mouse.diff
@@ -0,0 +1,73 @@
+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,     "" },
+-      { Button5,              XK_ANY_MOD,     "" },
++      { Button4,              XK_NO_MOD,      "" },
++      { Button5,              XK_NO_MOD,      "" },
++};
++
++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);
+ 


Reply via email to