From fad741de0a7a72fd809aaa3ad206c2a440b5f36e Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 16 Dec 2005 23:28:05 +0000 Subject: [PATCH] PATCH: [ 1381984 ] Folder compare progressdialog could be drawn off-screen --- Src/Changes.txt | 4 ++++ Src/DirCompProgressDlg.cpp | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Src/Changes.txt b/Src/Changes.txt index b8106cb79..d58e0d03f 100644 --- a/Src/Changes.txt +++ b/Src/Changes.txt @@ -1,3 +1,7 @@ +2005-12-16 Kimmo + PATCH: [ 1381984 ] Folder compare progressdialog could be drawn off-screen + Src: DirCompProgressDlg.cpp + 2005-12-16 Perry PATCH: [ 1380083 ] Fix EditBinaryFiles Plugin BuildTmp paths Plugins\src_VCPP\EditBinaryFiles: EditBinaryFiles.dsp diff --git a/Src/DirCompProgressDlg.cpp b/Src/DirCompProgressDlg.cpp index f7ed1ad6f..a6c3cbb59 100644 --- a/Src/DirCompProgressDlg.cpp +++ b/Src/DirCompProgressDlg.cpp @@ -14,6 +14,11 @@ #include "DirFrame.h" #include "CompareStats.h" +#ifdef COMPILE_MULTIMON_STUBS +#undef COMPILE_MULTIMON_STUBS +#endif +#include + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE @@ -265,8 +270,22 @@ void DirCompProgressDlg::CenterToParent() x -= rectBar.right / 2; y -= rectBar.bottom / 2; - SetWindowPos(&CWnd::wndTop, x, y, rectBar.right, - rectBar.bottom, SWP_NOOWNERZORDER | SWP_NOSIZE ); + // Calculate real desktop coordinates (if we have multiple monitors or + // virtual desktops + CRect dsk_rc; + dsk_rc.left = ::GetSystemMetrics(SM_XVIRTUALSCREEN); + dsk_rc.top = ::GetSystemMetrics(SM_YVIRTUALSCREEN); + dsk_rc.right = dsk_rc.left + ::GetSystemMetrics(SM_CXVIRTUALSCREEN); + dsk_rc.bottom = dsk_rc.top + ::GetSystemMetrics(SM_CYVIRTUALSCREEN); + + // Only move Open-dialog if its fully visible in new position + CPoint ptLeftTop(x, y); + CPoint ptRightBottom(rectBar.right, rectBar.bottom); + if (dsk_rc.PtInRect(ptLeftTop) && dsk_rc.PtInRect(ptRightBottom)) + { + SetWindowPos(&CWnd::wndTop, x, y, rectBar.right, + rectBar.bottom, SWP_NOOWNERZORDER | SWP_NOSIZE ); + } } /** -- 2.11.0