aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/main_window.cpp
diff options
context:
space:
mode:
authorQuantumDriftDev <350698041+QuantumDriftDev@users.noreply.github.com>2026-10-31 14:33:08 +0100
committerGitHub <noreply@github.com>2026-10-31 14:33:08 +0100
commitd4e2dc88611252748b8dc3bb70baf56fc8bd2256 (patch)
tree88cf5a92002f58efee5de70df65fe40519a45b01 /src/yuzu/main_window.cpp
parent7b6f27b91e0ecaebcc4d66ee7dd3855bebce6c78 (diff)
Fix game list crash, unresponsive macOS menu, and missing SDL gamepad input (#100)
* game_list: fix crash when scanning games by removing nested event processing Assisted-by: DeepSeek V4 Pro (root cause diagnosis and fix) Signed-off-by: QuantumDriftDev <350698041+QuantumDriftDev@users.noreply.github.com> * macos: fix unresponsive application menu by removing the SDL/Qt event loop conflict Assisted-by: GPT-6.1 Sol (root cause diagnosis and implementation) Signed-off-by: QuantumDriftDev <350698041+QuantumDriftDev@users.noreply.github.com> * input_common: handle SDL gamepad button and axis events Assisted-by: DeepSeek V4 Pro (implementation) Signed-off-by: QuantumDriftDev <350698041+QuantumDriftDev@users.noreply.github.com> --------- Signed-off-by: QuantumDriftDev <350698041+QuantumDriftDev@users.noreply.github.com>
Diffstat (limited to 'src/yuzu/main_window.cpp')
-rw-r--r--src/yuzu/main_window.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp
index 13359620dd..b0c0446add 100644
--- a/src/yuzu/main_window.cpp
+++ b/src/yuzu/main_window.cpp
@@ -85,6 +85,10 @@
#include <QStatusBar>
#include <QtConcurrentRun>
+#ifdef __APPLE__
+#include "util/macos_sleep.h"
+#endif
+
// Qt Common //
#include "qt_common/config/shared_translation.h"
#include "qt_common/config/uisettings.h"
@@ -493,7 +497,8 @@ MainWindow::MainWindow(bool has_broken_vulkan)
VkDeviceInfo::PopulateRecords(vk_device_records, this->window()->windowHandle());
}
-#if !defined(_WIN32)
+ // On macOS, SDL video would pump AppKit events alongside Qt and disrupt native menus.
+#if !defined(_WIN32) && !defined(__APPLE__)
SDL_InitSubSystem(SDL_INIT_VIDEO);
// Set a screensaver inhibition reason string. Currently passed to DBus by SDL and visible to
@@ -549,6 +554,10 @@ MainWindow::MainWindow(bool has_broken_vulkan)
}
MainWindow::~MainWindow() {
+#ifdef __APPLE__
+ AllowOSSleep();
+#endif
+
// will get automatically deleted otherwise
if (render_window->parent() == nullptr) {
delete render_window;
@@ -1758,6 +1767,10 @@ void MainWindow::OnSigInterruptNotifierActivated() {
void MainWindow::PreventOSSleep() {
#ifdef _WIN32
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
+#elif defined(__APPLE__)
+ if (sleep_assertion_id == 0) {
+ sleep_assertion_id = MacOS::PreventSleep();
+ }
#else
SDL_DisableScreenSaver();
#endif
@@ -1766,6 +1779,11 @@ void MainWindow::PreventOSSleep() {
void MainWindow::AllowOSSleep() {
#ifdef _WIN32
SetThreadExecutionState(ES_CONTINUOUS);
+#elif defined(__APPLE__)
+ if (sleep_assertion_id != 0) {
+ MacOS::AllowSleep(sleep_assertion_id);
+ sleep_assertion_id = 0;
+ }
#else
SDL_EnableScreenSaver();
#endif