Fix docked panels invisibility in multiinst mode

When Notepad++ was set to "Always in multi-instance mode" and the 1st instance has been minimized to the task-bar, then the other instance's docked panels were invisible.

Fix #15873, and fix many Community reports like this link: https://community.notepad-plus-plus.org/topic/26164/v8-7-search-results-missing
This commit is contained in:
xomx 2024-11-29 02:42:34 +01:00 committed by Don Ho
parent 234ce61b9f
commit b43eba3f4b

View File

@ -6774,9 +6774,8 @@ void NppParameters::feedDockingManager(TiXmlNode *node)
HWND hwndNpp = ::FindWindow(Notepad_plus_Window::getClassName(), NULL); HWND hwndNpp = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
if (hwndNpp) if (hwndNpp)
{ {
// TODO: // this code-branch is currently reached only if the Notepad++ multi-instance mode is ON and it is not the 1st Notepad++ instance
// the problem here is that this code-branch cannot be currently reached // (the feedDockingManager() is called at the Notepad++ init via the wWinMain nppParameters.load()))
// (as it is called at the Notepad++ startup in the wWinMain nppParameters.load())
HMONITOR hCurMon = ::MonitorFromWindow(hwndNpp, MONITOR_DEFAULTTONEAREST); HMONITOR hCurMon = ::MonitorFromWindow(hwndNpp, MONITOR_DEFAULTTONEAREST);
if (hCurMon) if (hCurMon)
@ -6794,8 +6793,13 @@ void NppParameters::feedDockingManager(TiXmlNode *node)
RECT rcNpp{}; RECT rcNpp{};
if (::GetClientRect(hwndNpp, &rcNpp)) if (::GetClientRect(hwndNpp, &rcNpp))
{ {
nppSize.cx = rcNpp.right; // rcNpp RECT could have zero size here! (if the 1st instance of Notepad++ is minimized to the task-bar (systray is ok))
nppSize.cy = rcNpp.bottom; if ((rcNpp.right > _nppGUI._dockingData._minDockedPanelVisibility) && (rcNpp.bottom > _nppGUI._dockingData._minDockedPanelVisibility))
{
// adjust according to the current Notepad++ client-wnd area
nppSize.cx = rcNpp.right;
nppSize.cy = rcNpp.bottom;
}
} }
} }
else else