From ea77899ddd4484229bda1cc5016a158b707ec75d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 14 Oct 2018 22:15:26 +1000 Subject: [PATCH] Qt/MainWindow: Maintain pointer to hotkey window Prevents multiple hotkey windows from being opened. --- Source/Core/DolphinQt/MainWindow.cpp | 14 ++++++++------ Source/Core/DolphinQt/MainWindow.h | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 10c2f1d0b3..2e85856cb1 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -937,13 +937,15 @@ void MainWindow::ShowAboutDialog() void MainWindow::ShowHotkeyDialog() { - auto* hotkey_window = new MappingWindow(this, MappingWindow::Type::MAPPING_HOTKEYS, 0); + if (!m_hotkey_window) + { + m_hotkey_window = new MappingWindow(this, MappingWindow::Type::MAPPING_HOTKEYS, 0); + InstallHotkeyFilter(m_hotkey_window); + } - InstallHotkeyFilter(hotkey_window); - - hotkey_window->show(); - hotkey_window->raise(); - hotkey_window->activateWindow(); + m_hotkey_window->show(); + m_hotkey_window->raise(); + m_hotkey_window->activateWindow(); } void MainWindow::ShowGraphicsWindow() diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 68456c65b2..eaec778b5d 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -29,6 +29,7 @@ class HotkeyScheduler; class JITWidget; class LogConfigWidget; class LogWidget; +class MappingWindow; class MemoryWidget; class MenuBar; class NetPlayDialog; @@ -184,6 +185,7 @@ private: SettingsWindow* m_settings_window = nullptr; GraphicsWindow* m_graphics_window = nullptr; FIFOPlayerWindow* m_fifo_window = nullptr; + MappingWindow* m_hotkey_window = nullptr; HotkeyScheduler* m_hotkey_scheduler; NetPlayDialog* m_netplay_dialog;