diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-04-01 00:51:02 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-04-01 00:51:02 +0000 |
| commit | be4b724b6b90a960f25844683f69d7f80ca2abeb (patch) | |
| tree | 58a48facded1540a0db655c589a793bdcd10b0de /Graphics/GraphicsEngineD3DBase | |
| parent | Added sync interval parameter to ISwapChain::Present() (diff) | |
| download | DiligentCore-be4b724b6b90a960f25844683f69d7f80ca2abeb.tar.gz DiligentCore-be4b724b6b90a960f25844683f69d7f80ca2abeb.zip | |
Fixed issue MakeWindowAssociation() not disabling Alt+Enter on D3D11
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
| -rw-r--r-- | Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h index e61a3842..743c9793 100644 --- a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h +++ b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h @@ -131,10 +131,19 @@ namespace Diligent FullScreenDesc.ScanlineOrdering = static_cast<DXGI_MODE_SCANLINE_ORDER>(m_FSDesc.ScanlineOrder); hr = factory->CreateSwapChainForHwnd(pD3D11DeviceOrD3D12CmdQueue, hWnd, &swapChainDesc, &FullScreenDesc, nullptr, &pSwapChain1); CHECK_D3D_RESULT_THROW(hr, "Failed to create Swap Chain"); - - // Do not allow the swap chain handle Alt+Enter - hr = factory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER); - + + { + // This is silly, but IDXGIFactory used for MakeWindowAssociation must be retrieved via + // calling IDXGISwapchain::GetParent first, otherwise it won't work + // https://www.gamedev.net/forums/topic/634235-dxgidisabling-altenter/?do=findComment&comment=4999990 + CComPtr<IDXGIFactory1> pFactoryFromSC; + if (SUCCEEDED(pSwapChain1->GetParent(__uuidof(pFactoryFromSC), (void **)&pFactoryFromSC))) + { + // Do not allow the swap chain to handle Alt+Enter + pFactoryFromSC->MakeWindowAssociation(hWnd, DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER); + } + } + #elif PLATFORM_UNIVERSAL_WINDOWS if (m_FSDesc.Fullscreen) |
