https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2bd6bfdd904094747220ed694071e25220b50abf

commit 2bd6bfdd904094747220ed694071e25220b50abf
Author:     Jose Carlos Jesus <[email protected]>
AuthorDate: Fri May 15 17:12:02 2020 +0100
Commit:     GitHub <[email protected]>
CommitDate: Fri May 15 18:12:02 2020 +0200

    [COMCTL32] Fix recalculation of property-sheet dialog position (#1818)
    
    During initialization of property sheet dialogs, their overall size can 
change (when adding property sheets) after the dialog has been created and 
pre-positioned by win32k.
    Therefore their position needs to be recomputed so that they try to fit the 
best on screen.
    
    CORE-9008, CORE-9602
---
 dll/win32/comctl32/propsheet.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dll/win32/comctl32/propsheet.c b/dll/win32/comctl32/propsheet.c
index 4dd355a78c8..543372fbb7f 100644
--- a/dll/win32/comctl32/propsheet.c
+++ b/dll/win32/comctl32/propsheet.c
@@ -3580,6 +3580,30 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM 
wParam, LPARAM lParam)
         }
         SetFocus(GetDlgItem(hwnd, IDOK));
       }
+#ifdef __REACTOS__
+      { /* 
+           try to fit it into the desktop  
+           user32 positions the dialog based on the IDD_PROPSHEET template, 
+           but we've since made it larger by adding controls
+        */
+          RECT rcWork;
+          RECT rcDlg;
+          int dx, dy;
+
+          if (GetWindowRect(hwnd, &rcDlg) && 
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0))
+          {
+              dx = rcDlg.right - rcWork.right;
+              dy = rcDlg.bottom - rcWork.bottom;
+
+              if (rcDlg.right > rcWork.right)
+                  rcDlg.left -= dx;
+              if (rcDlg.bottom > rcWork.bottom)
+                  rcDlg.top -= dy;
+
+              SetWindowPos(hwnd, HWND_TOPMOST, rcDlg.left, rcDlg.top, 0, 0, 
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOSIZE);
+          }
+      }
+#endif
 
       if (IS_INTRESOURCE(psInfo->ppshheader.pszCaption) &&
               psInfo->ppshheader.hInstance)

Reply via email to