[PATCH v3 2/3] user32/tests: Return MA_ACTIVATE to WM_MOUSEACTIVATE on main test window.

Rémi Bernon rbernon at codeweavers.com
Thu Dec 26 05:51:22 CST 2019


This shows that one of test_SetWindowPos is broken on Wine, and needs
to be fixed. It was previously fixed by some change in DefWindowProcA,
introduced in 71d35d8940118bc6de6522913fb8c473fa5b2c24 but that was a
unexpected side effect.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

The test_SetForegroundWindow test is now back to its previous state and
Gabriel's patch for X11 focus event race condition should fix it.

For test_SetWindowPos, I don't know enough about the focus rules to
really understand how this is supposed to work, but it looks like the
child window should not be activated for some reason although it is.

The child window passes the winex11.drv/event.c can_activate_window
check -having both WS_POPUP and WS_CHILD flags, and it then forwards
the WM_MOUSEACTIVATE message to its parent, as implemented in
DefWindowProcA.

 dlls/user32/tests/win.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 3f64d53958e..9f3841ad070 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -840,6 +840,8 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
             if (wparam) app_activated = TRUE;
             else app_deactivated = TRUE;
             break;
+        case WM_MOUSEACTIVATE:
+            return MA_ACTIVATE;
     }
 
     return DefWindowProcA(hwnd, msg, wparam, lparam);
@@ -2717,7 +2719,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
     ret = SetWindowPos(hwnd_child, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
     ok(ret, "Got %d\n", ret);
     flush_events( TRUE );
-    check_active_state(hwnd2, hwnd2, hwnd2);
+    todo_wine check_active_state(hwnd2, hwnd2, hwnd2);
     DestroyWindow(hwnd_child);
 }
 
@@ -3371,8 +3373,12 @@ static void test_SetForegroundWindow(HWND hwnd)
 
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
-    ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
-    ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
+
+    /* FIXME: these tests are failing because of a race condition
+     * between internal focus state applied immediately and X11 focus
+     * message coming late */
+    todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
+    todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
 
     SetForegroundWindow(hwnd);
     check_wnd_state(hwnd, hwnd, hwnd, 0);
-- 
2.24.1




More information about the wine-devel mailing list