diff options
author | TomFrost | 2011-09-25 14:13:47 -0400 |
---|---|---|
committer | TomFrost | 2011-09-25 14:13:47 -0400 |
commit | c958701c788217e93534deb6f5059e0a702531e8 (patch) | |
tree | a0e19d218780c870e22ff7e8f034cf1300c056c0 | |
parent | 9467e4d8d4270deaa24e2d040f504fee82fc96ec (diff) | |
download | scummvm-rg350-c958701c788217e93534deb6f5059e0a702531e8.tar.gz scummvm-rg350-c958701c788217e93534deb6f5059e0a702531e8.tar.bz2 scummvm-rg350-c958701c788217e93534deb6f5059e0a702531e8.zip |
WebOS: Make right-clicks last longer.
While the right-click was working in most games, the
weapon-switching in Full Throttle wasn't registering the click.
Holding the button down for 50ms instead of immediately firing
the mouseup fixes the issue.
-rw-r--r-- | backends/events/webossdl/webossdl-events.cpp | 18 | ||||
-rw-r--r-- | backends/events/webossdl/webossdl-events.h | 14 |
2 files changed, 21 insertions, 11 deletions
diff --git a/backends/events/webossdl/webossdl-events.cpp b/backends/events/webossdl/webossdl-events.cpp index 778f41dd7e..be96f20e12 100644 --- a/backends/events/webossdl/webossdl-events.cpp +++ b/backends/events/webossdl/webossdl-events.cpp @@ -209,10 +209,11 @@ bool WebOSSdlEventSource::handleMouseButtonUp(SDL_Event &ev, // right mouse click. else if (ev.button.which == 1 && _fingerDown[0] && _fingerDown[1] && !_fingerDown[2]) { - event.type = Common::EVENT_RBUTTONUP; - processMouseEvent(event, _curX, _curY); - g_system->getEventManager()->pushEvent(event); + //event.type = Common::EVENT_RBUTTONUP; + //g_system->getEventManager()->pushEvent(event); event.type = Common::EVENT_RBUTTONDOWN; + processMouseEvent(event, _curX, _curY); + _queuedRUpTime = g_system->getMillis() + QUEUED_RUP_DELAY; } // If two fingers are down and a third taps, it's a middle @@ -372,8 +373,9 @@ bool WebOSSdlEventSource::pollEvent(Common::Event &event) { // Run down the priority list for queued events. The built-in // event queue runs events on the next poll, which causes many - // WebOS devices to ignore certain inputs. Allowing keys to - // stay "down" longer is enough to register the press. + // WebOS devices (and a few game engines) to ignore certain inputs. + // Allowing keys and clicks to stay "down" longer is enough to register + // the press. if (_queuedEscapeUpTime != 0 && curTime >= _queuedEscapeUpTime) { event.type = Common::EVENT_KEYUP; event.kbd.flags = 0; @@ -390,6 +392,12 @@ bool WebOSSdlEventSource::pollEvent(Common::Event &event) { _queuedSpaceUpTime = 0; return true; } + else if (_queuedRUpTime != 0 && curTime >= _queuedRUpTime) { + event.type = Common::EVENT_RBUTTONUP; + processMouseEvent(event, _curX, _curY); + _queuedRUpTime = 0; + return true; + } else if (_queuedDragTime != 0 && curTime >= _queuedDragTime) { event.type = Common::EVENT_LBUTTONDOWN; _dragging = true; diff --git a/backends/events/webossdl/webossdl-events.h b/backends/events/webossdl/webossdl-events.h index a623a133b8..3c2679c4a1 100644 --- a/backends/events/webossdl/webossdl-events.h +++ b/backends/events/webossdl/webossdl-events.h @@ -35,15 +35,15 @@ public: }; WebOSSdlEventSource() : _gestureDown(false), - _dragStartTime(0), - _dragging(false), + _dragStartTime(0), _dragging(false), _curX(0), _curY(0), - _touchpadMode(false), - _autoDragMode(true), + _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_KEY_DELAY(250), QUEUED_DRAG_DELAY(500), + QUEUED_RUP_DELAY(50) { for (int i = 0; i < MAX_FINGERS; i++) { _fingerDown[i] = false; _screenDownTime[i] = _dragDiffX[i] = _dragDiffY[i] = 0; @@ -84,11 +84,13 @@ protected: bool _firstPoll; // Event queues - uint32 _queuedDragTime, _queuedEscapeUpTime, _queuedSpaceUpTime; + 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; virtual void SDLModToOSystemKeyFlags(SDLMod mod, Common::Event &event); virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event); |