|
@@ -4414,6 +4414,20 @@ void ImGui::NewFrame()
|
|
|
g.ActiveIdUsingKeyInputMask.ClearAllBits();
|
|
|
}
|
|
|
|
|
|
+#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
|
+ if (g.ActiveId == 0)
|
|
|
+ g.ActiveIdUsingNavInputMask = 0;
|
|
|
+ else if (g.ActiveIdUsingNavInputMask != 0)
|
|
|
+ {
|
|
|
+ // If your custom widget code used: { g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); }
|
|
|
+ // Since IMGUI_VERSION_NUM >= 18804 it should be: { SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel); }
|
|
|
+ if (g.ActiveIdUsingNavInputMask & (1 << ImGuiNavInput_Cancel))
|
|
|
+ SetActiveIdUsingKey(ImGuiKey_Escape);
|
|
|
+ if (g.ActiveIdUsingNavInputMask & ~(1 << ImGuiNavInput_Cancel))
|
|
|
+ IM_ASSERT(0); // Other values unsupported
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
// Drag and drop
|
|
|
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
|
|
g.DragDropAcceptIdCurr = 0;
|
|
@@ -7674,6 +7688,18 @@ const char* ImGui::GetKeyName(ImGuiKey key)
|
|
|
return GKeyNames[key - ImGuiKey_NamedKey_BEGIN];
|
|
|
}
|
|
|
|
|
|
+void ImGui::GetKeyChordName(ImGuiModFlags mods, ImGuiKey key, char* out_buf, int out_buf_size)
|
|
|
+{
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
+ IM_ASSERT((mods & ~ImGuiModFlags_All) == 0 && "Passing invalid ImGuiModFlags value!"); // A frequent mistake is to pass ImGuiKey_ModXXX instead of ImGuiModFlags_XXX
|
|
|
+ ImFormatString(out_buf, (size_t)out_buf_size, "%s%s%s%s%s",
|
|
|
+ (mods & ImGuiModFlags_Ctrl) ? "Ctrl+" : "",
|
|
|
+ (mods & ImGuiModFlags_Shift) ? "Shift+" : "",
|
|
|
+ (mods & ImGuiModFlags_Alt) ? "Alt+" : "",
|
|
|
+ (mods & ImGuiModFlags_Super) ? (g.IO.ConfigMacOSXBehaviors ? "Cmd+" : "Super+") : "",
|
|
|
+ GetKeyName(key));
|
|
|
+}
|
|
|
+
|
|
|
// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime)
|
|
|
// t1 = current time (e.g.: g.Time)
|
|
|
// An event is triggered at:
|
|
@@ -10614,15 +10640,6 @@ static void ImGui::NavUpdateCancelRequest()
|
|
|
if (!IsKeyPressed(ImGuiKey_Escape, false) && !IsKeyPressed(ImGuiKey_NavGamepadCancel, false))
|
|
|
return;
|
|
|
|
|
|
-#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
|
|
- // If your custom widget code used: { g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); }
|
|
|
- // Since IMGUI_VERSION_NUM >= 18804 it should be: { SetActiveIdUsingKey(ImGuiKey_Escape); SetActiveIdUsingKey(ImGuiKey_NavGamepadCancel); }
|
|
|
- if (g.ActiveIdUsingNavInputMask & (1 << ImGuiNavInput_Cancel))
|
|
|
- SetActiveIdUsingKey(ImGuiKey_Escape);
|
|
|
- if (g.ActiveIdUsingNavInputMask & ~(1 << ImGuiNavInput_Cancel))
|
|
|
- IM_ASSERT(0); // Other values unsupported
|
|
|
-#endif
|
|
|
-
|
|
|
IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()\n");
|
|
|
if (g.ActiveId != 0)
|
|
|
{
|