mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Windows: fixed an issue where resizable child windows would emit border logic when hidden/non-visible. (#8815)
This makes more sense in docking branch but may be merged in master right away.
This commit is contained in:
parent
ed5bd1f9ef
commit
ea613e181c
2 changed files with 11 additions and 2 deletions
|
|
@ -43,6 +43,9 @@ Breaking Changes:
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
|
- Windows: fixed an issue where resizable child windows would emit border
|
||||||
|
logic when hidden/non-visible (e.g. when in a docked window that is not
|
||||||
|
selected), impacting code not checking for BeginChild() return value. (#8815)
|
||||||
- Error Handling: minor improvements to error handling for TableGetSortSpecs()
|
- Error Handling: minor improvements to error handling for TableGetSortSpecs()
|
||||||
and TableSetBgColor() calls. (#1651, #8499)
|
and TableSetBgColor() calls. (#1651, #8499)
|
||||||
- Backends: OpenGL2, OpenGL3: set GL_UNPACK_ALIGNMENT to 1 before updating
|
- Backends: OpenGL2, OpenGL3: set GL_UNPACK_ALIGNMENT to 1 before updating
|
||||||
|
|
|
||||||
10
imgui.cpp
10
imgui.cpp
|
|
@ -7578,12 +7578,19 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Decide if we are going to handle borders and resize grips
|
||||||
|
// 'window->SkipItems' is not updated yet so for child windows we rely on ParentWindow to avoid submitting decorations. (#8815)
|
||||||
|
// Whenever we add support for full decorated child windows we will likely make this logic more general.
|
||||||
|
bool handle_borders_and_resize_grips = true;
|
||||||
|
if ((flags & ImGuiWindowFlags_ChildWindow) && window->ParentWindow->SkipItems)
|
||||||
|
handle_borders_and_resize_grips = false;
|
||||||
|
|
||||||
// Handle manual resize: Resize Grips, Borders, Gamepad
|
// Handle manual resize: Resize Grips, Borders, Gamepad
|
||||||
int border_hovered = -1, border_held = -1;
|
int border_hovered = -1, border_held = -1;
|
||||||
ImU32 resize_grip_col[4] = {};
|
ImU32 resize_grip_col[4] = {};
|
||||||
const int resize_grip_count = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) ? 0 : g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.
|
const int resize_grip_count = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) ? 0 : g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.
|
||||||
const float resize_grip_draw_size = IM_TRUNC(ImMax(g.FontSize * 1.10f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
|
const float resize_grip_draw_size = IM_TRUNC(ImMax(g.FontSize * 1.10f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
|
||||||
if (!window->Collapsed)
|
if (handle_borders_and_resize_grips && !window->Collapsed)
|
||||||
if (int auto_fit_mask = UpdateWindowManualResize(window, size_auto_fit, &border_hovered, &border_held, resize_grip_count, &resize_grip_col[0], visibility_rect))
|
if (int auto_fit_mask = UpdateWindowManualResize(window, size_auto_fit, &border_hovered, &border_held, resize_grip_count, &resize_grip_col[0], visibility_rect))
|
||||||
{
|
{
|
||||||
if (auto_fit_mask & (1 << ImGuiAxis_X))
|
if (auto_fit_mask & (1 << ImGuiAxis_X))
|
||||||
|
|
@ -7720,7 +7727,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||||
// Handle title bar, scrollbar, resize grips and resize borders
|
// Handle title bar, scrollbar, resize grips and resize borders
|
||||||
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
|
||||||
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
|
const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
|
||||||
const bool handle_borders_and_resize_grips = true; // This exists to facilitate merge with 'docking' branch.
|
|
||||||
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size);
|
RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size);
|
||||||
|
|
||||||
if (render_decorations_in_parent)
|
if (render_decorations_in_parent)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue