2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #8249 from german77/queued

hotkeys: Trigger actions on a separate thread
This commit is contained in:
Morph 2022-04-23 16:21:23 -04:00 committed by GitHub
commit 7f77aafe41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -933,8 +933,9 @@ void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name
auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); auto* controller = system->HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
const auto* controller_hotkey = const auto* controller_hotkey =
hotkey_registry.GetControllerHotkey(main_window, action_name, controller); hotkey_registry.GetControllerHotkey(main_window, action_name, controller);
connect(controller_hotkey, &ControllerShortcut::Activated, this, connect(
[action] { action->trigger(); }); controller_hotkey, &ControllerShortcut::Activated, this, [action] { action->trigger(); },
Qt::QueuedConnection);
} }
void GMainWindow::InitializeHotkeys() { void GMainWindow::InitializeHotkeys() {
@ -961,7 +962,8 @@ void GMainWindow::InitializeHotkeys() {
const auto* controller_hotkey = const auto* controller_hotkey =
hotkey_registry.GetControllerHotkey(main_window, action_name, controller); hotkey_registry.GetControllerHotkey(main_window, action_name, controller);
connect(hotkey, &QShortcut::activated, this, function); connect(hotkey, &QShortcut::activated, this, function);
connect(controller_hotkey, &ControllerShortcut::Activated, this, function); connect(controller_hotkey, &ControllerShortcut::Activated, this, function,
Qt::QueuedConnection);
}; };
connect_shortcut(QStringLiteral("Exit Fullscreen"), [&] { connect_shortcut(QStringLiteral("Exit Fullscreen"), [&] {