mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
IO: Added io.ClearEventsQueue(). Obsoleted io.ClearInputCharacters(). (#4921)
cc #2425 #1153 #1600
This commit is contained in:
parent
9a15730c2a
commit
6aa408c6af
@ -36,8 +36,19 @@ HOW TO UPDATE?
|
||||
|
||||
Breaking changes:
|
||||
|
||||
- IO: Obsoleted io.ClearInputCharacters() (added in 1.47) as it now ambiguous
|
||||
and often incorrect/misleading considering the existence of a higher-level
|
||||
input queue. (#4921)
|
||||
|
||||
Other changes:
|
||||
|
||||
- IO: Added io.ClearEventsQueue() to clear incoming inputs events. (#4921)
|
||||
May be useful in conjunction with io.ClearInputsKeys() if you need to clear
|
||||
both current inputs state and queued events (e.g. when using blocking native
|
||||
dialogs such as Windows's ::MessageBox() or ::GetOpenFileName()).
|
||||
- IO: Changed io.ClearInputsKeys() specs to also clear current frame character buffer
|
||||
(what now obsoleted io.ClearInputCharacters() did), as this is effectively the
|
||||
desirable behavior.
|
||||
- Demo: Better showcase use of SetNextItemAllowOverlap(). (#6574, #6512, #3909, #517)
|
||||
|
||||
|
||||
|
20
imgui.cpp
20
imgui.cpp
@ -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()
|
||||
{
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
@ -1368,8 +1370,18 @@ void ImGuiIO::ClearInputKeys()
|
||||
MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.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)
|
||||
{
|
||||
ImGuiContext& g = *ctx;
|
||||
|
9
imgui.h
9
imgui.h
@ -25,7 +25,7 @@
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||
#define IMGUI_VERSION "1.89.8 WIP"
|
||||
#define IMGUI_VERSION_NUM 18971
|
||||
#define IMGUI_VERSION_NUM 18972
|
||||
#define IMGUI_HAS_TABLE
|
||||
|
||||
/*
|
||||
@ -2058,8 +2058,11 @@ struct ImGuiIO
|
||||
|
||||
IMGUI_API void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index = -1); // [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode.
|
||||
IMGUI_API void SetAppAcceptingEvents(bool accepting_events); // Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen.
|
||||
IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually
|
||||
IMGUI_API void ClearInputKeys(); // [Internal] Release all keys
|
||||
IMGUI_API void ClearEventsQueue(); // Clear all incoming events.
|
||||
IMGUI_API void ClearInputKeys(); // Clear current keyboard/mouse/gamepad state + current frame text input buffer. Equivalent to releasing all keys/buttons.
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
IMGUI_API void ClearInputCharacters(); // [Obsolete] Clear the current frame text input buffer. Now included within ClearInputKeys().
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Output - Updated by NewFrame() or EndFrame()/Render()
|
||||
|
Loading…
Reference in New Issue
Block a user