Qt: Allow toggling fullscreen when VM is paused
This commit is contained in:
parent
ecd8d97f72
commit
429cb4f351
|
@ -322,7 +322,12 @@ void Host::ResizeDisplayWindow(s32 width, s32 height, float scale)
|
|||
if (System::IsValid())
|
||||
{
|
||||
if (System::IsPaused())
|
||||
{
|
||||
// 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.
|
||||
System::InvalidateDisplay();
|
||||
System::InvalidateDisplay();
|
||||
}
|
||||
|
||||
System::HostDisplayResized();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||
|
||||
#include "displaywidget.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/bitutils.h"
|
||||
#include "common/log.h"
|
||||
#include "mainwindow.h"
|
||||
#include "qthost.h"
|
||||
#include "qtutils.h"
|
||||
|
||||
#include "core/fullscreen_ui.h"
|
||||
|
||||
#include "util/imgui_manager.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/bitutils.h"
|
||||
#include "common/log.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QKeyEvent>
|
||||
|
@ -311,9 +316,12 @@ bool DisplayWidget::event(QEvent* event)
|
|||
|
||||
// don't toggle fullscreen when we're bound.. that wouldn't end well.
|
||||
if (event->type() == QEvent::MouseButtonDblClick &&
|
||||
static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton &&
|
||||
!InputManager::HasAnyBindingsForKey(InputManager::MakePointerButtonKey(0, 0)) && QtHost::IsSystemValid() &&
|
||||
!QtHost::IsSystemPaused() && Host::GetBoolSettingValue("Main", "DoubleClickTogglesFullscreen", true))
|
||||
static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton && QtHost::IsSystemValid() &&
|
||||
!FullscreenUI::HasActiveWindow() &&
|
||||
((!QtHost::IsSystemPaused() &&
|
||||
!InputManager::HasAnyBindingsForKey(InputManager::MakePointerButtonKey(0, 0))) ||
|
||||
(QtHost::IsSystemPaused() && !ImGuiManager::WantsMouseInput())) &&
|
||||
Host::GetBoolSettingValue("Main", "DoubleClickTogglesFullscreen", true))
|
||||
{
|
||||
g_emu_thread->toggleFullscreen();
|
||||
}
|
||||
|
|
|
@ -892,6 +892,11 @@ bool ImGuiManager::WantsTextInput()
|
|||
return s_imgui_wants_keyboard.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
bool ImGuiManager::WantsMouseInput()
|
||||
{
|
||||
return s_imgui_wants_mouse.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
void ImGuiManager::AddTextInput(std::string str)
|
||||
{
|
||||
if (!ImGui::GetCurrentContext())
|
||||
|
|
|
@ -69,6 +69,9 @@ ImFont* GetLargeFont();
|
|||
/// Returns true if imgui wants to intercept text input.
|
||||
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.
|
||||
void AddTextInput(std::string str);
|
||||
|
||||
|
|
Loading…
Reference in New Issue