]> Shamusworld >> Repos - virtualjaguar/commitdiff
Possible fix for gamepad 'Select All Keys' problem.
authorShamus Hammons <jlhamm@acm.org>
Wed, 8 Oct 2014 16:48:37 +0000 (11:48 -0500)
committerShamus Hammons <jlhamm@acm.org>
Wed, 8 Oct 2014 16:48:37 +0000 (11:48 -0500)
src/gui/controllertab.cpp
src/gui/controllerwidget.cpp
src/gui/keygrabber.cpp
src/gui/keygrabber.h

index 7ff002f1dbc1902457092deeddbae3510856c422..89a678f380ddff453bce1b412735ba527813c5a2 100644 (file)
@@ -156,7 +156,8 @@ void ControllerTab::DefineAllKeys(void)
                if (key == Qt::Key_Escape)
                        break;
 
-               // Otherwise, populate the appropriate spot in the settings & update screen...
+               // Otherwise, populate the appropriate spot in the settings & update
+               // the screen...
                controllerWidget->keys[orderToDefine[i]] = key;
                controllerWidget->update();
                profile[profileNum].map[orderToDefine[i]] = key;
index ca27cb5cb360b90dc3da33b3041bf0b056314c73..f268c00ce65267f181886866045348d0e08f8558 100644 (file)
@@ -173,7 +173,8 @@ void ControllerWidget::mousePressEvent(QMouseEvent * /*event*/)
 void ControllerWidget::mouseReleaseEvent(QMouseEvent * /*event*/)
 {
        mouseDown = false;
-       // Spawning the keygrabber causes leaveEvent() to be called, so we need to save this
+       // Spawning the keygrabber causes leaveEvent() to be called, so we need to
+       // save this
        int keyToHighlightSave = keyToHighlight;
 
        KeyGrabber keyGrab(this);
index 87fc6404dda44590fdc5a1d65c8927c5ca32ebb5..e1c33d0e3eada8aefb61210650c88f739603ecb4 100644 (file)
 #include "gamepad.h"
 
 
+// Class variables
+// These need to be preserved between calls to this class, otherwise bad stuff
+// (like controllers not working correctly) can happen.
+/*static*/ bool KeyGrabber::buttonDown = false;
+/*static*/ int KeyGrabber::button = -1;
+
+
 KeyGrabber::KeyGrabber(QWidget * parent/*= 0*/): QDialog(parent),
-       label(new QLabel), timer(new QTimer), buttonDown(false)
+       label(new QLabel), timer(new QTimer)//, buttonDown(false)
 {
 //     label = new QLabel(this);
        QVBoxLayout * mainLayout = new QVBoxLayout;
index cb0abaf7352499413590e2e96d115103d59f7c2c..abaf534122bf6c17da4c4b95cc7ee46527a1f9ab 100644 (file)
@@ -28,8 +28,8 @@ class KeyGrabber: public QDialog
        private:
                QLabel * label;
                QTimer * timer;
-               bool buttonDown;
-               int button;
+               static bool buttonDown; // Class variable
+               static int button;              // Class variable
 
        public:
                int key;