From 110e88e2579c3431d0c9e3df6459ab05f057148d Mon Sep 17 00:00:00 2001 From: Sacha Date: Sun, 7 Apr 2013 00:34:46 +1000 Subject: [PATCH] Fix stuck keys on Qt and Blackberry --- base/BlackberryMain.cpp | 10 +++++++--- base/PCMain.cpp | 4 +++- base/QtMain.cpp | 7 +++---- base/QtMain.h | 12 ++++++++---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/base/BlackberryMain.cpp b/base/BlackberryMain.cpp index 850ddab926..ceac9524f1 100644 --- a/base/BlackberryMain.cpp +++ b/base/BlackberryMain.cpp @@ -388,6 +388,7 @@ int main(int argc, char *argv[]) { #ifdef BLACKBERRY10 vibration_request_events(0); #endif + static int pad_buttons = 0; BlackberryAudio* audio = new BlackberryAudio(); bool running = true; while (running) { @@ -444,13 +445,13 @@ int main(int argc, char *argv[]) { if (flags & (KEY_DOWN | KEY_SYM_VALID)) { for (int b = 0; b < 14; b++) { if (value == buttonMappings[b]) - input_state.pad_buttons |= (1< #include @@ -41,7 +41,7 @@ void SimulateGamepad(InputState *input) { float CalculateDPIScale() { - // Sane default for Symbian, Blackberry and Meego + // Sane default rather than check DPI #ifdef __SYMBIAN32__ return 1.4f; #else @@ -79,7 +79,6 @@ int main(int argc, char *argv[]) #ifndef Q_WS_X11 MainUI w(dpi_scale); - w.setAttribute(Qt::WA_LockLandscapeOrientation); w.resize(pixel_xres, pixel_yres); w.showFullScreen(); #endif diff --git a/base/QtMain.h b/base/QtMain.h index 34881a0876..fc298504c4 100644 --- a/base/QtMain.h +++ b/base/QtMain.h @@ -54,6 +54,8 @@ public: QGLWidget(parent), dpi_scale(scale) { setAttribute(Qt::WA_AcceptTouchEvents); + setAttribute(Qt::WA_LockLandscapeOrientation); + pad_buttons = 0; #ifdef __SYMBIAN32__ acc = new QAccelerometer(this); acc->start(); @@ -108,15 +110,15 @@ protected: input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * dpi_scale; break; case QEvent::KeyPress: - for (int b = 0; b < 14; b++) { + for (int b = 0; b < 18; b++) { if (((QKeyEvent*)e)->key() == buttonMappings[b]) - input_state.pad_buttons |= (1<key() == buttonMappings[b]) - input_state.pad_buttons &= ~(1<