20EM_JS(
bool, js_is_mac_platform, (), {
21 return navigator.platform.toUpperCase().indexOf(
'MAC') >= 0;
31#elif defined(__APPLE__)
46 return g_cached_platform;
71 case ImGuiKey_Backspace:
83 case ImGuiKey_PageDown:
85 case ImGuiKey_LeftArrow:
87 case ImGuiKey_RightArrow:
89 case ImGuiKey_UpArrow:
91 case ImGuiKey_DownArrow:
199 case ImGuiKey_Period:
203 case ImGuiKey_Semicolon:
205 case ImGuiKey_Apostrophe:
207 case ImGuiKey_LeftBracket:
209 case ImGuiKey_RightBracket:
211 case ImGuiKey_Backslash:
217 case ImGuiKey_GraveAccent:
226 if (keys.empty())
return "";
229 bool has_primary =
false;
230 bool has_shift =
false;
231 bool has_alt =
false;
232 bool has_super =
false;
233 ImGuiKey main_key = ImGuiKey_None;
236 for (ImGuiKey key : keys) {
237 int key_value =
static_cast<int>(key);
238 if (key_value & ImGuiMod_Mask_) {
239 if (key_value & ImGuiMod_Ctrl) has_primary =
true;
240 if (key_value & ImGuiMod_Shift) has_shift =
true;
241 if (key_value & ImGuiMod_Alt) has_alt =
true;
242 if (key_value & ImGuiMod_Super) has_super =
true;
245 if (key == ImGuiMod_Shortcut) {
249 if (key == ImGuiMod_Shift) {
253 if (key == ImGuiMod_Alt) {
257 if (key == ImGuiMod_Super) {
286 if (main_key != ImGuiKey_None) {
const char * GetCtrlDisplayName()
Get the display name for the primary modifier key.
std::string FormatCtrlShiftShortcut(ImGuiKey key)
Convenience function for Ctrl+Shift+key shortcuts.
Platform
Runtime platform detection for display string customization.
const char * GetKeyName(ImGuiKey key)
Get the ImGui key name as a string.
Platform GetCurrentPlatform()
Get the current platform at runtime.
std::string FormatShortcut(const std::vector< ImGuiKey > &keys)
Format a list of ImGui keys into a human-readable shortcut string.
bool IsMacPlatform()
Check if running on macOS (native or web)
const char * GetAltDisplayName()
Get the display name for the secondary modifier key.
std::string FormatCtrlShortcut(ImGuiKey key)
Convenience function for Ctrl+key shortcuts.