Disable DXGI monitoring the message queue for Alt+Enter fullscreen switch. Switching that way instead of calling toggle_fullscreen, causes issue when trying to Alt+Tab. Also users might want to use Alt+Enter for other things.
Changed how DXGI factory is handled. I retrieve the one associated with the current DXGI device and adapter instead of creating a new one. Fixed missing new line in the log at 1 location.
This commit is contained in:
parent
d926166630
commit
f3dc516704
|
@ -1744,7 +1744,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
window_style |= WS_MAXIMIZE;
|
||||
}
|
||||
log_os(" windowed dimensions: %d, %d\n"
|
||||
" initially maximized: %d",
|
||||
" initially maximized: %d\n",
|
||||
window_rect.right - window_rect.left,
|
||||
window_rect.bottom - window_rect.top,
|
||||
((window_style & WS_MAXIMIZE) != 0));
|
||||
|
|
|
@ -50,6 +50,8 @@ win32_gl_create_window(HWND *wnd_out, DWORD style, RECT rect){
|
|||
|
||||
ID3D11Device* base_device = 0;
|
||||
ID3D11DeviceContext* base_device_context = 0;
|
||||
IDXGIDevice1* dxgi_device = 0;
|
||||
IDXGIAdapter* dxgi_adapter = 0;
|
||||
IDXGIFactory2* dxgi_factory = 0;
|
||||
|
||||
ID3D11BlendState* blend_state = 0;
|
||||
|
@ -176,8 +178,26 @@ win32_gl_create_window(HWND *wnd_out, DWORD style, RECT rect){
|
|||
log_os( " sRBG back buffer supported.\n" );
|
||||
}
|
||||
|
||||
log_os( " Creating a IDXGIFactory2...\n" );
|
||||
hr = CreateDXGIFactory( __uuidof( IDXGIFactory2 ), ( void** ) &dxgi_factory );
|
||||
log_os( " Getting a IDXGIFactory2...\n" );
|
||||
|
||||
log_os( " Qurey for the IDXGIDevice1...\n" );
|
||||
hr = device->QueryInterface( __uuidof( IDXGIDevice1 ), ( void** ) &dxgi_device );
|
||||
|
||||
if ( FAILED( hr ) ) {
|
||||
log_os( " Failed.\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
log_os( " Getting the IDXGIAdapter...\n" );
|
||||
dxgi_device->GetAdapter( &dxgi_adapter );
|
||||
|
||||
if ( FAILED( hr ) ) {
|
||||
log_os( " Failed.\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
log_os( " Getting the IDXGIFactor2...\n" );
|
||||
dxgi_adapter->GetParent( __uuidof( IDXGIFactory2 ), ( void** ) &dxgi_factory );
|
||||
|
||||
if ( FAILED( hr ) ) {
|
||||
log_os( " Failed.\n" );
|
||||
|
@ -203,6 +223,13 @@ win32_gl_create_window(HWND *wnd_out, DWORD style, RECT rect){
|
|||
break;
|
||||
}
|
||||
|
||||
log_os( " Prevent DXGI handling ALT + ENTER...\n" );
|
||||
hr = dxgi_factory->MakeWindowAssociation( wnd, DXGI_MWA_NO_ALT_ENTER );
|
||||
|
||||
if ( FAILED( hr ) ) {
|
||||
log_os( " Failed.\n" );
|
||||
}
|
||||
|
||||
// NOTE(simon, 28/02/24): We setup alpha blending here as it's always on in 4coder.
|
||||
D3D11_BLEND_DESC blend_state_desc = { };
|
||||
blend_state_desc.RenderTarget[ 0 ].BlendEnable = TRUE;
|
||||
|
@ -393,6 +420,16 @@ win32_gl_create_window(HWND *wnd_out, DWORD style, RECT rect){
|
|||
base_device_context = 0;
|
||||
}
|
||||
|
||||
if ( dxgi_device ) {
|
||||
dxgi_device->Release( );
|
||||
dxgi_device = 0;
|
||||
}
|
||||
|
||||
if ( dxgi_adapter ) {
|
||||
dxgi_adapter->Release( );
|
||||
dxgi_adapter = 0;
|
||||
}
|
||||
|
||||
if ( dxgi_factory ) {
|
||||
dxgi_factory->Release( );
|
||||
dxgi_factory = 0;
|
||||
|
|
Loading…
Reference in New Issue