[PATCH] Annoying EndDialog Feature

gerard patel gerard.patel at asi.fr
Sun Mar 4 16:05:36 CST 2001


This is based on an earlier patch from A.Mohr using a WM_NULL message
to unblock a modal dialog box.

I had objected on the ground that this was not based on what Windows is doing.
Well, I checked by implementing the message loop myself in a Windows test app
and - it's rather annoying but this ....is indeed what Windows is doing ;-)

2 little differences from his patch :
- check immediately the DF_END flag after returning from GetMessage
in DIALOG_DoDialogBox. It seems that the WM_NULL message is not seen
by the app under Windows.
- Post the WM_NULL message at the end of the EndDialog routine - else there
is a possibility for the message to be handled too early if EndDialog is called from
another thread and (for example) DIALOG_EnableOwner yields (it's possible 
if working in -managed mode)


ChangeLog:

    * window/dialog.c
    Unblock the dialog message loop with a WM_NULL message
-------------- next part --------------
Index: windows/dialog.c
===================================================================
RCS file: /home/wine/wine/windows/dialog.c,v
retrieving revision 1.78
diff -u -r1.78 dialog.c
--- windows/dialog.c	2001/01/25 22:22:22	1.78
+++ windows/dialog.c	2001/03/04 22:00:38
@@ -1051,7 +1051,7 @@
         while (MSG_InternalGetMessage(QMSG_WIN32A, &msg, hwnd, ownerMsg, MSGF_DIALOGBOX, 
                                       PM_REMOVE, !(wndPtr->dwStyle & DS_NOIDLEMSG), NULL ))
         {
-            if (!IsDialogMessageA( hwnd, &msg))
+            if (!(dlgInfo->flags & DF_END) && (!IsDialogMessageA( hwnd, &msg)))
             {
                 TranslateMessage( &msg );
                 DispatchMessageA( &msg );
@@ -1257,7 +1257,8 @@
                  | SWP_NOZORDER | SWP_NOACTIVATE | SWP_HIDEWINDOW);
 
     WIN_ReleaseWndPtr(wndPtr);
- 
+    /* unblock dialog loop */
+    PostMessageA(hwnd, WM_NULL, 0, 0); 
     return TRUE;
 }
 
-------------- next part --------------



More information about the wine-patches mailing list