You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: imgui.h
+38
Original file line number
Diff line number
Diff line change
@@ -210,6 +210,7 @@ typedef int ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: f
210
210
typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for BeginDragDropSource(), AcceptDragDropPayload()
211
211
typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused()
212
212
typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc.
213
+
typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for Shortcut(), SetNextItemShortcut()
213
214
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline()
214
215
typedef int ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for IsKeyChordPressed(), Shortcut() etc. an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values.
215
216
typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen()
@@ -938,6 +939,24 @@ namespace ImGui
938
939
IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared.
939
940
IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call.
940
941
942
+
// Inputs Utilities: Shortcut Testing & Routing
943
+
// - ImGuiKeyChord = a ImGuiKey + optional ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super.
944
+
// ImGuiKey_C // Accepted by functions taking ImGuiKey or ImGuiKeyChord arguments)
// only ImGuiMod_XXX values are legal to combine with an ImGuiKey. You CANNOT combine two ImGuiKey values.
947
+
// - The general idea is that several callers may register interest in a shortcut, and only one owner gets it.
948
+
// Parent -> call Shortcut(Ctrl+S) // When Parent is focused, Parent gets the shortcut.
949
+
// Child1 -> call Shortcut(Ctrl+S) // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts)
950
+
// Child2 -> no call // When Child2 is focused, Parent gets the shortcut.
951
+
// The whole system is order independent, so if Child1 makes its calls before Parent, results will be identical.
952
+
// This is an important property as it facilitate working with foreign code or larger codebase.
953
+
// - To understand the difference:
954
+
// - IsKeyChordPressed() compares mods and call IsKeyPressed() -> function has no side-effect.
955
+
// - Shortcut() submits a route, routes are resolved, if it currently can be routed it calls IsKeyChordPressed() -> function has (desirable) side-effects as it can prevents another call from getting the route.
956
+
// - Visualize registered routes in 'Metrics/Debugger->Inputs'.
// - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right.
943
962
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
@@ -1454,6 +1473,25 @@ enum ImGuiKey : int
1454
1473
#endif
1455
1474
};
1456
1475
1476
+
// Flags for Shortcut(), SetNextItemShortcut(),
1477
+
// (and for upcoming extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner() that are still in imgui_internal.h)
1478
+
// Don't mistake with ImGuiInputTextFlags! (which is for ImGui::InputText() function)
1479
+
enum ImGuiInputFlags_
1480
+
{
1481
+
ImGuiInputFlags_None = 0,
1482
+
ImGuiInputFlags_Repeat = 1 << 0, // Enable repeat. Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
1483
+
1484
+
// Flags for Shortcut()
1485
+
// - Default policy is RouteFocused. Can select only 1 policy among all available.
1486
+
// - Priorities: GlobalHighest > Focused (if owner is active item) > GlobalOverFocused > Focused (if in focused window) > Global.
1487
+
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.
1488
+
ImGuiInputFlags_RouteGlobal = 1 << 13, // Global route (normal priority): unless a focused window or active item registered the route) -> recommended Global priority.
1489
+
ImGuiInputFlags_RouteGlobalOverFocused = 1 << 14, // Global route (higher priority): unless an active item registered the route, e.g. CTRL+A registered by InputText will take priority over this).
1490
+
ImGuiInputFlags_RouteGlobalHighest = 1 << 15, // 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)
1491
+
ImGuiInputFlags_RouteAlways = 1 << 16, // Do not register route, poll keys directly.
1492
+
ImGuiInputFlags_RouteUnlessBgFocused = 1 << 17, // Option combine with others: global routes will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications.
1493
+
};
1494
+
1457
1495
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
1458
1496
// OBSOLETED in 1.88 (from July 2022): ImGuiNavInput and io.NavInputs[].
1459
1497
// Official backends between 1.60 and 1.86: will keep working and feed gamepad inputs as long as IMGUI_DISABLE_OBSOLETE_KEYIO is not set.
// Flags for extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner()
1446
1446
// Don't mistake with ImGuiInputTextFlags! (which is for ImGui::InputText() function)
1447
-
enum ImGuiInputFlags_
1447
+
enum ImGuiInputFlagsPrivate_
1448
1448
{
1449
-
ImGuiInputFlags_None = 0,
1450
-
1451
1449
// Flags for IsKeyPressed(), IsKeyChordPressed(), IsMouseClicked(), Shortcut()
1452
1450
// - Repeat mode
1453
-
ImGuiInputFlags_Repeat = 1 << 0, // Enable repeat. Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1.
ImGuiInputFlags_LockThisFrame = 1 << 10, // Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame.
1473
1470
ImGuiInputFlags_LockUntilRelease = 1 << 11, // Further accesses to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released.
1474
1471
1475
-
// Flags for Shortcut() and low-level SetShortcutRouting()
1476
-
// - Routing Policies
1477
-
// The general idea is that several callers register interest in a shortcut, and only one owner gets it.
1478
-
// Parent -> call Shortcut(Ctrl+S) // When Parent is focused, Parent gets the shortcut.
1479
-
// Child1 -> call Shortcut(Ctrl+S) // When Child1 is focused, Child1 gets the shortcut (Child1 overrides Parent shortcuts)
1480
-
// Child2 -> no call // When Child2 is focused, Parent gets the shortcut.
1481
-
// The whole system is order independent, so if Child1 does it calls before Parent results will be identical.
1482
-
// This is an important property as it facilitate working with foreign code or larger codebase.
1483
-
// - Visualize registered routes in 'Metrics->Inputs' and submitted routes in 'Debug Log->InputRouting'.
1484
-
// - When a policy (except for _RouteAlways *) is set, Shortcut() will register itself with SetShortcutRouting(),
1485
-
// allowing the system to decide where to route the input among other route-aware calls.
1486
-
// (* Using ImGuiInputFlags_RouteAlways is roughly equivalent to calling IsKeyChordPressed(key)).
1487
-
// - Shortcut() uses ImGuiInputFlags_RouteFocused by default. Meaning that a Shortcut() call will register
1488
-
// a route and only succeed when parent window is in the focus-stack and if no-one with a higher priority
1489
-
// is claiming the same shortcut.
1490
-
// - You can chain two unrelated windows in the focus stack using SetWindowParentWindowForFocusRoute()
1491
-
// e.g. if you have a tool window associated to a document, and you want document shortcuts to run when the tool is focused.
1492
-
// - Priorities: GlobalHighest > Focused (if owner is active item) > GlobalOverFocused > Focused (if in focused window) > Global.
1493
-
// - Can select only 1 policy among all available.
1494
-
ImGuiInputFlags_RouteFocused = 1 << 12, // (Default) Honor focus route: Accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window.
1495
-
ImGuiInputFlags_RouteGlobal = 1 << 13, // Register route globally (normal priority: unless a focused window or active item registered the route) -> recommended Global priority.
1496
-
ImGuiInputFlags_RouteGlobalOverFocused = 1 << 14, // Register route globally (higher priority: unless an active item registered the route, e.g. CTRL+A registered by InputText will take priority over this).
1497
-
ImGuiInputFlags_RouteGlobalHighest = 1 << 15, // Register route globally (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)
1498
-
ImGuiInputFlags_RouteAlways = 1 << 16, // Do not register route, poll keys directly.
1499
-
// Routing polices: extra options
1500
-
ImGuiInputFlags_RouteUnlessBgFocused = 1 << 17, // Global routes will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications.
1501
-
1502
1472
// [Internal] Mask of which function support which flags
// - ImGuiKeyChord = a ImGuiKey optionally OR-red with ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super.
3280
-
// ImGuiKey_C (accepted by functions taking ImGuiKey or ImGuiKeyChord)
3281
-
// ImGuiKey_C | ImGuiMod_Ctrl (accepted by functions taking ImGuiKeyChord)
3282
-
// ONLY ImGuiMod_XXX values are legal to 'OR' with an ImGuiKey. You CANNOT 'OR' two ImGuiKey values.
3283
-
// - When using one of the routing option, e.g. ImGuiInputFlags_RouteFocused:
3248
+
// Shortcut Testing & Routing
3249
+
// - Set Shortcut() and SetNextItemShortcut() in imgui.h
3250
+
// - When a policy (except for ImGuiInputFlags_RouteAlways *) is set, Shortcut() will register itself with SetShortcutRouting(),
3251
+
// allowing the system to decide where to route the input among other route-aware calls.
3252
+
// (* using ImGuiInputFlags_RouteAlways is roughly equivalent to calling IsKeyChordPressed(key) and bypassing route registration and check)
3253
+
// - When using one of the routing option:
3254
+
// - The default route is ImGuiInputFlags_RouteFocused (accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window.)
3284
3255
// - Routes are requested given a chord (key + modifiers) and a routing policy.
3285
3256
// - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame.
3286
-
// - One route may be granted to a single owner. When multiple requests are made we have policies to select the winning route (e.g. deep most window).
3257
+
// - Each route may be granted to a single owner. When multiple requests are made we have policies to select the winning route (e.g. deep most window).
3287
3258
// - Multiple read sites may use the same owner id can all access the granted route.
3288
3259
// - When owner_id is 0 we use the current Focus Scope ID as a owner ID in order to identify our location.
3289
-
// - TL;DR;
3290
-
// - IsKeyChordPressed() compares mods + call IsKeyPressed() -> function has no side-effect.
3291
-
// - Shortcut() submits a route then if currently can be routed calls IsKeyChordPressed() -> function has (desirable) side-effects.
3292
-
// - Use Tools->Metrics/Debugger->Inputs to view input routes.
0 commit comments