wheel scrollback in normal, non-alt screen mode

patches from https://st.suckless.org/patches/scrollback/:

* https://st.suckless.org/patches/scrollback/st-scrollback-reflow-0.8.5.diff
* https://st.suckless.org/patches/scrollback/st-scrollback-mouse-20220127-2c5edf2.diff
* https://st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20220127-2c5edf2.diff

co-authored-by: Jochen Sprickerhof <st@jochen.sprickerhof.de>
co-authored-by: M Farkas-Dyck <strake888@gmail.com>
co-authored-by: Ivan Tham <pickfire@riseup.net>
co-authored-by: Ori Bernstein <ori@eigenstate.org>
co-authored-by: Matthias Schoth <mschoth@gmail.com>
co-authored-by: Laslo Hunhold <dev@frign.de>
co-authored-by: Paride Legovini <pl@ninthfloor.org>
co-authored-by: Lorenzo Bracco <devtry@riseup.net>
co-authored-by: Kamil Kleban <funmaker95@gmail.com>
co-authored-by: Avi Halachmi <avihpit@yahoo.com>
co-authored-by: Jacob Prosser <geriatricjacob@cumallover.me>
co-authored-by: Alexander Arkhipov <scm_2022@mineeyes.cyou>
co-authored-by: Ashish Kumar Yadav <ashishkumar.yadav@students.iiserpune.ac.in>
master
alex 2 years ago
parent b2c1b111f9
commit b7ac8947d8

@ -178,14 +178,18 @@ static uint forcemousemod = ShiftMask;
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.
*
* alt screen - 0: don't care, -1: not alt screen, 1: alt screen
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
/* mask button function argument release alt screen */
{ XK_ANY_MOD, Button4, kscrollup, {.i = 3}, 0, -1 },
{ XK_ANY_MOD, Button5, kscrolldown, {.i = 3}, 0, -1 },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
};
/* Internal keyboard shortcuts. */

939
st.c

File diff suppressed because it is too large Load Diff

26
st.h

@ -22,17 +22,19 @@
enum glyph_attribute {
ATTR_NULL = 0,
ATTR_BOLD = 1 << 0,
ATTR_FAINT = 1 << 1,
ATTR_ITALIC = 1 << 2,
ATTR_UNDERLINE = 1 << 3,
ATTR_BLINK = 1 << 4,
ATTR_REVERSE = 1 << 5,
ATTR_INVISIBLE = 1 << 6,
ATTR_STRUCK = 1 << 7,
ATTR_WRAP = 1 << 8,
ATTR_WIDE = 1 << 9,
ATTR_WDUMMY = 1 << 10,
ATTR_SET = 1 << 0,
ATTR_BOLD = 1 << 1,
ATTR_FAINT = 1 << 2,
ATTR_ITALIC = 1 << 3,
ATTR_UNDERLINE = 1 << 4,
ATTR_BLINK = 1 << 5,
ATTR_REVERSE = 1 << 6,
ATTR_INVISIBLE = 1 << 7,
ATTR_STRUCK = 1 << 8,
ATTR_WRAP = 1 << 9,
ATTR_WIDE = 1 << 10,
ATTR_WDUMMY = 1 << 11,
ATTR_SELECTED = 1 << 12,
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
};
@ -88,8 +90,10 @@ void printsel(const Arg *);
void sendbreak(const Arg *);
void toggleprinter(const Arg *);
int tisaltscr(void);
int tattrset(int);
void tnew(int, int);
int tisaltscreen(void);
void tresize(int, int);
void tsetdirtattr(int);
void ttyhangup(void);

2
x.c

@ -35,6 +35,7 @@ typedef struct {
void (*func)(const Arg *);
const Arg arg;
uint release;
int altscrn;
} MouseShortcut;
typedef struct {
@ -457,6 +458,7 @@ mouseaction(XEvent *e, uint release)
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (ms->release == release &&
ms->button == e->xbutton.button &&
(!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
(match(ms->mod, state) || /* exact or forced */
match(ms->mod, state & ~forcemousemod))) {
ms->func(&(ms->arg));

Loading…
Cancel
Save