D3D11: Prevent DXGI hooking the Alt+Enter keystroke

When ANGLE is using D3D11 and not using DirectComposition, DXGI will hook
the window's message loop and override Alt+Enter to trigger a transition
to exclusive fullscreen mode. This disables that behaviour, since it's
inconsistent between backends and, at least during my testing, the
application did not even work correctly after the transition to fullscreen
mode.

This commit should be similar to the workarounds implemented in Qt and mpv
to prevent this behaviour and will hopefully make those workarounds
unnecessary. Only the DXGI_MWA_NO_ALT_ENTER flag is used, since the other
flags didn't seem to have an effect and probably only matter in fullscreen
mode.

BUG=angleproject:1414

Change-Id: Icb70c2c1405225619dcb27c5ffc9472fddd1157b
Reviewed-on: https://chromium-review.googlesource.com/352950
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
James Ross-Gowan 2016-06-15 22:35:50 +10:00 коммит произвёл Commit Bot
Родитель 989cac3467
Коммит cd9aa12afc
3 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -44,3 +44,4 @@ Josh Soref
Maks Naumov
Jinyoung Hur
Sebastian Bergstein
James Ross-Gowan

Просмотреть файл

@ -86,6 +86,7 @@ Jacek Caban
Tibor den Ouden
Régis Fénéon
Sebastian Bergstein
James Ross-Gowan
Microsoft Corporation
Cooper Partin

Просмотреть файл

@ -166,6 +166,7 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device,
nullptr, nullptr, &swapChain1);
if (SUCCEEDED(result))
{
factory2->MakeWindowAssociation(getNativeWindow(), DXGI_MWA_NO_ALT_ENTER);
*swapChain = static_cast<IDXGISwapChain *>(swapChain1);
}
SafeRelease(factory2);
@ -190,7 +191,12 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device,
swapChainDesc.Windowed = TRUE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
return factory->CreateSwapChain(device, &swapChainDesc, swapChain);
HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain);
if (SUCCEEDED(result))
{
factory->MakeWindowAssociation(getNativeWindow(), DXGI_MWA_NO_ALT_ENTER);
}
return result;
}
void NativeWindow11Win32::commitChange()