1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-09-24 19:48:34 +02:00

Begin: Moved code that calls FocusWindow() on a newly appearing window lower in the function so that Nav branch can use CursorStartPos on the first window frame. (#323)

Pushing in master because it _should_ be a no-op but I'd rather test for any issue in Begin() as soon as possible.
This commit is contained in:
ocornut 2016-07-18 15:25:44 +02:00
parent 19d02becef
commit ffdd7d7f17

View File

@ -3918,16 +3918,10 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
else
PushClipRect(fullscreen_rect.Min, fullscreen_rect.Max, true);
// New windows appears in front
if (!window_was_active)
{
window->AutoPosLastDirection = -1;
if (!(flags & ImGuiWindowFlags_NoFocusOnAppearing))
if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
FocusWindow(window);
// Popup first latch mouse position, will position itself when it appears next frame
window->AutoPosLastDirection = -1;
if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api)
window->PosFloat = g.IO.MousePos;
}
@ -4265,6 +4259,11 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
if (window->AutoFitFramesY > 0)
window->AutoFitFramesY--;
// New windows appears in front (we need to do that AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)
if (!window_was_active && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))
if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
FocusWindow(window);
// Title bar
if (!(flags & ImGuiWindowFlags_NoTitleBar))
{