mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
Fix Notepad++ blocked when closed minimized or from systray
When Notepad++ is minimized and there are 2 or more unsaved opened files, close Notepad++ directly from the taskbar (no periodic backup) will launch modal Save All dialog, which will not be on the foreground. Hence the blocage of Notepad++. This commit fixes the issue above. Fix #14718, close #14725
This commit is contained in:
parent
8ffe8147c7
commit
f66dd91046
@ -2449,13 +2449,20 @@ int Notepad_plus::doSaveOrNot(const TCHAR* fn, bool isMulti)
|
|||||||
if ((NppParameters::getInstance()).isEndSessionCritical())
|
if ((NppParameters::getInstance()).isEndSessionCritical())
|
||||||
return IDCANCEL; // simulate Esc-key or Cancel-button as there should not be any big delay / code-flow block
|
return IDCANCEL; // simulate Esc-key or Cancel-button as there should not be any big delay / code-flow block
|
||||||
|
|
||||||
// In case Notepad++ is iconized into notification zone
|
// In case Notepad++ is minimized into taskbar or iconized into notification zone
|
||||||
if (!::IsWindowVisible(_pPublicInterface->getHSelf()))
|
if (::IsIconic(_pPublicInterface->getHSelf()))
|
||||||
{
|
{
|
||||||
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
|
::ShowWindow(_pPublicInterface->getHSelf(), SW_RESTORE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!::IsWindowVisible(_pPublicInterface->getHSelf()))
|
||||||
|
{
|
||||||
|
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
|
||||||
|
|
||||||
// Send sizing info to make window fit (specially to show tool bar.)
|
// Send sizing info to make window fit (specially to show tool bar.)
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMulti)
|
if (!isMulti)
|
||||||
|
@ -79,10 +79,15 @@ void StaticDialog::goToCenter(UINT swpFlags)
|
|||||||
{
|
{
|
||||||
RECT rc{};
|
RECT rc{};
|
||||||
::GetClientRect(_hParent, &rc);
|
::GetClientRect(_hParent, &rc);
|
||||||
|
if ((rc.left == rc.right) || (rc.top == rc.bottom))
|
||||||
|
swpFlags |= SWP_NOSIZE; // sizing has no sense here
|
||||||
|
|
||||||
POINT center{};
|
POINT center{};
|
||||||
center.x = rc.left + (rc.right - rc.left)/2;
|
center.x = rc.left + (rc.right - rc.left)/2;
|
||||||
center.y = rc.top + (rc.bottom - rc.top)/2;
|
center.y = rc.top + (rc.bottom - rc.top)/2;
|
||||||
::ClientToScreen(_hParent, ¢er);
|
::ClientToScreen(_hParent, ¢er);
|
||||||
|
if ((center.x == -32000) && (center.y == -32000)) // https://devblogs.microsoft.com/oldnewthing/20041028-00/?p=37453
|
||||||
|
swpFlags |= SWP_NOMOVE; // moving has no sense here (owner wnd is minimized)
|
||||||
|
|
||||||
int x = center.x - (_rc.right - _rc.left)/2;
|
int x = center.x - (_rc.right - _rc.left)/2;
|
||||||
int y = center.y - (_rc.bottom - _rc.top)/2;
|
int y = center.y - (_rc.bottom - _rc.top)/2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user