소스 검색

Windows: changed how g.CurrentItemFlags is modified before windows' CloseButton() submission to be less misleading. (#8903)

I don't think anyone would have `ImGuiItemFlags_NoFocus` set globally but technically it might.
ocornut 3 주 전
부모
커밋
87c1ab7988
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      imgui.cpp

+ 2 - 1
imgui.cpp

@@ -7113,10 +7113,11 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
     // Close button
     if (has_close_button)
     {
+        ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
         g.CurrentItemFlags |= ImGuiItemFlags_NoFocus;
         if (CloseButton(window->GetID("#CLOSE"), close_button_pos))
             *p_open = false;
-        g.CurrentItemFlags &= ~ImGuiItemFlags_NoFocus;
+        g.CurrentItemFlags = backup_item_flags;
     }
 
     window->DC.NavLayerCurrent = ImGuiNavLayer_Main;