[Scummvm-git-logs] scummvm master -> 2df8aee33575b26d675f84ef6784ed4f20ede745
criezy
noreply at scummvm.org
Sun Aug 20 20:38:57 UTC 2023
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
77d56abc66 IOS7: Fix scenario where "right button" was kept pressed
0d77f8a262 IOS7: Delete deprecated and unused event variables
7c96a7ff76 IOS7: Fix gamepad controller dpad button presses
8576e9e1f3 IOS7: Register inputs based on capabilities
2df8aee335 IOS7: Handle all deletes in UITextInput proto func deleteBackward
Commit: 77d56abc660fb8319fb382ffc610e3422bc88bf6
https://github.com/scummvm/scummvm/commit/77d56abc660fb8319fb382ffc610e3422bc88bf6
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-08-20T21:38:52+01:00
Commit Message:
IOS7: Fix scenario where "right button" was kept pressed
The UITapGestureRecognizer is used to identify taps with two fingers,
sending an ESC key event. The UITapGestureRecognizer will not stop
touchesBegan from being called when doing a touch with two fingers.
Touching with two fingers when _mouseClickAndDragEnabled is enabled
will send a EVENT_RBUTTONDOWN.
But if doing a double tap the UITapGestureRecognizer with two fingers
will cancel the touchesEnded from being called meaning that no event
EVENT_RBUTTONUP will be sent to the engine. In some engines, e.g.
lure, this will cause problems since the engine might wait for mouse
clicks to be released before processing other events.
Fix the scenario above by introducing a delay of sending the event
EVENT_RBUTTONDOWN. If the UITapGestureRecognizer is triggered before
this timeout it will cancel the EVENT_RBUTTONDOWN by overwriting the
_queuedInputEvent with the ESC key event.
This commit also deletes the legacy implementation handling double
tap with two fingers to trigger an ESC event.
Changed paths:
backends/platform/ios7/ios7_osys_events.cpp
diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp
index 444b7537107..25494192f62 100644
--- a/backends/platform/ios7/ios7_osys_events.cpp
+++ b/backends/platform/ios7/ios7_osys_events.cpp
@@ -249,6 +249,7 @@ bool OSystem_iOS7::handleEvent_touchSecondDown(Common::Event &event, int x, int
handleEvent_mouseEvent(event, 0, 0);
_queuedInputEvent.type = Common::EVENT_RBUTTONDOWN;
+ _queuedEventTime = getMillis() + 250;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
} else
return false;
@@ -259,32 +260,20 @@ bool OSystem_iOS7::handleEvent_touchSecondDown(Common::Event &event, int x, int
bool OSystem_iOS7::handleEvent_touchSecondUp(Common::Event &event, int x, int y) {
int curTime = getMillis();
- if (curTime - _lastSecondaryDown < 400) {
- //printf("Right tap!\n");
- if (curTime - _lastSecondaryTap < 400) {
- //printf("Right escape!\n");
- event.type = Common::EVENT_KEYDOWN;
- _queuedInputEvent.type = Common::EVENT_KEYUP;
-
- event.kbd.flags = _queuedInputEvent.kbd.flags = 0;
- event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_ESCAPE;
- event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_ESCAPE;
- _queuedEventTime = curTime + kQueuedInputEventDelay;
- _lastSecondaryTap = 0;
- } else 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);
- _lastSecondaryTap = curTime;
- _queuedEventTime = curTime + kQueuedInputEventDelay;
- } else {
- //printf("Right nothing!\n");
- return false;
- }
- }
- if (_mouseClickAndDragEnabled) {
+ 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);
}
Commit: 0d77f8a2626719a75fd3132beec580bc442f053d
https://github.com/scummvm/scummvm/commit/0d77f8a2626719a75fd3132beec580bc442f053d
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-08-20T21:38:52+01:00
Commit Message:
IOS7: Delete deprecated and unused event variables
These class member variables aren't used anymore.
Changed paths:
backends/platform/ios7/ios7_osys_events.cpp
backends/platform/ios7/ios7_osys_main.cpp
backends/platform/ios7/ios7_osys_main.h
diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp
index 25494192f62..29cff7b35e7 100644
--- a/backends/platform/ios7/ios7_osys_events.cpp
+++ b/backends/platform/ios7/ios7_osys_events.cpp
@@ -232,8 +232,7 @@ bool OSystem_iOS7::handleEvent_touchFirstUp(Common::Event &event, int x, int y)
_queuedInputEvent.type = Common::EVENT_LBUTTONUP;
handleEvent_mouseEvent(_queuedInputEvent, 0, 0);
- _lastMouseTap = getMillis();
- _queuedEventTime = _lastMouseTap + kQueuedInputEventDelay;
+ _queuedEventTime = getMillis() + kQueuedInputEventDelay;
} else
return false;
}
@@ -242,7 +241,6 @@ bool OSystem_iOS7::handleEvent_touchFirstUp(Common::Event &event, int x, int y)
}
bool OSystem_iOS7::handleEvent_touchSecondDown(Common::Event &event, int x, int y) {
- _lastSecondaryDown = getMillis();
if (_mouseClickAndDragEnabled) {
event.type = Common::EVENT_LBUTTONUP;
diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index b6fa471315d..cbf5bc5e181 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -88,8 +88,8 @@ public:
};
OSystem_iOS7::OSystem_iOS7() :
- _mixer(NULL), _lastMouseTap(0), _queuedEventTime(0),
- _secondaryTapped(false), _lastSecondaryTap(0),
+ _mixer(NULL), _queuedEventTime(0),
+ _secondaryTapped(false),
_screenOrientation(kScreenOrientationAuto),
_timeSuspended(0), _runningTasks(0) {
_queuedInputEvent.type = Common::EVENT_INVALID;
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 40ffbbe3b8c..9ea5990fe42 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -64,12 +64,9 @@ protected:
int _runningTasks;
long _lastMouseDown;
- long _lastMouseTap;
long _queuedEventTime;
Common::Event _queuedInputEvent;
bool _secondaryTapped;
- long _lastSecondaryDown;
- long _lastSecondaryTap;
bool _mouseClickAndDragEnabled;
bool _touchpadModeEnabled;
int _lastPadX;
Commit: 7c96a7ff7646e00c8ae8f6d0cea37a995c41c1c0
https://github.com/scummvm/scummvm/commit/7c96a7ff7646e00c8ae8f6d0cea37a995c41c1c0
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-08-20T21:38:52+01:00
Commit Message:
IOS7: Fix gamepad controller dpad button presses
The gamepad controller dpad button vaule change handler callback,
also called for the virtual controller dpad buttons, sent events
also for buttons not being pressed or released.
E.g. when the left dpad button was pressed an event was sent,
JOYSTICK_BUTTON_DPAD_LEFT with value 1 meaning it's pressed DOWN.
However, the other dpad buttons also did send their events but with
value 0 meaning UP. This had no impact for most of the games but
"The Griffon Legend" handles the dpad events a bit different where
the character is kept moving when the button is released. It meant
that the engine was triggering movements on both the event
EVENT_CUSTOM_ENGINE_ACTION_START and EVENT_CUSTOM_ENGINE_ACTION_END.
This commit changes the dpad button input handling so it remembers
the current state for UP/DOWN and LEFT/RIGHT. This ensures that only
the button that changes state is triggering an event.
Changed paths:
backends/platform/ios7/ios7_gamepad_controller.mm
diff --git a/backends/platform/ios7/ios7_gamepad_controller.mm b/backends/platform/ios7/ios7_gamepad_controller.mm
index 157693093c3..32bec9e3a94 100644
--- a/backends/platform/ios7/ios7_gamepad_controller.mm
+++ b/backends/platform/ios7/ios7_gamepad_controller.mm
@@ -38,6 +38,8 @@
GCVirtualControllerConfiguration *_config;
#endif
#endif
+ int _currentDpadXValue;
+ int _currentDpadYValue;
}
@dynamic view;
@@ -61,6 +63,8 @@
}
#endif
#endif
+ _currentDpadXValue = 0;
+ _currentDpadYValue = 0;
return self;
}
@@ -162,10 +166,37 @@
_controller.extendedGamepad.dpad.valueChangedHandler = ^(GCControllerDirectionPad * _Nonnull dpad, float xValue, float yValue) {
// Negative values are left/down, positive are right/up, 0 is no press
- [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_LEFT isPressed:(xValue < 0)];
- [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_RIGHT isPressed:(xValue > 0)];
- [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_UP isPressed:(yValue > 0)];
- [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_DOWN isPressed:(yValue < 0)];
+ // Change xValue to only be -1, 0, or 1
+ xValue = xValue < 0.f ? -1.f : xValue > 0.f ? 1.f : 0.f;
+ if (xValue != _currentDpadXValue) {
+ if (_currentDpadXValue < 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_LEFT isPressed:false];
+ } else if (_currentDpadXValue > 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_RIGHT isPressed:false];
+ }
+ if (xValue < 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_LEFT isPressed:true];
+ } else if (xValue > 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_RIGHT isPressed:true];
+ }
+ _currentDpadXValue = xValue;
+ }
+
+ // Change yValue to only be -1, 0, or 1
+ yValue = yValue < 0.f ? -1.f : yValue > 0.f ? 1.f : 0.f;
+ if (yValue != _currentDpadYValue) {
+ if (_currentDpadYValue < 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_DOWN isPressed:false];
+ } else if (_currentDpadYValue > 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_UP isPressed:false];
+ }
+ if (yValue < 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_DOWN isPressed:true];
+ } else if (yValue > 0) {
+ [self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_UP isPressed:true];
+ }
+ _currentDpadYValue = yValue;
+ }
};
_controller.extendedGamepad.buttonA.valueChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
Commit: 8576e9e1f3ca6b5ea718071af99486515c5ca798
https://github.com/scummvm/scummvm/commit/8576e9e1f3ca6b5ea718071af99486515c5ca798
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-08-20T21:38:52+01:00
Commit Message:
IOS7: Register inputs based on capabilities
Instead of register input based on if hardware is connected or not
register input based on backend capabilities.
Mouse support is default supported through touch events on screen
(iOS) or touch on controller (Apple TV), and through connected
mouse hardwares. Gamepad controllers are supported from iOS 14 and
later.
Register mouse and gamepad input based on above capabilities to be
able to map actions to buttons on these input devices.
Keyboard support is to be added but not in this commit.
Remove the "isConnected" methods for each input and change the same
method for game controllers to a "isSupported" function to deal
with the iOS version support.
Remove the sending of the EVENT_INPUT_CHANGED event due to the
above reasons. The overide of the isConnected property function is
also removed due to this reason. It caused problems that key
mappings were reset on connections/disconnections.
Changed paths:
backends/platform/ios7/ios7_common.h
backends/platform/ios7/ios7_game_controller.mm
backends/platform/ios7/ios7_osys_events.cpp
backends/platform/ios7/ios7_osys_misc.mm
backends/platform/ios7/ios7_video.h
backends/platform/ios7/ios7_video.mm
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index 95fdec1e4bd..c0d2bfbfbde 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -50,7 +50,6 @@ enum InputEvent {
kInputJoystickAxisMotion,
kInputJoystickButtonDown,
kInputJoystickButtonUp,
- kInputChanged,
kInputScreenChanged
};
diff --git a/backends/platform/ios7/ios7_game_controller.mm b/backends/platform/ios7/ios7_game_controller.mm
index d3b82cd24ea..1d8070c9aaa 100644
--- a/backends/platform/ios7/ios7_game_controller.mm
+++ b/backends/platform/ios7/ios7_game_controller.mm
@@ -44,13 +44,6 @@
return self;
}
-// Override the setter method
-- (void)setIsConnected:(BOOL)isConnected {
- // Inform that input changed
- _isConnected = isConnected;
- [view addEvent:InternalEvent(kInputChanged, 0, 0)];
-}
-
- (CGPoint)getLocationInView:(UITouch *)touch; {
CGPoint p = [touch locationInView:[self view]];
p.x *= [[self view] contentScaleFactor];
diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp
index 29cff7b35e7..e60e38bf428 100644
--- a/backends/platform/ios7/ios7_osys_events.cpp
+++ b/backends/platform/ios7/ios7_osys_events.cpp
@@ -155,12 +155,6 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) {
event.joystick.button = internalEvent.value1;
break;
- case kInputChanged:
- event.type = Common::EVENT_INPUT_CHANGED;
- _queuedInputEvent.type = Common::EVENT_INVALID;
- _queuedEventTime = getMillis() + kQueuedInputEventDelay;
- break;
-
case kInputScreenChanged:
rebuildSurface();
dynamic_cast<iOSCommonGraphics *>(_graphicsManager)->notifyResize(getScreenWidth(), getScreenHeight());
diff --git a/backends/platform/ios7/ios7_osys_misc.mm b/backends/platform/ios7/ios7_osys_misc.mm
index 7a99c2b8196..5ce58348062 100644
--- a/backends/platform/ios7/ios7_osys_misc.mm
+++ b/backends/platform/ios7/ios7_osys_misc.mm
@@ -216,13 +216,10 @@ Common::HardwareInputSet *OSystem_iOS7::getHardwareInputSet() {
using namespace Common;
CompositeHardwareInputSet *inputSet = new CompositeHardwareInputSet();
- // Ask view about connected controllers
- if ([[iOS7AppDelegate iPhoneView] isTouchControllerConnected] ||
- [[iOS7AppDelegate iPhoneView] isMouseControllerConnected]) {
- inputSet->addHardwareInputSet(new MouseHardwareInputSet(defaultMouseButtons));
- }
+ // Mouse is alwyas supported, either through touch or device
+ inputSet->addHardwareInputSet(new MouseHardwareInputSet(defaultMouseButtons));
- if ([[iOS7AppDelegate iPhoneView] isGamepadControllerConnected]) {
+ if ([[iOS7AppDelegate iPhoneView] isGamepadControllerSupported]) {
inputSet->addHardwareInputSet(new JoystickHardwareInputSet(defaultJoystickButtons, defaultJoystickAxes));
}
diff --git a/backends/platform/ios7/ios7_video.h b/backends/platform/ios7/ios7_video.h
index 40e4f2a0600..0d4c5540f3c 100644
--- a/backends/platform/ios7/ios7_video.h
+++ b/backends/platform/ios7/ios7_video.h
@@ -97,9 +97,7 @@ uint getSizeNextPOT(uint size);
- (void)addEvent:(InternalEvent)event;
- (bool)fetchEvent:(InternalEvent *)event;
-- (BOOL)isTouchControllerConnected;
-- (BOOL)isMouseControllerConnected;
-- (BOOL)isGamepadControllerConnected;
+- (bool)isGamepadControllerSupported;
- (void)virtualController:(bool)connect;
@end
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 9c9a03d585b..2f0087896de 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -424,36 +424,12 @@ bool iOS7_fetchEvent(InternalEvent *event) {
return true;
}
-- (BOOL)isControllerTypeConnected:(Class)controller {
- for (GameController *c : _controllers) {
- if ([c isConnected]) {
- if ([c isKindOfClass:controller]) {
- return YES;
- }
- }
- }
- return NO;
-}
-
-- (BOOL)isTouchControllerConnected {
- return [self isControllerTypeConnected:TouchController.class];
-}
-
-- (BOOL)isMouseControllerConnected {
+- (bool)isGamepadControllerSupported {
if (@available(iOS 14.0, tvOS 14.0, *)) {
- return [self isControllerTypeConnected:MouseController.class];
+ // Both virtual and hardware controllers are supported
+ return true;
} else {
- // Fallback on earlier versions
- return NO;
- }
-}
-
-- (BOOL)isGamepadControllerConnected {
- if (@available(iOS 14.0, tvOS 14.0, *)) {
- return [self isControllerTypeConnected:GamepadController.class];
- } else {
- // Fallback on earlier versions
- return NO;
+ return false;
}
}
Commit: 2df8aee33575b26d675f84ef6784ed4f20ede745
https://github.com/scummvm/scummvm/commit/2df8aee33575b26d675f84ef6784ed4f20ede745
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2023-08-20T21:38:52+01:00
Commit Message:
IOS7: Handle all deletes in UITextInput proto func deleteBackward
The UITextField protocol function:
"textField: shouldChangeCharactersInRange: replacementString:"
was sometimes called with empty replacementStrings on key press
releases on keyboard. That triggered a backspace keyboard char to
be sent which caused problems when trying to remap actions to
other keyboard keys. No matter which key you were pressing the
resulting key would always be the backspace key.
Only handle text input using the UITextField protocol function
when the replacement string isn't empty. Handle all deletes through
the UITextInput protocol function "deleteBackword".
This has been tested in both cases when the UITextField is empty
(but GUI text field has text) and when the UITextField has text
(which has been added using the SoftKeyboard).
It has also been tested on Apple TV where a software keyboard is
shown with a big text field.
Changed paths:
backends/platform/ios7/ios7_keyboard.mm
diff --git a/backends/platform/ios7/ios7_keyboard.mm b/backends/platform/ios7/ios7_keyboard.mm
index 989c313f3cb..5921618b8a4 100644
--- a/backends/platform/ios7/ios7_keyboard.mm
+++ b/backends/platform/ios7/ios7_keyboard.mm
@@ -157,20 +157,12 @@
* the textField. To be able to handle the cases where the user wants to
* delete existing texts when the textField is empty the inputView has
* to implement the UITextInput protocol function deleteBackward that is
- * called every time the backward key is pressed. */
+ * called every time the backward key is pressed.
+ * Propagate all delete callbacks to the backend.
+ */
-(void)deleteBackward {
- if ([self hasText]) {
- /* If the textField has text the backward key presses will be
- * forwarded to the EventManager in the delegate function
- * textField:shouldChangeTextInRange:replacementText:
- * call the super class to delete characters in the textField */
- [super deleteBackward];
- } else {
- /* Forward the key press to the EventManager also in the cases
- * where the textField is empty to remove prefilled characters
- * in dialogs. */
- [softKeyboard handleKeyPress:'\b'];
- }
+ [softKeyboard handleKeyPress:'\b'];
+ [super deleteBackward];
}
-(void)selectUITabBarItem:(UITapGestureRecognizer *)recognizer {
@@ -468,14 +460,9 @@
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)text {
- unichar c;
if (text.length) {
- c = [text characterAtIndex:0];
+ [inputDelegate handleKeyPress:[text characterAtIndex:0]];
}
- else {
- c = '\b';
- }
- [inputDelegate handleKeyPress:c];
return YES;
}
More information about the Scummvm-git-logs
mailing list