mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Fix stuck keys on Qt and Blackberry
This commit is contained in:
parent
8e06b06d7e
commit
110e88e257
@ -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<<b);
|
||||
pad_buttons |= (1<<b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int b = 0; b < 14; b++) {
|
||||
if (value == buttonMappings[b])
|
||||
input_state.pad_buttons &= ~(1<<b);
|
||||
pad_buttons &= ~(1<<b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -460,7 +461,7 @@ int main(int argc, char *argv[]) {
|
||||
{
|
||||
case NAVIGATOR_BACK:
|
||||
case NAVIGATOR_SWIPE_DOWN:
|
||||
input_state.pad_buttons |= PAD_BUTTON_MENU;
|
||||
pad_buttons |= PAD_BUTTON_MENU;
|
||||
break;
|
||||
case NAVIGATOR_EXIT:
|
||||
running = false;
|
||||
@ -468,6 +469,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
input_state.pad_buttons = pad_buttons;
|
||||
// Handle accelerometer
|
||||
double x, y, z;
|
||||
accelerometer_read_forces(&x, &y, &z);
|
||||
@ -477,6 +479,8 @@ int main(int argc, char *argv[]) {
|
||||
EndInputState(&input_state);
|
||||
NativeRender();
|
||||
time_update();
|
||||
// TODO: For gestures, clear this where it is handled
|
||||
pad_buttons &= ~PAD_BUTTON_MENU;
|
||||
// On Blackberry, this handles VSync for us
|
||||
eglSwapBuffers(egl_disp, egl_surf);
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
// PC implementation of the framework.
|
||||
// SDL/EGL implementation of the framework.
|
||||
// This is quite messy due to platform-specific implementations and #ifdef's.
|
||||
// It is suggested to use the Qt implementation instead.
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -2,8 +2,8 @@
|
||||
* Copyright (c) 2012 Sacha Refshauge
|
||||
*
|
||||
*/
|
||||
// Qt implementation of the framework.
|
||||
// Currently supports: Symbian, Blackberry, Linux
|
||||
// Qt 4.7 implementation of the framework.
|
||||
// Currently supports: Symbian, Blackberry, Meego, Linux, Windows
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QUrl>
|
||||
@ -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
|
||||
|
@ -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<<b);
|
||||
pad_buttons |= (1<<b);
|
||||
}
|
||||
break;
|
||||
case QEvent::KeyRelease:
|
||||
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<<b);
|
||||
pad_buttons &= ~(1<<b);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -136,6 +138,7 @@ protected:
|
||||
|
||||
void paintGL()
|
||||
{
|
||||
input_state.pad_buttons = pad_buttons;
|
||||
SimulateGamepad(&input_state);
|
||||
updateAccelerometer();
|
||||
UpdateInputState(&input_state);
|
||||
@ -160,6 +163,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
int pad_buttons;
|
||||
InputState input_state;
|
||||
#ifdef __SYMBIAN32__
|
||||
QAccelerometer* acc;
|
||||
|
Loading…
Reference in New Issue
Block a user