mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-24 08:00:21 -04:00
macOS: disable press-and-hold accent popup while moving (#713)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user