1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

On Windows, show hidden mouse pointer on error.

If a terminal window closed with a popup (due to a network error,
for instance) while the mouse pointer was hidden by 'Hide mouse
pointer when typing in window', the mouse pointer could remain hidden
while over the terminal window, making it hard to navigate to the
popup.

(cherry picked from commit d9c4ce9fd8)
This commit is contained in:
Jacob Nevins 2020-04-14 20:36:46 +01:00 committed by Simon Tatham
parent 8896cf55bc
commit b22b4cc19f

View File

@ -89,6 +89,7 @@
#endif
static Mouse_Button translate_button(Mouse_Button button);
static void show_mouseptr(bool show);
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output);
@ -1199,6 +1200,7 @@ static void wintw_set_raw_mouse_mode(TermWin *tw, bool activate)
static void win_seat_connection_fatal(Seat *seat, const char *msg)
{
char *title = dupprintf("%s Fatal Error", appname);
show_mouseptr(true);
MessageBox(hwnd, msg, title, MB_ICONERROR | MB_OK);
sfree(title);
@ -2128,9 +2130,11 @@ static void win_seat_notify_remote_exit(Seat *seat)
/* exitcode == INT_MAX indicates that the connection was closed
* by a fatal error, so an error box will be coming our way and
* we should not generate this informational one. */
if (exitcode != INT_MAX)
if (exitcode != INT_MAX) {
show_mouseptr(true);
MessageBox(hwnd, "Connection closed by remote host",
appname, MB_OK | MB_ICONINFORMATION);
}
}
}
}
@ -5422,6 +5426,7 @@ void modalfatalbox(const char *fmt, ...)
va_start(ap, fmt);
message = dupvprintf(fmt, ap);
va_end(ap);
show_mouseptr(true);
title = dupprintf("%s Fatal Error", appname);
MessageBox(hwnd, message, title, MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
sfree(message);
@ -5440,6 +5445,7 @@ void nonfatal(const char *fmt, ...)
va_start(ap, fmt);
message = dupvprintf(fmt, ap);
va_end(ap);
show_mouseptr(true);
title = dupprintf("%s Error", appname);
MessageBox(hwnd, message, title, MB_ICONERROR | MB_OK);
sfree(message);
@ -5552,6 +5558,7 @@ static void wintw_bell(TermWin *tw, int mode)
if (!p_PlaySound || !p_PlaySound(bell_wavefile->path, NULL,
SND_ASYNC | SND_FILENAME)) {
char *buf, *otherbuf;
show_mouseptr(true);
buf = dupprintf(
"Unable to play sound file\n%s\nUsing default sound instead",
bell_wavefile->path);