Commit a600760f authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

dxgi: Implement Alt+Enter handling.

parent b94a6b1e
......@@ -174,7 +174,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *ifa
static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IWineDXGIFactory *iface,
HWND window, UINT flags)
{
FIXME("iface %p, window %p, flags %#x stub!\n", iface, window, flags);
struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface);
TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags);
if (flags > DXGI_MWA_VALID)
return DXGI_ERROR_INVALID_CALL;
if (!window)
{
wined3d_unregister_windows(factory->wined3d);
return S_OK;
}
if (!wined3d_register_window(factory->wined3d, window, NULL, flags))
return E_FAIL;
return S_OK;
}
......
......@@ -5086,7 +5086,7 @@ static void test_window_association(void)
}
hr = IDXGIFactory_MakeWindowAssociation(factory, swapchain_desc.OutputWindow, DXGI_MWA_VALID + 1);
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
/* Alt+Enter tests. */
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
......@@ -5134,10 +5134,9 @@ static void test_window_association(void)
flush_events();
hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(tests[i].expect_fullscreen)
ok(fullscreen == tests[i].expect_fullscreen
|| broken(tests[i].broken_d3d10 && fullscreen),
"Test %u: Got unexpected fullscreen %#x.\n", i, fullscreen);
ok(fullscreen == tests[i].expect_fullscreen
|| broken(tests[i].broken_d3d10 && fullscreen),
"Test %u: Got unexpected fullscreen %#x.\n", i, fullscreen);
wndproc = GetWindowLongPtrW(swapchain_desc.OutputWindow, GWLP_WNDPROC);
ok(wndproc == original_wndproc, "Text %u: Got unexpected wndproc %#lx, expected %#lx.\n",
......
......@@ -511,7 +511,7 @@ unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE dxgi_usage)
}
#define DXGI_WINED3D_SWAPCHAIN_FLAGS \
(WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
(WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT | WINED3D_SWAPCHAIN_HOOK)
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
{
......
......@@ -1015,7 +1015,7 @@ HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device,
{
TRACE("device %p, window %p.\n", device, window);
if (!wined3d_register_window(window, device))
if (!wined3d_register_window(NULL, window, device, 0))
{
ERR("Failed to register window %p.\n", window);
return E_FAIL;
......
......@@ -121,6 +121,7 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
device = swapchain->device;
if (device->swapchain_count && device->swapchains[0] == swapchain)
wined3d_device_uninit_3d(device);
wined3d_unhook_swapchain(swapchain);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
swapchain_cleanup(swapchain);
......@@ -1037,6 +1038,9 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, struct win
return hr;
}
if (desc->flags & WINED3D_SWAPCHAIN_HOOK)
wined3d_hook_swapchain(object);
if (desc->flags & WINED3D_SWAPCHAIN_IMPLICIT)
{
wined3d_mutex_lock();
......
......@@ -20,7 +20,9 @@
@ cdecl wined3d_get_output_desc(ptr long ptr)
@ cdecl wined3d_incref(ptr)
@ cdecl wined3d_register_software_device(ptr ptr)
@ cdecl wined3d_register_window(ptr ptr ptr long)
@ cdecl wined3d_set_adapter_display_mode(ptr long ptr)
@ cdecl wined3d_unregister_windows(ptr)
@ cdecl wined3d_blend_state_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_blend_state_decref(ptr)
......
......@@ -2978,8 +2978,9 @@ struct wined3d
struct wined3d_adapter *adapters[1];
};
void wined3d_hook_swapchain(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) DECLSPEC_HIDDEN;
BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_unhook_swapchain(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size) DECLSPEC_HIDDEN;
......
......@@ -903,6 +903,7 @@ enum wined3d_shader_type
#define WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT 0x00004000u
#define WINED3D_SWAPCHAIN_GDI_COMPATIBLE 0x00008000u
#define WINED3D_SWAPCHAIN_IMPLICIT 0x00010000u
#define WINED3D_SWAPCHAIN_HOOK 0x00020000u
#define WINED3DDP_MAXTEXCOORD 8
......@@ -1584,6 +1585,10 @@ enum wined3d_shader_type
#define WINED3D_MAX_VIEWPORTS 16
#define WINED3D_REGISTER_WINDOW_NO_WINDOW_CHANGES 0x00000001u
#define WINED3D_REGISTER_WINDOW_NO_ALT_ENTER 0x00000002u
#define WINED3D_REGISTER_WINDOW_NO_PRINT_SCREEN 0x00000004u
struct wined3d_display_mode
{
UINT width;
......@@ -2210,8 +2215,11 @@ HRESULT __cdecl wined3d_get_output_desc(const struct wined3d *wined3d, unsigned
struct wined3d_output_desc *desc);
ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function);
BOOL __cdecl wined3d_register_window(struct wined3d *wined3d, HWND window,
struct wined3d_device *device, unsigned int flags);
HRESULT __cdecl wined3d_set_adapter_display_mode(struct wined3d *wined3d,
UINT adapter_idx, const struct wined3d_display_mode *mode);
void __cdecl wined3d_unregister_windows(struct wined3d *wined3d);
HRESULT __cdecl wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc,
const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops,
......
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