IOS7: Remove old touch to mouse button translations

Remove the old translations from touch events to mouse button events.
These have been replaced with UIGestures.
This commit is contained in:
Lars Sundström 2023-10-06 22:26:35 +02:00
parent 4dae507f14
commit b2ba581917
4 changed files with 4 additions and 115 deletions

View File

@ -70,7 +70,6 @@ private:
GUI::StaticTextWidget *_gamepadControllerDirectionalInputDesc;
GUI::PopUpWidget *_gamepadControllerDirectionalInputPopUp;
GUI::CheckboxWidget *_clickAndDragCheckbox;
GUI::CheckboxWidget *_keyboardFnBarCheckbox;
#if TARGET_OS_IOS
GUI::StaticTextWidget *_preferredTouchModeDesc;
@ -108,7 +107,6 @@ IOS7OptionsWidget::IOS7OptionsWidget(GuiObject *boss, const Common::String &name
_gamepadControllerDirectionalInputPopUp->appendEntry(_("Thumbstick"), kDirectionalInputThumbstick);
_gamepadControllerDirectionalInputPopUp->appendEntry(_("Dpad"), kDirectionalInputDpad);
_clickAndDragCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.ClickAndDragMode", _("Mouse-click-and-drag mode"));
_keyboardFnBarCheckbox = new GUI::CheckboxWidget(widgetsBoss(), "IOS7OptionsDialog.KeyboardFunctionBar", _("Show keyboard function bar"));
#if TARGET_OS_IOS
@ -250,7 +248,6 @@ void IOS7OptionsWidget::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
"One finger tap: Left mouse click\n"
"Two finger tap: Right mouse click\n"
"Two finger double tap: ESC\n"
"Two finger swipe (bottom to top): Toggles Click and drag mode\n"
"Two finger swipe (left to right): Toggles between touch direct mode and touchpad mode\n"
"Two finger swipe (right to left): Shows/hides on-screen controls\n"
"Two finger swipe (top to bottom): Global Main Menu\n"
@ -392,7 +389,6 @@ void IOS7OptionsWidget::load() {
_gamepadControllerOpacityLabel->setValue(_gamepadControllerOpacitySlider->getValue());
_gamepadControllerDirectionalInputPopUp->setSelectedTag(loadDirectionalInput("gamepad_controller_directional_input", !inAppDomain, kDirectionalInputThumbstick));
_clickAndDragCheckbox->setState(ConfMan.getBool("clickanddrag_mode", _domain));
_keyboardFnBarCheckbox->setState(ConfMan.getBool("keyboard_fn_bar", _domain));
#if TARGET_OS_IOS
@ -419,7 +415,6 @@ bool IOS7OptionsWidget::save() {
ConfMan.setInt("gamepad_controller_opacity", _gamepadControllerOpacitySlider->getValue(), _domain);
ConfMan.setInt("gamepad_controller_directional_input", _gamepadControllerDirectionalInputPopUp->getSelectedTag(), _domain);
ConfMan.setBool("clickanddrag_mode", _clickAndDragCheckbox->getState(), _domain);
ConfMan.setBool("keyboard_fn_bar", _keyboardFnBarCheckbox->getState(), _domain);
#if TARGET_OS_IOS
@ -448,7 +443,6 @@ bool IOS7OptionsWidget::save() {
ConfMan.removeKey("touch_mode_2d_games", _domain);
ConfMan.removeKey("touch_mode_3d_games", _domain);
ConfMan.removeKey("clickanddrag_mode", _domain);
ConfMan.removeKey("keyboard_fn_bar", _domain);
if (inAppDomain) {
@ -470,9 +464,7 @@ bool IOS7OptionsWidget::hasKeys() {
ConfMan.hasKey("touch_mode_menus", _domain) ||
ConfMan.hasKey("touch_mode_2d_games", _domain) ||
ConfMan.hasKey("touch_mode_3d_games", _domain) ||
ConfMan.hasKey("clickanddrag_mode", _domain);
ConfMan.hasKey("touch_mode_3d_games", _domain);
#if TARGET_OS_IOS
hasKeys = hasKeys || (_domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("orientation_menus", _domain)) ||
@ -515,7 +507,6 @@ void IOS7OptionsWidget::setEnabled(bool e) {
_gamepadControllerOpacityLabel->setEnabled(false);
#endif /* TARGET_OS_IOS */
_clickAndDragCheckbox->setEnabled(e);
_keyboardFnBarCheckbox->setEnabled(e);
#if TARGET_OS_IOS
@ -554,7 +545,6 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
ConfMan.registerDefault("touch_mode_2d_games", "touchpad");
ConfMan.registerDefault("touch_mode_3d_games", "gamepad");
ConfMan.registerDefault("clickanddrag_mode", false);
ConfMan.registerDefault("keyboard_fn_bar", true);
#if TARGET_OS_IOS
@ -568,7 +558,6 @@ void OSystem_iOS7::registerDefaultSettings(const Common::String &target) const {
void OSystem_iOS7::applyBackendSettings() {
virtualController(ConfMan.getBool("gamepad_controller"));
// _currentTouchMode is applied by the graphic manager
_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
#if TARGET_OS_IOS
applyOrientationSettings();

View File

@ -109,12 +109,10 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) {
return false;
break;
case kInputTouchSecondDown:
_secondaryTapped = true;
if (!handleEvent_touchSecondDown(event, internalEvent.value1, internalEvent.value2))
return false;
break;
case kInputTouchSecondUp:
_secondaryTapped = false;
if (!handleEvent_touchSecondUp(event, internalEvent.value1, internalEvent.value2))
return false;
break;
@ -180,12 +178,6 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) {
}
bool OSystem_iOS7::handleEvent_touchFirstDown(Common::Event &event, int x, int y) {
//printf("Mouse down at (%u, %u)\n", x, y);
// Workaround: kInputMouseSecondToggled isn't always sent when the
// secondary finger is lifted. Need to make sure we get out of that mode.
_secondaryTapped = false;
_lastPadX = x;
_lastPadY = y;
@ -194,106 +186,28 @@ bool OSystem_iOS7::handleEvent_touchFirstDown(Common::Event &event, int x, int y
dynamic_cast<iOSCommonGraphics *>(_graphicsManager)->notifyMousePosition(mouse);
}
if (_mouseClickAndDragEnabled) {
if (_currentTouchMode == kTouchModeTouchpad) {
_queuedInputEvent.type = Common::EVENT_LBUTTONDOWN;
_queuedEventTime = getMillis() + 250;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
} else {
event.type = Common::EVENT_LBUTTONDOWN;
handleEvent_mouseEvent(event, 0, 0);
}
return true;
} else {
_lastMouseDown = getMillis();
}
return false;
}
bool OSystem_iOS7::handleEvent_touchFirstUp(Common::Event &event, int x, int y) {
//printf("Mouse up at (%u, %u)\n", x, y);
if (_secondaryTapped) {
_secondaryTapped = false;
if (!handleEvent_touchSecondUp(event, x, y))
return false;
} else if (_mouseClickAndDragEnabled) {
if (_currentTouchMode == kTouchModeTouchpad && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
// This has not been sent yet, send it right away
event = _queuedInputEvent;
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
_queuedEventTime = getMillis() + kQueuedInputEventDelay;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
} else {
event.type = Common::EVENT_LBUTTONUP;
handleEvent_mouseEvent(event, 0, 0);
}
} else {
if (getMillis() - _lastMouseDown < 250) {
event.type = Common::EVENT_LBUTTONDOWN;
handleEvent_mouseEvent(event, 0, 0);
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
_queuedEventTime = getMillis() + kQueuedInputEventDelay;
} else
return false;
}
return true;
return false;
}
bool OSystem_iOS7::handleEvent_touchSecondDown(Common::Event &event, int x, int y) {
if (_mouseClickAndDragEnabled) {
event.type = Common::EVENT_LBUTTONUP;
handleEvent_mouseEvent(event, 0, 0);
_queuedInputEvent.type = Common::EVENT_RBUTTONDOWN;
_queuedEventTime = getMillis() + 250;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
} else
return false;
return true;
return false;
}
bool OSystem_iOS7::handleEvent_touchSecondUp(Common::Event &event, int x, int y) {
int curTime = getMillis();
if (!_mouseClickAndDragEnabled) {
//printf("Rightclick!\n");
event.type = Common::EVENT_RBUTTONDOWN;
handleEvent_mouseEvent(event, 0, 0);
_queuedInputEvent.type = Common::EVENT_RBUTTONUP;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
_queuedEventTime = curTime + kQueuedInputEventDelay;
} else if (_queuedInputEvent.type == Common::EVENT_RBUTTONDOWN) {
// This has not been sent yet, send it right away
event = _queuedInputEvent;
_queuedInputEvent.type = Common::EVENT_RBUTTONUP;
_queuedEventTime = curTime + kQueuedInputEventDelay;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
} else {
event.type = Common::EVENT_RBUTTONUP;
handleEvent_mouseEvent(event, 0, 0);
}
return true;
return false;
}
bool OSystem_iOS7::handleEvent_touchFirstDragged(Common::Event &event, int x, int y) {
//printf("Mouse dragged at (%u, %u)\n", x, y);
int deltaX = _lastPadX - x;
int deltaY = _lastPadY - y;
_lastPadX = x;
_lastPadY = y;
if (_currentTouchMode == kTouchModeTouchpad) {
if (_mouseClickAndDragEnabled && _queuedInputEvent.type == Common::EVENT_LBUTTONDOWN) {
// Cancel the button down event since this was a pure mouse move
_queuedInputEvent.type = Common::EVENT_INVALID;
}
handleEvent_mouseDelta(event, deltaX, deltaY);
} else {
// Update mouse position
@ -439,16 +353,6 @@ bool OSystem_iOS7::handleEvent_swipe(Common::Event &event, int direction, int to
else if (touches == 2) {
switch ((UIViewSwipeDirection)direction) {
case kUIViewSwipeUp: {
_mouseClickAndDragEnabled = !_mouseClickAndDragEnabled;
ConfMan.setBool("clickanddrag_mode", _mouseClickAndDragEnabled);
ConfMan.flushToDisk();
Common::U32String dialogMsg;
if (_mouseClickAndDragEnabled) {
dialogMsg = _("Mouse-click-and-drag mode enabled.");
} else
dialogMsg = _("Mouse-click-and-drag mode disabled.");
GUI::TimedMessageDialog dialog(dialogMsg, 1500);
dialog.runModal();
return false;
}

View File

@ -89,12 +89,10 @@ public:
OSystem_iOS7::OSystem_iOS7() :
_mixer(NULL), _queuedEventTime(0),
_secondaryTapped(false),
_screenOrientation(kScreenOrientationAuto),
_timeSuspended(0), _runningTasks(0) {
_queuedInputEvent.type = Common::EVENT_INVALID;
_currentTouchMode = kTouchModeTouchpad;
_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
_chrootBasePath = iOS7_getDocumentsDir();
ChRootFilesystemFactory *chFsFactory = new ChRootFilesystemFactory(_chrootBasePath);

View File

@ -66,8 +66,6 @@ protected:
long _lastMouseDown;
long _queuedEventTime;
Common::Event _queuedInputEvent;
bool _secondaryTapped;
bool _mouseClickAndDragEnabled;
TouchMode _currentTouchMode;
int _lastPadX;
int _lastPadY;