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

Restore fullscreen toggle menu for the Android editor and clean up the immersive mode logic #96208

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented Aug 28, 2024

While testing #94285, I noticed a couple things:

  • The diff was using an editor setting to enable immersive mode which required restarting the editor

    • I found that odd since Android apps are able to toggle immersive mode on/off without restarting themselves, so I updated the logic to allow toggling immersive mode on/off without having to restart the editor
    • In the process, I updated the immersive mode logic to reflect the latest best practices and removed the deprecated apis
  • Looking for a way to expose the new immersive mode logic in the editor, I found out that the editor has a Toggle fullscreen menu which was disabled for Android (by me :) ) when the Android editor was first released

    • I restored the menu for the Android editor and wired the Android logic to toggle immersive mode. The new functionality can be seen in the video
Screen_Recording_20240828_030935.mp4

Note:

  • The new Android immersive mode logic is hooked to the DisplayServer#window_set_mode(...) and DisplayServer#window_get_mode(....) apis which means that game logic can also leverage the new functionality to query and toggle immersive mode at runtime on Android
  • The editor's immersive mode state is not used for the play / game window. This is done intentionally to allow the game logic to control the play / game window's immersive mode state via the DisplayServer apis
  • The editor retains its immersive mode state when the project is reloaded, when the editor quit to the project manager or when a new project is loaded from the project manager that doesn't have its own editor layout config
  • The editor's immersive mode state is not retained across full restart (killing and starting again) of the editor

Supersedes #94285

@akien-mga
Copy link
Member

The new Android immersive mode logic is hooked to the DisplayServer#window_set_mode(...) and DisplayServer#window_get_mode(....) apis which means that game logic can also leverage the new functionality to query and toggle immersive mode at runtime on Android

I'm not too familiar with immersive mode on Android, but I assume that this might change the default behavior for a number of games that might be configured to be fullscreen by default, and end up immersive on Android. Would that reasonably be desired/intended behavior in this case? Or would that break compat if prior to this, it would not be immersive?

Might also be worth adding a note in the documentation of window_set_mode to clarify that it does this on Android.

@m4gr3d m4gr3d force-pushed the cleanup_immersive_logic branch from 7fa180e to 46ac778 Compare August 28, 2024 16:01
@m4gr3d m4gr3d force-pushed the cleanup_immersive_logic branch from 46ac778 to 923b0f2 Compare August 28, 2024 16:50
@akien-mga akien-mga merged commit b128e71 into godotengine:master Aug 30, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

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.

2 participants