diff options
Diffstat (limited to 'backends/events/webossdl/webossdl-events.h')
-rw-r--r-- | backends/events/webossdl/webossdl-events.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/backends/events/webossdl/webossdl-events.h b/backends/events/webossdl/webossdl-events.h index c925132d92..a36ee535a3 100644 --- a/backends/events/webossdl/webossdl-events.h +++ b/backends/events/webossdl/webossdl-events.h @@ -29,13 +29,87 @@ * SDL events manager for WebOS */ class WebOSSdlEventSource : public SdlEventSource { +public: + enum { + 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) { + for (int i = 0; i < MAX_FINGERS; i++) { + _fingerDown[i] = false; + _screenDownTime[i] = _dragDiffX[i] = _dragDiffY[i] = 0; + } + }; protected: + // Inidicates if gesture area is pressed down or not. + bool _gestureDown; + + // The timestamp when screen was pressed down for each finger. + uint32 _screenDownTime[MAX_FINGERS]; + + // The timestamp when a possible drag operation was triggered. + uint32 _dragStartTime; + + // The distance each finger traveled from touch to release. + int _dragDiffX[MAX_FINGERS], _dragDiffY[MAX_FINGERS]; + + // Indicates if we are in drag mode. + bool _dragging; + + // 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; + + // Indicates if we're in automatic drag mode. + bool _autoDragMode; + + // Tracks which fingers are currently touching the screen. + bool _fingerDown[MAX_FINGERS]; + + // Indicates if a click should be executed when the first finger is lifted + bool _doClick; + + // Indicates whether the event poll has been run before + bool _firstPoll; + + // Event queues + uint32 _queuedDragTime, _queuedEscapeUpTime, _queuedSpaceUpTime, + _queuedRUpTime; + + // 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); virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event); 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 |