Qt/ImGui: Use macOS keyboard behaviors

Signed-off-by: SternXD <stern@sidestore.io>
This commit is contained in:
SternXD
2026-06-07 15:02:57 -04:00
committed by Ty
parent b5ed65ddd6
commit d0c2097cd4
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -590,6 +590,12 @@ u32 QtUtils::KeyEventToCode(const QKeyEvent* ev)
modifiers &= ~Qt::KeypadModifier;
}
}
// Undo Qt's swapping of Control and Command on macOS.
if (key == Qt::Key_Control)
key = Qt::Key_Meta;
else if (key == Qt::Key_Meta)
key = Qt::Key_Control;
#endif
return static_cast<u32>(key) | (static_cast<u32>(modifiers) & static_cast<u32>(Qt::KeypadModifier));
+4
View File
@@ -147,6 +147,10 @@ bool ImGuiManager::Initialize()
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset | ImGuiBackendFlags_RendererHasTextures | ImGuiBackendFlags_HasGamepad;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard | ImGuiConfigFlags_NavEnableGamepad;
io.KeyRepeatDelay = 0.5f;
#ifdef __APPLE__
// For macOS we should use the standard macOS text editing shortcuts
io.ConfigMacOSXBehaviors = true;
#endif
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
platform_io.Platform_GetClipboardTextFn = [](ImGuiContext* ctx) -> const char* {