From 5ef8c61a2d4d438d2ae7a139af4b02cd650aeb61 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Sun, 23 Jul 2023 01:01:48 -0700 Subject: [PATCH] fix: reenable controls when mouse closes menu Imgui will disable the IsEnabled boolean automatically on window close. On detecting any control input, this will always sync the controller state to the window state. closes #15 --- src/Menu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Menu.cpp b/src/Menu.cpp index 00471a15af..8dcdd53f44 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -214,9 +214,6 @@ RE::BSEventNotifyControl Menu::ProcessEvent(RE::InputEvent* const* a_event, RE:: settingToggleKey = false; } else if (key == toggleKey) { IsEnabled = !IsEnabled; - if (const auto controlMap = RE::ControlMap::GetSingleton()) { - controlMap->GetRuntimeData().ignoreKeyboardMouse = IsEnabled; - } } } @@ -242,6 +239,9 @@ RE::BSEventNotifyControl Menu::ProcessEvent(RE::InputEvent* const* a_event, RE:: default: continue; } + if (const auto controlMap = RE::ControlMap::GetSingleton()) { + controlMap->GetRuntimeData().ignoreKeyboardMouse = IsEnabled; + } } }