diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/events/webossdl/webossdl-events.cpp | 26 | ||||
-rw-r--r-- | backends/events/webossdl/webossdl-events.h | 6 | ||||
-rw-r--r-- | backends/keymapper/action.h | 22 | ||||
-rw-r--r-- | backends/keymapper/keymapper.cpp | 3 | ||||
-rw-r--r-- | backends/keymapper/remap-dialog.cpp | 32 | ||||
-rw-r--r-- | backends/keymapper/remap-dialog.h | 2 | ||||
-rw-r--r-- | backends/platform/android/android.cpp | 1 | ||||
-rw-r--r-- | backends/platform/android/android.h | 2 | ||||
-rw-r--r-- | backends/platform/android/events.cpp | 23 | ||||
-rw-r--r-- | backends/platform/maemo/maemo-common.h | 8 |
10 files changed, 86 insertions, 39 deletions
diff --git a/backends/events/webossdl/webossdl-events.cpp b/backends/events/webossdl/webossdl-events.cpp index 996ac48b15..286289f7a6 100644 --- a/backends/events/webossdl/webossdl-events.cpp +++ b/backends/events/webossdl/webossdl-events.cpp @@ -151,8 +151,8 @@ bool WebOSSdlEventSource::handleMouseButtonDown(SDL_Event &ev, event.type = Common::EVENT_LBUTTONDOWN; processMouseEvent(event, _curX, _curY); } - // If we're not in touchpad mode, move the cursor to the tap - if (!_touchpadMode) { + // If we're not in trackpad mode, move the cursor to the tap + if (!_trackpadMode) { _curX = MIN(_screenX, MAX(0, 0 + ev.motion.x)); _curY = MIN(_screenY, MAX(0, 0 + ev.motion.y)); // If we're already clicking, hold it until after the move. @@ -254,7 +254,7 @@ bool WebOSSdlEventSource::handleMouseMotion(SDL_Event &ev, // If only one finger is on the screen and moving, that's // the mouse pointer. if (!_fingerDown[1] && !_fingerDown[2]) { - if (_touchpadMode) { + if (_trackpadMode) { _curX = MIN(_screenX, MAX(0, _curX + ev.motion.xrel)); _curY = MIN(_screenY, MAX(0, _curY + ev.motion.yrel)); } else { @@ -301,16 +301,16 @@ bool WebOSSdlEventSource::handleMouseMotion(SDL_Event &ev, _queuedEscapeUpTime = g_system->getMillis() + QUEUED_KEY_DELAY; } else if (_dragDiffX[0] > 0 && _dragDiffX[1] > 0) { - // A swipe right toggles touchpad mode - _touchpadMode = !_touchpadMode; - g_system->showMouse(_touchpadMode); - // I18N: Touchpad mode toggle status. - Common::String dialogMsg(_("Touchpad mode is now")); + // A swipe right toggles trackpad mode + _trackpadMode = !_trackpadMode; + g_system->showMouse(_trackpadMode); + // I18N: Trackpad mode toggle status. + Common::String dialogMsg(_("Trackpad mode is now")); dialogMsg += " "; - // I18N: Touchpad mode on or off. - dialogMsg += (_touchpadMode ? _("ON") : _("OFF")); + // I18N: Trackpad mode on or off. + dialogMsg += (_trackpadMode ? _("ON") : _("OFF")); dialogMsg += ".\n"; - // I18N: Instructions to toggle Touchpad mode. + // I18N: Instructions to toggle Trackpad mode. dialogMsg += _("Swipe two fingers to the right to toggle."); GUI::TimedMessageDialog dialog(dialogMsg, 1500); @@ -377,11 +377,11 @@ bool WebOSSdlEventSource::pollEvent(Common::Event &event) { // Set the initial dimensions calculateDimensions(); - // Having a mouse pointer on screen when not in Touchpad mode is poor + // Having a mouse pointer on screen when not in Trackpad mode is poor // interface design, because the user won't know whether to tap buttons // or drag the pointer to them. On the first poll, set the appropriate // pointer visibility. - g_system->showMouse(_touchpadMode); + g_system->showMouse(_trackpadMode); _firstPoll = false; } diff --git a/backends/events/webossdl/webossdl-events.h b/backends/events/webossdl/webossdl-events.h index a36ee535a3..99ed3105f8 100644 --- a/backends/events/webossdl/webossdl-events.h +++ b/backends/events/webossdl/webossdl-events.h @@ -45,7 +45,7 @@ public: _dragStartTime(0), _dragging(false), _curX(0), _curY(0), _screenX(0), _screenY(0), - _touchpadMode(false), _autoDragMode(true), + _trackpadMode(false), _autoDragMode(true), _doClick(true), _queuedDragTime(0), _queuedEscapeUpTime(0), _queuedSpaceUpTime(0), _queuedRUpTime(0), @@ -80,8 +80,8 @@ protected: // 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 trackpad mode or tap-to-move mode. + bool _trackpadMode; // Indicates if we're in automatic drag mode. bool _autoDragMode; diff --git a/backends/keymapper/action.h b/backends/keymapper/action.h index e5bf6d51dd..308a76aa88 100644 --- a/backends/keymapper/action.h +++ b/backends/keymapper/action.h @@ -75,6 +75,13 @@ public: events.push_back(evt); } + void addEvent(const EventType evtType) { + Event evt; + + evt.type = evtType; + events.push_back(evt); + } + void addKeyEvent(const KeyState &ks) { Event evt; @@ -84,24 +91,15 @@ public: } void addLeftClickEvent() { - Event evt; - - evt.type = EVENT_LBUTTONDOWN; - addEvent(evt); + addEvent(EVENT_LBUTTONDOWN); } void addMiddleClickEvent() { - Event evt; - - evt.type = EVENT_MBUTTONDOWN; - addEvent(evt); + addEvent(EVENT_MBUTTONDOWN); } void addRightClickEvent() { - Event evt; - - evt.type = EVENT_RBUTTONDOWN; - addEvent(evt); + addEvent(EVENT_RBUTTONDOWN); } Keymap *getParent() { diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp index 38711343c2..6d9ae21ef8 100644 --- a/backends/keymapper/keymapper.cpp +++ b/backends/keymapper/keymapper.cpp @@ -268,6 +268,9 @@ void Keymapper::executeAction(const Action *action, bool keyDown) { case EVENT_MBUTTONUP: if (keyDown) evt.type = EVENT_MBUTTONDOWN; break; + case EVENT_MAINMENU: + if (!keyDown) evt.type = EVENT_MAINMENU; + break; default: // don't deliver other events on key up if (!keyDown) continue; diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp index 5c339f8c27..4b95a1a021 100644 --- a/backends/keymapper/remap-dialog.cpp +++ b/backends/keymapper/remap-dialog.cpp @@ -39,7 +39,7 @@ enum { }; RemapDialog::RemapDialog() - : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0) { + : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0), _topKeymapIsGui(false) { _keymapper = g_system->getEventManager()->getKeymapper(); assert(_keymapper); @@ -61,7 +61,9 @@ void RemapDialog::open() { const Stack<Keymapper::MapRecord> &activeKeymaps = _keymapper->getActiveStack(); if (activeKeymaps.size() > 0) { - _kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Active)")); + if (activeKeymaps.top().keymap->getName() == Common::kGuiKeymapName) + _topKeymapIsGui = true; + _kmPopUp->appendEntry(activeKeymaps.top().keymap->getName() + _(" (Effective)")); divider = true; } @@ -84,6 +86,10 @@ void RemapDialog::open() { keymapCount += _gameKeymaps->size(); } + if (activeKeymaps.size() > 1) { + keymapCount += activeKeymaps.size() - 1; + } + debug(3, "RemapDialog::open keymaps: %d", keymapCount); _keymapTable = (Keymap **)malloc(sizeof(Keymap*) * keymapCount); @@ -91,6 +97,18 @@ void RemapDialog::open() { Keymapper::Domain::iterator it; uint32 idx = 0; + if (activeKeymaps.size() > 1) { + if (divider) + _kmPopUp->appendEntry(""); + int topIndex = activeKeymaps.size() - 1; + for (int i = topIndex - 1; i >= 0; --i) { + Keymapper::MapRecord mr = activeKeymaps[i]; + _kmPopUp->appendEntry(mr.keymap->getName() + _(" (Active)"), idx); + _keymapTable[idx++] = mr.keymap; + } + divider = true; + } + if (_globalKeymaps) { if (divider) _kmPopUp->appendEntry(""); @@ -108,6 +126,7 @@ void RemapDialog::open() { _kmPopUp->appendEntry(it->_value->getName() + _(" (Game)"), idx); _keymapTable[idx++] = it->_value; } + divider = true; } _changes = false; @@ -149,7 +168,7 @@ void RemapDialog::reflowLayout() { int labelWidth = colWidth - (keyButtonWidth + spacing + clearButtonWidth + spacing); _rowCount = (areaH + spacing) / (buttonHeight + spacing); - debug("rowCount = %d" , _rowCount); + debug(7, "rowCount = %d" , _rowCount); if (colWidth <= 0 || _rowCount <= 0) error("Remap dialog too small to display any keymaps"); @@ -307,9 +326,10 @@ void RemapDialog::loadKeymap() { List<const HardwareKey*> freeKeys(_keymapper->getHardwareKeys()); int topIndex = activeKeymaps.size() - 1; - // skip the top gui keymap since it is for the keymapper itself - // TODO: Don't use the keymap name as a way to discriminate GUI maps - if (topIndex > 0 && activeKeymaps[topIndex].keymap->getName().equals(kGuiKeymapName)) + + // This is a WORKAROUND for changing the popup list selected item and changing it back + // to the top entry. Upon changing it back, the top keymap is always "gui". + if (!_topKeymapIsGui && activeKeymaps[topIndex].keymap->getName() == kGuiKeymapName) --topIndex; // add most active keymap's keys diff --git a/backends/keymapper/remap-dialog.h b/backends/keymapper/remap-dialog.h index 1cb930bd42..143deca4cf 100644 --- a/backends/keymapper/remap-dialog.h +++ b/backends/keymapper/remap-dialog.h @@ -91,6 +91,8 @@ protected: bool _changes; + bool _topKeymapIsGui; + }; } // End of namespace Common diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index aba31320ea..902599d50f 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -134,6 +134,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) : _enable_zoning(false), _mixer(0), _shake_offset(0), + _queuedEventTime(0), _event_queue_lock(createMutex()), _touch_pt_down(), _touch_pt_scroll(), diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index f39a8f1144..47a6515a2a 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -220,6 +220,8 @@ public: private: Common::Queue<Common::Event> _event_queue; + Common::Event _queuedEvent; + uint32 _queuedEventTime; MutexRef _event_queue_lock; Common::Point _touch_pt_down, _touch_pt_scroll, _touch_pt_dt; diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp index e73e689e3b..b46c144344 100644 --- a/backends/platform/android/events.cpp +++ b/backends/platform/android/events.cpp @@ -216,6 +216,8 @@ static inline T scalef(T in, float numerator, float denominator) { return static_cast<float>(in) * numerator / denominator; } +static const int kQueuedInputEventDelay = 50; + void OSystem_Android::setupKeymapper() { #ifdef ENABLE_KEYMAPPER using namespace Common; @@ -601,13 +603,18 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, lockMutex(_event_queue_lock); + if (_queuedEventTime) + _event_queue.push(_queuedEvent); + if (!_touchpad_mode) _event_queue.push(e); e.type = down; _event_queue.push(e); + e.type = up; - _event_queue.push(e); + _queuedEvent = e; + _queuedEventTime = getMillis() + kQueuedInputEventDelay; unlockMutex(_event_queue_lock); } @@ -702,9 +709,14 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3, lockMutex(_event_queue_lock); + if (_queuedEventTime) + _event_queue.push(_queuedEvent); + _event_queue.push(e); + e.type = up; - _event_queue.push(e); + _queuedEvent = e; + _queuedEventTime = getMillis() + kQueuedInputEventDelay; unlockMutex(_event_queue_lock); return; @@ -800,6 +812,13 @@ bool OSystem_Android::pollEvent(Common::Event &event) { lockMutex(_event_queue_lock); + if (_queuedEventTime && (getMillis() > _queuedEventTime)) { + event = _queuedEvent; + _queuedEventTime = 0; + unlockMutex(_event_queue_lock); + return true; + } + if (_event_queue.empty()) { unlockMutex(_event_queue_lock); return false; diff --git a/backends/platform/maemo/maemo-common.h b/backends/platform/maemo/maemo-common.h index f33aa24278..5f8645a6b7 100644 --- a/backends/platform/maemo/maemo-common.h +++ b/backends/platform/maemo/maemo-common.h @@ -28,9 +28,10 @@ namespace Maemo { enum ModelType { - kModelTypeN800 = 1, - kModelTypeN810 = 2, - kModelTypeN900 = 4, + kModelType770 = 1, + kModelTypeN800 = 2, + kModelTypeN810 = 4, + kModelTypeN900 = 8, kModelTypeInvalid = 0 }; @@ -42,6 +43,7 @@ struct Model { }; static const Model models[] = { + {"SU-18", kModelType770, "770", false}, {"RX-34", kModelTypeN800, "N800", false}, {"RX-44", kModelTypeN810, "N810", true}, {"RX-48", kModelTypeN810, "N810W", true}, |