Merge branch 'dennisleexyz-mouse'

This commit is contained in:
Luke Smith 2020-07-08 11:13:33 -04:00
commit 3f51ba298c
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252
4 changed files with 15 additions and 9 deletions

View File

@ -228,10 +228,8 @@ static MouseShortcut mshortcuts[] = {
MouseKey mkeys[] = { MouseKey mkeys[] = {
/* button mask function argument */ /* button mask function argument */
{ Button4, ShiftMask, kscrollup, {.i = 1} }, { Button4, XK_NO_MOD, kscrollup, {.i = 1} },
{ Button5, ShiftMask, kscrolldown, {.i = 1} }, { Button5, XK_NO_MOD, kscrolldown, {.i = 1} },
{ Button4, MODKEY, kscrollup, {.i = 1} },
{ Button5, MODKEY, kscrolldown, {.i = 1} },
{ Button4, TERMMOD, zoom, {.f = +1} }, { Button4, TERMMOD, zoom, {.f = +1} },
{ Button5, TERMMOD, zoom, {.f = -1} }, { Button5, TERMMOD, zoom, {.f = -1} },
}; };

5
st.c
View File

@ -1063,6 +1063,11 @@ tnew(int col, int row)
treset(); treset();
} }
int tisaltscr(void)
{
return IS_SET(MODE_ALTSCREEN);
}
void void
tswapscreen(void) tswapscreen(void)
{ {

1
st.h
View File

@ -104,6 +104,7 @@ void sendbreak(const Arg *);
void toggleprinter(const Arg *); void toggleprinter(const Arg *);
int tattrset(int); int tattrset(int);
int tisaltscr(void);
void tnew(int, int); void tnew(int, int);
void tresize(int, int); void tresize(int, int);
void tsetdirtattr(int); void tsetdirtattr(int);

12
x.c
View File

@ -442,11 +442,13 @@ bpress(XEvent *e)
return; return;
} }
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { if (tisaltscr()) {
if (e->xbutton.button == ms->b for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
&& match(ms->mask, e->xbutton.state)) { if (e->xbutton.button == ms->b
ttywrite(ms->s, strlen(ms->s), 1); && match(ms->mask, e->xbutton.state)) {
return; ttywrite(ms->s, strlen(ms->s), 1);
return;
}
} }
} }