mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Focus: merge extra param for FocusTopMostWindowUnderOne() from docking branch to facilitate merge.
This commit is contained in:
parent
00d3f9295e
commit
f0fe1957a8
22
imgui.cpp
22
imgui.cpp
@ -4624,7 +4624,7 @@ void ImGui::NewFrame()
|
|||||||
|
|
||||||
// Closing the focused window restore focus to the first active root window in descending z-order
|
// Closing the focused window restore focus to the first active root window in descending z-order
|
||||||
if (g.NavWindow && !g.NavWindow->WasActive)
|
if (g.NavWindow && !g.NavWindow->WasActive)
|
||||||
FocusTopMostWindowUnderOne(NULL, NULL);
|
FocusTopMostWindowUnderOne(NULL, NULL, NULL);
|
||||||
|
|
||||||
// No window should be open at the beginning of the frame.
|
// No window should be open at the beginning of the frame.
|
||||||
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
||||||
@ -6968,9 +6968,10 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|||||||
BringWindowToDisplayFront(display_front_window);
|
BringWindowToDisplayFront(display_front_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)
|
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window, ImGuiViewport* filter_viewport)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
IM_UNUSED(filter_viewport); // Unused in master branch.
|
||||||
int start_idx = g.WindowsFocusOrder.Size - 1;
|
int start_idx = g.WindowsFocusOrder.Size - 1;
|
||||||
if (under_this_window != NULL)
|
if (under_this_window != NULL)
|
||||||
{
|
{
|
||||||
@ -6988,13 +6989,14 @@ void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWind
|
|||||||
// We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
|
// We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
|
||||||
ImGuiWindow* window = g.WindowsFocusOrder[i];
|
ImGuiWindow* window = g.WindowsFocusOrder[i];
|
||||||
IM_ASSERT(window == window->RootWindow);
|
IM_ASSERT(window == window->RootWindow);
|
||||||
if (window != ignore_window && window->WasActive)
|
if (window == ignore_window || !window->WasActive)
|
||||||
if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))
|
continue;
|
||||||
{
|
if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))
|
||||||
ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);
|
{
|
||||||
FocusWindow(focus_window);
|
ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);
|
||||||
return;
|
FocusWindow(focus_window);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FocusWindow(NULL);
|
FocusWindow(NULL);
|
||||||
}
|
}
|
||||||
@ -10261,7 +10263,7 @@ void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_
|
|||||||
if (focus_window && !focus_window->WasActive && popup_window)
|
if (focus_window && !focus_window->WasActive && popup_window)
|
||||||
{
|
{
|
||||||
// Fallback
|
// Fallback
|
||||||
FocusTopMostWindowUnderOne(popup_window, NULL);
|
FocusTopMostWindowUnderOne(popup_window, NULL, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2752,7 +2752,7 @@ namespace ImGui
|
|||||||
|
|
||||||
// Windows: Display Order and Focus Order
|
// Windows: Display Order and Focus Order
|
||||||
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
||||||
IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window);
|
IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window, ImGuiViewport* filter_viewport);
|
||||||
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
||||||
|
@ -7084,7 +7084,7 @@ void ImGui::EndMainMenuBar()
|
|||||||
// FIXME: With this strategy we won't be able to restore a NULL focus.
|
// FIXME: With this strategy we won't be able to restore a NULL focus.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest)
|
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest)
|
||||||
FocusTopMostWindowUnderOne(g.NavWindow, NULL);
|
FocusTopMostWindowUnderOne(g.NavWindow, NULL, NULL);
|
||||||
|
|
||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user