|
@@ -1341,13 +1341,15 @@ void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// FIXME: Perhaps we could clear queued events as well?
|
|
|
|
-void ImGuiIO::ClearInputCharacters()
|
|
|
|
|
|
+// Clear all incoming events.
|
|
|
|
+void ImGuiIO::ClearEventsQueue()
|
|
{
|
|
{
|
|
- InputQueueCharacters.resize(0);
|
|
|
|
|
|
+ IM_ASSERT(Ctx != NULL);
|
|
|
|
+ ImGuiContext& g = *Ctx;
|
|
|
|
+ g.InputEventsQueue.clear();
|
|
}
|
|
}
|
|
|
|
|
|
-// FIXME: Perhaps we could clear queued events as well?
|
|
|
|
|
|
+// Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons.
|
|
void ImGuiIO::ClearInputKeys()
|
|
void ImGuiIO::ClearInputKeys()
|
|
{
|
|
{
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
@@ -1368,8 +1370,18 @@ void ImGuiIO::ClearInputKeys()
|
|
MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f;
|
|
MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f;
|
|
}
|
|
}
|
|
MouseWheel = MouseWheelH = 0.0f;
|
|
MouseWheel = MouseWheelH = 0.0f;
|
|
|
|
+ InputQueueCharacters.resize(0); // Behavior of old ClearInputCharacters().
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue.
|
|
|
|
+// Current frame character buffer is now also cleared by ClearInputKeys().
|
|
|
|
+#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
|
|
+void ImGuiIO::ClearInputCharacters()
|
|
|
|
+{
|
|
|
|
+ InputQueueCharacters.resize(0);
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1)
|
|
static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1)
|
|
{
|
|
{
|
|
ImGuiContext& g = *ctx;
|
|
ImGuiContext& g = *ctx;
|