summaryrefslogtreecommitdiff
path: root/src/gui/setup_joystick.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-09 03:54:55 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-09 03:58:39 +0300
commita9c6d1da99732437d56b9ca964bb1b13b8d76887 (patch)
tree0c5e8ed1bd721c50dd9e15c564287e131b071251 /src/gui/setup_joystick.cpp
parentffbd974deb426cdda39e1f0137a7fc4df681418d (diff)
downloadplus-a9c6d1da99732437d56b9ca964bb1b13b8d76887.tar.gz
plus-a9c6d1da99732437d56b9ca964bb1b13b8d76887.tar.bz2
plus-a9c6d1da99732437d56b9ca964bb1b13b8d76887.tar.xz
plus-a9c6d1da99732437d56b9ca964bb1b13b8d76887.zip
Add option to use joystick only if game window is active.
Diffstat (limited to 'src/gui/setup_joystick.cpp')
-rw-r--r--src/gui/setup_joystick.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index f0899be3f..7899247e3 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -70,7 +70,10 @@ Setup_Joystick::Setup_Joystick():
mCalibrateLabel(new Label(_("Press the button to start calibration"))),
mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)),
mJoystickEnabled(new CheckBox(_("Enable joystick"))),
- mNamesModel(new NamesModel())
+ mNamesModel(new NamesModel()),
+ mNamesDropDown(new DropDown(mNamesModel)),
+ mUseInactiveCheckBox(new CheckBox(_("Use joystick if client "
+ "window inactive"), config.getBoolValue("useInactiveJoystick")))
{
setName(_("Joystick"));
@@ -82,7 +85,6 @@ Setup_Joystick::Setup_Joystick():
mJoystickEnabled->addActionListener(this);
mCalibrateButton->setEnabled(mOriginalJoystickEnabled);
- mNamesDropDown = new DropDown(mNamesModel);
mNamesDropDown->setActionEventId("name");
mNamesDropDown->addActionListener(this);
@@ -104,8 +106,9 @@ Setup_Joystick::Setup_Joystick():
place(0, 0, mJoystickEnabled);
place(0, 1, mNamesDropDown);
- place(0, 2, mCalibrateLabel);
- place(0, 3, mCalibrateButton);
+ place(0, 2, mUseInactiveCheckBox);
+ place(0, 3, mCalibrateLabel);
+ place(0, 4, mCalibrateButton);
setDimension(gcn::Rectangle(0, 0, 365, 75));
}
@@ -180,4 +183,8 @@ void Setup_Joystick::apply()
config.setValue("joystickEnabled",
joystick ? joystick->isEnabled() : false);
+
+ config.setValue("useInactiveJoystick", mUseInactiveCheckBox->isSelected());
+ if (joystick)
+ joystick->setUseInactive(mUseInactiveCheckBox->isSelected());
}