[PATCH 3/3] user32: Send WM_CANCELMODE to the current capture window after initializing a modal dialog.

Zebediah Figura z.figura12 at gmail.com
Wed Jan 6 22:49:48 CST 2021


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48860
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/user32/dialog.c       | 5 +++++
 dlls/user32/tests/dialog.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 9bf3470921d..c48f404eceb 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -667,6 +667,8 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
 
     if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode ))
     {
+        HWND capture;
+
         /* Send initialisation messages and set focus */
 
         if (dlgProc)
@@ -695,6 +697,9 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
             }
         }
 
+        if (modal_owner && (capture = GetCapture()))
+            SendMessageW( capture, WM_CANCELMODE, 0, 0 );
+
         if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
         {
            ShowWindow( hwnd, SW_SHOWNORMAL );   /* SW_SHOW doesn't always work */
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index 33469377bcc..fcfaf5c12d6 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -2192,7 +2192,7 @@ static INT_PTR CALLBACK capture_release_proc(HWND dialog, UINT message, WPARAM w
         HWND child = (HWND)lparam;
         DWORD style;
 
-        todo_wine ok(!GetCapture(), "got capture %p\n", GetCapture());
+        ok(!GetCapture(), "got capture %p\n", GetCapture());
         style = GetWindowLongA(child, GWL_STYLE);
         ok(!(style & WS_DISABLED), "child should not be disabled\n");
 
@@ -2233,12 +2233,12 @@ static void test_capture_release(void)
     SetCapture(child);
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", NULL, capture_release_proc, (LPARAM)child);
     ok(ret == 1, "got %#Ix\n", ret);
-    todo_wine ok(!GetCapture(), "got capture %p\n", GetCapture());
+    ok(!GetCapture(), "got capture %p\n", GetCapture());
 
     SetCapture(child);
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", window, capture_release_proc, (LPARAM)child);
     ok(ret == 1, "got %#Ix\n", ret);
-    todo_wine ok(!GetCapture(), "got capture %p\n", GetCapture());
+    ok(!GetCapture(), "got capture %p\n", GetCapture());
 
     SetCapture(child);
     dialog = CreateDialogParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG",
-- 
2.29.2




More information about the wine-devel mailing list