mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-22 15:46:35 +00:00
Fixed GetKeyName() for ImGuiMod_XXX values, made invalid MousePos display in log nicer. (#4921, #456)
Amend fd408c9
This commit is contained in:
parent
0749453355
commit
9e7f460c09
@ -7817,6 +7817,8 @@ const char* ImGui::GetKeyName(ImGuiKey key)
|
||||
#endif
|
||||
if (key == ImGuiKey_None)
|
||||
return "None";
|
||||
if (key & ImGuiMod_Mask_)
|
||||
key = ConvertSingleModFlagToKey(key);
|
||||
if (!IsNamedKey(key))
|
||||
return "Unknown";
|
||||
|
||||
@ -8086,7 +8088,7 @@ static const char* GetInputSourceName(ImGuiInputSource source)
|
||||
static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (e->Type == ImGuiInputEventType_MousePos) { IMGUI_DEBUG_LOG_IO("%s: MousePos (%.1f, %.1f)\n", prefix, e->MousePos.PosX, e->MousePos.PosY); return; }
|
||||
if (e->Type == ImGuiInputEventType_MousePos) { if (e->MousePos.PosX == -FLT_MAX && e->MousePos.PosY == -FLT_MAX) IMGUI_DEBUG_LOG_IO("%s: MousePos (-FLT_MAX, -FLT_MAX)\n", prefix); else IMGUI_DEBUG_LOG_IO("%s: MousePos (%.1f, %.1f)\n", prefix, e->MousePos.PosX, e->MousePos.PosY); return; }
|
||||
if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("%s: MouseButton %d %s\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up"); return; }
|
||||
if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("%s: MouseWheel (%.1f, %.1f)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY); return; }
|
||||
if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("%s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; }
|
||||
@ -8205,7 +8207,7 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
|
||||
}
|
||||
else if (e->Type == ImGuiInputEventType_Focus)
|
||||
{
|
||||
// We intentionally overwrite this and process lower, in order to give a chance
|
||||
// We intentionally overwrite this and process in NewFrame(), in order to give a chance
|
||||
// to multi-viewports backends to queue AddFocusEvent(false) + AddFocusEvent(true) in same frame.
|
||||
const bool focus_lost = !e->AppFocused.Focused;
|
||||
e->IgnoredAsSame = (io.AppFocusLost == focus_lost);
|
||||
|
Loading…
Reference in New Issue
Block a user