Commit f4d520d6 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Don't minimize hidden windows.

parent 0edb13a2
......@@ -2140,7 +2140,7 @@ struct message
WPARAM expect_wparam;
};
static const struct message *expect_messages;
static const struct message *expect_messages, *unexpected_messages;
static HWND device_window, focus_window;
struct wndproc_thread_param
......@@ -2189,6 +2189,13 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
}
}
if (unexpected_messages)
{
const struct message *i;
for (i = unexpected_messages; i->message; i++)
ok(i->message != message, "Got unexpected message %x on window %p.\n", message, hwnd);
}
return DefWindowProcA(hwnd, message, wparam, lparam);
}
......@@ -2290,6 +2297,21 @@ static void test_wndproc(void)
{WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, TRUE},
{0, 0, FALSE, 0},
};
static const struct message focus_loss_messages_hidden[] =
{
{WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0},
{WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE},
{0, 0, FALSE, 0},
};
static const struct message focus_loss_messages_hidden_unexpected[] =
{
/* KDE randomly does something with the hidden window during the
* mode change that sometimes generates a WM_WINDOWPOSCHANGING
* message. A WM_WINDOWPOSCHANGED message is not generated, so
* just flag WM_WINDOWPOSCHANGED as bad. */
{WM_WINDOWPOSCHANGED, 0, FALSE, 0},
{0, 0, FALSE, 0},
};
d3d8 = Direct3DCreate8(D3D_SDK_VERSION);
ok(!!d3d8, "Failed to create a D3D object.\n");
......@@ -2498,6 +2520,30 @@ static void test_wndproc(void)
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
ShowWindow(device_window, SW_HIDE);
flush_events();
expect_messages = focus_loss_messages_hidden;
unexpected_messages = focus_loss_messages_hidden_unexpected;
SetForegroundWindow(GetDesktopWindow());
ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n",
expect_messages->message, expect_messages->window);
expect_messages = NULL;
unexpected_messages = NULL;
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth);
ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight);
ShowWindow(focus_window, SW_MINIMIZE);
ShowWindow(focus_window, SW_RESTORE);
SetForegroundWindow(focus_window);
flush_events();
/* Releasing a device in lost state breaks follow-up tests on native. */
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
......
......@@ -1706,7 +1706,7 @@ struct message
WPARAM expect_wparam;
};
static const struct message *expect_messages;
static const struct message *expect_messages, *unexpected_messages;
static HWND device_window, focus_window;
struct wndproc_thread_param
......@@ -1755,6 +1755,13 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
}
}
if (unexpected_messages)
{
const struct message *i;
for (i = unexpected_messages; i->message; i++)
ok(i->message != message, "Got unexpected message %x on window %p.\n", message, hwnd);
}
return DefWindowProcA(hwnd, message, wparam, lparam);
}
......@@ -1857,6 +1864,21 @@ static void test_wndproc(void)
{WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE},
{0, 0, FALSE, 0},
};
static const struct message focus_loss_messages_hidden[] =
{
{WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0},
{WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE},
{0, 0, FALSE, 0},
};
static const struct message focus_loss_messages_hidden_unexpected[] =
{
/* KDE randomly does something with the hidden window during the
* mode change that sometimes generates a WM_WINDOWPOSCHANGING
* message. A WM_WINDOWPOSCHANGED message is not generated, so
* just flag WM_WINDOWPOSCHANGED as bad. */
{WM_WINDOWPOSCHANGED, 0, FALSE, 0},
{0, 0, FALSE, 0},
};
static const struct
{
DWORD create_flags;
......@@ -2076,6 +2098,31 @@ static void test_wndproc(void)
&& devmode.dmPelsHeight == d3d_height, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
ShowWindow(device_window, SW_HIDE);
flush_events();
expect_messages = focus_loss_messages_hidden;
unexpected_messages = focus_loss_messages_hidden_unexpected;
SetForegroundWindow(GetDesktopWindow());
ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n",
expect_messages->message, expect_messages->window, i);
expect_messages = NULL;
unexpected_messages = NULL;
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth);
ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight);
ShowWindow(device_window, SW_RESTORE);
ShowWindow(focus_window, SW_MINIMIZE);
ShowWindow(focus_window, SW_RESTORE);
SetForegroundWindow(focus_window);
flush_events();
filter_messages = focus_window;
ref = IDirect3DDevice9Ex_Release(device);
ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i);
......
......@@ -3095,7 +3095,7 @@ struct message
WPARAM expect_wparam;
};
static const struct message *expect_messages;
static const struct message *expect_messages, *unexpected_messages;
static HWND device_window, focus_window;
struct wndproc_thread_param
......@@ -3144,6 +3144,13 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
}
}
if (unexpected_messages)
{
const struct message *i;
for (i = unexpected_messages; i->message; i++)
ok(i->message != message, "Got unexpected message %x on window %p.\n", message, hwnd);
}
return DefWindowProcA(hwnd, message, wparam, lparam);
}
......@@ -3259,6 +3266,21 @@ static void test_wndproc(void)
{WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_ACTIVE},
{0, 0, FALSE, 0},
};
static const struct message focus_loss_messages_hidden[] =
{
{WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0},
{WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE},
{0, 0, FALSE, 0},
};
static const struct message focus_loss_messages_hidden_unexpected[] =
{
/* KDE randomly does something with the hidden window during the
* mode change that sometimes generates a WM_WINDOWPOSCHANGING
* message. A WM_WINDOWPOSCHANGED message is not generated, so
* just flag WM_WINDOWPOSCHANGED as bad. */
{WM_WINDOWPOSCHANGED, 0, FALSE, 0},
{0, 0, FALSE, 0},
};
static const struct
{
DWORD create_flags;
......@@ -3482,6 +3504,31 @@ static void test_wndproc(void)
&& devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n",
devmode.dmPelsWidth, devmode.dmPelsHeight);
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
ShowWindow(device_window, SW_HIDE);
flush_events();
expect_messages = focus_loss_messages_hidden;
unexpected_messages = focus_loss_messages_hidden_unexpected;
SetForegroundWindow(GetDesktopWindow());
ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n",
expect_messages->message, expect_messages->window, i);
expect_messages = NULL;
unexpected_messages = NULL;
ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode);
ok(ret, "Failed to get display mode.\n");
ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth);
ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight);
ShowWindow(device_window, SW_RESTORE);
ShowWindow(focus_window, SW_MINIMIZE);
ShowWindow(focus_window, SW_RESTORE);
SetForegroundWindow(focus_window);
flush_events();
/* Releasing a device in lost state breaks follow-up tests on native. */
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i);
......
......@@ -1207,7 +1207,8 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
swapchain->reapply_mode = TRUE;
if (!(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES))
if (!(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)
&& IsWindowVisible(swapchain->device_window))
ShowWindow(swapchain->device_window, SW_MINIMIZE);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment