Henri Verbeet : user32: Also show dialogs right after a WM_TIMER message.

Alexandre Julliard julliard at winehq.org
Tue Mar 2 10:32:34 CST 2010


Module: wine
Branch: master
Commit: 6ee4a87ad6958dc2e00fff646a3bb2b50d188977
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6ee4a87ad6958dc2e00fff646a3bb2b50d188977

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Mar  2 11:51:52 2010 +0100

user32: Also show dialogs right after a WM_TIMER message.

---

 dlls/user32/dialog.c       |    6 +++++
 dlls/user32/tests/dialog.c |   50 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 325d6e2..79f5182 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -815,6 +815,12 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
                 DispatchMessageW( &msg );
             }
             if (dlgInfo->flags & DF_END) break;
+
+            if (bFirstEmpty && msg.message == WM_TIMER)
+            {
+                ShowWindow( hwnd, SW_SHOWNORMAL );
+                bFirstEmpty = FALSE;
+            }
         }
     }
     if (dlgInfo->flags & DF_OWNERENABLED) DIALOG_EnableOwner( owner );
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index ef4d5dc..1b36c53 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1157,6 +1157,55 @@ static void test_SaveRestoreFocus(void)
     DestroyWindow(hDlg);
 }
 
+static INT_PTR CALLBACK timer_message_dlg_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    static int count;
+    BOOL visible;
+
+    switch (msg)
+    {
+        case WM_INITDIALOG:
+            visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE;
+            ok(!visible, "Dialog should not be visible.\n");
+            SetTimer(wnd, 1, 100, NULL);
+            Sleep(200);
+            return FALSE;
+
+        case WM_COMMAND:
+            if (LOWORD(wparam) != IDCANCEL) return FALSE;
+            EndDialog(wnd, LOWORD(wparam));
+            return TRUE;
+
+        case WM_TIMER:
+            if (wparam != 1) return FALSE;
+            visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE;
+            if (!count++)
+            {
+                ok(!visible, "Dialog should not be visible.\n");
+                PostMessage(wnd, WM_USER, 0, 0);
+            }
+            else
+            {
+                ok(visible, "Dialog should be visible.\n");
+                PostMessage(wnd, WM_COMMAND, IDCANCEL, 0);
+            }
+            return TRUE;
+
+        case WM_USER:
+            visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE;
+            ok(visible, "Dialog should be visible.\n");
+            return TRUE;
+
+        default:
+            return FALSE;
+    }
+}
+
+static void test_timer_message(void)
+{
+    DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
+}
+
 START_TEST(dialog)
 {
     g_hinst = GetModuleHandleA (0);
@@ -1172,4 +1221,5 @@ START_TEST(dialog)
     test_DisabledDialogTest();
     test_MessageBoxFontTest();
     test_SaveRestoreFocus();
+    test_timer_message();
 }




More information about the wine-cvs mailing list