From 27a4c494e9d17836c7473165b67e47b2d876c265 Mon Sep 17 00:00:00 2001 From: c0d3d3v Date: Mon, 11 Jul 2022 18:52:51 +0200 Subject: [PATCH] Make UI inputs more secure --- src/game/client/components/menus.cpp | 2 ++ src/game/client/ui.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index d32f7745f..1a1f6ffae 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -2393,6 +2393,8 @@ void CMenus::SetActive(bool Active) { ms_ColorPicker.m_Active = false; Input()->SetIMEState(Active); + UI()->SetHotItem(nullptr); + UI()->SetActiveItem(nullptr); } m_MenuActive = Active; if(!m_MenuActive) diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp index 8e752e28e..ab094e97a 100644 --- a/src/game/client/ui.cpp +++ b/src/game/client/ui.cpp @@ -155,6 +155,11 @@ void CUI::Update(float MouseX, float MouseY, float MouseWorldX, float MouseWorld if(m_pActiveItem) m_pHotItem = m_pActiveItem; m_pBecomingHotItem = 0; + if(!Enabled()) + { + m_pHotItem = nullptr; + m_pActiveItem = nullptr; + } } bool CUI::MouseInside(const CUIRect *pRect) const