From c6a24decde17555ef90c06f0b7bf7f3fd2bd2b0a Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Sat, 31 Oct 2020 04:22:42 -0700 Subject: [PATCH] Fix MakeWindowAssociation so alt-enter is actually disabled --- src/FNA3D_Driver_D3D11.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/FNA3D_Driver_D3D11.c b/src/FNA3D_Driver_D3D11.c index 7137b3ef5..a6a9fd7da 100644 --- a/src/FNA3D_Driver_D3D11.c +++ b/src/FNA3D_Driver_D3D11.c @@ -5022,9 +5022,24 @@ static void D3D11_PLATFORM_CreateSwapChain( ); ERROR_CHECK("Could not create swapchain") + /* + * The swapchain's parent is a separate factory from the factory that + * we used to create the swapchain, and only that parent can be used to + * set the window association. Trying to set an association on our factory + * will silently fail and doesn't even verify arguments or return errors. + * See https://gamedev.net/forums/topic/634235-dxgidisabling-altenter/4999955/ + */ + IDXGIFactory1* pParent; + res = IDXGISwapChain_GetParent( + (IDXGISwapChain *) renderer->swapchain, + &D3D_IID_IDXGIFactory1, + &pParent + ); + ERROR_CHECK("Could not get swapchain parent") + /* Disable DXGI window crap */ - res = IDXGIFactory_MakeWindowAssociation( - (IDXGIFactory*) renderer->factory, + res = IDXGIFactory1_MakeWindowAssociation( + pParent, dxgiHandle, DXGI_MWA_NO_WINDOW_CHANGES );