Skip to content

Commit

Permalink
Fixed 1185718: ImGUI blocks text events to text fields in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
SKYBOXLABS\sardana.nikolaeva committed Mar 21, 2024
1 parent a937298 commit 922b48f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3113,6 +3113,7 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
g.ActiveId = id;
g.ActiveIdAllowOverlap = false;
g.ActiveIdNoClearOnFocusLoss = false;
g.ActiveIdWindowIsJustChanged = (g.ActiveIdWindow != window);
g.ActiveIdWindow = window;
g.ActiveIdHasBeenEditedThisFrame = false;
if (id)
Expand Down Expand Up @@ -3930,7 +3931,9 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags()
g.IO.WantCaptureKeyboard = true;

// Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible
const bool oldWantTextInput = g.IO.WantTextInput;
g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;
g.IO.WantTextInputIsJustChanged = (g.IO.WantTextInput != oldWantTextInput);
}

ImGuiKeyModFlags ImGui::GetMergedKeyModFlags()
Expand Down
1 change: 1 addition & 0 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1865,6 +1865,7 @@ struct ImGuiIO
bool WantCaptureMouse; // Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.).
bool WantCaptureKeyboard; // Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.).
bool WantTextInput; // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).
bool WantTextInputIsJustChanged; // Set when WantTextInput is changed.
bool WantSetMousePos; // MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled.
bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving!
bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
Expand Down
2 changes: 2 additions & 0 deletions imgui_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@ struct ImGuiContext
ImU64 ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array.
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
ImGuiWindow* ActiveIdWindow;
bool ActiveIdWindowIsJustChanged;
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
int ActiveIdMouseButton;
ImGuiID ActiveIdPreviousFrame;
Expand Down Expand Up @@ -1692,6 +1693,7 @@ struct ImGuiContext
ActiveIdUsingKeyInputMask = 0x00;
ActiveIdClickOffset = ImVec2(-1, -1);
ActiveIdWindow = NULL;
ActiveIdWindowIsJustChanged = false;
ActiveIdSource = ImGuiInputSource_None;
ActiveIdMouseButton = -1;
ActiveIdPreviousFrame = 0;
Expand Down

0 comments on commit 922b48f

Please sign in to comment.