1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Slight improvement to cursor blink timing: since the cursor doesn't

blink when the window doesn't have focus, we don't schedule blink
timers at that point either.

Infrastructure change: term->has_focus should now not be written
directly from outside terminal.c. Instead, use the function
term_set_focus, which will sort out the blink timers as well.

[originally from svn r4911]
This commit is contained in:
Simon Tatham
2004-11-27 19:34:45 +00:00
parent 02b0474f57
commit 92f3b101f5
5 changed files with 18 additions and 13 deletions

View File

@ -1043,10 +1043,9 @@ static void seen_disp_event(Terminal *term)
*/
static void term_schedule_tblink(Terminal *term)
{
if (term->tblink_pending)
return; /* already well in hand */
if (term->blink_is_real) {
term->next_tblink = schedule_timer(TBLINK_DELAY, term_timer, term);
if (!term->tblink_pending)
term->next_tblink = schedule_timer(TBLINK_DELAY, term_timer, term);
term->tblink_pending = TRUE;
} else {
term->tblinker = 1; /* reset when not in use */
@ -1059,10 +1058,9 @@ static void term_schedule_tblink(Terminal *term)
*/
static void term_schedule_cblink(Terminal *term)
{
if (term->cblink_pending)
return; /* already well in hand */
if (term->cfg.blink_cur) {
term->next_cblink = schedule_timer(CBLINK_DELAY, term_timer, term);
if (term->cfg.blink_cur && term->has_focus) {
if (!term->cblink_pending)
term->next_cblink = schedule_timer(CBLINK_DELAY, term_timer, term);
term->cblink_pending = TRUE;
} else {
term->cblinker = 1; /* reset when not in use */
@ -6074,3 +6072,9 @@ void term_provide_logctx(Terminal *term, void *logctx)
{
term->logctx = logctx;
}
void term_set_focus(Terminal *term, int has_focus)
{
term->has_focus = has_focus;
term_schedule_cblink(term);
}