XQuartz: Honor system key repeat rate

This commit is contained in:
Jeremy Huddleston 2008-12-31 11:17:38 -08:00
parent e9963f1a4f
commit 4303c9be39

View File

@ -324,6 +324,8 @@ static void DarwinKeyboardSetDeviceKeyMap(KeySymsRec *keySyms) {
void DarwinKeyboardInit(DeviceIntPtr pDev) {
KeySymsRec keySyms;
XkbComponentNamesRec names;
CFIndex value;
BOOL ok;
// Open a shared connection to the HID System.
// Note that the Event Status Driver is really just a wrapper
@ -342,6 +344,25 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
QuartzBell, DarwinChangeKeyboardControl));
pthread_mutex_unlock(&keyInfo_mutex);
/* Get our key repeat settings from GlobalPreferences */
(void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
value = CFPreferencesGetAppIntegerValue(CFSTR("InitialKeyRepeat"), CFSTR(".GlobalPreferences"), &ok);
if(!ok)
value = 35;
if(value == 300000) { // off
XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOff);
} else {
pDev->key->xkbInfo->desc->ctrls->repeat_delay = value * 15;
value = CFPreferencesGetAppIntegerValue(CFSTR("KeyRepeat"), CFSTR(".GlobalPreferences"), &ok);
if(!ok)
value = 6;
pDev->key->xkbInfo->desc->ctrls->repeat_interval = value * 15;
XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn);
}
SwitchCoreKeyboard(pDev);
DarwinKeyboardSetDeviceKeyMap(&keySyms);