summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-26 15:48:37 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-26 15:48:37 +0300
commit93012ff28bfeae7820941e80a9a8568051790473 (patch)
treee673f6fcf768959f9a44933ddffac125724e77a6
parenta5d6ded17d979404d5b6e18573f35c99abaf97fb (diff)
downloadmv-93012ff28bfeae7820941e80a9a8568051790473.tar.gz
mv-93012ff28bfeae7820941e80a9a8568051790473.tar.bz2
mv-93012ff28bfeae7820941e80a9a8568051790473.tar.xz
mv-93012ff28bfeae7820941e80a9a8568051790473.zip
Add keyboard repeat setting to misc tab.
-rw-r--r--src/client.cpp14
-rw-r--r--src/client.h2
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/gui/setup_other.cpp10
4 files changed, 27 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"));
+}
diff --git a/src/client.h b/src/client.h
index 9e3996526..c6780dfd6 100644
--- a/src/client.h
+++ b/src/client.h
@@ -281,6 +281,8 @@ public:
void applyVSync();
+ void applyKeyRepeat();
+
void optionChanged(const std::string &name);
void action(const gcn::ActionEvent &event);
diff --git a/src/defaults.cpp b/src/defaults.cpp
index ad9fcaddb..be6e72f77 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -249,6 +249,8 @@ DefaultsData* getConfigDefaults()
#endif
AddDEF(configData, "audioFrequency", 22010);
AddDEF(configData, "audioChannels", 2);
+ AddDEF(configData, "repeateDelay", SDL_DEFAULT_REPEAT_DELAY);
+ AddDEF(configData, "repeateInterval", SDL_DEFAULT_REPEAT_INTERVAL);
return configData;
}
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index ff678225f..bf186b45a 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -162,6 +162,16 @@ Setup_Other::Setup_Other()
"guild support"), "", "enableGuildBot", this,
"enableGuildBotEvent", false);
+
+ new SetupItemLabel(_("Keyboard"), "", this);
+
+ new SetupItemIntTextField(_("Repeat delay"), "",
+ "repeateDelay", this, "repeateDelayEvent", 0, 10000);
+
+ new SetupItemIntTextField(_("Repeat interval"), "",
+ "repeateInterval", this, "repeateIntervalEvent", 0, 10000);
+
+
new SetupItemLabel(_("Windows"), "", this);
mShortcutsList = new SetupItemNames();