From 7bfaa042b9a3522839583ddd1e5603e9a9d17492 Mon Sep 17 00:00:00 2001 From: Udo Hoffmann Date: Mon, 18 May 2020 14:06:48 +0200 Subject: [PATCH] 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 --- .../src/WinControls/DocumentMap/documentMap.cpp | 13 ++++--------- .../src/WinControls/DocumentMap/documentMap.rc | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index d0bbe02d..ed299557 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -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; } diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.rc b/PowerEditor/src/WinControls/DocumentMap/documentMap.rc index 42e34e45..38434f44 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.rc +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.rc @@ -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