Fix screen_get_usable_rect returning display safe area #60553
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When creating #60551, I noticed that #40761 (for iPhone) and #43104 (for Android) had aimed to reimplement the 3.x
OS.get_window_safe_area()
method. However, instead of recreating the method, they've incorrectly redefinedDisplayServer.screen_get_usable_rect(screen)
, which should return the usable rectangle for the specified screen. On Android and iPhone this should be the full screen not the safe area.This PR creates the
DisplayServer.get_display_safe_area()
, which returns the rectangle that is not obscured by cutouts, notches, inserts used by cameras and sensors on some devices, or the full screen rectangle if there are no obstructions, and reverts the changes made toDisplayServer.screen_get_usable_rect(screen)
on the Android and iPhone platforms.