diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 87930af1..959c3b12 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -712,7 +712,7 @@ bool Notepad_plus::saveGUIParams() nppGUI._userDefineDlgStatus = (b?UDD_DOCKED:0) | (udd->isVisible()?UDD_SHOW:0); // Save the position - +/* WINDOWPLACEMENT posInfo; posInfo.length = sizeof(WINDOWPLACEMENT); @@ -723,6 +723,16 @@ bool Notepad_plus::saveGUIParams() nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left; nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top; nppGUI._isMaximized = (IsZoomed(_pPublicInterface->getHSelf()) || (posInfo.flags & WPF_RESTORETOMAXIMIZED)); +*/ + // There is some discontinuity in position values that are coming from GetWindowPlacement when window + // is on secondary screen and Windows taskbar is on left side of the screen. Use GetWindowRect instead. + RECT pos; + ::GetWindowRect(_pPublicInterface->getHSelf(), &pos); + + nppGUI._appPos.left = pos.left; + nppGUI._appPos.top = pos.top; + nppGUI._appPos.right = pos.right - pos.left; + nppGUI._appPos.bottom = pos.bottom - pos.top; saveDockingParams(); diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 2b4dc21e..982b2c6c 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -94,8 +94,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin // In setting the startup window position, take into account that the last-saved // position might have assumed a second monitor that's no longer available. POINT newUpperLeft; - newUpperLeft.x = nppGUI._appPos.left + workAreaRect.left; - newUpperLeft.y = nppGUI._appPos.top + workAreaRect.top; + newUpperLeft.x = nppGUI._appPos.left; + newUpperLeft.y = nppGUI._appPos.top; // GetSystemMetrics does not support the multi-monitor values on Windows NT and Windows 95. winVer winVersion = pNppParams->getWinVersion();