--- st.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index 0c917fd..ba769c5 100644 --- a/st.c +++ b/st.c _AT_@ -406,6 +406,7 @@ static void ttyresize(void); static void ttysend(char *, size_t); static void ttywrite(const char *, size_t); static void tstrsequence(uchar c); +static int tsetblinks(struct timespec *); static void xdraws(char *, Glyph, int, int, int, int); static void xhints(void); _AT_@ -3261,6 +3262,9 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { if(base.mode & ATTR_BLINK && term.mode & MODE_BLINK) fg = bg; + if(base.mode & ATTR_FASTBLINK && term.mode & MODE_FBLINK) + fg = bg; + if(base.mode & ATTR_INVISIBLE) fg = bg; _AT_@ -3768,6 +3772,26 @@ resize(XEvent *e) { cresize(e->xconfigure.width, e->xconfigure.height); } +int +tsetblinks(struct timespec *now) { + unsigned long long int t; + int blink, fblink, change = 0; + + t = now->tv_sec * 1000 + now->tv_nsec / 1000000; + blink = (t / blinktimeout) & 1; + if(!!(term.mode & MODE_BLINK) != blink) + change = 1; + + fblink = (t / (blinktimeout / 4)) & 1; + if(!!(term.mode & MODE_FBLINK) != fblink) + change = 1; + + MODBIT(term.mode, blink, MODE_BLINK); + MODBIT(term.mode, fblink, MODE_FBLINK); + + return change; +} + void run(void) { XEvent ev; _AT_@ -3824,10 +3848,9 @@ run(void) { tv = &drawtimeout; dodraw = 0; - if(blinktimeout && TIMEDIFF(now, lastblink) > blinktimeout) { + if(blinktimeout && blinkset && tsetblinks(&now)) { tsetdirtattr(ATTR_BLINK); - term.mode ^= MODE_BLINK; - lastblink = now; + tsetdirtattr(ATTR_FASTBLINK); dodraw = 1; } deltatime = TIMEDIFF(now, last); -- 1.8.5.3 --7JfCtLOvnd9MIVvH--Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Thu Jul 31 2014 - 12:24:02 CEST