From: Shamus Hammons Date: Wed, 8 Oct 2014 16:48:37 +0000 (-0500) Subject: Possible fix for gamepad 'Select All Keys' problem. X-Git-Tag: 2.1.1~3 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=virtualjaguar;a=commitdiff_plain;h=2e7108fbe3b1a8a42f155069e4648d43fda57789 Possible fix for gamepad 'Select All Keys' problem. --- diff --git a/src/gui/controllertab.cpp b/src/gui/controllertab.cpp index 7ff002f..89a678f 100644 --- a/src/gui/controllertab.cpp +++ b/src/gui/controllertab.cpp @@ -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; diff --git a/src/gui/controllerwidget.cpp b/src/gui/controllerwidget.cpp index ca27cb5..f268c00 100644 --- a/src/gui/controllerwidget.cpp +++ b/src/gui/controllerwidget.cpp @@ -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); diff --git a/src/gui/keygrabber.cpp b/src/gui/keygrabber.cpp index 87fc640..e1c33d0 100644 --- a/src/gui/keygrabber.cpp +++ b/src/gui/keygrabber.cpp @@ -15,8 +15,15 @@ #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; diff --git a/src/gui/keygrabber.h b/src/gui/keygrabber.h index cb0abaf..abaf534 100644 --- a/src/gui/keygrabber.h +++ b/src/gui/keygrabber.h @@ -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;