aboutsummaryrefslogtreecommitdiff
path: root/backends/events/webossdl/webossdl-events.h
diff options
context:
space:
mode:
authorTomFrost2011-10-01 23:03:15 -0400
committerTomFrost2011-10-01 23:03:15 -0400
commitdbd391bdfe9790aab8f6ae3dc7762ff2662cfbb4 (patch)
tree5ad3673ffe7e81c66f882932f0b9a0177eb1816b /backends/events/webossdl/webossdl-events.h
parentc958701c788217e93534deb6f5059e0a702531e8 (diff)
downloadscummvm-rg350-dbd391bdfe9790aab8f6ae3dc7762ff2662cfbb4.tar.gz
scummvm-rg350-dbd391bdfe9790aab8f6ae3dc7762ff2662cfbb4.tar.bz2
scummvm-rg350-dbd391bdfe9790aab8f6ae3dc7762ff2662cfbb4.zip
WebOS: Add improvements suggested in pull req. 89.
The improvements in this commit are mostly code formatting, variable abstraction, and in one case, a performance enhancement as calculations were made a one-time fire rather than being run with every mouse move event.
Diffstat (limited to 'backends/events/webossdl/webossdl-events.h')
-rw-r--r--backends/events/webossdl/webossdl-events.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/backends/events/webossdl/webossdl-events.h b/backends/events/webossdl/webossdl-events.h
index 3c2679c4a1..a36ee535a3 100644
--- a/backends/events/webossdl/webossdl-events.h
+++ b/backends/events/webossdl/webossdl-events.h
@@ -31,19 +31,25 @@
class WebOSSdlEventSource : public SdlEventSource {
public:
enum {
- MAX_FINGERS = 3
+ DOUBLETAP_LIMIT = 400,
+ MAX_FINGERS = 3,
+ MOUSE_DEADZONE_PIXELS = 5,
+ QUEUED_DRAG_DELAY = 500,
+ QUEUED_KEY_DELAY = 250,
+ QUEUED_RUP_DELAY = 50,
+ SWIPE_PERCENT_HORIZ = 15,
+ SWIPE_PERCENT_VERT = 20
};
WebOSSdlEventSource() :
_gestureDown(false),
_dragStartTime(0), _dragging(false),
_curX(0), _curY(0),
+ _screenX(0), _screenY(0),
_touchpadMode(false), _autoDragMode(true),
_doClick(true),
_queuedDragTime(0), _queuedEscapeUpTime(0), _queuedSpaceUpTime(0),
_queuedRUpTime(0),
- _firstPoll(true),
- QUEUED_KEY_DELAY(250), QUEUED_DRAG_DELAY(500),
- QUEUED_RUP_DELAY(50) {
+ _firstPoll(true) {
for (int i = 0; i < MAX_FINGERS; i++) {
_fingerDown[i] = false;
_screenDownTime[i] = _dragDiffX[i] = _dragDiffY[i] = 0;
@@ -67,6 +73,12 @@ protected:
// The current mouse position on the screen.
int _curX, _curY;
+
+ // The current screen dimensions
+ int _screenX, _screenY;
+
+ // The drag distance for linear gestures
+ int _swipeDistX, _swipeDistY;
// Indicates if we're in touchpad mode or tap-to-move mode.
bool _touchpadMode;
@@ -87,11 +99,7 @@ protected:
uint32 _queuedDragTime, _queuedEscapeUpTime, _queuedSpaceUpTime,
_queuedRUpTime;
- // Standard event queue delays in milliseconds
- const int QUEUED_KEY_DELAY;
- const int QUEUED_DRAG_DELAY;
- const int QUEUED_RUP_DELAY;
-
+ // SDL overrides
virtual void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event);
virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
virtual bool handleKeyUp(SDL_Event &ev, Common::Event &event);
@@ -99,6 +107,9 @@ protected:
virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
virtual bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
virtual bool pollEvent(Common::Event &event);
+
+ // Utility functions
+ void calculateDimensions();
};
#endif