[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);
|
||||
|
||||
// Save the position
|
||||
/*
|
||||
WINDOWPLACEMENT posInfo;
|
||||
|
||||
posInfo.length = sizeof(WINDOWPLACEMENT);
|
||||
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
|
||||
nppGUI._isMaximized = IsZoomed(_pPublicInterface->getHSelf()) != 0;
|
||||
|
||||
nppGUI._appPos.left = posInfo.rcNormalPosition.left;
|
||||
nppGUI._appPos.top = posInfo.rcNormalPosition.top;
|
||||
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);
|
||||
if(nppGUI._isMaximized)
|
||||
{
|
||||
// When window is maximized GetWindowPlacement returns window's last non maximized coordinates.
|
||||
// Save them so that those will be used when window is restored next time.
|
||||
WINDOWPLACEMENT posInfo;
|
||||
posInfo.length = sizeof(WINDOWPLACEMENT);
|
||||
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
|
||||
|
||||
nppGUI._appPos.left = pos.left;
|
||||
nppGUI._appPos.top = pos.top;
|
||||
nppGUI._appPos.right = pos.right - pos.left;
|
||||
nppGUI._appPos.bottom = pos.bottom - pos.top;
|
||||
nppGUI._appPos.left = posInfo.rcNormalPosition.left;
|
||||
nppGUI._appPos.top = posInfo.rcNormalPosition.top;
|
||||
nppGUI._appPos.right = posInfo.rcNormalPosition.right - posInfo.rcNormalPosition.left;
|
||||
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();
|
||||
|
||||
return (NppParameters::getInstance())->writeGUIParams();
|
||||
|
Loading…
Reference in New Issue
Block a user