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.
This commit is contained in:
TomFrost 2011-09-25 14:13:47 -04:00
parent 9467e4d8d4
commit c958701c78
2 changed files with 21 additions and 11 deletions

View file

@ -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;

View file

@ -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);