From 93012ff28bfeae7820941e80a9a8568051790473 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 26 Apr 2012 15:48:37 +0300 Subject: Add keyboard repeat setting to misc tab. --- src/client.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/client.cpp') 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")); +} -- cgit v1.2.3-70-g09d2