Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/classes/DisplayServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3074,7 +3074,8 @@
<constant name="WINDOW_FLAG_TRANSPARENT" value="3" enum="WindowFlags">
The window background can be transparent.
[b]Note:[/b] This flag has no effect if [method is_window_transparency_available] returns [code]false[/code].
[b]Note:[/b] Transparency support is implemented on Android, Linux (X11/Wayland), macOS, and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities.
[b]Note:[/b] Transparency support is implemented on Linux (X11/Wayland), macOS, and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities.
[b]Note:[/b] Transparency support is implemented on Android, but can only be enabled via [member ProjectSettings.display/window/per_pixel_transparency/allowed]. This flag has no effect on Android.
</constant>
<constant name="WINDOW_FLAG_NO_FOCUS" value="4" enum="WindowFlags">
The window can't be focused. No-focus window will ignore all input, except mouse clicks.
Expand Down
1 change: 1 addition & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@
If [code]true[/code], enables a window manager hint that the main window background [i]can[/i] be transparent. This does not make the background actually transparent. For the background to be transparent, the root viewport must also be made transparent by enabling [member rendering/viewport/transparent_background].
[b]Note:[/b] To use a transparent splash screen, set [member application/boot_splash/bg_color] to [code]Color(0, 0, 0, 0)[/code].
[b]Note:[/b] This setting has no effect if [member display/window/per_pixel_transparency/allowed] is set to [code]false[/code].
[b]Note:[/b] This setting has no effect on Android as transparency is controlled only via [member display/window/per_pixel_transparency/allowed].
</member>
<member name="display/window/size/viewport_height" type="int" setter="" getter="" default="648">
Sets the game's main viewport height. On desktop platforms, this is also the initial window height, represented by an indigo-colored rectangle in the 2D editor. Stretch mode settings also use this as a reference when using the [code]canvas_items[/code] or [code]viewport[/code] stretch modes. See also [member display/window/size/viewport_width], [member display/window/size/window_width_override] and [member display/window/size/window_height_override].
Expand Down
1 change: 1 addition & 0 deletions platform/android/display_server_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ void DisplayServerAndroid::window_set_flag(DisplayServer::WindowFlags p_flag, bo
}

bool DisplayServerAndroid::window_get_flag(DisplayServer::WindowFlags p_flag, DisplayServer::WindowID p_window) const {
ERR_FAIL_COND_V(p_window != MAIN_WINDOW_ID, false);
switch (p_flag) {
case WindowFlags::WINDOW_FLAG_TRANSPARENT:
return is_window_transparency_available();
Expand Down
12 changes: 6 additions & 6 deletions platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref<EditorExportPres
store_string_at_path(manifest_path, manifest_text);
}

bool EditorExportPlatformAndroid::_should_be_transparent(const Ref<EditorExportPreset> &p_preset) const {
bool EditorExportPlatformAndroid::_is_transparency_allowed(const Ref<EditorExportPreset> &p_preset) const {
return (bool)get_project_setting(p_preset, "display/window/per_pixel_transparency/allowed");
}

Expand All @@ -1062,21 +1062,21 @@ void EditorExportPlatformAndroid::_fix_themes_xml(const Ref<EditorExportPreset>
return;
}

bool should_be_transparent = _should_be_transparent(p_preset);
bool transparency_allowed = _is_transparency_allowed(p_preset);

// Default/Reserved theme attributes.
Dictionary main_theme_attributes;
main_theme_attributes["android:windowSwipeToDismiss"] = bool_to_string(p_preset->get("gesture/swipe_to_dismiss"));
main_theme_attributes["android:windowIsTranslucent"] = bool_to_string(should_be_transparent);
if (should_be_transparent) {
main_theme_attributes["android:windowIsTranslucent"] = bool_to_string(transparency_allowed);
if (transparency_allowed) {
main_theme_attributes["android:windowBackground"] = "@android:color/transparent";
}

Dictionary splash_theme_attributes;
splash_theme_attributes["android:windowSplashScreenBackground"] = "@mipmap/icon_background";
splash_theme_attributes["windowSplashScreenAnimatedIcon"] = "@mipmap/icon_foreground";
splash_theme_attributes["postSplashScreenTheme"] = "@style/GodotAppMainTheme";
splash_theme_attributes["android:windowIsTranslucent"] = bool_to_string(should_be_transparent);
splash_theme_attributes["android:windowIsTranslucent"] = bool_to_string(transparency_allowed);

Dictionary custom_theme_attributes = p_preset->get("gradle_build/custom_theme_attributes");

Expand Down Expand Up @@ -2988,7 +2988,7 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<Edit
}
}
} else {
if (_should_be_transparent(p_preset)) {
if (_is_transparency_allowed(p_preset)) {
// Warning only, so don't override `valid`.
err += vformat(TTR("\"Use Gradle Build\" is required for transparent background on Android"));
err += "\n";
Expand Down
2 changes: 1 addition & 1 deletion platform/android/export/export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {

void _write_tmp_manifest(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, bool p_debug);

bool _should_be_transparent(const Ref<EditorExportPreset> &p_preset) const;
bool _is_transparency_allowed(const Ref<EditorExportPreset> &p_preset) const;

void _fix_themes_xml(const Ref<EditorExportPreset> &p_preset);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ class Godot private constructor(val context: Context) {

// Check whether the render view should be made transparent
val shouldBeTransparent =
!isProjectManagerHint() && !isEditorHint() && java.lang.Boolean.parseBoolean(GodotLib.getGlobal("display/window/per_pixel_transparency/allowed"))
!isProjectManagerHint() &&
!isEditorHint() &&
java.lang.Boolean.parseBoolean(GodotLib.getGlobal("display/window/per_pixel_transparency/allowed"))
Log.d(TAG, "Render view should be transparent: $shouldBeTransparent")
renderView = if (usesVulkan()) {
if (meetsVulkanRequirements(context.packageManager)) {
Expand Down