Nav: Fixed a few widgets from not setting reference keyboard/gamepad navigation ID when activated with mouse.
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 248483e..37f6e45 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -51,6 +51,11 @@
to common idioms (e.g. passing .data(), .data() + .size() from a null string). (#3615)
- Nav: Fixed toggling menu layer with Alt or exiting menu layer with Esc not moving mouse when
the NavEnableSetMousePos config flag is set.
+- Nav: Fixed a few widgets from not setting reference keyboard/gamepad navigation ID when
+ activated with mouse. More specifically: BeginTabItem(), the scrolling arrows of BeginTabBar(),
+ the arrow section of TreeNode(), the +/- buttons of InputInt()/InputFloat(), Selectable() with
+ ImGuiSelectableFlags_SelectOnRelease. More generally: any direct use of ButtonBehavior() with
+ the PressedOnClick/PressedOnDoubleClick/PressedOnRelease button policy.
- Menus: Adjust closing logic to accomodate for varying font size and dpi.
- Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510).
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
diff --git a/imgui.h b/imgui.h
index f36c44b..6ea22bb 100644
--- a/imgui.h
+++ b/imgui.h
@@ -64,7 +64,7 @@
// Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
#define IMGUI_VERSION "1.85 WIP"
-#define IMGUI_VERSION_NUM 18413
+#define IMGUI_VERSION_NUM 18414
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE
diff --git a/imgui_tables.cpp b/imgui_tables.cpp
index b60676a..7b783e3 100644
--- a/imgui_tables.cpp
+++ b/imgui_tables.cpp
@@ -1170,7 +1170,7 @@
KeepAliveID(column_id);
bool hovered = false, held = false;
- bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
+ bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus);
if (pressed && IsMouseDoubleClicked(0))
{
TableSetColumnWidthAutoSingle(table, column_n);
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index ddb50b6..f8aea16 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -571,6 +571,8 @@
ClearActiveID();
else
SetActiveID(id, window); // Hold on ID
+ if (!(flags & ImGuiButtonFlags_NoNavFocus))
+ SetFocusID(id, window);
g.ActiveIdMouseButton = mouse_button_clicked;
FocusWindow(window);
}
@@ -581,6 +583,8 @@
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
if (!has_repeated_at_least_once)
pressed = true;
+ if (!(flags & ImGuiButtonFlags_NoNavFocus))
+ SetFocusID(id, window);
ClearActiveID();
}