mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Internals: Removed RootWindowForTabbing, won't be needed. Nav: Not starting NavWindowingTarget when a modal is active (was not noticeable).
This commit is contained in:
parent
6201cad2b4
commit
0708f91617
19
imgui.cpp
19
imgui.cpp
@ -2135,7 +2135,6 @@ ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
|
|||||||
ParentWindow = NULL;
|
ParentWindow = NULL;
|
||||||
RootWindow = NULL;
|
RootWindow = NULL;
|
||||||
RootWindowForTitleBarHighlight = NULL;
|
RootWindowForTitleBarHighlight = NULL;
|
||||||
RootWindowForTabbing = NULL;
|
|
||||||
RootWindowForNav = NULL;
|
RootWindowForNav = NULL;
|
||||||
|
|
||||||
NavLastIds[0] = NavLastIds[1] = 0;
|
NavLastIds[0] = NavLastIds[1] = 0;
|
||||||
@ -3063,12 +3062,19 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
ImGuiWindow* apply_focus_window = NULL;
|
ImGuiWindow* apply_focus_window = NULL;
|
||||||
bool apply_toggle_layer = false;
|
bool apply_toggle_layer = false;
|
||||||
|
|
||||||
|
ImGuiWindow* modal_window = GetFrontMostPopupModal();
|
||||||
|
if (modal_window != NULL)
|
||||||
|
{
|
||||||
|
g.NavWindowingTarget = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
|
||||||
bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
|
||||||
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
if (start_windowing_with_gamepad || start_windowing_with_keyboard)
|
||||||
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavigable(g.Windows.Size - 1, -INT_MAX, -1))
|
if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavigable(g.Windows.Size - 1, -INT_MAX, -1))
|
||||||
{
|
{
|
||||||
g.NavWindowingTarget = window->RootWindowForTabbing;
|
g.NavWindowingTarget = window;
|
||||||
g.NavWindowingHighlightTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
g.NavWindowingHighlightTimer = g.NavWindowingHighlightAlpha = 0.0f;
|
||||||
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
|
||||||
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_NavKeyboard : ImGuiInputSource_NavGamepad;
|
g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_NavKeyboard : ImGuiInputSource_NavGamepad;
|
||||||
@ -3137,7 +3143,7 @@ static void ImGui::NavUpdateWindowing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply final focus
|
// Apply final focus
|
||||||
if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindowForTabbing))
|
if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindow))
|
||||||
{
|
{
|
||||||
g.NavDisableHighlight = false;
|
g.NavDisableHighlight = false;
|
||||||
g.NavDisableMouseHover = true;
|
g.NavDisableMouseHover = true;
|
||||||
@ -3813,6 +3819,7 @@ void ImGui::NewFrame()
|
|||||||
UpdateMovingWindow();
|
UpdateMovingWindow();
|
||||||
UpdateHoveredWindowAndCaptureFlags();
|
UpdateHoveredWindowAndCaptureFlags();
|
||||||
|
|
||||||
|
// Background darkening/whitening
|
||||||
if (GetFrontMostPopupModal() != NULL)
|
if (GetFrontMostPopupModal() != NULL)
|
||||||
g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);
|
g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);
|
||||||
else
|
else
|
||||||
@ -6181,11 +6188,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
window->ParentWindow = parent_window;
|
window->ParentWindow = parent_window;
|
||||||
window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForTabbing = window->RootWindowForNav = window;
|
window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
|
||||||
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !window_is_child_tooltip)
|
if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !window_is_child_tooltip)
|
||||||
window->RootWindow = parent_window->RootWindow;
|
window->RootWindow = parent_window->RootWindow;
|
||||||
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
|
||||||
window->RootWindowForTitleBarHighlight = window->RootWindowForTabbing = parent_window->RootWindowForTitleBarHighlight; // Same value in master branch, will differ for docking
|
window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight;
|
||||||
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened)
|
||||||
window->RootWindowForNav = window->RootWindowForNav->ParentWindow;
|
window->RootWindowForNav = window->RootWindowForNav->ParentWindow;
|
||||||
|
|
||||||
@ -7262,7 +7269,7 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)
|
|||||||
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
return window->Active && window == window->RootWindowForTabbing && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow);
|
return window->Active && window == window->RootWindow && (!(window->Flags & ImGuiWindowFlags_NoNavFocus) || window == g.NavWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ImGui::GetWindowWidth()
|
float ImGui::GetWindowWidth()
|
||||||
|
@ -1002,7 +1002,6 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window.
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window.
|
||||||
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
ImGuiWindow* RootWindowForTabbing; // Point to ourself or first ancestor which can be CTRL-Tabbed into.
|
|
||||||
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
|
|
||||||
ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
|
ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
|
||||||
|
Loading…
Reference in New Issue
Block a user