1 From 580e3f386e9215707100e9ba44797701943fd927 Mon Sep 17 00:00:00 2001
2 From: asparagii <michele.lambertucci1@gmail.com>
3 Date: Thu, 27 Jan 2022 15:49:27 +0100
4 Subject: [PATCH] st-scrollback-mouse-altscreen
11 4 files changed, 10 insertions(+), 2 deletions(-)
13 diff --git a/config.def.h b/config.def.h
14 index c217315..c223706 100644
17 @@ -176,8 +176,8 @@ static uint forcemousemod = ShiftMask;
19 static MouseShortcut mshortcuts[] = {
20 /* mask button function argument release */
21 - { ShiftMask, Button4, kscrollup, {.i = 1} },
22 - { ShiftMask, Button5, kscrolldown, {.i = 1} },
23 + { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 },
24 + { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 },
25 { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
26 { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
27 { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
28 diff --git a/st.c b/st.c
29 index f3af82b..876a6bf 100644
32 @@ -1060,6 +1060,11 @@ tnew(int col, int row)
38 + return IS_SET(MODE_ALTSCREEN);
44 diff --git a/st.h b/st.h
45 index da36b34..e95c6f8 100644
48 @@ -89,6 +89,7 @@ void sendbreak(const Arg *);
49 void toggleprinter(const Arg *);
54 void tresize(int, int);
55 void tsetdirtattr(int);
56 diff --git a/x.c b/x.c
57 index cd96575..9274556 100644
60 @@ -34,6 +34,7 @@ typedef struct {
61 void (*func)(const Arg *);
64 + int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
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 : -1))) &&
73 (match(ms->mod, state) || /* exact or forced */
74 match(ms->mod, state & ~forcemousemod))) {