From 650cb51bf10d532ccdbff65f5640fd8d39ca5426 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 24 May 2024 15:27:43 +0200 Subject: [PATCH] Shortcuts: renamed ImGuiInputFlags_RouteActiveItem to ImGuiInputFlags_RouteActive. (#456, #7618) Amend ef9d525 --- docs/CHANGELOG.txt | 2 +- imgui.cpp | 4 ++-- imgui.h | 2 +- imgui_demo.cpp | 2 +- imgui_internal.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 6be27caf7..edc775738 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -80,7 +80,7 @@ Other changes: active item, e.g. InputText() won't be deactivated. - Added routing policies for Shortcut(), SetNextItemShortcut(): (#456, #2637) - ImGuiInputFlags_RouteFocused: focus stack route (default) - - ImGuiInputFlags_RouteActiveItem: only route to active item + - ImGuiInputFlags_RouteActive: only route to active item - ImGuiInputFlags_RouteGlobal: route globally, unless a focus route claim shame shortcut. - ImGuiInputFlags_RouteGlobalOverFocused - ImGuiInputFlags_RouteGlobalHighest diff --git a/imgui.cpp b/imgui.cpp index 2e5951840..e9a9ec5ce 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8636,7 +8636,7 @@ static int CalcRoutingScore(ImGuiID focus_scope_id, ImGuiID owner_id, ImGuiInput return 255; } - if (flags & ImGuiInputFlags_RouteActiveItem) + if (flags & ImGuiInputFlags_RouteActive) { if (owner_id != 0 && g.ActiveId == owner_id) return 1; @@ -8712,7 +8712,7 @@ bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiInputFlags flags, I return false; } - if (flags & ImGuiInputFlags_RouteActiveItem) + if (flags & ImGuiInputFlags_RouteActive) return false; // ActiveIdUsingAllKeyboardKeys trumps all for ActiveId diff --git a/imgui.h b/imgui.h index cb2ba17b7..cc97e12af 100644 --- a/imgui.h +++ b/imgui.h @@ -1485,7 +1485,7 @@ enum ImGuiInputFlags_ // - Default policy is RouteFocused. Can select only 1 policy among all available. // - Priorities: RouteGlobalHighest >> RouteActiveItem or RouteFocused (if owner is active item) >> RouteGlobalOverFocused >> RouteFocused (if in focused window stack) >> RouteGlobal. ImGuiInputFlags_RouteFocused = 1 << 12, // Focus stack route (default): Accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window. - ImGuiInputFlags_RouteActiveItem = 1 << 13, // Route to active item only. + ImGuiInputFlags_RouteActive = 1 << 13, // Route to active item only. ImGuiInputFlags_RouteGlobal = 1 << 14, // Global route (normal priority): unless a focused window or active item registered the route) -> recommended Global priority. ImGuiInputFlags_RouteGlobalOverFocused = 1 << 15, // Global route (higher priority): unless an active item registered the route, e.g. CTRL+A registered by InputText will take priority over this. ImGuiInputFlags_RouteGlobalHighest = 1 << 16, // Global route (highest priority): unlikely you need to use that: will interfere with every active items, e.g. CTRL+A registered by InputText will be overridden by this. May not be fully honored as user/internal code is likely to always assume they can access keys when active. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 5577913a2..78b829682 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -6283,7 +6283,7 @@ static void ShowDemoWindowInputs() static ImGuiInputFlags routing_flags = ImGuiInputFlags_RouteFocused; ImGui::CheckboxFlags("ImGuiInputFlags_Repeat", &other_flags, ImGuiInputFlags_Repeat); ImGui::RadioButton("ImGuiInputFlags_RouteFocused (default)", &routing_flags, ImGuiInputFlags_RouteFocused); - ImGui::RadioButton("ImGuiInputFlags_RouteActiveItem", &routing_flags, ImGuiInputFlags_RouteActiveItem); + ImGui::RadioButton("ImGuiInputFlags_RouteActive", &routing_flags, ImGuiInputFlags_RouteActive); ImGui::RadioButton("ImGuiInputFlags_RouteAlways", &routing_flags, ImGuiInputFlags_RouteAlways); ImGui::RadioButton("ImGuiInputFlags_RouteGlobal", &routing_flags, ImGuiInputFlags_RouteGlobal); ImGui::RadioButton("ImGuiInputFlags_RouteGlobalOverFocused", &routing_flags, ImGuiInputFlags_RouteGlobalOverFocused); diff --git a/imgui_internal.h b/imgui_internal.h index 2ce7060c2..fa12bf43c 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1477,7 +1477,7 @@ enum ImGuiInputFlagsPrivate_ ImGuiInputFlags_RepeatUntilMask_ = ImGuiInputFlags_RepeatUntilRelease | ImGuiInputFlags_RepeatUntilKeyModsChange | ImGuiInputFlags_RepeatUntilKeyModsChangeFromNone | ImGuiInputFlags_RepeatUntilOtherKeyPress, ImGuiInputFlags_RepeatMask_ = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RepeatUntilMask_, ImGuiInputFlags_CondMask_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, - ImGuiInputFlags_RouteTypeMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteActiveItem | ImGuiInputFlags_RouteGlobalOverFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalHighest | ImGuiInputFlags_RouteAlways, + ImGuiInputFlags_RouteTypeMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteActive | ImGuiInputFlags_RouteGlobalOverFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalHighest | ImGuiInputFlags_RouteAlways, ImGuiInputFlags_RouteOptionsMask_ = ImGuiInputFlags_RouteUnlessBgFocused | ImGuiInputFlags_RouteFromRootWindow, ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_RepeatMask_, ImGuiInputFlags_SupportedByIsMouseClicked = ImGuiInputFlags_Repeat,