st-scrollback-mouse-altscreen-20190131-e23acb9.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       st-scrollback-mouse-altscreen-20190131-e23acb9.diff (1658B)
       ---
            1 diff --git a/config.def.h b/config.def.h
            2 index a6d2fb9..16830c8 100644
            3 --- a/config.def.h
            4 +++ b/config.def.h
            5 @@ -162,8 +162,8 @@ static MouseShortcut mshortcuts[] = {
            6  
            7  MouseKey mkeys[] = {
            8          /* button               mask            function        argument */
            9 -        { Button4,              ShiftMask,      kscrollup,      {.i =  1} },
           10 -        { Button5,              ShiftMask,      kscrolldown,    {.i =  1} },
           11 +        { Button4,              XK_NO_MOD,      kscrollup,      {.i =  1} },
           12 +        { Button5,              XK_NO_MOD,      kscrolldown,    {.i =  1} },
           13  };
           14  
           15  /* Internal keyboard shortcuts. */
           16 diff --git a/st.c b/st.c
           17 index 218ae73..f543305 100644
           18 --- a/st.c
           19 +++ b/st.c
           20 @@ -1058,6 +1058,11 @@ tnew(int col, int row)
           21          treset();
           22  }
           23  
           24 +int tisaltscr(void)
           25 +{
           26 +        return IS_SET(MODE_ALTSCREEN);
           27 +}
           28 +
           29  void
           30  tswapscreen(void)
           31  {
           32 diff --git a/st.h b/st.h
           33 index 3592957..23f4ca3 100644
           34 --- a/st.h
           35 +++ b/st.h
           36 @@ -95,6 +95,7 @@ void sendbreak(const Arg *);
           37  void toggleprinter(const Arg *);
           38  
           39  int tattrset(int);
           40 +int tisaltscr(void);
           41  void tnew(int, int);
           42  void tresize(int, int);
           43  void tsetdirtattr(int);
           44 diff --git a/x.c b/x.c
           45 index e9fd6e9..2dc315e 100644
           46 --- a/x.c
           47 +++ b/x.c
           48 @@ -417,11 +417,13 @@ bpress(XEvent *e)
           49                  return;
           50          }
           51  
           52 -        for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
           53 -                if (e->xbutton.button == ms->b
           54 -                                && match(ms->mask, e->xbutton.state)) {
           55 -                        ttywrite(ms->s, strlen(ms->s), 1);
           56 -                        return;
           57 +        if (tisaltscr()) {
           58 +                for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
           59 +                        if (e->xbutton.button == ms->b
           60 +                                        && match(ms->mask, e->xbutton.state)) {
           61 +                                ttywrite(ms->s, strlen(ms->s), 1);
           62 +                                return;
           63 +                        }
           64                  }
           65          }
           66