|
|
|
@@ -3964,6 +3964,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|
|
|
|
DisabledStackSize = 0;
|
|
|
|
|
LockMarkEdited = 0;
|
|
|
|
|
TooltipOverrideCount = 0;
|
|
|
|
|
TooltipPreviousWindow = NULL;
|
|
|
|
|
|
|
|
|
|
PlatformImeData.InputPos = ImVec2(0.0f, 0.0f);
|
|
|
|
|
PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission
|
|
|
|
@@ -5152,6 +5153,7 @@ void ImGui::NewFrame()
|
|
|
|
|
g.DragDropWithinSource = false;
|
|
|
|
|
g.DragDropWithinTarget = false;
|
|
|
|
|
g.DragDropHoldJustPressedId = 0;
|
|
|
|
|
g.TooltipPreviousWindow = NULL;
|
|
|
|
|
|
|
|
|
|
// Close popups on focus lost (currently wip/opt-in)
|
|
|
|
|
//if (g.IO.AppFocusLost)
|
|
|
|
@@ -7549,6 +7551,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
|
|
// Clear hit test shape every frame
|
|
|
|
|
window->HitTestHoleSize.x = window->HitTestHoleSize.y = 0;
|
|
|
|
|
|
|
|
|
|
if (flags & ImGuiWindowFlags_Tooltip)
|
|
|
|
|
g.TooltipPreviousWindow = window;
|
|
|
|
|
|
|
|
|
|
// Pressing CTRL+C while holding on a window copy its content to the clipboard
|
|
|
|
|
// This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.
|
|
|
|
|
// Maybe we can support CTRL+C on every element?
|
|
|
|
@@ -11504,7 +11509,8 @@ bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags ext
|
|
|
|
|
{
|
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
|
|
|
|
|
|
|
if (g.DragDropWithinSource || g.DragDropWithinTarget)
|
|
|
|
|
const bool is_dragdrop_tooltip = g.DragDropWithinSource || g.DragDropWithinTarget;
|
|
|
|
|
if (is_dragdrop_tooltip)
|
|
|
|
|
{
|
|
|
|
|
// Drag and Drop tooltips are positioning differently than other tooltips:
|
|
|
|
|
// - offset visibility to increase visibility around mouse.
|
|
|
|
@@ -11520,16 +11526,16 @@ bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags ext
|
|
|
|
|
tooltip_flags |= ImGuiTooltipFlags_OverridePrevious;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char window_name[16];
|
|
|
|
|
ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount);
|
|
|
|
|
if (tooltip_flags & ImGuiTooltipFlags_OverridePrevious)
|
|
|
|
|
if (ImGuiWindow* window = FindWindowByName(window_name))
|
|
|
|
|
if (window->Active)
|
|
|
|
|
{
|
|
|
|
|
// Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
|
|
|
|
|
SetWindowHiddenAndSkipItemsForCurrentFrame(window);
|
|
|
|
|
ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
|
|
|
|
|
}
|
|
|
|
|
const char* window_name_template = is_dragdrop_tooltip ? "##Tooltip_DragDrop_%02d" : "##Tooltip_%02d";
|
|
|
|
|
char window_name[32];
|
|
|
|
|
ImFormatString(window_name, IM_ARRAYSIZE(window_name), window_name_template, g.TooltipOverrideCount);
|
|
|
|
|
if ((tooltip_flags & ImGuiTooltipFlags_OverridePrevious) && g.TooltipPreviousWindow != NULL && g.TooltipPreviousWindow->Active)
|
|
|
|
|
{
|
|
|
|
|
// Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
|
|
|
|
|
//IMGUI_DEBUG_LOG("[tooltip] '%s' already active, using +1 for this frame\n", window_name);
|
|
|
|
|
SetWindowHiddenAndSkipItemsForCurrentFrame(g.TooltipPreviousWindow);
|
|
|
|
|
ImFormatString(window_name, IM_ARRAYSIZE(window_name), window_name_template, ++g.TooltipOverrideCount);
|
|
|
|
|
}
|
|
|
|
|
ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;
|
|
|
|
|
Begin(window_name, NULL, flags | extra_window_flags);
|
|
|
|
|
// 2023-03-09: Added bool return value to the API, but currently always returning true.
|
|
|
|
|