st-scrollback-mouse-altscreen-0.8.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-0.8.diff (1658B)
---
1 diff --git a/config.def.h b/config.def.h
2 index feec7e2..f1a9768 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 1d8c12a..458dcfa 100644
18 --- a/st.c
19 +++ b/st.c
20 @@ -1051,6 +1051,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 cdd25ae..e6143f0 100644
34 --- a/st.h
35 +++ b/st.h
36 @@ -99,6 +99,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 1de5f6c..991bc3e 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