st-scrollback-mouse-altscreen-20220127-2c5edf2.diff - sites - public wiki conte… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
st-scrollback-mouse-altscreen-20220127-2c5edf2.diff (2338B) | |
--- | |
1 From 580e3f386e9215707100e9ba44797701943fd927 Mon Sep 17 00:00:00 2001 | |
2 From: asparagii <[email protected]> | |
3 Date: Thu, 27 Jan 2022 15:49:27 +0100 | |
4 Subject: [PATCH] st-scrollback-mouse-altscreen | |
5 | |
6 --- | |
7 config.def.h | 4 ++-- | |
8 st.c | 5 +++++ | |
9 st.h | 1 + | |
10 x.c | 2 ++ | |
11 4 files changed, 10 insertions(+), 2 deletions(-) | |
12 | |
13 diff --git a/config.def.h b/config.def.h | |
14 index c217315..c223706 100644 | |
15 --- a/config.def.h | |
16 +++ b/config.def.h | |
17 @@ -176,8 +176,8 @@ static uint forcemousemod = ShiftMask; | |
18 */ | |
19 static MouseShortcut mshortcuts[] = { | |
20 /* mask button function argument … | |
21 - { ShiftMask, Button4, kscrollup, {.i = 1} }, | |
22 - { ShiftMask, Button5, kscrolldown, {.i = 1} }, | |
23 + { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, … | |
24 + { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, … | |
25 { XK_ANY_MOD, Button2, selpaste, {.i = 0}, … | |
26 { ShiftMask, Button4, ttysend, {.s = "\033[5;… | |
27 { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} … | |
28 diff --git a/st.c b/st.c | |
29 index f3af82b..876a6bf 100644 | |
30 --- a/st.c | |
31 +++ b/st.c | |
32 @@ -1060,6 +1060,11 @@ tnew(int col, int row) | |
33 treset(); | |
34 } | |
35 | |
36 +int tisaltscr(void) | |
37 +{ | |
38 + return IS_SET(MODE_ALTSCREEN); | |
39 +} | |
40 + | |
41 void | |
42 tswapscreen(void) | |
43 { | |
44 diff --git a/st.h b/st.h | |
45 index da36b34..e95c6f8 100644 | |
46 --- a/st.h | |
47 +++ b/st.h | |
48 @@ -89,6 +89,7 @@ void sendbreak(const Arg *); | |
49 void toggleprinter(const Arg *); | |
50 | |
51 int tattrset(int); | |
52 +int tisaltscr(void); | |
53 void tnew(int, int); | |
54 void tresize(int, int); | |
55 void tsetdirtattr(int); | |
56 diff --git a/x.c b/x.c | |
57 index cd96575..9274556 100644 | |
58 --- a/x.c | |
59 +++ b/x.c | |
60 @@ -34,6 +34,7 @@ typedef struct { | |
61 void (*func)(const Arg *); | |
62 const Arg arg; | |
63 uint release; | |
64 + int altscrn; /* 0: don't care, -1: not alt screen, 1: alt scr… | |
65 } MouseShortcut; | |
66 | |
67 typedef struct { | |
68 @@ -455,6 +456,7 @@ mouseaction(XEvent *e, uint release) | |
69 for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { | |
70 if (ms->release == release && | |
71 ms->button == e->xbutton.button && | |
72 + (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 :… | |
73 (match(ms->mod, state) || /* exact or forced */ | |
74 match(ms->mod, state & ~forcemousemod))) { | |
75 ms->func(&(ms->arg)); | |
76 -- | |
77 2.34.1 | |
78 |