KEMBAR78
Change orientation detection mechanism on iOS by criezy · Pull Request #4918 · scummvm/scummvm · GitHub
Skip to content

Conversation

@criezy
Copy link
Member

@criezy criezy commented Apr 18, 2023

This should fix incorrect orientation being detected on some devices, which caused the virtual keyboard to appear in landscape mode instead of portrait mode.

This includes three main changes that are tied to each others:

  • Use the interface orientation and not the device orientation. This may be different for example when locking the orientation.
  • Changes the way orientation changes are detected using the documented method. However this means dropping support for iOS 7 as this method is only available since iOS 8, and alternative methods available in iOS 7 have been deprecated in iOS 13. See https://developer.apple.com/documentation/uikit/uiviewcontroller?language=objc
  • Properly detect the interface orientation instead of inferring it from the view bounds, which was incorrect on some devices.

Copy link
Contributor

@larsamannen larsamannen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected. Some comments on platform checks.

@criezy
Copy link
Member Author

criezy commented Apr 21, 2023

Thank you for your review. I think all the issues you reported should be fixed.

Copy link
Contributor

@larsamannen larsamannen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if I should add a tvOS CI-job as well. It's not official yet but will at least give a notice on incompatibles.

criezy added 3 commits April 25, 2023 22:08
The main change in to use the interface orientation and not the device
orientation. This may be different for example when locking the orientation.
This also changes the way orientation changes are detected using the
documented method. However this means dropping support for iOS 7 as this
method is only available since iOS 8, and alternative methods available in
iOS 7 have been deprecated in iOS 13.

Another change is to properly detect the interface orientation instead of
infering it from the view bounds, which was incorrect on some devices.
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.
@criezy
Copy link
Member Author

criezy commented Apr 25, 2023

I have rebased on current master and made the necessary modifications to fix the compilation when targeting TvOS.

@larsamannen larsamannen merged commit 4413600 into scummvm:master Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants