mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 21:34:58 +02:00
Fix inconsistencies at OS-forced Notepad++ (v8.4.7) exit
Now if the Notepad++ will have an unsaved data and is still running at the OS restart/shutdown, there will be one universal messagebox "Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?". When Notepad++ backup mode is ON, answer: - YES ... Notepad++ simply quits (Notepad++ backup engine silently handles all the stuff needed) - NO ... Notepad++ stays running, user is on his/her own When Notepad++ backup mode is OFF, answer: - YES ... Notepad++ behaves identically as in the case of the usual Notepad++ IDM_FILE_EXIT or WM_CLOSE messages (save dlgs appears etc., it depends on the current user Notepad++ settings) - NO ... Notepad++ stays running, user is on his/her own Fix v847
This commit is contained in:
parent
de5f419314
commit
bd4c323d75
@ -1377,6 +1377,7 @@ Notepad++ will be restarted after all the operations are terminated.
|
||||
Continue?"/>
|
||||
<NeedToRestartToLoadPlugins title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to load plugins you installed."/> <!-- HowToReproduce: Import a plugin via menu "Settings->Import->Import Plugin(s)...". -->
|
||||
<ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/> <!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
|
||||
<WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/>
|
||||
</MessageBox>
|
||||
<ClipboardHistory>
|
||||
<PanelTitle name="Clipboard History"/>
|
||||
|
@ -2106,6 +2106,18 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_WINDOWSSESSIONEXIT:
|
||||
{
|
||||
int answer = _nativeLangSpeaker.messageBox("WindowsSessionExit",
|
||||
_pPublicInterface->getHSelf(),
|
||||
TEXT("Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"),
|
||||
TEXT("Notepad++ - Windows session exit"),
|
||||
MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
|
||||
if (answer == IDYES)
|
||||
::PostMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_QUERYENDSESSION:
|
||||
{
|
||||
// app should return TRUE or FALSE immediately upon receiving this message,
|
||||
@ -2176,7 +2188,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
::SendMessage(hwnd, WM_SIZE, 0, 0); // to make window fit (specially to show tool bar.)
|
||||
}
|
||||
}
|
||||
::PostMessage(hwnd, WM_COMMAND, IDM_FILE_SAVEALL, 0); // posting will not block us here
|
||||
::PostMessage(hwnd, NPPM_INTERNAL_WINDOWSSESSIONEXIT, 0, 0); // posting will not block us here
|
||||
return FALSE; // request abort of the shutdown
|
||||
}
|
||||
}
|
||||
|
@ -643,6 +643,7 @@
|
||||
#define NPPM_INTERNAL_ENABLECHANGEHISTORY (NOTEPADPLUS_USER_INTERNAL + 67)
|
||||
#define NPPM_INTERNAL_CLEANSMARTHILITING (NOTEPADPLUS_USER_INTERNAL + 68)
|
||||
#define NPPM_INTERNAL_CLEANBRACEMATCH (NOTEPADPLUS_USER_INTERNAL + 69)
|
||||
#define NPPM_INTERNAL_WINDOWSSESSIONEXIT (NOTEPADPLUS_USER_INTERNAL + 70)
|
||||
|
||||
// See Notepad_plus_msgs.h
|
||||
//#define NOTEPADPLUS_USER (WM_USER + 1000)
|
||||
|
Loading…
x
Reference in New Issue
Block a user