From 2b69a68ef6657d857bec77a2871ecd2945635953 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 14 Apr 2020 17:35:31 +0200 Subject: [PATCH] Qt: show mouse in fullscreen --- rpcs3/rpcs3qt/gs_frame.cpp | 3 ++- rpcs3/rpcs3qt/gs_frame.h | 3 ++- rpcs3/rpcs3qt/gui_settings.h | 9 +++++---- rpcs3/rpcs3qt/settings_dialog.cpp | 10 ++++++++-- rpcs3/rpcs3qt/settings_dialog.ui | 7 +++++++ rpcs3/rpcs3qt/tooltips.h | 1 + 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index 9fabd6312b..5f968caf6e 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -43,6 +43,7 @@ gs_frame::gs_frame(const QRect& geometry, const QIcon& appIcon, const std::share : QWindow(), m_gui_settings(gui_settings) { m_disable_mouse = gui_settings->GetValue(gui::gs_disableMouse).toBool(); + m_show_mouse_in_fullscreen = gui_settings->GetValue(gui::gs_showMouseFs).toBool(); m_window_title = qstr(Emu.GetFormattedTitle(0)); @@ -410,7 +411,7 @@ void gs_frame::mouseDoubleClickEvent(QMouseEvent* ev) void gs_frame::HandleCursor(QWindow::Visibility visibility) { - if (visibility == QWindow::Visibility::FullScreen) + if (visibility == QWindow::Visibility::FullScreen && !m_show_mouse_in_fullscreen) { setCursor(Qt::BlankCursor); } diff --git a/rpcs3/rpcs3qt/gs_frame.h b/rpcs3/rpcs3qt/gs_frame.h index f09eeb9868..aa6ecd8333 100644 --- a/rpcs3/rpcs3qt/gs_frame.h +++ b/rpcs3/rpcs3qt/gs_frame.h @@ -32,7 +32,8 @@ private: u64 m_frames = 0; QString m_window_title; - bool m_disable_mouse; + bool m_disable_mouse = false; + bool m_show_mouse_in_fullscreen = false; public: gs_frame(const QRect& geometry, const QIcon& appIcon, const std::shared_ptr& gui_settings); diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index ae6aa802a7..2cef496ac0 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -191,10 +191,11 @@ namespace gui const gui_save m_discordState = gui_save(meta, "discordState", ""); const gui_save m_check_upd_start = gui_save(meta, "checkUpdateStart", true); - const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false); - const gui_save gs_resize = gui_save(gs_frame, "resize", false); - const gui_save gs_width = gui_save(gs_frame, "width", 1280); - const gui_save gs_height = gui_save(gs_frame, "height", 720); + const gui_save gs_disableMouse = gui_save(gs_frame, "disableMouse", false); + const gui_save gs_showMouseFs = gui_save(gs_frame, "showMouseInFullscreen", false); + const gui_save gs_resize = gui_save(gs_frame, "resize", false); + const gui_save gs_width = gui_save(gs_frame, "width", 1280); + const gui_save gs_height = gui_save(gs_frame, "height", 720); const gui_save tr_icon_color = gui_save(trophy, "icon_color", gl_icon_color); const gui_save tr_icon_height = gui_save(trophy, "icon_height", 75); diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 979fa87a54..2dd5b6a279 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -1264,15 +1264,21 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (!game) { SubscribeTooltip(ui->gs_resizeOnBoot, tooltips.settings.resize_on_boot); - SubscribeTooltip(ui->gs_disableMouse, tooltips.settings.disable_mouse); + SubscribeTooltip(ui->gs_showMouseInFullscreen, tooltips.settings.show_mouse_in_fullscreen); ui->gs_disableMouse->setChecked(m_gui_settings->GetValue(gui::gs_disableMouse).toBool()); - connect(ui->gs_disableMouse, &QCheckBox::clicked, [=, this](bool val) + connect(ui->gs_disableMouse, &QCheckBox::clicked, [this](bool val) { m_gui_settings->SetValue(gui::gs_disableMouse, val); }); + ui->gs_showMouseInFullscreen->setChecked(m_gui_settings->GetValue(gui::gs_showMouseFs).toBool()); + connect(ui->gs_showMouseInFullscreen, &QCheckBox::clicked, [this](bool val) + { + m_gui_settings->SetValue(gui::gs_showMouseFs, val); + }); + const bool enable_buttons = m_gui_settings->GetValue(gui::gs_resize).toBool(); ui->gs_resizeOnBoot->setChecked(enable_buttons); ui->gs_width->setEnabled(enable_buttons); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index 1c84447eb5..1f663b0f64 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -2338,6 +2338,13 @@ + + + + Show mouse cursor in Fullscreen + + + diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index e543c6236c..a03df31884 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -104,6 +104,7 @@ public: const QString show_trophy_popups = tr("Show trophy pop-ups when a trophy is unlocked."); const QString disable_mouse = tr("Disables the activation of fullscreen mode per double-click while the game screen is active.\nCheck this if you want to play with mouse and keyboard (for example with UCR)."); const QString max_llvm_threads = tr("Limits the maximum number of threads used for the initial PPU and SPU module compilation.\nLower this in order to increase performance of other open applications.\nThe default uses all available threads."); + const QString show_mouse_in_fullscreen = tr("Shows the mouse cursor when the fullscreen mode is active.\nCurrently this may not work every time."); const QString show_shader_compilation_hint = tr("Show shader compilation hints using the native overlay."); const QString use_native_interface = tr("Enables use of native HUD within the game window that can interact with game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nCurrently, the on-screen keyboard only supports the English key layout.");