Module: wine Branch: oldstable Commit: d60a0ad930e15f07d430bae28bdea7a3426e97f2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d60a0ad930e15f07d430bae28...
Author: Zebediah Figura z.figura12@gmail.com Date: Wed Jan 6 22:49:48 2021 -0600
user32: Send WM_CANCELMODE to the current capture window after initializing a modal dialog.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48860 Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 32f5dfde0db785b862af1c8a81152f268c08fa47) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
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 88c2930c065..0541c3d82a3 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -671,6 +671,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) @@ -699,6 +701,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 c7f80c7b734..629fcd2e7dc 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -2194,7 +2194,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");
@@ -2235,12 +2235,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",