1
0
mirror of https://github.com/ocornut/imgui.git synced 2025-01-19 01:34:08 +01:00

Merge branch 'master' into docking

This commit is contained in:
ocornut 2023-09-20 12:53:35 +02:00
commit 3ce6b06feb
4 changed files with 19 additions and 6 deletions

View File

@ -84,6 +84,7 @@ Other changes:
- Fonts: Better assert during load when passing truncated font data or wrong data size. (#6822) - Fonts: Better assert during load when passing truncated font data or wrong data size. (#6822)
- Fonts: Ensure calling AddFontXXX function doesn't invalidates ImFont's ConfigData pointers - Fonts: Ensure calling AddFontXXX function doesn't invalidates ImFont's ConfigData pointers
prior to building again. (#6825) prior to building again. (#6825)
- Fonts, imgui_freetype: Fixed a warning and leak in IMGUI_ENABLE_FREETYPE_LUNASVG support. (#6842, #6591)
- InputTextMultiline: Fixed a crash pressing Down on last empty line of a multiline buffer. - InputTextMultiline: Fixed a crash pressing Down on last empty line of a multiline buffer.
(regression from 1.89.2, only happened in some states). (#6783, #6000) (regression from 1.89.2, only happened in some states). (#6783, #6000)
- InputTextMultiline: Fixed Tabbing cycle leading to a situation where Enter key wouldn't - InputTextMultiline: Fixed Tabbing cycle leading to a situation where Enter key wouldn't
@ -92,6 +93,7 @@ Other changes:
- MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously - MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously
register contents size in a way that would affect the scrolling layer. register contents size in a way that would affect the scrolling layer.
Was most often noticable when using an horizontal scrollbar. (#6789) Was most often noticable when using an horizontal scrollbar. (#6789)
- IO: Setting io.WantSetMousePos ignores incoming MousePos events. (#6837, #228) [@bertaye]
- ImDrawList: Added AddEllipse(), AddEllipseFilled(), PathEllipticalArcTo(). (#2743) [@Doohl] - ImDrawList: Added AddEllipse(), AddEllipseFilled(), PathEllipticalArcTo(). (#2743) [@Doohl]
- ImVector: Added find_index() helper. - ImVector: Added find_index() helper.
- Backends: GLFW: Clear emscripten's MouseWheel callback before shutdown. (#6790, #6096, #4019) [@halx99] - Backends: GLFW: Clear emscripten's MouseWheel callback before shutdown. (#6790, #6096, #4019) [@halx99]

View File

@ -8493,6 +8493,7 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
// - IsMouseDragPastThreshold() [Internal] // - IsMouseDragPastThreshold() [Internal]
// - IsMouseDragging() // - IsMouseDragging()
// - GetMousePos() // - GetMousePos()
// - SetMousePos() [Internal]
// - GetMousePosOnOpeningCurrentPopup() // - GetMousePosOnOpeningCurrentPopup()
// - IsMousePosValid() // - IsMousePosValid()
// - IsAnyMouseDown() // - IsAnyMouseDown()
@ -9022,6 +9023,17 @@ ImVec2 ImGui::GetMousePos()
return g.IO.MousePos; return g.IO.MousePos;
} }
// This is called TeleportMousePos() and not SetMousePos() to emphasis that setting MousePosPrev will effectively clear mouse delta as well.
// It is expected you only call this if (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos) is set and supported by backend.
void ImGui::TeleportMousePos(const ImVec2& pos)
{
ImGuiContext& g = *GImGui;
g.IO.MousePos = g.IO.MousePosPrev = pos;
g.IO.MouseDelta = ImVec2(0.0f, 0.0f);
g.IO.WantSetMousePos = true;
//IMGUI_DEBUG_LOG_IO("TeleportMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y);
}
// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed! // NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed!
ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup() ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup()
{ {
@ -9514,6 +9526,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs)
ImGuiInputEvent* e = &g.InputEventsQueue[event_n]; ImGuiInputEvent* e = &g.InputEventsQueue[event_n];
if (e->Type == ImGuiInputEventType_MousePos) if (e->Type == ImGuiInputEventType_MousePos)
{ {
if (g.IO.WantSetMousePos)
continue;
// Trickling Rule: Stop processing queued events if we already handled a mouse button change // Trickling Rule: Stop processing queued events if we already handled a mouse button change
ImVec2 event_pos(e->MousePos.PosX, e->MousePos.PosY); ImVec2 event_pos(e->MousePos.PosX, e->MousePos.PosY);
if (trickle_fast_inputs && (mouse_button_changed != 0 || mouse_wheeled || key_changed || text_inputted)) if (trickle_fast_inputs && (mouse_button_changed != 0 || mouse_wheeled || key_changed || text_inputted))
@ -12219,11 +12233,7 @@ static void ImGui::NavUpdate()
// Update mouse position if requested // Update mouse position if requested
// (This will take into account the possibility that a Scroll was queued in the window to offset our absolute mouse position before scroll has been applied) // (This will take into account the possibility that a Scroll was queued in the window to offset our absolute mouse position before scroll has been applied)
if (set_mouse_pos && (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) && (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos)) if (set_mouse_pos && (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) && (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos))
{ TeleportMousePos(NavCalcPreferredRefPos());
io.MousePos = io.MousePosPrev = NavCalcPreferredRefPos();
io.WantSetMousePos = true;
//IMGUI_DEBUG_LOG_IO("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y);
}
// [DEBUG] // [DEBUG]
g.NavScoringDebugCount = 0; g.NavScoringDebugCount = 0;

View File

@ -3306,6 +3306,7 @@ namespace ImGui
IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis); IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis);
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate); IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate); IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate);
IMGUI_API void TeleportMousePos(const ImVec2& pos);
IMGUI_API void SetActiveIdUsingAllKeyboardKeys(); IMGUI_API void SetActiveIdUsingAllKeyboardKeys();
inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; } inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }

View File

@ -840,7 +840,7 @@ static FT_Error ImGuiLunasvgPortInit(FT_Pointer* _state)
static void ImGuiLunasvgPortFree(FT_Pointer* _state) static void ImGuiLunasvgPortFree(FT_Pointer* _state)
{ {
IM_DELETE(*_state); IM_DELETE(*(LunasvgPortState*)_state);
} }
static FT_Error ImGuiLunasvgPortRender(FT_GlyphSlot slot, FT_Pointer* _state) static FT_Error ImGuiLunasvgPortRender(FT_GlyphSlot slot, FT_Pointer* _state)