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

Android Editor: Fix embed mode orientation handling #102802

Merged

Conversation

syntaxerror247
Copy link
Member

@syntaxerror247 syntaxerror247 commented Feb 13, 2025

Follow up to #102492, this PR fixes the orientation handling for embedded mode.

Since the game can apply its own orientation, it causes layout issues when its in window mode and orientation is set to portrait. It break the editor layout.

To address this:

  • Orientation changes are now disabled when embed mode is enabled and running in windowed mode (i.e., fullscreen is not active).
  • If the game requests an orientation change in windowed mode, it will be cached.
  • The cached orientation will be applied when switching to fullscreen.
  • When switching back to windowed mode, the orientation will revert to landscape to maintain editor layout.
Before this PR
Screenrecorder-2025-02-13-14-30-38-112.mp4
After this PR
VID_20250213_144317.mp4

It also fixes an issue where tapping the cutout area would unintentionally minimize the game or switch it to Picture-in-Picture mode.

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

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

The logic looks good!

One thing I'm curious about though is whether updating the aspect ratio of the window dimensions to match the requested orientation (in addition to caching the requested orientation) would provide the desired effect.

@syntaxerror247
Copy link
Member Author

One thing I'm curious about though is whether updating the aspect ratio of the window dimensions to match the requested orientation (in addition to caching the requested orientation) would provide the desired effect.

Yes, I initially tried implementing it (i.e. reducing width to give the effect of portrait). However, I left it out of this PR because reducing the width would leave very little space for the game menu buttons, requiring the user to scroll for each item. To address this, we would need to replace the horizontal scroll layout with a dropdown in portrait mode.

I felt it made more sense to include these changes in a single PR that properly implements window resizing.

@syntaxerror247 syntaxerror247 force-pushed the fix_orientation_handling branch from 02aebe0 to 14cf313 Compare February 13, 2025 16:50
@syntaxerror247 syntaxerror247 force-pushed the fix_orientation_handling branch from 14cf313 to 4a22e00 Compare February 13, 2025 16:52
@akien-mga akien-mga merged commit 3787cc4 into godotengine:master Feb 13, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@syntaxerror247 syntaxerror247 deleted the fix_orientation_handling branch February 14, 2025 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants