OSDN Git Service

PATCH: [ 1381984 ] Folder compare progressdialog could be drawn off-screen
authorKimmo Varis <kimmov@gmail.com>
Fri, 16 Dec 2005 23:28:05 +0000 (23:28 +0000)
committerKimmo Varis <kimmov@gmail.com>
Fri, 16 Dec 2005 23:28:05 +0000 (23:28 +0000)
Src/Changes.txt
Src/DirCompProgressDlg.cpp

index b8106cb..d58e0d0 100644 (file)
@@ -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
index f7ed1ad..a6c3cbb 100644 (file)
 #include "DirFrame.h"
 #include "CompareStats.h"
 
+#ifdef COMPILE_MULTIMON_STUBS
+#undef COMPILE_MULTIMON_STUBS
+#endif
+#include <multimon.h>
+
 #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 );
+       }
 }
 
 /**