diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp index c871b2372..fe890c984 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -378,7 +378,7 @@ void Client::gameInit() initPacketLimiter(); SDL_EnableUNICODE(1); - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + applyKeyRepeat(); // disable unused SDL events SDL_EventState(SDL_VIDEOEXPOSE, SDL_IGNORE); @@ -687,6 +687,8 @@ void Client::gameInit() config.addListener("gamma", this); config.addListener("particleEmitterSkip", this); config.addListener("vsync", this); + config.addListener("repeateDelay", this); + config.addListener("repeateInterval", this); setGuiAlpha(config.getFloatValue("guialpha")); optionChanged("fpslimit"); @@ -1568,6 +1570,10 @@ void Client::optionChanged(const std::string &name) { applyVSync(); } + else if (name == "repeateInterval" or name == "repeateDelay") + { + applyKeyRepeat(); + } } void Client::action(const gcn::ActionEvent &event) @@ -2531,3 +2537,9 @@ void Client::applyVSync() if (val > 0 && val < 2) SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, val); } + +void Client::applyKeyRepeat() +{ + SDL_EnableKeyRepeat(config.getIntValue("repeateDelay"), + config.getIntValue("repeateInterval")); +} |