Module: wine
Branch: master
Commit: 763dc064504d729029f227e220c858fdb8a8178e
URL: https://gitlab.winehq.org/wine/wine/-/commit/763dc064504d729029f227e220c858…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Wed Sep 6 14:40:52 2023 +0300
d3d8/tests: Don't check messages when doing the minimization workaround dance.
---
dlls/d3d8/tests/device.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index ec6f2ce51b3..b61ad207cc9 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -3203,9 +3203,15 @@ static void test_wndproc(void)
/* I have to minimize and restore the focus window, otherwise native d3d8 fails
* device::reset with D3DERR_DEVICELOST. This does not happen when the window
- * restore is triggered by the user. */
+ * restore is triggered by the user.
+ *
+ * fvwm randomly sends a focus loss notification when we minimize, so do it
+ * before checking the incoming messages. It might match WM_ACTIVATEAPP but has
+ * a wrong WPARAM. Use SW_SHOWMINNOACTIVE to make sure we don't accidentally
+ * activate the window at this point and miss our WM_ACTIVATEAPP(wparam=1). */
+ ShowWindow(focus_window, SW_SHOWMINNOACTIVE);
+ flush_events();
expect_messages = reactivate_messages;
- ShowWindow(focus_window, SW_MINIMIZE);
ShowWindow(focus_window, SW_RESTORE);
/* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */
SetForegroundWindow(focus_window);
Module: wine
Branch: master
Commit: 49e1d2ea215548a30db6962e24030da4a24557cd
URL: https://gitlab.winehq.org/wine/wine/-/commit/49e1d2ea215548a30db6962e24030d…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Wed Sep 6 14:38:46 2023 +0300
d3d9/tests: Don't check messages when doing the minimization workaround dance.
---
dlls/d3d9/tests/device.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index d36b76156f5..c972e97f572 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -4230,9 +4230,15 @@ static void test_wndproc(void)
/* I have to minimize and restore the focus window, otherwise native d3d9 fails
* device::reset with D3DERR_DEVICELOST. This does not happen when the window
- * restore is triggered by the user. */
+ * restore is triggered by the user.
+ *
+ * fvwm randomly sends a focus loss notification when we minimize, so do it
+ * before checking the incoming messages. It might match WM_ACTIVATEAPP but has
+ * a wrong WPARAM. Use SW_SHOWMINNOACTIVE to make sure we don't accidentally
+ * activate the window at this point and miss our WM_ACTIVATEAPP(wparam=1). */
+ ShowWindow(focus_window, SW_SHOWMINNOACTIVE);
+ flush_events();
expect_messages = tests[i].reactivate_messages;
- ShowWindow(focus_window, SW_MINIMIZE);
ShowWindow(focus_window, SW_RESTORE);
/* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */
SetForegroundWindow(focus_window);
Module: wine
Branch: master
Commit: 4bc8b73cf34175faea59b152878c484d16d7feda
URL: https://gitlab.winehq.org/wine/wine/-/commit/4bc8b73cf34175faea59b152878c48…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Wed Sep 6 14:11:07 2023 +0300
d3d9/tests: Don't fail test_reset_fullscreen if the WM resizes us.
fvwm does that for two independent reasons. The important thing is that
we don't receive a WM_SIZE during the reset call itself.
---
dlls/d3d9/tests/device.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 8284e3365c8..d36b76156f5 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -4757,6 +4757,7 @@ static void test_reset_fullscreen(void)
IDirect3DDevice9 *device;
WNDCLASSEXA wc = {0};
IDirect3D9 *d3d;
+ RECT r1, r2;
HRESULT hr;
ATOM atom;
static const struct message messages[] =
@@ -4835,7 +4836,35 @@ static void test_reset_fullscreen(void)
device_desc.flags = CREATE_DEVICE_FULLSCREEN;
ok(SUCCEEDED(reset_device(device, &device_desc)), "Failed to reset device.\n");
+ /* We shouldn't receive a WM_SIZE message during the reset because d3d filters
+ * messages sent to the focus window. This is important because some games
+ * respond to WM_SIZE messages by calling Reset(), resulting in an endless
+ * recursion. */
+ ok(!wm_size_received, "Received unexpected WM_SIZE message.\n");
+ GetWindowRect(device_window, &r1);
+
flush_events();
+ GetWindowRect(device_window, &r2);
+
+ /* fvwm2 and 3 resize the window though. We learn about this when processing
+ * events, after Reset() has finished and d3d is no longer filtering window
+ * messages. This still shouldn't happen but won't lead to an endless recursion.
+ *
+ * As far as I understand the fvwm3 source code, the WM doesn't expect a window
+ * to change from size A maximized to size B maximized. It will un-maximize the
+ * window, picking the stored normal size - which appens to be the size of the
+ * first fullscreen mode above, but not necessarily the screen size at startup.
+ *
+ * fvwm2 on the other hand doesn't understand mode switches at all. It will see
+ * the window is fullscreen (it has separate flags for fullscreen and maximized),
+ * and try to resize it to what it thinks is the display mode - which is the mode
+ * that fvwm2 was started with. The above fvwm3 bug also exists in fvwm2 but is
+ * hidden by the mode bug.
+ *
+ * This comment is based on a very superficial understanding of fvwm's event
+ * and window dimension handling code, which is about 10k lines of code. So it
+ * may be wrong. */
+ todo_wine_if(!EqualRect(&r1, &r2))
ok(!wm_size_received, "Received unexpected WM_SIZE message.\n");
cleanup: