- Fixed some hotkey buttons being disabled at startup until the game loads into the main menu

This commit is contained in:
EricPlayZ
2025-01-19 04:00:05 +02:00
parent d4f68003a5
commit 9e7ee5450c

View File

@ -452,11 +452,29 @@ namespace ImGui {
});
#pragma endregion
static void HotkeyDebugInfo(const std::string_view& label) {
ImGuiContext& g = *GImGui;
ImGui::Text("Hotkey Label: %s", label.data());
ImGui::Text("CurrentItemFlags: 0x%X", g.CurrentItemFlags);
ImGui::Text("DisabledStackSize: %d", g.DisabledStackSize);
ImGui::Text("ItemFlagsStack Size: %d", (int)g.ItemFlagsStack.size());
for (size_t i = 0; i < g.ItemFlagsStack.size(); ++i) {
ImGui::Text(" Stack[%d]: 0x%X", (int)i, g.ItemFlagsStack[i]);
}
}
void Hotkey(const std::string_view& label, KeyBindOption* key) {
ImGuiContext& g = *GImGui;
bool wasDisabled = (g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0;
//HotkeyDebugInfo(label);
if (wasDisabled)
EndDisabled();
ImGui::EndDisabled();
ImGuiItemFlags backupFlags = g.CurrentItemFlags;
g.CurrentItemFlags &= ~ImGuiItemFlags_Disabled;
float backupAlpha = g.Style.Alpha;
g.Style.Alpha = backupAlpha / g.Style.DisabledAlpha;
const ImGuiID id = GetID(label.data());
PushID(label.data());
@ -498,7 +516,12 @@ namespace ImGui {
PopID();
g.CurrentItemFlags = backupFlags;
g.Style.Alpha = backupAlpha;
if (wasDisabled)
BeginDisabled(wasDisabled);
ImGui::BeginDisabled(true);
//HotkeyDebugInfo(label);
}
}