mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-20 14:25:37 +00:00
Windows: clicking on a window close button doesn't claim focus and bring to front. (#8683)
Added ImGuiItemFlags_NoFocus, ImGuiButtonFlags_NoFocus. Neither are well specified so marking as experimental.
This commit is contained in:
@@ -7126,8 +7126,12 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
||||
|
||||
// Close button
|
||||
if (has_close_button)
|
||||
{
|
||||
g.CurrentItemFlags |= ImGuiItemFlags_NoFocus;
|
||||
if (CloseButton(window->GetID("#CLOSE"), close_button_pos))
|
||||
*p_open = false;
|
||||
g.CurrentItemFlags &= ~ImGuiItemFlags_NoFocus;
|
||||
}
|
||||
|
||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||
g.CurrentItemFlags = item_flags_backup;
|
||||
|
||||
Reference in New Issue
Block a user