From 2b6b0e0e2ce7363375f8bd21104c5f60d4dcdfa3 Mon Sep 17 00:00:00 2001 From: korenkonder Date: Sat, 6 Jul 2024 12:48:30 +0300 Subject: [PATCH] Don't interact with dw_gui if ImGui window is selected --- src/ReDIVA/input.cpp | 9 +++++++-- src/ReDIVA/input_state.cpp | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ReDIVA/input.cpp b/src/ReDIVA/input.cpp index 5f05f3f7..12ab5b8c 100644 --- a/src/ReDIVA/input.cpp +++ b/src/ReDIVA/input.cpp @@ -34,7 +34,7 @@ extern HWND window_handle; extern ImGuiContext* imgui_context; extern lock_cs imgui_context_lock; -extern bool disable_input_state_update; +extern uint8_t disable_input_state_update; extern bool disable_cursor; namespace Input { @@ -214,10 +214,15 @@ namespace Input { input_roll = 0.0; if (IsKeyTapped(GLFW_KEY_F3)) - disable_input_state_update ^= true; + disable_input_state_update ^= 0x01; else if (IsKeyTapped(GLFW_KEY_F3, GLFW_MOD_CONTROL)) disable_cursor ^= true; + if (input_locked) + disable_input_state_update |= 0x02; + else + disable_input_state_update &= ~0x02; + if (!window_handle || window_handle != GetForegroundWindow() || !disable_input_state_update) return; diff --git a/src/ReDIVA/input_state.cpp b/src/ReDIVA/input_state.cpp index 7a8df8a3..6bb62075 100644 --- a/src/ReDIVA/input_state.cpp +++ b/src/ReDIVA/input_state.cpp @@ -69,7 +69,7 @@ static bool sub_140190A30(struc_794* a1, int32_t index); InputState* input_state; -bool disable_input_state_update = false; +uint8_t disable_input_state_update = 0; bool disable_cursor = false; extern render_context* rctx_ptr;