mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 21:17:01 +00:00
Internals: Update ->RootWindow and other links before applying the SetNextWindowXXX stuff. This is so FocusWindow() can always assume that ->RootWindow != NULL.
This commit is contained in:
parent
d9bca0d853
commit
fb257eef3e
13
imgui.cpp
13
imgui.cpp
@ -5402,6 +5402,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
if (window_just_appearing_after_hidden_for_resize && !(flags & ImGuiWindowFlags_ChildWindow))
|
if (window_just_appearing_after_hidden_for_resize && !(flags & ImGuiWindowFlags_ChildWindow))
|
||||||
window->NavLastIds[0] = 0;
|
window->NavLastIds[0] = 0;
|
||||||
|
|
||||||
|
// Update ->RootWindow and others pointers (before any possible call to FocusWindow)
|
||||||
|
if (first_begin_of_the_frame)
|
||||||
|
UpdateWindowParentAndRootLinks(window, flags, parent_window);
|
||||||
|
|
||||||
// Process SetNextWindow***() calls
|
// Process SetNextWindow***() calls
|
||||||
bool window_pos_set_by_api = false;
|
bool window_pos_set_by_api = false;
|
||||||
bool window_size_x_set_by_api = false, window_size_y_set_by_api = false;
|
bool window_size_x_set_by_api = false, window_size_y_set_by_api = false;
|
||||||
@ -5443,8 +5447,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
const bool window_is_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345)
|
const bool window_is_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345)
|
||||||
UpdateWindowParentAndRootLinks(window, flags, parent_window);
|
|
||||||
|
|
||||||
window->Active = true;
|
window->Active = true;
|
||||||
window->HasCloseButton = (p_open != NULL);
|
window->HasCloseButton = (p_open != NULL);
|
||||||
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
|
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
|
||||||
@ -6037,7 +6039,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Move the root window to the top of the pile
|
// Move the root window to the top of the pile
|
||||||
if (window->RootWindow)
|
IM_ASSERT(window->RootWindow != NULL);
|
||||||
window = window->RootWindow;
|
window = window->RootWindow;
|
||||||
|
|
||||||
// Steal focus on active widgets
|
// Steal focus on active widgets
|
||||||
@ -7823,7 +7825,7 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)
|
|||||||
// [SECTION] KEYBOARD/GAMEPAD NAVIGATION
|
// [SECTION] KEYBOARD/GAMEPAD NAVIGATION
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// FIXME-NAV: The existance of SetNavID vs SetNavIDWithRectRel vs SetFocusID is incredibly messy and confusing,
|
// FIXME-NAV: The existence of SetNavID vs SetNavIDWithRectRel vs SetFocusID is incredibly messy and confusing,
|
||||||
// and needs some explanation or serious refactoring.
|
// and needs some explanation or serious refactoring.
|
||||||
void ImGui::SetNavID(ImGuiID id, int nav_layer, ImGuiID focus_scope_id)
|
void ImGui::SetNavID(ImGuiID id, int nav_layer, ImGuiID focus_scope_id)
|
||||||
{
|
{
|
||||||
@ -8295,7 +8297,8 @@ static void ImGui::NavUpdate()
|
|||||||
if (g.NavScoringCount > 0) IMGUI_DEBUG_LOG("NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
|
if (g.NavScoringCount > 0) IMGUI_DEBUG_LOG("NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set input source as Gamepad when buttons are pressed before we map Keyboard (some features differs when used with Gamepad vs Keyboard)
|
// Set input source as Gamepad when buttons are pressed (as some features differs when used with Gamepad vs Keyboard)
|
||||||
|
// (do it before we map Keyboard input!)
|
||||||
bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
|
||||||
if (nav_gamepad_active)
|
if (nav_gamepad_active)
|
||||||
|
Loading…
Reference in New Issue
Block a user