Nav: Internals: Renamed ImGuiButtonFlags_NoNavOverride to ImGuiButtonFlags_NoNavFocus + fixed a theorically missing test in ButtonBehavior() (#787)
diff --git a/imgui.cpp b/imgui.cpp
index 66f736f..92cce91 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -5214,7 +5214,7 @@
const ImRect resize_rect(br - ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br);
const ImGuiID resize_id = window->GetID("#RESIZE");
bool hovered, held;
- ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds | ImGuiButtonFlags_NoNavOverride);
+ ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds | ImGuiButtonFlags_NoNavFocus);
if (hovered || held)
g.MouseCursor = ImGuiMouseCursor_ResizeNWSE;
@@ -5567,7 +5567,7 @@
bool held = false;
bool hovered = false;
const bool previously_held = (g.ActiveId == id);
- ImGui::ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavOverride);
+ ImGui::ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus);
float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v);
float scroll_ratio = ImSaturate(scroll_v / scroll_max);
@@ -6715,7 +6715,7 @@
if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0])
{
SetActiveID(id, window);
- if (!(flags & ImGuiButtonFlags_NoNavOverride))
+ if (!(flags & ImGuiButtonFlags_NoNavFocus))
SetFocusID(id, window);
FocusWindow(window);
g.ActiveIdClickOffset = g.IO.MousePos - bb.Min;
@@ -6759,7 +6759,8 @@
// Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button.
g.NavActivateId = id; // This is so SetActiveId assign a Nav source
SetActiveID(id, window);
- SetFocusID(id, window);
+ if (!(flags & ImGuiButtonFlags_NoNavFocus))
+ SetFocusID(id, window);
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
}
}
@@ -6780,7 +6781,7 @@
pressed = true;
ClearActiveID();
}
- if (!(flags & ImGuiButtonFlags_NoNavOverride))
+ if (!(flags & ImGuiButtonFlags_NoNavFocus))
g.NavDisableHighlight = true;
}
else if (g.ActiveIdSource == ImGuiInputSource_Nav)
diff --git a/imgui_internal.h b/imgui_internal.h
index f7994ae..967b441 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -182,7 +182,7 @@
ImGuiButtonFlags_AlignTextBaseLine = 1 << 8, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
ImGuiButtonFlags_NoKeyModifiers = 1 << 9, // disable interaction if a key modifier is held
ImGuiButtonFlags_AllowOverlapMode = 1 << 10, // require previous frame HoveredId to either match id or be null before being usable
- ImGuiButtonFlags_NoNavOverride = 1 << 11 // don't override navigation id when activated
+ ImGuiButtonFlags_NoNavFocus = 1 << 11 // don't override navigation focus when activated
};
enum ImGuiSliderFlags_