From c8043294b369c427b75caaa0adf3d8628d14e0aa Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 27 Jan 2013 21:15:21 +0000 Subject: [PATCH] =?UTF-8?q?[BUG=5FFIXED]=20(Author:=20Pekka=20P=C3=B6yry)?= =?UTF-8?q?=20Fix=20the=20problem=20of=20wrong=20starting=20window=20posit?= =?UTF-8?q?ion=20on=20the=20second=20monitor.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1015 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 12 +++++++++++- PowerEditor/src/Notepad_plus_Window.cpp | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) 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();