diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-10 13:52:23 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-10 13:52:23 +0200 |
commit | 543128d84de7d9412da71d67f5cb674c522b6f7d (patch) | |
tree | 1d5080ecfd60b379121e64247e1f488f4bb67ab1 /editor/editor_node.cpp | |
parent | 104af08e9d7c8308c2dd6cad89a0caee774043a0 (diff) | |
parent | 73430f292b8c0b3803c7d346195ec1cdffd194b8 (diff) |
Merge pull request #67175 from bruvzg/macos_title_edscale
[macOS] Fix window button position and title bar size when editor scale do not match OS UI scale.
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 288ee4fa8f..7aca8fde6f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1181,7 +1181,8 @@ void EditorNode::_vp_resized() { } void EditorNode::_titlebar_resized() { - const Size2 &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID); + DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(menu_hb->get_global_position().y + menu_hb->get_size().y / 2, menu_hb->get_global_position().y + menu_hb->get_size().y / 2), DisplayServer::MAIN_WINDOW_ID); + const Vector3i &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID); if (left_menu_spacer) { int w = (gui_base->is_layout_rtl()) ? margin.y : margin.x; left_menu_spacer->set_custom_minimum_size(Size2(w, 0)); @@ -1190,6 +1191,9 @@ void EditorNode::_titlebar_resized() { int w = (gui_base->is_layout_rtl()) ? margin.x : margin.y; right_menu_spacer->set_custom_minimum_size(Size2(w, 0)); } + if (menu_hb) { + menu_hb->set_custom_minimum_size(Size2(0, margin.z - menu_hb->get_global_position().y)); + } } void EditorNode::_version_button_pressed() { @@ -7560,7 +7564,6 @@ EditorNode::EditorNode() { // Extend menu bar to window title. if (can_expand) { - DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(menu_hb->get_minimum_size().y / 2, menu_hb->get_minimum_size().y / 2), DisplayServer::MAIN_WINDOW_ID); DisplayServer::get_singleton()->window_set_flag(DisplayServer::WINDOW_FLAG_EXTEND_TO_TITLE, true, DisplayServer::MAIN_WINDOW_ID); menu_hb->set_can_move_window(true); } |