Custom changes to make the altscreen mouse scollback patch working with latest version of st
This commit is contained in:
parent
87b8b9cf48
commit
4966f31256
|
@ -1,4 +1,4 @@
|
|||
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.2 (ed68fe7dce2b21b4e0e595b99d47790e76812cb7) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
|
||||
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.2 (51e19ea11dd42eefed1ca136ee3f6be975f618b1, 2020-02-18) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
|
||||
|
||||
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.h):
|
||||
```c
|
||||
|
@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||
|
||||
### Changelog:
|
||||
|
||||
2020-03-24 - Upgraded to latest (master) of st (commit 51e19ea11dd42eefed1ca136ee3f6be975f618b1 at the time of writing). Custom changes to make the altscreen mouse scollback patch working.
|
||||
|
||||
2020-03-21 - Added font2 patch
|
||||
|
||||
2020-01-07 - Added st embedder patch
|
||||
|
|
36
config.def.h
36
config.def.h
|
@ -274,6 +274,28 @@ static uint forcemousemod = ShiftMask;
|
|||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
#if CLIPBOARD_PATCH
|
||||
{ XK_ANY_MOD, Button2, clippaste, {.i = 0}, 1 },
|
||||
#else
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
#endif // CLIPBOARD_PATCH
|
||||
#if SCROLLBACK_MOUSE_PATCH
|
||||
{ ShiftMask, Button4, kscrollup, {.i = 1} },
|
||||
{ ShiftMask, Button5, kscrolldown, {.i = 1} },
|
||||
#endif // SCROLLBACK_MOUSE_PATCH
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
{ XK_NO_MOD, Button4, kscrollup, {.i = 1} },
|
||||
{ XK_NO_MOD, Button5, kscrolldown, {.i = 1} },
|
||||
#else
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
|
||||
};
|
||||
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
static MouseShortcut maltshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
#if CLIPBOARD_PATCH
|
||||
{ XK_ANY_MOD, Button2, clippaste, {.i = 0}, 1 },
|
||||
|
@ -283,19 +305,7 @@ static MouseShortcut mshortcuts[] = {
|
|||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
#if SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
MouseKey mkeys[] = {
|
||||
/* button mask function argument */
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
{ Button4, XK_NO_MOD, kscrollup, {.i = 1} },
|
||||
{ Button5, XK_NO_MOD, kscrolldown, {.i = 1} },
|
||||
#else
|
||||
{ Button4, ShiftMask, kscrollup, {.i = 1} },
|
||||
{ Button5, ShiftMask, kscrolldown, {.i = 1} },
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
};
|
||||
#endif // SCROLLBACK_MOUSE_PATCH / SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
|
||||
/* Internal keyboard shortcuts. */
|
||||
#define MODKEY Mod1Mask
|
||||
|
|
29
x.c
29
x.c
|
@ -399,6 +399,19 @@ mouseaction(XEvent *e, uint release)
|
|||
{
|
||||
MouseShortcut *ms;
|
||||
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
if (tisaltscr())
|
||||
for (ms = maltshortcuts; ms < maltshortcuts + LEN(maltshortcuts); ms++) {
|
||||
if (ms->release == release &&
|
||||
ms->button == e->xbutton.button &&
|
||||
(match(ms->mod, e->xbutton.state) || /* exact or forced */
|
||||
match(ms->mod, e->xbutton.state & ~forcemousemod))) {
|
||||
ms->func(&(ms->arg));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
|
||||
if (ms->release == release &&
|
||||
ms->button == e->xbutton.button &&
|
||||
|
@ -496,9 +509,6 @@ void
|
|||
bpress(XEvent *e)
|
||||
{
|
||||
struct timespec now;
|
||||
#if SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
MouseKey *mk;
|
||||
#endif // SCROLLBACK_MOUSE_PATCH / SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
int snap;
|
||||
|
||||
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forcemousemod)) {
|
||||
|
@ -506,22 +516,9 @@ bpress(XEvent *e)
|
|||
return;
|
||||
}
|
||||
|
||||
#if SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
if (tisaltscr())
|
||||
#endif // SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
if (mouseaction(e, 0))
|
||||
return;
|
||||
|
||||
#if SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
|
||||
if (e->xbutton.button == mk->b
|
||||
&& match(mk->mask, e->xbutton.state)) {
|
||||
mk->func(&mk->arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // SCROLLBACK_MOUSE_PATCH / SCROLLBACK_MOUSE_ALTSCREEN_PATCH
|
||||
|
||||
if (e->xbutton.button == Button1) {
|
||||
/*
|
||||
* If the user clicks below predefined timeouts specific
|
||||
|
|
Loading…
Reference in New Issue