|
@@ -2626,6 +2626,14 @@ ImGuiID ImGuiWindow::GetID(const void* ptr)
|
|
|
return id;
|
|
return id;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ImGuiID ImGuiWindow::GetID(int n)
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiID seed = IDStack.back();
|
|
|
|
|
+ ImGuiID id = ImHashData(&n, sizeof(n), seed);
|
|
|
|
|
+ ImGui::KeepAliveID(id);
|
|
|
|
|
+ return id;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)
|
|
ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)
|
|
|
{
|
|
{
|
|
|
ImGuiID seed = IDStack.back();
|
|
ImGuiID seed = IDStack.back();
|
|
@@ -2638,6 +2646,12 @@ ImGuiID ImGuiWindow::GetIDNoKeepAlive(const void* ptr)
|
|
|
return ImHashData(&ptr, sizeof(void*), seed);
|
|
return ImHashData(&ptr, sizeof(void*), seed);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ImGuiID ImGuiWindow::GetIDNoKeepAlive(int n)
|
|
|
|
|
+{
|
|
|
|
|
+ ImGuiID seed = IDStack.back();
|
|
|
|
|
+ return ImHashData(&n, sizeof(n), seed);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
|
// This is only used in rare/specific situations to manufacture an ID out of nowhere.
|
|
|
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
|
ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)
|
|
|
{
|
|
{
|
|
@@ -3577,9 +3591,12 @@ void ImGui::NewFrame()
|
|
|
g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
|
|
g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);
|
|
|
g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame))) : FLT_MAX;
|
|
g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame))) : FLT_MAX;
|
|
|
|
|
|
|
|
|
|
+ // Find hovered window
|
|
|
|
|
+ // (needs to be before UpdateMouseMovingWindowNewFrame so we fill g.HoveredWindowUnderMovingWindow on the mouse release frame)
|
|
|
|
|
+ UpdateHoveredWindowAndCaptureFlags();
|
|
|
|
|
+
|
|
|
// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering)
|
|
// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering)
|
|
|
UpdateMouseMovingWindowNewFrame();
|
|
UpdateMouseMovingWindowNewFrame();
|
|
|
- UpdateHoveredWindowAndCaptureFlags();
|
|
|
|
|
|
|
|
|
|
// Background darkening/whitening
|
|
// Background darkening/whitening
|
|
|
if (GetFrontMostPopupModal() != NULL || (g.NavWindowingTarget != NULL && g.NavWindowingHighlightAlpha > 0.0f))
|
|
if (GetFrontMostPopupModal() != NULL || (g.NavWindowingTarget != NULL && g.NavWindowingHighlightAlpha > 0.0f))
|
|
@@ -4724,7 +4741,7 @@ static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- // Maximum window size is determined by the display size
|
|
|
|
|
|
|
+ // Maximum window size is determined by the viewport size or monitor size
|
|
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;
|
|
const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0;
|
|
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
|
const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0;
|
|
|
ImVec2 size_min = style.WindowMinSize;
|
|
ImVec2 size_min = style.WindowMinSize;
|
|
@@ -5083,7 +5100,7 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
|
|
const bool has_close_button = (p_open != NULL);
|
|
const bool has_close_button = (p_open != NULL);
|
|
|
const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse);
|
|
const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse);
|
|
|
|
|
|
|
|
- // Close & collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
|
|
|
|
|
|
|
+ // Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
|
|
|
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
|
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
|
|
window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;
|
|
window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;
|
|
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
|
@@ -5453,7 +5470,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
|
|
else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
|
|
|
window->Pos = FindBestWindowPosForPopup(window);
|
|
window->Pos = FindBestWindowPosForPopup(window);
|
|
|
|
|
|
|
|
- // Clamp position/size so it stays visible
|
|
|
|
|
|
|
+ // Clamp position/size so window stays visible within its viewport or monitor
|
|
|
|
|
+
|
|
|
// Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
|
// Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
|
|
ImRect viewport_rect(GetViewportRect());
|
|
ImRect viewport_rect(GetViewportRect());
|
|
|
if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
|
if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
|
|
@@ -6834,9 +6852,8 @@ void ImGui::PushID(const void* ptr_id)
|
|
|
|
|
|
|
|
void ImGui::PushID(int int_id)
|
|
void ImGui::PushID(int int_id)
|
|
|
{
|
|
{
|
|
|
- const void* ptr_id = (void*)(intptr_t)int_id;
|
|
|
|
|
ImGuiWindow* window = GImGui->CurrentWindow;
|
|
ImGuiWindow* window = GImGui->CurrentWindow;
|
|
|
- window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id));
|
|
|
|
|
|
|
+ window->IDStack.push_back(window->GetIDNoKeepAlive(int_id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Push a given id value ignoring the ID stack as a seed.
|
|
// Push a given id value ignoring the ID stack as a seed.
|
|
@@ -8703,6 +8720,7 @@ void ImGui::PushColumnsBackground()
|
|
|
window->DrawList->ChannelsSetCurrent(0);
|
|
window->DrawList->ChannelsSetCurrent(0);
|
|
|
int cmd_size = window->DrawList->CmdBuffer.Size;
|
|
int cmd_size = window->DrawList->CmdBuffer.Size;
|
|
|
PushClipRect(columns->HostClipRect.Min, columns->HostClipRect.Max, false);
|
|
PushClipRect(columns->HostClipRect.Min, columns->HostClipRect.Max, false);
|
|
|
|
|
+ IM_UNUSED(cmd_size);
|
|
|
IM_ASSERT(cmd_size == window->DrawList->CmdBuffer.Size); // Being in channel 0 this should not have created an ImDrawCmd
|
|
IM_ASSERT(cmd_size == window->DrawList->CmdBuffer.Size); // Being in channel 0 this should not have created an ImDrawCmd
|
|
|
}
|
|
}
|
|
|
|
|
|