From a241dc7990b631fde6575771173c2442d43d2812 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 27 Oct 2022 20:17:19 +0200 Subject: [PATCH] IO: Fixed AddFocusEvent(false) to also clear MouseDown[] state. (#4921) --- docs/CHANGELOG.txt | 1 + imgui.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 1fc0a0e6..f97cdf19 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -142,6 +142,7 @@ Other Changes: - IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey can apply to mouse data as well. (#4921) - IO: Filter duplicate input events during the AddXXX() calls. (#5599, #4921) +- IO: Fixed AddFocusEvent(false) to also clear MouseDown[] state. (#4921) - Menus: Fixed incorrect sub-menu parent association when opening a menu by closing another. Among other things, it would accidentally break part of the closing heuristic logic when moving towards a sub-menu. (#2517, #5614). [@rokups] diff --git a/imgui.cpp b/imgui.cpp index 0e056abb..979384a5 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1303,6 +1303,9 @@ void ImGuiIO::ClearInputKeys() } KeyCtrl = KeyShift = KeyAlt = KeySuper = false; KeyMods = ImGuiMod_None; + MousePos = ImVec2(-FLT_MAX, -FLT_MAX); + memset(MouseDown, 0, sizeof(MouseDown)); + MouseWheel = MouseWheelH = 0.0f; } static ImGuiInputEvent* FindLatestInputEvent(ImGuiInputEventType type, int arg = -1)