Merge pull request #714 from RaiKoHoff/Dev_RC_fixes

Notepad3 RC fixes (v)
This commit is contained in:
Rainer Kottenhoff 2018-10-19 14:51:29 +02:00 committed by GitHub
commit fc22c482cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 11 deletions

View File

@ -2599,6 +2599,21 @@ WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO* hMonitorInfo)
wndpl.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hwnd, &wndpl);
// corrections in case of aero snapped position
if (SW_NORMAL == wndpl.showCmd) {
RECT rc;
GetWindowRect(hwnd, &rc);
MONITORINFO mi;
GetMonitorInfoFromRect(&rc, &mi);
LONG const width = rc.right - rc.left;
LONG const height = rc.bottom - rc.top;
rc.left -= (mi.rcWork.left - mi.rcMonitor.left);
rc.right = rc.left + width;
rc.top -= (mi.rcWork.top - mi.rcMonitor.top);
rc.bottom = rc.top + height;
wndpl.rcNormalPosition = rc;
}
WININFO wi;
wi.x = wndpl.rcNormalPosition.left;
wi.y = wndpl.rcNormalPosition.top;
@ -2607,6 +2622,7 @@ WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO* hMonitorInfo)
wi.max = IsZoomed(hwnd) || (wndpl.flags & WPF_RESTORETOMAXIMIZED);
wi.zoom = SciCall_GetZoom();
// set monitor info too
GetMonitorInfoFromRect(&(wndpl.rcNormalPosition), hMonitorInfo);
return wi;

View File

@ -871,7 +871,7 @@ void EndWaitCursor()
// _InitWindowPosition()
//
//
static WININFO _InitDefaultWndPos(const int flagsPos)
static WININFO _InitDefaultWndPos(const int flagsPos)
{
RECT rc;
GetWindowRect(GetDesktopWindow(), &rc);
@ -2001,9 +2001,6 @@ LRESULT MsgEndSession(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
// Terminate file watching
InstallFileWatching(NULL);
// remember window position
s_WinInfo = GetMyWindowPlacement(hwnd, NULL);
DragAcceptFiles(hwnd, true);
#ifdef _EXTRA_DRAG_N_DROP_HANDLER_
RevokeDragAndDrop(pDropTarget);
@ -7095,10 +7092,12 @@ void SaveSettings(bool bSaveSettingsNow)
CreateIniFile();
if (!s_bSaveSettings && !bSaveSettingsNow) {
if (!(s_bSaveSettings || bSaveSettingsNow)) {
IniSetBool(L"Settings", L"SaveSettings", s_bSaveSettings);
return;
}
// update window placement
s_WinInfo = GetMyWindowPlacement(Globals.hwndMain, NULL);
WCHAR tchMsg[80];
GetLngString(IDS_MUI_SAVINGSETTINGS, tchMsg, COUNTOF(tchMsg));
@ -7261,7 +7260,6 @@ void SaveSettings(bool bSaveSettingsNow)
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, CustomSchemesDlgPosX);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, CustomSchemesDlgPosY);
SaveIniSection(L"Settings", pIniSection);
FreeMem(pIniSection);
@ -7270,11 +7268,6 @@ void SaveSettings(bool bSaveSettingsNow)
// Scintilla Styles
Style_Save();
// update window placement
if (bSaveSettingsNow) {
s_WinInfo = GetMyWindowPlacement(Globals.hwndMain, NULL);
}
int ResX = GetSystemMetrics(SM_CXSCREEN);
int ResY = GetSystemMetrics(SM_CYSCREEN);