From b43eba3f4bc1a0fda65cf550a15e7157f4011e9c Mon Sep 17 00:00:00 2001 From: xomx Date: Fri, 29 Nov 2024 02:42:34 +0100 Subject: [PATCH] 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 --- PowerEditor/src/Parameters.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 343908a9f..f5e5d25e3 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -6774,9 +6774,8 @@ void NppParameters::feedDockingManager(TiXmlNode *node) HWND hwndNpp = ::FindWindow(Notepad_plus_Window::getClassName(), NULL); if (hwndNpp) { - // TODO: - // the problem here is that this code-branch cannot be currently reached - // (as it is called at the Notepad++ startup in the wWinMain nppParameters.load()) + // this code-branch is currently reached only if the Notepad++ multi-instance mode is ON and it is not the 1st Notepad++ instance + // (the feedDockingManager() is called at the Notepad++ init via the wWinMain nppParameters.load())) HMONITOR hCurMon = ::MonitorFromWindow(hwndNpp, MONITOR_DEFAULTTONEAREST); if (hCurMon) @@ -6794,8 +6793,13 @@ void NppParameters::feedDockingManager(TiXmlNode *node) RECT rcNpp{}; if (::GetClientRect(hwndNpp, &rcNpp)) { - nppSize.cx = rcNpp.right; - nppSize.cy = rcNpp.bottom; + // rcNpp RECT could have zero size here! (if the 1st instance of Notepad++ is minimized to the task-bar (systray is ok)) + 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