mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
Added the force redraw on keypress patch
This commit is contained in:
parent
ae97f681fc
commit
a4d8ea1853
@ -1,4 +1,4 @@
|
|||||||
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.
|
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.2 (c279f5, 2020-04-19) 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.def.h):
|
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.def.h):
|
||||||
```c
|
```c
|
||||||
@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2020-04-20 - Added the force redraw on pselect after key is pressed patch
|
||||||
|
|
||||||
2020-03-29 - Added invert and workingdir patches
|
2020-03-29 - Added invert and workingdir patches
|
||||||
|
|
||||||
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-24 - Upgraded to latest (master) of st (commit 51e19ea11dd42eefed1ca136ee3f6be975f618b1 at the time of writing). Custom changes to make the altscreen mouse scollback patch working.
|
||||||
@ -68,6 +70,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||||||
- [font2](https://st.suckless.org/patches/font2/)
|
- [font2](https://st.suckless.org/patches/font2/)
|
||||||
- allows you to add a spare font besides the default
|
- allows you to add a spare font besides the default
|
||||||
|
|
||||||
|
- [force-redraw-after-keypress](https://lists.suckless.org/hackers/2004/17221.html)
|
||||||
|
- this patch forces the terminal to check for new data on the tty on keypress with the aim of reducing input latency
|
||||||
|
|
||||||
- [hidecursor](https://st.suckless.org/patches/hidecursor/)
|
- [hidecursor](https://st.suckless.org/patches/hidecursor/)
|
||||||
- hides the X cursor whenever a key is pressed and show it back when the mouse is moved in the terminal window
|
- hides the X cursor whenever a key is pressed and show it back when the mouse is moved in the terminal window
|
||||||
|
|
||||||
|
@ -82,6 +82,15 @@
|
|||||||
*/
|
*/
|
||||||
#define FONT2_PATCH 0
|
#define FONT2_PATCH 0
|
||||||
|
|
||||||
|
/* This patch creates a global flag which is set when a keypress is sent
|
||||||
|
* from X which forces the terminal to check for new data on the tty fd on
|
||||||
|
* every return from pselect(). When new data read from the tty results in
|
||||||
|
* a line being redrawn, the flag is reset. This results in a less input lag
|
||||||
|
* when typing on the terminal.
|
||||||
|
* https://lists.suckless.org/hackers/2004/17221.html
|
||||||
|
*/
|
||||||
|
#define FORCE_REDRAW_AFTER_KEYPRESS 0
|
||||||
|
|
||||||
/* Hide the X cursor whenever a key is pressed and show it back when the mouse is moved in
|
/* Hide the X cursor whenever a key is pressed and show it back when the mouse is moved in
|
||||||
* the terminal window.
|
* the terminal window.
|
||||||
* https://st.suckless.org/patches/hidecursor/
|
* https://st.suckless.org/patches/hidecursor/
|
||||||
|
21
x.c
21
x.c
@ -251,6 +251,9 @@ static DC dc;
|
|||||||
static XWindow xw;
|
static XWindow xw;
|
||||||
static XSelection xsel;
|
static XSelection xsel;
|
||||||
static TermWindow win;
|
static TermWindow win;
|
||||||
|
#if FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
static int pendingkpress = 0;
|
||||||
|
#endif // FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
|
||||||
/* Font Ring Cache */
|
/* Font Ring Cache */
|
||||||
enum {
|
enum {
|
||||||
@ -935,6 +938,12 @@ xclear(int x1, int y1, int x2, int y2)
|
|||||||
#endif // INVERT_PATCH
|
#endif // INVERT_PATCH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xclearwin(void)
|
||||||
|
{
|
||||||
|
xclear(0, 0, win.w, win.h);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xhints(void)
|
xhints(void)
|
||||||
{
|
{
|
||||||
@ -1937,6 +1946,10 @@ xdrawline(Line line, int x1, int y1, int x2)
|
|||||||
Glyph base, new;
|
Glyph base, new;
|
||||||
XftGlyphFontSpec *specs = xw.specbuf;
|
XftGlyphFontSpec *specs = xw.specbuf;
|
||||||
|
|
||||||
|
#if FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
pendingkpress = 0;
|
||||||
|
#endif // FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
|
||||||
numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1);
|
numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1);
|
||||||
i = ox = 0;
|
i = ox = 0;
|
||||||
for (x = x1; x < x2 && i < numspecs; x++) {
|
for (x = x1; x < x2 && i < numspecs; x++) {
|
||||||
@ -2168,6 +2181,10 @@ kpress(XEvent *ev)
|
|||||||
Status status;
|
Status status;
|
||||||
Shortcut *bp;
|
Shortcut *bp;
|
||||||
|
|
||||||
|
#if FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
pendingkpress = 1;
|
||||||
|
#endif // FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
|
||||||
#if HIDECURSOR_PATCH
|
#if HIDECURSOR_PATCH
|
||||||
if (xw.pointerisvisible) {
|
if (xw.pointerisvisible) {
|
||||||
XDefineCursor(xw.dpy, xw.win, xw.bpointer);
|
XDefineCursor(xw.dpy, xw.win, xw.bpointer);
|
||||||
@ -2330,6 +2347,10 @@ run(void)
|
|||||||
tv = &drawtimeout;
|
tv = &drawtimeout;
|
||||||
|
|
||||||
dodraw = 0;
|
dodraw = 0;
|
||||||
|
#if FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
|
if (pendingkpress)
|
||||||
|
dodraw = 1;
|
||||||
|
#endif // FORCE_REDRAW_AFTER_KEYPRESS
|
||||||
#if VISUALBELL_2_PATCH || VISUALBELL_3_PATCH
|
#if VISUALBELL_2_PATCH || VISUALBELL_3_PATCH
|
||||||
to_ms = -1; /* timeout in ms, indefinite if negative */
|
to_ms = -1; /* timeout in ms, indefinite if negative */
|
||||||
if (blinkset) {
|
if (blinkset) {
|
||||||
|
Loading…
Reference in New Issue
Block a user