summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-31 12:44:50 -0800
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-31 12:44:50 -0800
commit9faf3de7e5610af340b92acb1b86bf03b6f2241a (patch)
tree5aa5ac4a7c95a4b4abdfd0e0954201833dac3000
parent4be8d7346b9fdc014b72dd6c404ceecc0ef0d245 (diff)
XQuartz: Honor system key repeat rate
(cherry picked from commit 4303c9be39a86f5a21de108f72b90a989435905e)
-rw-r--r--hw/xquartz/quartzKeyboard.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 228679aa2..563b7b5a3 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -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,8 +344,26 @@ 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);
+ }
// TODO: What do we do now in 1.6?
- //SwitchCoreKeyboard(pDev);
+ SwitchCoreKeyboard(pDev);
DarwinKeyboardSetDeviceKeyMap(&keySyms);
}