1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

IO: added ImGuiConfigFlags_NoKeyboard for consistency and convenience. (#4921)

# Conflicts:
#	imgui.h
#	imgui_demo.cpp
This commit is contained in:
ocornut 2024-06-21 10:08:07 -07:00
parent 8067d05f74
commit e3971079cf
3 changed files with 20 additions and 5 deletions

View file

@ -4577,7 +4577,7 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
if (modal_window && g.HoveredWindow && !IsWindowWithinBeginStackOf(g.HoveredWindow->RootWindow, modal_window))
clear_hovered_windows = true;
// Disabled mouse?
// Disabled mouse hovering (we don't currently clear MousePos, we could)
if (io.ConfigFlags & ImGuiConfigFlags_NoMouse)
clear_hovered_windows = true;
@ -9136,6 +9136,9 @@ static void ImGui::UpdateKeyboardInputs()
ImGuiContext& g = *GImGui;
ImGuiIO& io = g.IO;
if (io.ConfigFlags & ImGuiConfigFlags_NoKeyboard)
io.ClearInputKeys();
// Import legacy keys or verify they are not used
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
if (io.BackendUsingLegacyKeyArrays == 0)
@ -9582,6 +9585,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
else if (e->Type == ImGuiInputEventType_Key)
{
// Trickling Rule: Stop processing queued events if we got multiple action on the same button
if (io.ConfigFlags & ImGuiConfigFlags_NoKeyboard)
continue;
ImGuiKey key = e->Key.Key;
IM_ASSERT(key != ImGuiKey_None);
ImGuiKeyData* key_data = GetKeyData(key);
@ -9602,6 +9607,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
}
else if (e->Type == ImGuiInputEventType_Text)
{
if (io.ConfigFlags & ImGuiConfigFlags_NoKeyboard)
continue;
// Trickling Rule: Stop processing queued events if keys/mouse have been interacted with
if (trickle_fast_inputs && ((key_changed && trickle_interleaved_keys_and_text) || mouse_button_changed != 0 || mouse_moved || mouse_wheeled))
break;