Commit graph

20 commits

Author SHA1 Message Date
Thierry Crozat
788411b5fe IOS7: Remove checks that @available can be used
This was used in the past to make sure the code can be compiled
with old compilers that do not support using @available. But we
already dropped support for those old compilers, and in many
places already used @available without checking first that it can
be used.
2023-04-26 08:29:59 +02:00
Lars Sundström
4c0cd6f2eb IOS7: Check keyboard visible if inputView being first responder
The keyboard can be presented and dismissed without being triggered by
the showKeyboard/hideKeyboard functions e.g. by pressing the menu button
on the Apple TV remote while the keyboard is shown.
If the keyboard visibility is not set entirely by the showKeyboard/
hideKeyboard functions that means that the _keyboardVisible state
variable can be out of sync.

Check if the keyboard is shown based on if the inputView is the first
responder or not. The check has to be made on the main thread.
2023-01-29 21:13:51 +00:00
Lars Sundström
8a2a6aa197 IOS7: Show inputAccessoryView when hardware keyboad is connected
The inputAccessoryView is only shown if no hardware keyboard is
connected. Some hardware keyboards doesn't necessary have all keys,
e.g. the Apple magic keyboard to the iPads which lacks the escape
key and all function keys.

To give the user the possibility to use these buttons, always show
the inputAccessoryView.
2023-01-29 21:13:51 +00:00
Lars Sundström
14ee8b07d3 IOS7: Forward backward key presses when textField is empty
There's a difference between UITextFields and UITextViews that the
delegate function textView:shouldChangeTextInRange:replacementText:
is called when pressing the backward button on a keyboard also when
the textView is empty. This is not the case for UITextFields, the
function textField:shouldChangeTextInRange:replacementText: is not
called if the textField is empty which is problematic in the cases
where there's already text in the open dialog (e.g. the save dialog
when the user wants to overwrite an existing slot). There's currently
no possibility to propagate existing text elements from dialog into
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.
2023-01-29 21:13:51 +00:00
Lars Sundström
d731c9c290 IOS7: Implement keyboard support for Apple TV OS
The UITextView is becoming focused by default in iOS and brings up the
keyboard for user input. This is not the case in tvOS. UITextView in
tvOS is not becoming focused by default and if manually setting it to
focused it will still not bring up the keyboard screen.

The UITextField is however becoming focused in both iOS and tvOS and
requires basically the same implementation. So the UITextView is
replaced with UITextField to bring up keyboard in both iOS and tvOS.

The UIToolbar class is not supported in tvOS. Instead implement the
toolbar as a UITabBar. The UITabBar is set directly as the
inputAccessoryView to the keyboard view in tvOS while in iOS it's put in
a UIScrollView (as the previous UIToolbar) to be able to scale the
inputAccessoryView better for small screens.

The UITabBar behaves a little bit different on iOS and tvOS where in
tvOS the delegate function
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
is called when navigated to a specific toolbar item, while in iOS called
when clicking on an item. To get the tvOS to trigger action on presses,
add a gesture recognizer to handle touch events.

Since the keyboard view on Apple TV always full screen prompted texts
gets hidden behind the keyboard. Delay the showing of the keyboard to
allow the user to understand what's requested as input.
2023-01-29 21:13:51 +00:00
Lars Sundström
5f54aedbb9 IOS7: Put iOS specific code within platform specific macros
iOS and tvOS shares a lot of code. However some there are parts that are
specific to iOS, for instance handling of UI device orientation and
certain types of gestures.

Currently there are also some limitations on the Apple TV that needs to
be flagged to the  engine. There is no support for virtual keyboard, no
clipboard support and no possibility to open URLs.

Put code specific for iOS within the ObjC platfrom macro TARGET_OS_IOS.
The code specific for tvOS are put within the macro TARGET_OS_TV.
2023-01-29 21:13:51 +00:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Thierry Crozat
68331af461 IOS7: Fix handling of arrow keys on iOS 15 2021-09-29 20:30:15 +01:00
Thierry Crozat
5f1e3f07ca IOS7: Fix using arrow keys from physical keyboard on iOS 15
This fixes part of bug #12942.
2021-09-29 00:05:58 +01:00
Thierry Crozat
2435046146 IOS7: Support using Escape key on external keyboards 2021-09-23 00:12:19 +01:00
Thierry Crozat
3baad9e2a4 IOS7: Hide virtual keyboard input assistant bar 2020-08-29 16:31:37 +01:00
Thierry Crozat
cfd66173ba IOS7: Hide input accessory toolbar when an external keyboard is connected 2019-07-06 17:00:27 +01:00
Thierry Crozat
bf92167007 IOS7: Add a tab key to the keyboard accessory view 2019-06-30 12:36:43 +01:00
Thierry Crozat
25ff69c250 IOS7: Use scrollview for keyboard accessory view
This allows to have more buttons than what can be displayed on the
screen, and now to have all the same buttons on iPhone and on iPad.
2019-06-30 12:36:43 +01:00
Thierry Crozat
3ba9245138 IOS7: Add input accessory view to virtual keyboard
This adds buttons for some keys that are not present on the iOS
keyboard, such as the function and arrow keys, as well as a GMM
key.
2019-06-30 12:36:43 +01:00
Michael Zinn
82e8bc43e6 IOS: Fix Arrow Key Capture in TextInputHandler.
This should fix these working from external keyboards i.e. IPad Pro and
other sources as well.

This is presumably what the original author intended.
2018-08-23 23:42:52 +01:00
D G Turner
f353e466df IOS: Fix Build due to Smartkeyboard on IPad Pro Patch.
The code provided for Smartkeyboard on IPad Pro seems to be broken, so
am making minor changes to try to fix this.

The following should still function, but this will need testing by an
IOS user with this hardware, if it compiles.
2018-07-29 02:55:48 +01:00
D G Turner
eee970df1f IOS: Add Keyboard and UI Fixes for Smartkeyboard on IPad Pro.
These have not been compiled or otherwise tested, but are cleaned up
version of code changes from forum user "dottostring" in thread:
http://forums.scummvm.org/viewtopic.php?t=14524

This should add Fake ESC key support replacing the '`' key and add full
support for the Arrow keys.
2018-07-25 10:17:40 +02:00
Johannes Schickel
f8ef5e2476 IOS7: Make includes match our style. 2016-01-07 12:44:48 +01:00
Vincent Bénony
699c350481 IOS: Renames iOS7 classes to avoid confusion 2016-01-06 16:17:34 +01:00
Renamed from backends/platform/ios7/iphone_keyboard.mm (Browse further)