[BUG_FIXED] (Author: Pekka Pöyry) Fix the problem of Window position not saved/restored properly.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1021 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
7c05c2f208
commit
f911b63a5c
|
@ -712,28 +712,34 @@ 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;
|
|
||||||
|
|
||||||
posInfo.length = sizeof(WINDOWPLACEMENT);
|
nppGUI._isMaximized = IsZoomed(_pPublicInterface->getHSelf()) != 0;
|
||||||
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
|
|
||||||
|
|
||||||
nppGUI._appPos.left = posInfo.rcNormalPosition.left;
|
if(nppGUI._isMaximized)
|
||||||
nppGUI._appPos.top = posInfo.rcNormalPosition.top;
|
{
|
||||||
nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left;
|
// When window is maximized GetWindowPlacement returns window's last non maximized coordinates.
|
||||||
nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top;
|
// Save them so that those will be used when window is restored next time.
|
||||||
nppGUI._isMaximized = (IsZoomed(_pPublicInterface->getHSelf()) || (posInfo.flags & WPF_RESTORETOMAXIMIZED));
|
WINDOWPLACEMENT posInfo;
|
||||||
*/
|
posInfo.length = sizeof(WINDOWPLACEMENT);
|
||||||
// There is some discontinuity in position values that are coming from GetWindowPlacement when window
|
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
|
||||||
// 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.left = posInfo.rcNormalPosition.left;
|
||||||
nppGUI._appPos.top = pos.top;
|
nppGUI._appPos.top = posInfo.rcNormalPosition.top;
|
||||||
nppGUI._appPos.right = pos.right - pos.left;
|
nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left;
|
||||||
nppGUI._appPos.bottom = pos.bottom - pos.top;
|
nppGUI._appPos.bottom = posInfo.rcNormalPosition.bottom - posInfo.rcNormalPosition.top;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 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();
|
||||||
|
|
||||||
return (NppParameters::getInstance())->writeGUIParams();
|
return (NppParameters::getInstance())->writeGUIParams();
|
||||||
|
|
Loading…
Reference in New Issue