Fixed vgui_screens always sending a mouse released event to the panel when the vgui_screen loses focus

This commit is contained in:
Peter Covington 2023-12-29 21:15:23 -05:00
parent 9f34a64e63
commit 9e2bdaab58
No known key found for this signature in database
GPG Key ID: CE9E79A4A4BDE09B

View File

@ -478,7 +478,7 @@ void C_VGuiScreen::ClientThink( void )
const int nBit = i ? IN_ATTACK2 : (IN_ATTACK | IN_USE);
const vgui::MouseCode nButton = i ? MOUSE_RIGHT : MOUSE_LEFT;
if ((m_nButtonReleased & nBit) || m_bLoseThinkNextFrame) // for a button release on loosing focus
if ((m_nButtonReleased & nBit) || ((m_nButtonState & nBit) && m_bLoseThinkNextFrame)) // for a button release on loosing focus
{
g_InputInternal->SetMouseCodeState(nButton, vgui::BUTTON_RELEASED);
vgui::ivgui()->PostMessage(focus, new KeyValues("MouseReleased", "code", nButton), NULL);