mirror of https://github.com/PCSX2/pcsx2.git
GS/DX: Fix ALT+ENTER causing mode switch
This commit is contained in:
parent
615e30fa52
commit
4dca6c3bb2
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||||
// SPDX-License-Identifier: LGPL-3.0+
|
// SPDX-License-Identifier: LGPL-3.0+
|
||||||
|
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
|
#include "common/Error.h"
|
||||||
#include "common/Path.h"
|
#include "common/Path.h"
|
||||||
#include "common/StringUtil.h"
|
#include "common/StringUtil.h"
|
||||||
|
|
||||||
|
@ -709,9 +710,19 @@ bool GSDevice11::CreateSwapChain()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = m_dxgi_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
// MWA needs to be called on the correct factory.
|
||||||
|
wil::com_ptr_nothrow<IDXGIFactory> swap_chain_factory;
|
||||||
|
hr = m_swap_chain->GetParent(IID_PPV_ARGS(swap_chain_factory.put()));
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = swap_chain_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
Console.Warning("MakeWindowAssociation() to disable ALT+ENTER failed");
|
Console.ErrorFmt("MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.ErrorFmt("GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||||
|
}
|
||||||
|
|
||||||
if (!CreateSwapChainRTV())
|
if (!CreateSwapChainRTV())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
||||||
// SPDX-License-Identifier: LGPL-3.0+
|
// SPDX-License-Identifier: LGPL-3.0+
|
||||||
|
|
||||||
#include "GS/GS.h"
|
#include "GS/GS.h"
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "common/Console.h"
|
#include "common/Console.h"
|
||||||
#include "common/BitUtils.h"
|
#include "common/BitUtils.h"
|
||||||
|
#include "common/Error.h"
|
||||||
#include "common/HostSys.h"
|
#include "common/HostSys.h"
|
||||||
#include "common/ScopedGuard.h"
|
#include "common/ScopedGuard.h"
|
||||||
#include "common/SmallString.h"
|
#include "common/SmallString.h"
|
||||||
|
@ -855,9 +856,19 @@ bool GSDevice12::CreateSwapChain()
|
||||||
Console.Warning("Failed to create windowed swap chain.");
|
Console.Warning("Failed to create windowed swap chain.");
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = m_dxgi_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
// MWA needs to be called on the correct factory.
|
||||||
|
wil::com_ptr_nothrow<IDXGIFactory> swap_chain_factory;
|
||||||
|
hr = m_swap_chain->GetParent(IID_PPV_ARGS(swap_chain_factory.put()));
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = swap_chain_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
Console.Warning("MakeWindowAssociation() to disable ALT+ENTER failed");
|
Console.ErrorFmt("MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.ErrorFmt("GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
|
||||||
|
}
|
||||||
|
|
||||||
if (!CreateSwapChainRTV())
|
if (!CreateSwapChainRTV())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue