diff options
| -rw-r--r-- | src/common/uuid.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/am/applet_ae.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.ui | 7 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 56 | ||||
| -rw-r--r-- | src/yuzu/main.h | 5 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 1 |
12 files changed, 111 insertions, 9 deletions
diff --git a/src/common/uuid.h b/src/common/uuid.h index f6ad064fb..4d3af8cec 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h | |||
| @@ -40,6 +40,11 @@ struct UUID { | |||
| 40 | uuid = INVALID_UUID; | 40 | uuid = INVALID_UUID; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // TODO(ogniK): Properly generate a Nintendo ID | ||
| 44 | constexpr u64 GetNintendoID() const { | ||
| 45 | return uuid[0]; | ||
| 46 | } | ||
| 47 | |||
| 43 | std::string Format() const; | 48 | std::string Format() const; |
| 44 | std::string FormatSwitch() const; | 49 | std::string FormatSwitch() const; |
| 45 | }; | 50 | }; |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 9a7992f58..630a8b048 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -228,7 +228,8 @@ public: | |||
| 228 | 228 | ||
| 229 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { | 229 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { |
| 230 | public: | 230 | public: |
| 231 | IManagerForApplication() : ServiceFramework("IManagerForApplication") { | 231 | explicit IManagerForApplication(Common::UUID user_id) |
| 232 | : ServiceFramework("IManagerForApplication"), user_id(user_id) { | ||
| 232 | // clang-format off | 233 | // clang-format off |
| 233 | static const FunctionInfo functions[] = { | 234 | static const FunctionInfo functions[] = { |
| 234 | {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, | 235 | {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, |
| @@ -254,12 +255,14 @@ private: | |||
| 254 | } | 255 | } |
| 255 | 256 | ||
| 256 | void GetAccountId(Kernel::HLERequestContext& ctx) { | 257 | void GetAccountId(Kernel::HLERequestContext& ctx) { |
| 257 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | 258 | LOG_DEBUG(Service_ACC, "called"); |
| 258 | // Should return a nintendo account ID | 259 | |
| 259 | IPC::ResponseBuilder rb{ctx, 4}; | 260 | IPC::ResponseBuilder rb{ctx, 4}; |
| 260 | rb.Push(RESULT_SUCCESS); | 261 | rb.Push(RESULT_SUCCESS); |
| 261 | rb.PushRaw<u64>(1); | 262 | rb.PushRaw<u64>(user_id.GetNintendoID()); |
| 262 | } | 263 | } |
| 264 | |||
| 265 | Common::UUID user_id; | ||
| 263 | }; | 266 | }; |
| 264 | 267 | ||
| 265 | void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { | 268 | void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { |
| @@ -382,7 +385,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo | |||
| 382 | LOG_DEBUG(Service_ACC, "called"); | 385 | LOG_DEBUG(Service_ACC, "called"); |
| 383 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 386 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 384 | rb.Push(RESULT_SUCCESS); | 387 | rb.Push(RESULT_SUCCESS); |
| 385 | rb.PushIpcInterface<IManagerForApplication>(); | 388 | rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); |
| 386 | } | 389 | } |
| 387 | 390 | ||
| 388 | void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { | 391 | void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index a967e6ef7..4df74c4f9 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1525,14 +1525,15 @@ void InstallInterfaces(SM::ServiceManager& service_manager, | |||
| 1525 | std::make_shared<TCAP>()->InstallAsService(service_manager); | 1525 | std::make_shared<TCAP>()->InstallAsService(service_manager); |
| 1526 | } | 1526 | } |
| 1527 | 1527 | ||
| 1528 | IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions") { | 1528 | IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel) |
| 1529 | : ServiceFramework("IHomeMenuFunctions"), kernel(kernel) { | ||
| 1529 | // clang-format off | 1530 | // clang-format off |
| 1530 | static const FunctionInfo functions[] = { | 1531 | static const FunctionInfo functions[] = { |
| 1531 | {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, | 1532 | {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, |
| 1532 | {11, nullptr, "LockForeground"}, | 1533 | {11, nullptr, "LockForeground"}, |
| 1533 | {12, nullptr, "UnlockForeground"}, | 1534 | {12, nullptr, "UnlockForeground"}, |
| 1534 | {20, nullptr, "PopFromGeneralChannel"}, | 1535 | {20, nullptr, "PopFromGeneralChannel"}, |
| 1535 | {21, nullptr, "GetPopFromGeneralChannelEvent"}, | 1536 | {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"}, |
| 1536 | {30, nullptr, "GetHomeButtonWriterLockAccessor"}, | 1537 | {30, nullptr, "GetHomeButtonWriterLockAccessor"}, |
| 1537 | {31, nullptr, "GetWriterLockAccessorEx"}, | 1538 | {31, nullptr, "GetWriterLockAccessorEx"}, |
| 1538 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, | 1539 | {100, nullptr, "PopRequestLaunchApplicationForDebug"}, |
| @@ -1542,6 +1543,9 @@ IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions" | |||
| 1542 | // clang-format on | 1543 | // clang-format on |
| 1543 | 1544 | ||
| 1544 | RegisterHandlers(functions); | 1545 | RegisterHandlers(functions); |
| 1546 | |||
| 1547 | pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair( | ||
| 1548 | kernel, "IHomeMenuFunctions:PopFromGeneralChannelEvent"); | ||
| 1545 | } | 1549 | } |
| 1546 | 1550 | ||
| 1547 | IHomeMenuFunctions::~IHomeMenuFunctions() = default; | 1551 | IHomeMenuFunctions::~IHomeMenuFunctions() = default; |
| @@ -1553,6 +1557,14 @@ void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) | |||
| 1553 | rb.Push(RESULT_SUCCESS); | 1557 | rb.Push(RESULT_SUCCESS); |
| 1554 | } | 1558 | } |
| 1555 | 1559 | ||
| 1560 | void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx) { | ||
| 1561 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 1562 | |||
| 1563 | IPC::ResponseBuilder rb{ctx, 2, 1}; | ||
| 1564 | rb.Push(RESULT_SUCCESS); | ||
| 1565 | rb.PushCopyObjects(pop_from_general_channel_event.readable); | ||
| 1566 | } | ||
| 1567 | |||
| 1556 | IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { | 1568 | IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { |
| 1557 | // clang-format off | 1569 | // clang-format off |
| 1558 | static const FunctionInfo functions[] = { | 1570 | static const FunctionInfo functions[] = { |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index dfa701d73..469f7f814 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -292,11 +292,15 @@ private: | |||
| 292 | 292 | ||
| 293 | class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { | 293 | class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { |
| 294 | public: | 294 | public: |
| 295 | IHomeMenuFunctions(); | 295 | explicit IHomeMenuFunctions(Kernel::KernelCore& kernel); |
| 296 | ~IHomeMenuFunctions() override; | 296 | ~IHomeMenuFunctions() override; |
| 297 | 297 | ||
| 298 | private: | 298 | private: |
| 299 | void RequestToGetForeground(Kernel::HLERequestContext& ctx); | 299 | void RequestToGetForeground(Kernel::HLERequestContext& ctx); |
| 300 | void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); | ||
| 301 | |||
| 302 | Kernel::EventPair pop_from_general_channel_event; | ||
| 303 | Kernel::KernelCore& kernel; | ||
| 300 | }; | 304 | }; |
| 301 | 305 | ||
| 302 | class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { | 306 | class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { |
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index e454b77d8..9df286d17 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp | |||
| @@ -202,7 +202,7 @@ private: | |||
| 202 | 202 | ||
| 203 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 203 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 204 | rb.Push(RESULT_SUCCESS); | 204 | rb.Push(RESULT_SUCCESS); |
| 205 | rb.PushIpcInterface<IHomeMenuFunctions>(); | 205 | rb.PushIpcInterface<IHomeMenuFunctions>(system.Kernel()); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | void GetGlobalStateController(Kernel::HLERequestContext& ctx) { | 208 | void GetGlobalStateController(Kernel::HLERequestContext& ctx) { |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 1cac2f942..3d759f77b 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -292,6 +292,8 @@ GRenderWindow::GRenderWindow(GMainWindow* parent_, EmuThread* emu_thread_) | |||
| 292 | setLayout(layout); | 292 | setLayout(layout); |
| 293 | InputCommon::Init(); | 293 | InputCommon::Init(); |
| 294 | 294 | ||
| 295 | this->setMouseTracking(true); | ||
| 296 | |||
| 295 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent_, &GMainWindow::OnLoadComplete); | 297 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent_, &GMainWindow::OnLoadComplete); |
| 296 | } | 298 | } |
| 297 | 299 | ||
| @@ -385,6 +387,7 @@ void GRenderWindow::mousePressEvent(QMouseEvent* event) { | |||
| 385 | } else if (event->button() == Qt::RightButton) { | 387 | } else if (event->button() == Qt::RightButton) { |
| 386 | InputCommon::GetMotionEmu()->BeginTilt(pos.x(), pos.y()); | 388 | InputCommon::GetMotionEmu()->BeginTilt(pos.x(), pos.y()); |
| 387 | } | 389 | } |
| 390 | QWidget::mousePressEvent(event); | ||
| 388 | } | 391 | } |
| 389 | 392 | ||
| 390 | void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { | 393 | void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { |
| @@ -397,6 +400,7 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) { | |||
| 397 | const auto [x, y] = ScaleTouch(pos); | 400 | const auto [x, y] = ScaleTouch(pos); |
| 398 | this->TouchMoved(x, y); | 401 | this->TouchMoved(x, y); |
| 399 | InputCommon::GetMotionEmu()->Tilt(pos.x(), pos.y()); | 402 | InputCommon::GetMotionEmu()->Tilt(pos.x(), pos.y()); |
| 403 | QWidget::mouseMoveEvent(event); | ||
| 400 | } | 404 | } |
| 401 | 405 | ||
| 402 | void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { | 406 | void GRenderWindow::mouseReleaseEvent(QMouseEvent* event) { |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index a44eed047..75c6cf20b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -743,6 +743,8 @@ void Config::ReadUIValues() { | |||
| 743 | UISettings::values.profile_index = ReadSetting(QStringLiteral("profileIndex"), 0).toUInt(); | 743 | UISettings::values.profile_index = ReadSetting(QStringLiteral("profileIndex"), 0).toUInt(); |
| 744 | UISettings::values.pause_when_in_background = | 744 | UISettings::values.pause_when_in_background = |
| 745 | ReadSetting(QStringLiteral("pauseWhenInBackground"), false).toBool(); | 745 | ReadSetting(QStringLiteral("pauseWhenInBackground"), false).toBool(); |
| 746 | UISettings::values.hide_mouse = | ||
| 747 | ReadSetting(QStringLiteral("hideInactiveMouse"), false).toBool(); | ||
| 746 | 748 | ||
| 747 | ApplyDefaultProfileIfInputInvalid(); | 749 | ApplyDefaultProfileIfInputInvalid(); |
| 748 | 750 | ||
| @@ -1169,6 +1171,7 @@ void Config::SaveUIValues() { | |||
| 1169 | WriteSetting(QStringLiteral("profileIndex"), UISettings::values.profile_index, 0); | 1171 | WriteSetting(QStringLiteral("profileIndex"), UISettings::values.profile_index, 0); |
| 1170 | WriteSetting(QStringLiteral("pauseWhenInBackground"), | 1172 | WriteSetting(QStringLiteral("pauseWhenInBackground"), |
| 1171 | UISettings::values.pause_when_in_background, false); | 1173 | UISettings::values.pause_when_in_background, false); |
| 1174 | WriteSetting(QStringLiteral("hideInactiveMouse"), UISettings::values.hide_mouse, false); | ||
| 1172 | 1175 | ||
| 1173 | qt_config->endGroup(); | 1176 | qt_config->endGroup(); |
| 1174 | } | 1177 | } |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 5ef927114..cb95423e0 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -26,6 +26,7 @@ void ConfigureGeneral::SetConfiguration() { | |||
| 26 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); | 26 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); |
| 27 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); | 27 | ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); |
| 28 | ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); | 28 | ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); |
| 29 | ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse); | ||
| 29 | 30 | ||
| 30 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); | 31 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); |
| 31 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); | 32 | ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); |
| @@ -36,6 +37,7 @@ void ConfigureGeneral::ApplyConfiguration() { | |||
| 36 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); | 37 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); |
| 37 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); | 38 | UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); |
| 38 | UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); | 39 | UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); |
| 40 | UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked(); | ||
| 39 | 41 | ||
| 40 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); | 42 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); |
| 41 | Settings::values.frame_limit = ui->frame_limit->value(); | 43 | Settings::values.frame_limit = ui->frame_limit->value(); |
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 857119bb3..fc3b7e65a 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui | |||
| @@ -72,6 +72,13 @@ | |||
| 72 | </property> | 72 | </property> |
| 73 | </widget> | 73 | </widget> |
| 74 | </item> | 74 | </item> |
| 75 | <item> | ||
| 76 | <widget class="QCheckBox" name="toggle_hide_mouse"> | ||
| 77 | <property name="text"> | ||
| 78 | <string>Hide mouse on inactivity</string> | ||
| 79 | </property> | ||
| 80 | </widget> | ||
| 81 | </item> | ||
| 75 | </layout> | 82 | </layout> |
| 76 | </item> | 83 | </item> |
| 77 | </layout> | 84 | </layout> |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b44b4276c..0a6839b2d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -135,6 +135,8 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; | |||
| 135 | } | 135 | } |
| 136 | #endif | 136 | #endif |
| 137 | 137 | ||
| 138 | constexpr int default_mouse_timeout = 2500; | ||
| 139 | |||
| 138 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; | 140 | constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; |
| 139 | 141 | ||
| 140 | /** | 142 | /** |
| @@ -236,6 +238,14 @@ GMainWindow::GMainWindow() | |||
| 236 | // Show one-time "callout" messages to the user | 238 | // Show one-time "callout" messages to the user |
| 237 | ShowTelemetryCallout(); | 239 | ShowTelemetryCallout(); |
| 238 | 240 | ||
| 241 | // make sure menubar has the arrow cursor instead of inheriting from this | ||
| 242 | ui.menubar->setCursor(QCursor()); | ||
| 243 | statusBar()->setCursor(QCursor()); | ||
| 244 | |||
| 245 | mouse_hide_timer.setInterval(default_mouse_timeout); | ||
| 246 | connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); | ||
| 247 | connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor); | ||
| 248 | |||
| 239 | QStringList args = QApplication::arguments(); | 249 | QStringList args = QApplication::arguments(); |
| 240 | if (args.length() >= 2) { | 250 | if (args.length() >= 2) { |
| 241 | BootGame(args[1]); | 251 | BootGame(args[1]); |
| @@ -1012,6 +1022,13 @@ void GMainWindow::BootGame(const QString& filename) { | |||
| 1012 | async_status_button->setDisabled(true); | 1022 | async_status_button->setDisabled(true); |
| 1013 | renderer_status_button->setDisabled(true); | 1023 | renderer_status_button->setDisabled(true); |
| 1014 | 1024 | ||
| 1025 | if (UISettings::values.hide_mouse) { | ||
| 1026 | mouse_hide_timer.start(); | ||
| 1027 | setMouseTracking(true); | ||
| 1028 | ui.centralwidget->setMouseTracking(true); | ||
| 1029 | ui.menubar->setMouseTracking(true); | ||
| 1030 | } | ||
| 1031 | |||
| 1015 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 1032 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 1016 | 1033 | ||
| 1017 | std::string title_name; | 1034 | std::string title_name; |
| @@ -1080,6 +1097,10 @@ void GMainWindow::ShutdownGame() { | |||
| 1080 | game_list->show(); | 1097 | game_list->show(); |
| 1081 | game_list->setFilterFocus(); | 1098 | game_list->setFilterFocus(); |
| 1082 | 1099 | ||
| 1100 | setMouseTracking(false); | ||
| 1101 | ui.centralwidget->setMouseTracking(false); | ||
| 1102 | ui.menubar->setMouseTracking(false); | ||
| 1103 | |||
| 1083 | UpdateWindowTitle(); | 1104 | UpdateWindowTitle(); |
| 1084 | 1105 | ||
| 1085 | // Disable status bar updates | 1106 | // Disable status bar updates |
| @@ -1837,6 +1858,17 @@ void GMainWindow::OnConfigure() { | |||
| 1837 | 1858 | ||
| 1838 | config->Save(); | 1859 | config->Save(); |
| 1839 | 1860 | ||
| 1861 | if (UISettings::values.hide_mouse && emulation_running) { | ||
| 1862 | setMouseTracking(true); | ||
| 1863 | ui.centralwidget->setMouseTracking(true); | ||
| 1864 | ui.menubar->setMouseTracking(true); | ||
| 1865 | mouse_hide_timer.start(); | ||
| 1866 | } else { | ||
| 1867 | setMouseTracking(false); | ||
| 1868 | ui.centralwidget->setMouseTracking(false); | ||
| 1869 | ui.menubar->setMouseTracking(false); | ||
| 1870 | } | ||
| 1871 | |||
| 1840 | dock_status_button->setChecked(Settings::values.use_docked_mode); | 1872 | dock_status_button->setChecked(Settings::values.use_docked_mode); |
| 1841 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); | 1873 | async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation); |
| 1842 | #ifdef HAS_VULKAN | 1874 | #ifdef HAS_VULKAN |
| @@ -1970,6 +2002,30 @@ void GMainWindow::UpdateStatusBar() { | |||
| 1970 | emu_frametime_label->setVisible(true); | 2002 | emu_frametime_label->setVisible(true); |
| 1971 | } | 2003 | } |
| 1972 | 2004 | ||
| 2005 | void GMainWindow::HideMouseCursor() { | ||
| 2006 | if (emu_thread == nullptr || UISettings::values.hide_mouse == false) { | ||
| 2007 | mouse_hide_timer.stop(); | ||
| 2008 | ShowMouseCursor(); | ||
| 2009 | return; | ||
| 2010 | } | ||
| 2011 | setCursor(QCursor(Qt::BlankCursor)); | ||
| 2012 | } | ||
| 2013 | |||
| 2014 | void GMainWindow::ShowMouseCursor() { | ||
| 2015 | unsetCursor(); | ||
| 2016 | if (emu_thread != nullptr && UISettings::values.hide_mouse) { | ||
| 2017 | mouse_hide_timer.start(); | ||
| 2018 | } | ||
| 2019 | } | ||
| 2020 | |||
| 2021 | void GMainWindow::mouseMoveEvent(QMouseEvent* event) { | ||
| 2022 | ShowMouseCursor(); | ||
| 2023 | } | ||
| 2024 | |||
| 2025 | void GMainWindow::mousePressEvent(QMouseEvent* event) { | ||
| 2026 | ShowMouseCursor(); | ||
| 2027 | } | ||
| 2028 | |||
| 1973 | void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) { | 2029 | void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) { |
| 1974 | QMessageBox::StandardButton answer; | 2030 | QMessageBox::StandardButton answer; |
| 1975 | QString status_message; | 2031 | QString status_message; |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 0b750689d..60b17c54a 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -216,6 +216,8 @@ private: | |||
| 216 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); | 216 | std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); |
| 217 | void UpdateWindowTitle(const QString& title_name = {}); | 217 | void UpdateWindowTitle(const QString& title_name = {}); |
| 218 | void UpdateStatusBar(); | 218 | void UpdateStatusBar(); |
| 219 | void HideMouseCursor(); | ||
| 220 | void ShowMouseCursor(); | ||
| 219 | 221 | ||
| 220 | Ui::MainWindow ui; | 222 | Ui::MainWindow ui; |
| 221 | 223 | ||
| @@ -244,6 +246,7 @@ private: | |||
| 244 | QString game_path; | 246 | QString game_path; |
| 245 | 247 | ||
| 246 | bool auto_paused = false; | 248 | bool auto_paused = false; |
| 249 | QTimer mouse_hide_timer; | ||
| 247 | 250 | ||
| 248 | // FS | 251 | // FS |
| 249 | std::shared_ptr<FileSys::VfsFilesystem> vfs; | 252 | std::shared_ptr<FileSys::VfsFilesystem> vfs; |
| @@ -265,4 +268,6 @@ protected: | |||
| 265 | void dropEvent(QDropEvent* event) override; | 268 | void dropEvent(QDropEvent* event) override; |
| 266 | void dragEnterEvent(QDragEnterEvent* event) override; | 269 | void dragEnterEvent(QDragEnterEvent* event) override; |
| 267 | void dragMoveEvent(QDragMoveEvent* event) override; | 270 | void dragMoveEvent(QDragMoveEvent* event) override; |
| 271 | void mouseMoveEvent(QMouseEvent* event) override; | ||
| 272 | void mousePressEvent(QMouseEvent* event) override; | ||
| 268 | }; | 273 | }; |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index a675ecf4d..830932d45 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -59,6 +59,7 @@ struct Values { | |||
| 59 | bool confirm_before_closing; | 59 | bool confirm_before_closing; |
| 60 | bool first_start; | 60 | bool first_start; |
| 61 | bool pause_when_in_background; | 61 | bool pause_when_in_background; |
| 62 | bool hide_mouse; | ||
| 62 | 63 | ||
| 63 | bool select_user_on_boot; | 64 | bool select_user_on_boot; |
| 64 | 65 | ||