[BUG_FIXED] (Author: Pekka Pöyry) Fix the problem of wrong starting window position on the second monitor.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1015 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-01-27 21:15:21 +00:00
parent e5861b4df1
commit c8043294b3
2 changed files with 13 additions and 3 deletions

View File

@ -712,7 +712,7 @@ bool Notepad_plus::saveGUIParams()
nppGUI._userDefineDlgStatus = (b?UDD_DOCKED:0) | (udd->isVisible()?UDD_SHOW:0); nppGUI._userDefineDlgStatus = (b?UDD_DOCKED:0) | (udd->isVisible()?UDD_SHOW:0);
// Save the position // Save the position
/*
WINDOWPLACEMENT posInfo; WINDOWPLACEMENT posInfo;
posInfo.length = sizeof(WINDOWPLACEMENT); posInfo.length = sizeof(WINDOWPLACEMENT);
@ -723,6 +723,16 @@ bool Notepad_plus::saveGUIParams()
nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left; nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left;
nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top; nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top;
nppGUI._isMaximized = (IsZoomed(_pPublicInterface->getHSelf()) || (posInfo.flags & WPF_RESTORETOMAXIMIZED)); 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(); saveDockingParams();

View File

@ -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 // 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. // position might have assumed a second monitor that's no longer available.
POINT newUpperLeft; POINT newUpperLeft;
newUpperLeft.x = nppGUI._appPos.left + workAreaRect.left; newUpperLeft.x = nppGUI._appPos.left;
newUpperLeft.y = nppGUI._appPos.top + workAreaRect.top; newUpperLeft.y = nppGUI._appPos.top;
// GetSystemMetrics does not support the multi-monitor values on Windows NT and Windows 95. // GetSystemMetrics does not support the multi-monitor values on Windows NT and Windows 95.
winVer winVersion = pNppParams->getWinVersion(); winVer winVersion = pNppParams->getWinVersion();