1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32: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

@ -770,7 +770,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
logpal = NULL;
init_palette();
term->has_focus = (GetForegroundWindow() == hwnd);
term_set_focus(term, GetForegroundWindow() == hwnd);
UpdateWindow(hwnd);
if (GetMessage(&msg, NULL, 0, 0) == 1) {
@ -787,7 +787,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
continue;
/* The messages seem unreliable; especially if we're being tricky */
term->has_focus = (GetForegroundWindow() == hwnd);
term_set_focus(term, GetForegroundWindow() == hwnd);
net_pending_errors();
@ -2317,7 +2317,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
net_pending_errors();
return 0;
case WM_SETFOCUS:
term->has_focus = TRUE;
term_set_focus(term, TRUE);
CreateCaret(hwnd, caretbm, font_width, font_height);
ShowCaret(hwnd);
flash_window(0); /* stop */
@ -2326,7 +2326,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
break;
case WM_KILLFOCUS:
show_mouseptr(1);
term->has_focus = FALSE;
term_set_focus(term, FALSE);
DestroyCaret();
caret_x = caret_y = -1; /* ensure caret is replaced next time */
term_update(term);