From 530f5ecdd0eb922d7c52bb4018d7d27a6ac6ddff Mon Sep 17 00:00:00 2001 From: sowens99 Date: Thu, 7 Oct 2021 21:39:52 -0400 Subject: [PATCH] MappingWindow: disable hotkeys while window is active MappingWindow is modal, yet the user can use hotkeys while the window is active. I believe hotkeys should not be recognized while this window is active. --- Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp index 037e9f4d37..8049658d4e 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp @@ -14,6 +14,7 @@ #include #include "Core/Core.h" +#include "Core/HotkeyManager.h" #include "Common/CommonPaths.h" #include "Common/FileSearch.h" @@ -44,6 +45,7 @@ #include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h" #include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h" #include "DolphinQt/QtUtils/ModalMessageBox.h" +#include "DolphinQt/QtUtils/WindowActivationEventFilter.h" #include "DolphinQt/QtUtils/WrapInScrollArea.h" #include "DolphinQt/Settings.h" @@ -77,6 +79,14 @@ MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num) const auto lock = GetController()->GetStateLock(); emit ConfigChanged(); + + auto* filter = new WindowActivationEventFilter(this); + installEventFilter(filter); + + filter->connect(filter, &WindowActivationEventFilter::windowDeactivated, + [] { HotkeyManagerEmu::Enable(true); }); + filter->connect(filter, &WindowActivationEventFilter::windowActivated, + [] { HotkeyManagerEmu::Enable(false); }); } void MappingWindow::CreateDevicesLayout()