Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fdfc6d1

Browse files
committedOct 20, 2024·
Editor without title bar
1 parent f032af7 commit fdfc6d1

29 files changed

+841
-73
lines changed
 

‎doc/classes/DisplayServer.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,7 @@
15111511
<param index="0" name="window_id" type="int" default="0" />
15121512
<description>
15131513
Returns left margins ([code]x[/code]), right margins ([code]y[/code]) and height ([code]z[/code]) of the title that are safe to use (contains no buttons or other elements) when [constant WINDOW_FLAG_EXTEND_TO_TITLE] flag is set.
1514+
[b]Note:[/b] On Linux and Windows, this method always returns [constant Vector2.ZERO], since the decoration buttons are not displayed by the OS when the [constant WINDOW_FLAG_EXTEND_TO_TITLE] flag is set.
15141515
</description>
15151516
</method>
15161517
<method name="window_get_size" qualifiers="const">
@@ -1873,7 +1874,7 @@
18731874
Display server supports text-to-speech. See [code]tts_*[/code] methods. [b]Windows, macOS, Linux (X11/Wayland), Android, iOS, Web[/b]
18741875
</constant>
18751876
<constant name="FEATURE_EXTEND_TO_TITLE" value="20" enum="Feature">
1876-
Display server supports expanding window content to the title. See [constant WINDOW_FLAG_EXTEND_TO_TITLE]. [b]macOS[/b]
1877+
Display server supports expanding window content to the title. See [constant WINDOW_FLAG_EXTEND_TO_TITLE]. [b]macOS, Linux, Windows[/b]
18771878
</constant>
18781879
<constant name="FEATURE_SCREEN_CAPTURE" value="21" enum="Feature">
18791880
Display server supports reading screen pixels. See [method screen_get_pixel].
@@ -2094,7 +2095,8 @@
20942095
Window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons.
20952096
Use [method window_set_window_buttons_offset] to adjust minimize/maximize/close buttons offset.
20962097
Use [method window_get_safe_title_margins] to determine area under the title bar that is not covered by decorations.
2097-
[b]Note:[/b] This flag is implemented only on macOS.
2098+
[b]Note:[/b] This flag is implemented on macOS, Linux, and Windows.
2099+
[b]Note:[/b] On Linux and Windows, the decoration buttons (Minimize, Maximize and Close) are rendered by Godot and use the theme of the Window.
20982100
</constant>
20992101
<constant name="WINDOW_FLAG_MOUSE_PASSTHROUGH" value="7" enum="WindowFlags">
21002102
All mouse events are passed to the underlying window of the same application.

‎doc/classes/EditorSettings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@
782782
</member>
783783
<member name="interface/editor/expand_to_title" type="bool" setter="" getter="">
784784
Expanding main editor window content to the title, if supported by [DisplayServer]. See [constant DisplayServer.WINDOW_FLAG_EXTEND_TO_TITLE].
785-
Specific to the macOS platform.
785+
[b]Note:[/b] This setting is implemented on macOS, Linux, and Windows.
786786
</member>
787787
<member name="interface/editor/font_allow_msdf" type="bool" setter="" getter="">
788788
If set to [code]true[/code], MSDF font rendering will be used for the visual shader graph editor. You may need to set this to [code]false[/code] when using a custom main font, as some fonts will look broken due to the use of self-intersecting outlines in their font data. Downloading the font from the font maker's official website as opposed to a service like Google Fonts can help resolve this issue.

‎doc/classes/ProjectSettings.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,9 @@
846846
</member>
847847
<member name="display/window/size/extend_to_title" type="bool" setter="" getter="" default="false">
848848
Main window content is expanded to the full size of the window. Unlike a borderless window, the frame is left intact and can be used to resize the window, and the title bar is transparent, but has minimize/maximize/close buttons.
849-
[b]Note:[/b] This setting is implemented only on macOS.
849+
[b]Note:[/b] This setting is implemented on macOS, Linux, and Windows.
850+
[b]Note:[/b] This setting only works if [member display/window/subwindows/embed_subwindows] is [code]false[/code].
851+
[b]Note:[/b] On Linux and Windows, the decoration buttons (Minimize, Maximize and Close) are rendered by Godot and use the theme of the Window.
850852
</member>
851853
<member name="display/window/size/initial_position" type="Vector2i" setter="" getter="" default="Vector2i(0, 0)">
852854
Main window initial position (in virtual desktop coordinates), this setting is used only if [member display/window/size/initial_position_type] is set to "Absolute" ([code]0[/code]).

‎doc/classes/Window.xml

+55-3
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@
592592
</member>
593593
<member name="extend_to_title" type="bool" setter="set_flag" getter="get_flag" default="false">
594594
If [code]true[/code], the [Window] contents is expanded to the full size of the window, window title bar is transparent.
595-
[b]Note:[/b] This property is implemented only on macOS.
595+
[b]Note:[/b] This property is implemented on macOS, Linux, and Windows.
596596
[b]Note:[/b] This property only works with native windows.
597597
</member>
598598
<member name="force_native" type="bool" setter="set_force_native" getter="get_force_native" default="false">
@@ -835,8 +835,9 @@
835835
</constant>
836836
<constant name="FLAG_EXTEND_TO_TITLE" value="6" enum="Flags">
837837
Window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons. Set with [member extend_to_title].
838-
[b]Note:[/b] This flag is implemented only on macOS.
838+
[b]Note:[/b] This flag is implemented on macOS, Linux, and Windows.
839839
[b]Note:[/b] This flag has no effect in embedded windows.
840+
[b]Note:[/b] On Linux and Windows, the decoration buttons (Minimize, Maximize and Close) are rendered by Godot and use the Window theme.
840841
</constant>
841842
<constant name="FLAG_MOUSE_PASSTHROUGH" value="7" enum="Flags">
842843
All mouse events are passed to the underlying window of the same application.
@@ -907,6 +908,15 @@
907908
</constant>
908909
</constants>
909910
<theme_items>
911+
<theme_item name="decoration_button_hover_modulate" data_type="color" type="Color" default="Color(0.95, 0.95, 0.95, 1)">
912+
Window decoration buttons modulation color, when the buttons are hovered, [member extend_to_title] is true and the buttons are rendered by Godot.
913+
</theme_item>
914+
<theme_item name="decoration_button_normal_modulate" data_type="color" type="Color" default="Color(0.875, 0.875, 0.875, 1)">
915+
Window decoration buttons modulation color, when [member extend_to_title] is true and the buttons are rendered by Godot.
916+
</theme_item>
917+
<theme_item name="decoration_button_pressed_modulate" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
918+
Window decoration buttons modulation color, when the buttons are pressed, [member extend_to_title] is true and the buttons are rendered by Godot.
919+
</theme_item>
910920
<theme_item name="title_color" data_type="color" type="Color" default="Color(0.875, 0.875, 0.875, 1)">
911921
The color of the title's text.
912922
</theme_item>
@@ -916,9 +926,21 @@
916926
<theme_item name="close_h_offset" data_type="constant" type="int" default="18">
917927
Horizontal position offset of the close button.
918928
</theme_item>
919-
<theme_item name="close_v_offset" data_type="constant" type="int" default="24">
929+
<theme_item name="close_v_offset" data_type="constant" type="int" default="20">
920930
Vertical position offset of the close button.
921931
</theme_item>
932+
<theme_item name="maximize_h_offset" data_type="constant" type="int" default="36">
933+
Horizontal position offset of the maximize/restore decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
934+
</theme_item>
935+
<theme_item name="maximize_v_offset" data_type="constant" type="int" default="20">
936+
Vertical position offset of the maximize/restore decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
937+
</theme_item>
938+
<theme_item name="minimize_h_offset" data_type="constant" type="int" default="54">
939+
Horizontal position offset of the minimize decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
940+
</theme_item>
941+
<theme_item name="minimize_v_offset" data_type="constant" type="int" default="20">
942+
Vertical position offset of the minimize decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
943+
</theme_item>
922944
<theme_item name="resize_margin" data_type="constant" type="int" default="4">
923945
Defines the outside margin at which the window border can be grabbed with mouse and resized.
924946
</theme_item>
@@ -940,6 +962,36 @@
940962
<theme_item name="close_pressed" data_type="icon" type="Texture2D">
941963
The icon for the close button when it's being pressed.
942964
</theme_item>
965+
<theme_item name="maximize" data_type="icon" type="Texture2D">
966+
The icon for the maximize decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
967+
</theme_item>
968+
<theme_item name="maximize_disabled" data_type="icon" type="Texture2D">
969+
The icon for the maximize decoration button when disabled (window not resizable), [member extend_to_title] is true and the button is rendered by Godot.
970+
</theme_item>
971+
<theme_item name="maximize_pressed" data_type="icon" type="Texture2D">
972+
The icon for the maximize decoration button when it's being pressed, [member extend_to_title] is true and the button is rendered by Godot.
973+
</theme_item>
974+
<theme_item name="minimize" data_type="icon" type="Texture2D">
975+
The icon for the minimize decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
976+
</theme_item>
977+
<theme_item name="minimize_pressed" data_type="icon" type="Texture2D">
978+
The icon for the minimize decoration button when it's being pressed, [member extend_to_title] is true and the button is rendered by Godot.
979+
</theme_item>
980+
<theme_item name="restore" data_type="icon" type="Texture2D">
981+
The icon for the restore decoration button, when [member extend_to_title] is true and the button is rendered by Godot.
982+
</theme_item>
983+
<theme_item name="restore_pressed" data_type="icon" type="Texture2D">
984+
The icon for the restore decoration button when it's being pressed, [member extend_to_title] is true and the button is rendered by Godot.
985+
</theme_item>
986+
<theme_item name="decoration_button_hover" data_type="style" type="StyleBox">
987+
The background style used of the window decoration buttons when the mouse pointer is hovering them, [member extend_to_title] is true and the button is rendered by Godot.
988+
</theme_item>
989+
<theme_item name="decoration_button_normal" data_type="style" type="StyleBox">
990+
The background style used of the window decoration buttons when [member extend_to_title] is true and the button is rendered by Godot.
991+
</theme_item>
992+
<theme_item name="decoration_button_pressed" data_type="style" type="StyleBox">
993+
The background style used of the window decoration buttons when they are being pressed, [member extend_to_title] is true and the button is rendered by Godot.
994+
</theme_item>
943995
<theme_item name="embedded_border" data_type="style" type="StyleBox">
944996
The background style used when the [Window] is embedded. Note that this is drawn only under the window's content, excluding the title. For proper borders and title bar style, you can use [code]expand_margin_*[/code] properties of [StyleBoxFlat].
945997
[b]Note:[/b] The content background will not be visible unless [member transparent] is enabled.

‎editor/editor_node.cpp

+18-8
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ void EditorNode::_update_theme(bool p_skip_creation) {
544544
}
545545

546546
_update_renderer_color();
547+
_titlebar_resized();
547548
}
548549

549550
editor_dock_manager->update_tab_styles();
@@ -650,7 +651,7 @@ void EditorNode::_notification(int p_what) {
650651

651652
Window *window = get_window();
652653
if (window) {
653-
// Handle macOS fullscreen and extend-to-title changes.
654+
// Handle fullscreen and extend-to-title changes.
654655
window->connect("titlebar_changed", callable_mp(this, &EditorNode::_titlebar_resized));
655656
}
656657

@@ -1239,18 +1240,27 @@ void EditorNode::_viewport_resized() {
12391240
}
12401241

12411242
void EditorNode::_titlebar_resized() {
1242-
DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(title_bar->get_global_position().y + title_bar->get_size().y / 2, title_bar->get_global_position().y + title_bar->get_size().y / 2), DisplayServer::MAIN_WINDOW_ID);
1243-
const Vector3i &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID);
1243+
Window *w = get_window();
1244+
if (!w) {
1245+
return;
1246+
}
1247+
1248+
// On Windows and Linux, we will let the window button in the corner, same as the
1249+
// default OS buttons.
1250+
#ifdef MACOS_ENABLED
1251+
w->set_window_buttons_offset(Vector2i(title_bar->get_global_position().y + title_bar->get_size().y / 2, title_bar->get_global_position().y + title_bar->get_size().y / 2));
1252+
#endif
1253+
1254+
const Vector2i &left_margin = w->get_safe_title_margins_left();
1255+
const Vector2i &right_margin = w->get_safe_title_margins_right();
12441256
if (left_menu_spacer) {
1245-
int w = (gui_base->is_layout_rtl()) ? margin.y : margin.x;
1246-
left_menu_spacer->set_custom_minimum_size(Size2(w, 0));
1257+
left_menu_spacer->set_custom_minimum_size(Size2(left_margin.x, 0));
12471258
}
12481259
if (right_menu_spacer) {
1249-
int w = (gui_base->is_layout_rtl()) ? margin.x : margin.y;
1250-
right_menu_spacer->set_custom_minimum_size(Size2(w, 0));
1260+
right_menu_spacer->set_custom_minimum_size(Size2(right_margin.x, 0));
12511261
}
12521262
if (title_bar) {
1253-
title_bar->set_custom_minimum_size(Size2(0, margin.z - title_bar->get_global_position().y));
1263+
title_bar->set_custom_minimum_size(Size2(0, MAX(left_margin.y, right_margin.y) - title_bar->get_global_position().y));
12541264
}
12551265
}
12561266

‎editor/icons/WindowClose.svg

+1
Loading

‎editor/icons/WindowMaximize.svg

+1
Loading

‎editor/icons/WindowMinimize.svg

+1
Loading

‎editor/icons/WindowRestore.svg

+1
Loading

‎editor/project_manager.cpp

+16-9
Original file line numberDiff line numberDiff line change
@@ -1053,20 +1053,27 @@ void ProjectManager::_files_dropped(PackedStringArray p_files) {
10531053
}
10541054

10551055
void ProjectManager::_titlebar_resized() {
1056-
DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(title_bar->get_global_position().y + title_bar->get_size().y / 2, title_bar->get_global_position().y + title_bar->get_size().y / 2), DisplayServer::MAIN_WINDOW_ID);
1057-
const Vector3i &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID);
1056+
Window *w = get_window();
1057+
if (!w) {
1058+
return;
1059+
}
1060+
1061+
// On Windows and Linux, we will let the window button in the corner, same as the
1062+
// default OS buttons.
1063+
#ifdef MACOS_ENABLED
1064+
w->set_window_buttons_offset(Vector2i(title_bar->get_global_position().y + title_bar->get_size().y / 2, title_bar->get_global_position().y + title_bar->get_size().y / 2));
1065+
#endif
1066+
1067+
const Vector2i &left_margin = w->get_safe_title_margins_left();
1068+
const Vector2i &right_margin = w->get_safe_title_margins_right();
10581069
if (left_menu_spacer) {
1059-
int w = (root_container->is_layout_rtl()) ? margin.y : margin.x;
1060-
left_menu_spacer->set_custom_minimum_size(Size2(w, 0));
1061-
right_spacer->set_custom_minimum_size(Size2(w, 0));
1070+
left_menu_spacer->set_custom_minimum_size(Size2(left_margin.x, 0));
10621071
}
10631072
if (right_menu_spacer) {
1064-
int w = (root_container->is_layout_rtl()) ? margin.x : margin.y;
1065-
right_menu_spacer->set_custom_minimum_size(Size2(w, 0));
1066-
left_spacer->set_custom_minimum_size(Size2(w, 0));
1073+
right_menu_spacer->set_custom_minimum_size(Size2(right_margin.x, 0));
10671074
}
10681075
if (title_bar) {
1069-
title_bar->set_custom_minimum_size(Size2(0, margin.z - title_bar->get_global_position().y));
1076+
title_bar->set_custom_minimum_size(Size2(0, MAX(left_margin.y, right_margin.y) - title_bar->get_global_position().y));
10701077
}
10711078
}
10721079

0 commit comments

Comments
 (0)
Please sign in to comment.