macOS: disable press-and-hold accent popup while moving (#713)

This commit is contained in:
quarrel07
2026-07-22 03:27:50 -07:00
committed by GitHub
parent aedcf9ada6
commit 022e0737d5
+12
View File
@@ -943,6 +943,10 @@ void CM_ThrowRuntimeError(const char* fmt, ...) {
exit(EXIT_FAILURE);
}
#ifdef __APPLE__
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef _WIN32
int SDL_main(int argc, char** argv) {
#else
@@ -955,6 +959,14 @@ extern "C"
#ifdef _WIN32
// Allow non-ascii characters for Windows
setlocale(LC_ALL, ".UTF8");
#endif
#if defined(__APPLE__)
// Disable the macOS "press and hold" accent/diacritic popup for this app. SDL keeps a Cocoa text
// input context active, so holding a movement key is interpreted as holding a letter key in a text
// field, and macOS shows the accent picker instead of repeating it. Per-app equivalent of
// `defaults write -app <App> ApplePressAndHoldEnabled -bool false`; key repeat still works.
CFPreferencesSetAppValue(CFSTR("ApplePressAndHoldEnabled"), kCFBooleanFalse, kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
#endif
// load_wasm();
GameEngine::Create();