diff options
author | Willem Jan Palenstijn | 2011-10-19 13:40:59 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-10-19 13:57:09 +0200 |
commit | 84bc5651271f70e470099a19ab197ef038ef4a3b (patch) | |
tree | b487a67bbd091f2066741c9738f13d6e8ff95e99 /backends/events/webossdl/webossdl-events.h | |
parent | dd2df58f21e3062bc39e366020dece2d84e436fd (diff) | |
parent | dbd391bdfe9790aab8f6ae3dc7762ff2662cfbb4 (diff) | |
download | scummvm-rg350-84bc5651271f70e470099a19ab197ef038ef4a3b.tar.gz scummvm-rg350-84bc5651271f70e470099a19ab197ef038ef4a3b.tar.bz2 scummvm-rg350-84bc5651271f70e470099a19ab197ef038ef4a3b.zip |
Merge pull request #89 from TomFrost/master
HP TouchPad compatibility and full WebOS port update, Round 2
This is a manual merge of the pull request, with some commit message changes.
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 |