mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-24 13:34:58 +01:00
Internals: removed NavLayerCurrentMask (redundant, add extra shift in ItemAdd().
This commit is contained in:
parent
014e5078a8
commit
4fd43a8b64
@ -5142,7 +5142,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|||||||
|
|
||||||
// Resize grips and borders are on layer 1
|
// Resize grips and borders are on layer 1
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
|
|
||||||
|
|
||||||
// Manual resize grips
|
// Manual resize grips
|
||||||
PushID("#RESIZE");
|
PushID("#RESIZE");
|
||||||
@ -5211,7 +5210,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s
|
|||||||
|
|
||||||
// Restore nav layer
|
// Restore nav layer
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
|
||||||
|
|
||||||
// Navigation resize (keyboard/gamepad)
|
// Navigation resize (keyboard/gamepad)
|
||||||
if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window)
|
if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window)
|
||||||
@ -5382,7 +5380,6 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
|||||||
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;
|
||||||
window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;
|
window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus;
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
|
|
||||||
|
|
||||||
// Layout buttons
|
// Layout buttons
|
||||||
// FIXME: Would be nice to generalize the subtleties expressed here into reusable code.
|
// FIXME: Would be nice to generalize the subtleties expressed here into reusable code.
|
||||||
@ -5418,7 +5415,6 @@ void ImGui::RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& titl
|
|||||||
*p_open = false;
|
*p_open = false;
|
||||||
|
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
|
||||||
window->DC.ItemFlags = item_flags_backup;
|
window->DC.ItemFlags = item_flags_backup;
|
||||||
|
|
||||||
// Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker)
|
// Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker)
|
||||||
@ -5994,7 +5990,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;
|
window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;
|
||||||
|
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
|
||||||
window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext;
|
window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext;
|
||||||
window->DC.NavLayerActiveMaskNext = 0x00;
|
window->DC.NavLayerActiveMaskNext = 0x00;
|
||||||
window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // -V595
|
window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // -V595
|
||||||
@ -7035,7 +7030,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg)
|
|||||||
// to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick).
|
// to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick).
|
||||||
// We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null.
|
// We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null.
|
||||||
// If we crash on a NULL g.NavWindow we need to fix the bug elsewhere.
|
// If we crash on a NULL g.NavWindow we need to fix the bug elsewhere.
|
||||||
window->DC.NavLayerActiveMaskNext |= window->DC.NavLayerCurrentMask;
|
window->DC.NavLayerActiveMaskNext |= (1 << window->DC.NavLayerCurrent);
|
||||||
if (g.NavId == id || g.NavAnyRequest)
|
if (g.NavId == id || g.NavAnyRequest)
|
||||||
if (g.NavWindow->RootWindowForNav == window->RootWindowForNav)
|
if (g.NavWindow->RootWindowForNav == window->RootWindowForNav)
|
||||||
if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened))
|
if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened))
|
||||||
|
@ -1497,9 +1497,8 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
|
|
||||||
// Keyboard/Gamepad navigation
|
// Keyboard/Gamepad navigation
|
||||||
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
||||||
int NavLayerCurrentMask; // = (1 << NavLayerCurrent) used by ItemAdd prior to clipping.
|
int NavLayerActiveMask; // Which layers have been written to (result from previous frame)
|
||||||
int NavLayerActiveMask; // Which layer have been written to (result from previous frame)
|
int NavLayerActiveMaskNext; // Which layers have been written to (accumulator for current frame)
|
||||||
int NavLayerActiveMaskNext; // Which layer have been written to (buffer for current frame)
|
|
||||||
ImGuiID NavFocusScopeIdCurrent; // Current focus scope ID while appending
|
ImGuiID NavFocusScopeIdCurrent; // Current focus scope ID while appending
|
||||||
bool NavHideHighlightOneFrame;
|
bool NavHideHighlightOneFrame;
|
||||||
bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
|
bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
|
||||||
@ -1544,7 +1543,6 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
|
|
||||||
NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
|
NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
|
||||||
NavLayerCurrent = ImGuiNavLayer_Main;
|
NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
|
||||||
NavFocusScopeIdCurrent = 0;
|
NavFocusScopeIdCurrent = 0;
|
||||||
NavHideHighlightOneFrame = false;
|
NavHideHighlightOneFrame = false;
|
||||||
NavHasScroll = false;
|
NavHasScroll = false;
|
||||||
|
@ -3833,7 +3833,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
draw_window = g.CurrentWindow; // Child window
|
draw_window = g.CurrentWindow; // Child window
|
||||||
draw_window->DC.NavLayerActiveMaskNext |= draw_window->DC.NavLayerCurrentMask; // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
|
draw_window->DC.NavLayerActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
|
||||||
inner_size.x -= draw_window->ScrollbarSizes.x;
|
inner_size.x -= draw_window->ScrollbarSizes.x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6462,7 +6462,6 @@ bool ImGui::BeginMenuBar()
|
|||||||
window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y);
|
window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y);
|
||||||
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Menu);
|
|
||||||
window->DC.MenuBarAppending = true;
|
window->DC.MenuBarAppending = true;
|
||||||
AlignTextToFramePadding();
|
AlignTextToFramePadding();
|
||||||
return true;
|
return true;
|
||||||
@ -6505,7 +6504,6 @@ void ImGui::EndMenuBar()
|
|||||||
EndGroup(); // Restore position on layer 0
|
EndGroup(); // Restore position on layer 0
|
||||||
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
||||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
window->DC.NavLayerCurrentMask = (1 << ImGuiNavLayer_Main);
|
|
||||||
window->DC.MenuBarAppending = false;
|
window->DC.MenuBarAppending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user