aboutsummaryrefslogtreecommitdiff
path: root/backends/events/openpandora/op-events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/events/openpandora/op-events.cpp')
-rw-r--r--backends/events/openpandora/op-events.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/backends/events/openpandora/op-events.cpp b/backends/events/openpandora/op-events.cpp
index fd5d2bc043..6302c15517 100644
--- a/backends/events/openpandora/op-events.cpp
+++ b/backends/events/openpandora/op-events.cpp
@@ -46,7 +46,22 @@ enum {
};
OPEventSource::OPEventSource()
- : _buttonStateL(false) {
+ : _buttonStateL(false),
+ _tapmodeLevel(TAPMODE_LEFT) {
+}
+
+void OPEventSource::ToggleTapMode() {
+ if (_tapmodeLevel == TAPMODE_LEFT) {
+ _tapmodeLevel = TAPMODE_RIGHT;
+ } else if (_tapmodeLevel == TAPMODE_RIGHT) {
+ _tapmodeLevel = TAPMODE_HOVER;
+ } else if (_tapmodeLevel == TAPMODE_HOVER) {
+ _tapmodeLevel = TAPMODE_HOVER_DPAD;
+ } else if (_tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ _tapmodeLevel = TAPMODE_LEFT;
+ } else {
+ _tapmodeLevel = TAPMODE_LEFT;
+ }
}
/* Custom handleMouseButtonDown/handleMouseButtonUp to deal with 'Tap Mode' for the touchscreen */
@@ -55,13 +70,13 @@ bool OPEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) {
if (ev.button.button == SDL_BUTTON_LEFT) {
if (_buttonStateL == true) /* _buttonStateL = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
event.type = Common::EVENT_LBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
event.type = Common::EVENT_RBUTTONDOWN;
- else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
- else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONDOWN; /* For normal mice etc. */
@@ -92,13 +107,13 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
if (ev.button.button == SDL_BUTTON_LEFT) {
if (_buttonStateL == true) /* _buttonStateL = Left Trigger Held, force Right Click */
event.type = Common::EVENT_RBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_LEFT) /* TAPMODE_LEFT = Left Click Tap Mode */
event.type = Common::EVENT_LBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_RIGHT) /* TAPMODE_RIGHT = Right Click Tap Mode */
event.type = Common::EVENT_RBUTTONUP;
- else if (OP::tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_HOVER) /* TAPMODE_HOVER = Hover (No Click) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
- else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
+ else if (_tapmodeLevel == TAPMODE_HOVER_DPAD) /* TAPMODE_HOVER_DPAD = Hover (DPad Clicks) Tap Mode */
event.type = Common::EVENT_MOUSEMOVE;
else
event.type = Common::EVENT_LBUTTONUP; /* For normal mice etc. */
@@ -125,7 +140,7 @@ bool OPEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) {
bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
- if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ if (_tapmodeLevel == TAPMODE_HOVER_DPAD) {
switch (ev.key.keysym.sym) {
case SDLK_LEFT:
event.type = (ev.type == SDL_KEYDOWN) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP;
@@ -166,14 +181,14 @@ bool OPEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
return true;
break;
case SDLK_PAGEUP:
- OP::ToggleTapMode();
- if (OP::tapmodeLevel == TAPMODE_LEFT) {
+ ToggleTapMode();
+ if (_tapmodeLevel == TAPMODE_LEFT) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Left Click"));
- } else if (OP::tapmodeLevel == TAPMODE_RIGHT) {
+ } else if (_tapmodeLevel == TAPMODE_RIGHT) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Right Click"));
- } else if (OP::tapmodeLevel == TAPMODE_HOVER) {
+ } else if (_tapmodeLevel == TAPMODE_HOVER) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (No Click)"));
- } else if (OP::tapmodeLevel == TAPMODE_HOVER_DPAD) {
+ } else if (_tapmodeLevel == TAPMODE_HOVER_DPAD) {
g_system->displayMessageOnOSD(_("Touchscreen 'Tap Mode' - Hover (DPad Clicks)"));
}
break;