comdlg32: don't call ShowWindow for the custom dialog until all rearrangements of the file dialog have been done.

Rein Klazes wijn at online.nl
Thu Jul 2 06:32:28 CDT 2009


partial fix for bug #5034
---
 dlls/comdlg32/filedlg.c       |    9 ++++-----
 dlls/comdlg32/tests/filedlg.c |   19 +++++++++++++++++++
 dlls/comdlg32/tests/rsrc.rc   |    2 +-
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index e2d6a30..fd75479 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -789,11 +789,7 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
           hChildDlg = CreateDialogIndirectParamA(hinst, template, hwnd,
               IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
               (LPARAM)fodInfos->ofnInfos);
-      if(hChildDlg)
-      {
-        ShowWindow(hChildDlg,SW_SHOW);
-        return hChildDlg;
-      }
+      return hChildDlg;
     }
     else if( IsHooked(fodInfos))
     {
@@ -1153,6 +1149,9 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
          FILEDLG95_ResizeControls(hwnd, wParam, lParam);
       	 FILEDLG95_FillControls(hwnd, wParam, lParam);
 
+         if( fodInfos->DlgInfos.hwndCustomDlg)
+             ShowWindow( fodInfos->DlgInfos.hwndCustomDlg, SW_SHOW);
+
          if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
              SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
 
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c
index 0b1561e..6272f72 100644
--- a/dlls/comdlg32/tests/filedlg.c
+++ b/dlls/comdlg32/tests/filedlg.c
@@ -296,6 +296,7 @@ static LONG_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, L
 {
     static RECT initrc, rc;
     static int index, count;
+    static int gotSWP_bottom, gotShowWindow;
     HWND parent = GetParent( dlg);
     int resize;
     switch( msg)
@@ -306,6 +307,7 @@ static LONG_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, L
 
             index = ((OPENFILENAME*)lParam)->lCustData;
             count = 0;
+            gotSWP_bottom = gotShowWindow = 0;
             /* test style */
             style = GetWindowLong( parent, GWL_STYLE);
             if( resize_testcases[index].flags & OFN_ENABLESIZING)
@@ -372,6 +374,23 @@ static LONG_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, L
             count++;
         }
         break;
+        case WM_WINDOWPOSCHANGING:
+        {
+            WINDOWPOS *pwp = (WINDOWPOS *)lParam;
+            if(  !index && pwp->hwndInsertAfter == HWND_BOTTOM){
+                gotSWP_bottom = 1;
+                ok( gotShowWindow == 0, "The WM_WINDOWPOSCHANGING message came after a WM_SHOWWINDOW message\n");
+            }
+        }
+        break;
+        case WM_SHOWWINDOW:
+        {
+            if(  !index){
+                gotShowWindow = 1;
+                ok( gotSWP_bottom == 1, "No WM_WINDOWPOSCHANGING message came before a WM_SHOWWINDOW message\n");
+            }
+        }
+        break;
     }
     return 0;
 }
diff --git a/dlls/comdlg32/tests/rsrc.rc b/dlls/comdlg32/tests/rsrc.rc
index 9600d85..ffd30f9 100644
--- a/dlls/comdlg32/tests/rsrc.rc
+++ b/dlls/comdlg32/tests/rsrc.rc
@@ -39,7 +39,7 @@ FONT 8, "MS Shell Dlg"
  * This will work with 640x480 pixels
  */
 TEMPLATE_SZ DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 300, 40
-STYLE WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
+STYLE WS_CHILD | WS_CLIPSIBLINGS
 FONT 8, "MS Shell Dlg"
 {
     LTEXT           "Path:",-1,28,4,36,8
-- 
1.6.3.3




More information about the wine-patches mailing list