Fix Document map overlay stuck to first monitor

This PR fixes the following effects:
1. Document map overlay remains visible after minimize to tray.
2. Document map overlay is left behind on current monitor after moving Npp with Windows+Shift+Arrow to another monitor.
3. Document map overlay escapes to another monitor without Npp, when Windows+Shift+Arrow is pressed while the input focus is at the document map.

Fix #1317, close #8280
This commit is contained in:
Udo Hoffmann 2020-05-18 14:06:48 +02:00 committed by Don HO
parent 08c11816ce
commit 7bfaa042b9
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 5 additions and 10 deletions

View File

@ -326,10 +326,8 @@ void DocumentMap::scrollMapWith(const MapPosition & mapPos)
void DocumentMap::doMove()
{
RECT rc;
POINT pt = {0,0};
::ClientToScreen(_hSelf, &pt);
getClientRect(rc);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, (rc.right - rc.left), (rc.bottom - rc.top), TRUE);
::MoveWindow(_vzDlg.getHSelf(), 0, 0, (rc.right - rc.left), (rc.bottom - rc.top), TRUE);
}
void DocumentMap::fold(size_t line, bool foldOrNot)
@ -378,6 +376,7 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
_vzDlg.init(::GetModuleHandle(NULL), _hSelf);
_vzDlg.doDialog();
(NppParameters::getInstance()).SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256
BringWindowToTop (_vzDlg.getHSelf());
setSyntaxHiliting();
@ -398,12 +397,10 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if (_vzDlg.isCreated())
{
POINT pt = {0,0};
::ClientToScreen(_hSelf, &pt);
if (!_pMapView->isWrap())
::MoveWindow(_pMapView->getHSelf(), 0, 0, width, height, TRUE);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, width, height, TRUE);
::MoveWindow(_vzDlg.getHSelf(), 0, 0, width, height, TRUE);
}
}
break;
@ -440,9 +437,7 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
int width = rc.right - rc.left;
int height = rc.bottom - rc.top;
POINT pt = {0,0};
::ClientToScreen(_hSelf, &pt);
::MoveWindow(_vzDlg.getHSelf(), pt.x, pt.y, width, height, TRUE);
::MoveWindow(_vzDlg.getHSelf(), 0, 0, width, height, TRUE);
scrollMap();
return TRUE;
}

View File

@ -38,7 +38,7 @@ BEGIN
END
IDD_VIEWZONE DIALOGEX 26, 41, 200, 200
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
CONTROL "",IDC_VIEWZONECANVAS,"Static",SS_OWNERDRAW,0,0,50,14