From d0c0f5247bd11a788b4f173ca6241b51a3adb458 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl <0x6A73@pm.me> Date: Thu, 25 Apr 2024 00:22:01 -0600 Subject: tidy some code + scroll patch --- patches/st-scrollback-mouse-altscreen-0.8.diff | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 patches/st-scrollback-mouse-altscreen-0.8.diff (limited to 'patches/st-scrollback-mouse-altscreen-0.8.diff') diff --git a/patches/st-scrollback-mouse-altscreen-0.8.diff b/patches/st-scrollback-mouse-altscreen-0.8.diff new file mode 100644 index 0000000..8ee58d9 --- /dev/null +++ b/patches/st-scrollback-mouse-altscreen-0.8.diff @@ -0,0 +1,66 @@ +diff --git a/config.def.h b/config.def.h +index feec7e2..f1a9768 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -162,8 +162,8 @@ static MouseShortcut mshortcuts[] = { + + 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 1d8c12a..458dcfa 100644 +--- a/st.c ++++ b/st.c +@@ -1051,6 +1051,11 @@ tnew(int col, int row) + treset(); + } + ++int tisaltscr(void) ++{ ++ return IS_SET(MODE_ALTSCREEN); ++} ++ + void + tswapscreen(void) + { +diff --git a/st.h b/st.h +index cdd25ae..e6143f0 100644 +--- a/st.h ++++ b/st.h +@@ -99,6 +99,7 @@ void sendbreak(const Arg *); + void toggleprinter(const Arg *); + + int tattrset(int); ++int tisaltscr(void); + void tnew(int, int); + void tresize(int, int); + void tsetdirtattr(int); +diff --git a/x.c b/x.c +index 1de5f6c..991bc3e 100644 +--- a/x.c ++++ b/x.c +@@ -417,11 +417,13 @@ bpress(XEvent *e) + return; + } + +- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { +- if (e->xbutton.button == ms->b +- && match(ms->mask, e->xbutton.state)) { +- ttywrite(ms->s, strlen(ms->s), 1); +- return; ++ if (tisaltscr()) { ++ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { ++ if (e->xbutton.button == ms->b ++ && match(ms->mask, e->xbutton.state)) { ++ ttywrite(ms->s, strlen(ms->s), 1); ++ return; ++ } + } + } + -- cgit v1.2.3