diff --git a/src/engine/sys_mainwind.cpp b/src/engine/sys_mainwind.cpp index 8163d6e2..703053ca 100644 --- a/src/engine/sys_mainwind.cpp +++ b/src/engine/sys_mainwind.cpp @@ -60,7 +60,7 @@ LRESULT CGame::ImguiWindowProc(HWND hWnd, UINT& uMsg, WPARAM wParam, LPARAM lPar } } - if (g_Console.IsActivated() || g_Browser.IsActivated()) + if (ImguiSystem()->IsSurfaceActive()) {////////////////////////////////////////////////////////////////////////////// hr = ImguiSystem()->MessageHandler(hWnd, uMsg, wParam, lParam); diff --git a/src/gameui/imgui_system.cpp b/src/gameui/imgui_system.cpp index c2162470..ad540297 100644 --- a/src/gameui/imgui_system.cpp +++ b/src/gameui/imgui_system.cpp @@ -173,6 +173,20 @@ void CImguiSystem::RenderFrame() ImGui_ImplDX11_RenderDrawData(&m_snapshotData.DrawData); } +//----------------------------------------------------------------------------- +// Checks whether we have an active surface. +//----------------------------------------------------------------------------- +bool CImguiSystem::IsSurfaceActive() const +{ + FOR_EACH_VEC(m_surfaceList, i) + { + if (m_surfaceList[i]->IsActivated()) + return true; + } + + return false; +} + //----------------------------------------------------------------------------- // Window procedure handler. //----------------------------------------------------------------------------- diff --git a/src/gameui/imgui_system.h b/src/gameui/imgui_system.h index 397148cd..91f99840 100644 --- a/src/gameui/imgui_system.h +++ b/src/gameui/imgui_system.h @@ -24,6 +24,8 @@ public: void SampleFrame(); void RenderFrame(); + bool IsSurfaceActive() const; + // statics: static LRESULT MessageHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/src/windows/id3dx.cpp b/src/windows/id3dx.cpp index 018eed26..c5d574cd 100644 --- a/src/windows/id3dx.cpp +++ b/src/windows/id3dx.cpp @@ -301,13 +301,13 @@ bool LoadTextureBuffer(unsigned char* buffer, int len, ID3D11ShaderResourceView* void ResetInput() { - g_pInputSystem->EnableInput( // Enables the input system when both are not drawn. - !g_Browser.IsActivated() && !g_Console.IsActivated()); + // Enables the input system when no imgui surface is drawn. + g_pInputSystem->EnableInput(!ImguiSystem()->IsSurfaceActive()); } bool PanelsVisible() { - if (g_Browser.IsActivated() || g_Console.IsActivated()) + if (ImguiSystem()->IsSurfaceActive()) { return true; }