mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-26 09:42:25 +00:00
Disable warn-on-close for inactive windows
[originally from svn r357]
This commit is contained in:
parent
3c7d363fd8
commit
812ea3f61c
2
putty.h
2
putty.h
@ -65,6 +65,8 @@ GLOBAL int app_cursor_keys, app_keypad_keys;
|
|||||||
GLOBAL int seen_key_event;
|
GLOBAL int seen_key_event;
|
||||||
GLOBAL int seen_disp_event;
|
GLOBAL int seen_disp_event;
|
||||||
|
|
||||||
|
GLOBAL int session_closed;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
US_NONE = 0, US_KEY = 1, US_DISP = 2, US_BOTH = 3
|
US_NONE = 0, US_KEY = 1, US_DISP = 2, US_BOTH = 3
|
||||||
} Unscroll_Trigger;
|
} Unscroll_Trigger;
|
||||||
|
5
window.c
5
window.c
@ -309,6 +309,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
|
|||||||
set_icon (msg);
|
set_icon (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session_closed = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up the input and output buffers.
|
* Set up the input and output buffers.
|
||||||
*/
|
*/
|
||||||
@ -631,7 +633,7 @@ static int WINAPI WndProc (HWND hwnd, UINT message,
|
|||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
break;
|
break;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
if (!cfg.warn_on_close ||
|
if (!cfg.warn_on_close || session_closed ||
|
||||||
MessageBox(hwnd, "Are you sure you want to close this session?",
|
MessageBox(hwnd, "Are you sure you want to close this session?",
|
||||||
"PuTTY Exit Confirmation",
|
"PuTTY Exit Confirmation",
|
||||||
MB_ICONWARNING | MB_OKCANCEL) == IDOK)
|
MB_ICONWARNING | MB_OKCANCEL) == IDOK)
|
||||||
@ -878,6 +880,7 @@ static int WINAPI WndProc (HWND hwnd, UINT message,
|
|||||||
if (cfg.close_on_exit)
|
if (cfg.close_on_exit)
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
else {
|
else {
|
||||||
|
session_closed = TRUE;
|
||||||
MessageBox(hwnd, "Connection closed by remote host",
|
MessageBox(hwnd, "Connection closed by remote host",
|
||||||
"PuTTY", MB_OK | MB_ICONINFORMATION);
|
"PuTTY", MB_OK | MB_ICONINFORMATION);
|
||||||
SetWindowText (hwnd, "PuTTY (inactive)");
|
SetWindowText (hwnd, "PuTTY (inactive)");
|
||||||
|
Loading…
Reference in New Issue
Block a user