Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve iOS inputs #1706

Merged
merged 5 commits into from Jun 30, 2019

Conversation

@criezy
Copy link
Member

commented Jun 23, 2019

I am submitting this as a Pull Request to see if others have feedback before I merge this. I am in particular looking for feedback from iPhone users since I only have an iPad, and was only able to test iPhone using the simulator. I am planning to leave it open for one week and then merge.

The first commit adds an input accessory view to the keyboard, which allows to add one row of buttons. Due to widths limitation, less buttons are added on iPhone than iPad. A scrollview is used so that we can have more buttons than fits the screen.

  • iPad and iPhone
    • Main Menu button
    • Escape key
    • Tab key
    • Return key
    • F1 to F12 keys
    • Arrow keys
  • iPhone
    • Return key
    • F1 to F10 keys

Here is a screenshot for iPad:
ipad_keyboard

The second commit removes the mapping of some keys to the return and F1 to F10 keys since those are now available in the keyboard. In particular this removes the mapping of the dash character to F1 and fixes bug #10314: LSL7: Unable to open Xqwsts’ locker on iOS.

The third commit change the gesture to show and hide the keyboard from a three finger swipe up/down to a pinch in/out. This allows to map the three finger swipes gesture to arrow keys instead. This fixes bug #5914: swipe to simulate arrow keys doesn't work. One finger swipes are not available as this conflicts with moving the cursor in touchpad mode.

criezy added some commits Jun 23, 2019

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.
IOS7: Remove key mapping for function and return keys
Those keys are not present on the virtual keyboard accessory view.
This should fix bug #10314: LSL7: Unable to open Xqwsts's locker
on iOS.
IOS7: Map three finger swipes to arrow keys
Also use the pinch gesture to show/hide the keyboard. Previously
it was using the three fingers swipe up and dowm, which is now
mapped to arrow keys.
@bluegr

This comment has been minimized.

Copy link
Member

commented Jun 29, 2019

Nice! I like the fact that you’ve removed the hardcoded special button assignments.

Pinch works fine for the main menu. However, why would you want to map three finger swipes to arrow keys? Won’t two finger swipes work for these?

criezy added some commits Jun 30, 2019

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.
@criezy

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2019

I have now added a scrollview so that we can have all the buttons on iPhone as well. And I have also added a button for the Tab key as somebody mentioned on the forum that it is needed to display the inventory in KQ1.

However, why would you want to map three finger swipes to arrow keys? Won’t two finger swipes work for these?

Those are already used for other actions:

  • two fingers swipe up: enable/disable mouse click and drag mode
  • two fingers swipe down: show the main menu
  • two fingers swipe right: enable/disable touchpad mode
@criezy

This comment has been minimized.

Copy link
Member Author

commented Jun 30, 2019

OK. It's time to see if buildbot likes this.

@criezy criezy merged commit bf92167 into scummvm:master Jun 30, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Purduecoz

This comment has been minimized.

Copy link

commented Jul 5, 2019

Any way to turn off the input accessory view if a physical Bluetooth or official Apple keyboard cover is attached? I am finding the input accessory view blocks a few rows of the bottom of the game output when my iPad is in landscape mode.

@criezy

This comment has been minimized.

Copy link
Member Author

commented Jul 5, 2019

Good question. Since I don't have any hardware keyboard for iPad I didn't think of that. So currently there is no way to do it. We will need to add some code to detect if an external keyboard is in use. I will take a look (hopefully that is something I should be able to test with the iOS simulator).

@Purduecoz

This comment has been minimized.

Copy link

commented Jul 5, 2019

@criezy

This comment has been minimized.

Copy link
Member Author

commented Jul 6, 2019

I forgot I had a bluetooth keyboard for my computer :-P
I have now pushed a change that should hide the input accessory view when a physical keyboard is connected. It only works with iOS 9 or above though. There is no public API to detect if a keyboard is connected, so I had to use one of the hack floating around (the only one that worked for me). There would be ways to make it work with older iOS versions, but I decided one hack was enough for today.

@Purduecoz

This comment has been minimized.

Copy link

commented Jul 6, 2019

Thank you! It's almost perfect... except the return button on the physical keyboard doesn't do anything, at least in the AGI and SCI interpreters. The parser line just sits there blinking at me. I'm thinking this may be a side effect of commit e5709ed?

@criezy

This comment has been minimized.

Copy link
Member Author

commented Jul 7, 2019

Right. I should have been a bit more careful when I removed all those mappings. Mapping LF to the return key is indeed needed. Sorry for this. I have now added that mapping back.

@Purduecoz

This comment has been minimized.

Copy link

commented Jul 7, 2019

Works brilliantly. Thank you for your contributions to the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.