commit 4a242c59d447a6744b4efbff5689d7fc457a416e
Author: Matthias Schoth <[email protected]>
Date:   Wed Feb 3 19:30:32 2016 +0100

    Introduce ALTSCREEN detection in the scrollback patch for st

diff --git a/st.suckless.org/patches/scrollback.md 
b/st.suckless.org/patches/scrollback.md
index 45c4f90..1d0b4cc 100644
--- a/st.suckless.org/patches/scrollback.md
+++ b/st.suckless.org/patches/scrollback.md
@@ -16,6 +16,13 @@ using Shift+MouseWheel.
 
 * 
[st-git-20151106-scrollback-mouse.diff](st-git-20151106-scrollback-mouse.diff)
 
+Apply the following patch on top of the previous two to allow scrolling
+the backbuffer using MouseWheel only when not in MODE_ALTSCREEN.
+This way when e.g. viweing files in less the content is being scrolled instead 
of the 
+scrollback buffer. Consequently the Shift modifier for scrolling is not needed 
anymore.
+
+* 
[st-git-20160203-scrollback-mouse-altscreen.diff](st-git-20160203-scrollback-mouse-altscreen.diff)
+
 Authors
 -------
 
@@ -24,3 +31,4 @@ Authors
  * Ivan Tham - [email protected] (mouse scrolling, st-git-20151122 port)
  * Laslo Hunhold - [email protected] (unscrambling, st-git-20151106 port)
  * Ori Bernstein - [email protected] (fix memory bug, st-git-20151216 port)
+ * Matthias Schoth - [email protected] (auto altscreen scrolling)
diff --git 
a/st.suckless.org/patches/st-git-20160203-scrollback-mouse-altscreen.diff 
b/st.suckless.org/patches/st-git-20160203-scrollback-mouse-altscreen.diff
new file mode 100644
index 0000000..99faf08
--- /dev/null
+++ b/st.suckless.org/patches/st-git-20160203-scrollback-mouse-altscreen.diff
@@ -0,0 +1,40 @@
+diff --git a/config.def.h b/config.def.h
+index db0bf24..1610013 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -143,8 +143,8 @@ static MouseShortcut mshortcuts[] = {
+ 
+ static MouseKey mkeys[] = {
+       /* button               mask            function        argument */
+-      { Button4,              ShiftMask,      kscrollup,      {.i =  1} },
+-      { Button5,              ShiftMask,      kscrolldown,    {.i =  1} },
++      { Button4,              XK_NO_MOD,      kscrollup,      {.i =  1} },
++      { Button5,              XK_NO_MOD,      kscrolldown,    {.i =  1} },
+ };
+ 
+ /* Internal keyboard shortcuts. */
+diff --git a/st.c b/st.c
+index 1c9df8f..acb4d8a 100644
+--- a/st.c
++++ b/st.c
+@@ -967,13 +967,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


Reply via email to