There is no need to resize our own fake dialog to match the parent

Dmitry Timoshkov dmitry at baikal.ru
Thu Nov 17 09:11:42 CST 2005


Hello,

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    There is no need to resize our own fake dialog to match the parent,
    it doesn't have controls anyway.

--- cvs/hq/wine/dlls/commdlg/filedlg.c	2005-11-10 11:28:26.000000000 +0800
+++ wine/dlls/commdlg/filedlg.c	2005-11-17 22:34:42.000000000 +0800
@@ -701,10 +701,6 @@ static void ArrangeCtrlPositions(HWND hw
     /* finally use fixed parent size */
     rectParent.bottom -= help_fixup;
 
-    /* save the size of the parent's client area */
-    rectChild.right = rectParent.right;
-    rectChild.bottom = rectParent.bottom;
-
     /* set the size of the parent dialog */
     AdjustWindowRectEx(&rectParent, GetWindowLongW(hwndParentDlg, GWL_STYLE),
                        FALSE, GetWindowLongW(hwndParentDlg, GWL_EXSTYLE));
@@ -713,10 +709,6 @@ static void ArrangeCtrlPositions(HWND hw
                  rectParent.right - rectParent.left,
                  rectParent.bottom - rectParent.top,
                  SWP_NOMOVE | SWP_NOZORDER);
-
-    /* set the size of the child dialog */
-    SetWindowPos(hwndChildDlg, HWND_BOTTOM,
-                 0, 0, rectChild.right, rectChild.bottom, SWP_NOACTIVATE);
 }
 
 static INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -1032,9 +1024,29 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND 
          FILEDLG95_InitControls(hwnd);
 
          if (fodInfos->DlgInfos.hwndCustomDlg)
+         {
+             RECT rc;
+             UINT flags = SWP_NOACTIVATE;
+
              ArrangeCtrlPositions(fodInfos->DlgInfos.hwndCustomDlg, hwnd,
                  (fodInfos->ofnInfos->Flags & (OFN_HIDEREADONLY | OFN_SHOWHELP)) == OFN_HIDEREADONLY);
 
+             /* resize the custom dialog to the parent size */
+             if (fodInfos->ofnInfos->Flags & (OFN_ENABLETEMPLATE | OFN_ENABLETEMPLATEHANDLE))
+                 GetClientRect(hwnd, &rc);
+             else
+             {
+                 /* our own fake template is zero sized and doesn't have
+                  * children, so there is no need to resize it.
+                  * Picasa depends on it.
+                  */
+                 flags |= SWP_NOSIZE;
+                 SetRectEmpty(&rc);
+             }
+             SetWindowPos(fodInfos->DlgInfos.hwndCustomDlg, HWND_BOTTOM,
+                          0, 0, rc.right, rc.bottom, flags);
+         }
+
       	 FILEDLG95_FillControls(hwnd, wParam, lParam);
 
          SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
@@ -3782,6 +3794,8 @@ BOOL WINAPI GetOpenFileNameA(
 {
     BOOL win16look = FALSE;
 
+    TRACE("flags %08lx\n", ofn->Flags);
+
     /* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
     if (ofn->Flags & OFN_FILEMUSTEXIST)
         ofn->Flags |= OFN_PATHMUSTEXIST;
@@ -3810,6 +3824,12 @@ BOOL WINAPI GetOpenFileNameW(
 {
     BOOL win16look = FALSE;
 
+    TRACE("flags %08lx\n", ofn->Flags);
+
+    /* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
+    if (ofn->Flags & OFN_FILEMUSTEXIST)
+        ofn->Flags |= OFN_PATHMUSTEXIST;
+
     if (ofn->Flags & (OFN_ALLOWMULTISELECT|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE))
         win16look = (ofn->Flags & OFN_EXPLORER) ? FALSE : TRUE;
 






More information about the wine-patches mailing list