diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-11-09 03:54:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-11-09 03:58:39 +0300 |
commit | a9c6d1da99732437d56b9ca964bb1b13b8d76887 (patch) | |
tree | 0c5e8ed1bd721c50dd9e15c564287e131b071251 /src/gui | |
parent | ffbd974deb426cdda39e1f0137a7fc4df681418d (diff) | |
download | mv-a9c6d1da99732437d56b9ca964bb1b13b8d76887.tar.gz mv-a9c6d1da99732437d56b9ca964bb1b13b8d76887.tar.bz2 mv-a9c6d1da99732437d56b9ca964bb1b13b8d76887.tar.xz mv-a9c6d1da99732437d56b9ca964bb1b13b8d76887.zip |
Add option to use joystick only if game window is active.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/setup_joystick.cpp | 15 | ||||
-rw-r--r-- | src/gui/setup_joystick.h | 1 |
2 files changed, 12 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()); } diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index e0a3a143f..5bd72cdad 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.h @@ -54,6 +54,7 @@ class Setup_Joystick : public SetupTab gcn::CheckBox *mJoystickEnabled; NamesModel *mNamesModel; DropDown *mNamesDropDown; + gcn::CheckBox *mUseInactiveCheckBox; }; #endif |