mirror of https://github.com/PCSX2/pcsx2.git
FSUI: Allow toggling fullscreen when VM is paused
This commit is contained in:
parent
f9833bb8af
commit
140fc28b3e
|
@ -6,6 +6,7 @@
|
||||||
#include "QtHost.h"
|
#include "QtHost.h"
|
||||||
#include "QtUtils.h"
|
#include "QtUtils.h"
|
||||||
|
|
||||||
|
#include "pcsx2/ImGui/FullscreenUI.h"
|
||||||
#include "pcsx2/ImGui/ImGuiManager.h"
|
#include "pcsx2/ImGui/ImGuiManager.h"
|
||||||
|
|
||||||
#include "common/Assertions.h"
|
#include "common/Assertions.h"
|
||||||
|
@ -323,8 +324,9 @@ bool DisplayWidget::event(QEvent* event)
|
||||||
// don't toggle fullscreen when we're bound.. that wouldn't end well.
|
// don't toggle fullscreen when we're bound.. that wouldn't end well.
|
||||||
if (event->type() == QEvent::MouseButtonDblClick &&
|
if (event->type() == QEvent::MouseButtonDblClick &&
|
||||||
static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton &&
|
static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton &&
|
||||||
QtHost::IsVMValid() && !QtHost::IsVMPaused() &&
|
QtHost::IsVMValid() && !FullscreenUI::HasActiveWindow() &&
|
||||||
!InputManager::HasAnyBindingsForKey(InputManager::MakePointerButtonKey(0, 0)) &&
|
((!QtHost::IsVMPaused() && !InputManager::HasAnyBindingsForKey(InputManager::MakePointerButtonKey(0, 0))) ||
|
||||||
|
(QtHost::IsVMPaused() && !ImGuiManager::WantsMouseInput())) &&
|
||||||
Host::GetBoolSettingValue("UI", "DoubleClickTogglesFullscreen", true))
|
Host::GetBoolSettingValue("UI", "DoubleClickTogglesFullscreen", true))
|
||||||
{
|
{
|
||||||
g_emu_thread->toggleFullscreen();
|
g_emu_thread->toggleFullscreen();
|
||||||
|
|
|
@ -497,7 +497,7 @@ void EmuThread::setFullscreen(bool fullscreen, bool allow_render_to_main)
|
||||||
MTGS::WaitGS();
|
MTGS::WaitGS();
|
||||||
|
|
||||||
// If we're using exclusive fullscreen, the refresh rate may have changed.
|
// If we're using exclusive fullscreen, the refresh rate may have changed.
|
||||||
UpdateVSyncRate(true);
|
VMManager::UpdateTargetSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::setSurfaceless(bool surfaceless)
|
void EmuThread::setSurfaceless(bool surfaceless)
|
||||||
|
|
|
@ -836,6 +836,11 @@ bool ImGuiManager::WantsTextInput()
|
||||||
return s_imgui_wants_text.load(std::memory_order_acquire);
|
return s_imgui_wants_text.load(std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGuiManager::WantsMouseInput()
|
||||||
|
{
|
||||||
|
return s_imgui_wants_mouse.load(std::memory_order_acquire);
|
||||||
|
}
|
||||||
|
|
||||||
void ImGuiManager::AddTextInput(std::string str)
|
void ImGuiManager::AddTextInput(std::string str)
|
||||||
{
|
{
|
||||||
if (!s_imgui_wants_text.load(std::memory_order_acquire))
|
if (!s_imgui_wants_text.load(std::memory_order_acquire))
|
||||||
|
|
|
@ -72,6 +72,9 @@ namespace ImGuiManager
|
||||||
/// Returns true if imgui wants to intercept text input.
|
/// Returns true if imgui wants to intercept text input.
|
||||||
bool WantsTextInput();
|
bool WantsTextInput();
|
||||||
|
|
||||||
|
/// Returns true if imgui wants to intercept mouse input.
|
||||||
|
bool WantsMouseInput();
|
||||||
|
|
||||||
/// Called on the UI or CPU thread in response to a key press. String is UTF-8.
|
/// Called on the UI or CPU thread in response to a key press. String is UTF-8.
|
||||||
void AddTextInput(std::string str);
|
void AddTextInput(std::string str);
|
||||||
|
|
||||||
|
|
|
@ -963,7 +963,12 @@ void MTGS::UpdateDisplayWindow()
|
||||||
|
|
||||||
// If we're paused, re-present the current frame at the new window size.
|
// If we're paused, re-present the current frame at the new window size.
|
||||||
if (VMManager::GetState() == VMState::Paused)
|
if (VMManager::GetState() == VMState::Paused)
|
||||||
|
{
|
||||||
|
// Hackity hack, on some systems, presenting a single frame isn't enough to actually get it
|
||||||
|
// displayed. Two seems to be good enough. Maybe something to do with direct scanout.
|
||||||
GSPresentCurrentFrame();
|
GSPresentCurrentFrame();
|
||||||
|
GSPresentCurrentFrame();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue