From b02cf351f35f85fa2afcaa12b644b818a4252cfe Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:37:15 +0300 Subject: [PATCH] [DisplayServer] Use screen "usable rect" instead of full rect to calculate initial window rect. --- platform/linuxbsd/x11/display_server_x11.cpp | 3 ++- platform/macos/display_server_macos.mm | 3 ++- platform/windows/display_server_windows.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 3bafdfb53d0..9bd096640d8 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -6108,7 +6108,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode if (p_screen == SCREEN_OF_MAIN_WINDOW) { p_screen = SCREEN_PRIMARY; } - window_position = screen_get_position(p_screen) + (screen_get_size(p_screen) - p_resolution) / 2; + Rect2i scr_rect = screen_get_usable_rect(p_screen); + window_position = scr_rect.position + (scr_rect.size - p_resolution) / 2; } WindowID main_window = _create_window(p_mode, p_vsync_mode, p_flags, Rect2i(window_position, p_resolution)); diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 2a6f17cb5d5..94ef7ebc894 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -4563,7 +4563,8 @@ DisplayServerMacOS::DisplayServerMacOS(const String &p_rendering_driver, WindowM if (p_screen == SCREEN_OF_MAIN_WINDOW) { p_screen = SCREEN_PRIMARY; } - window_position = screen_get_position(p_screen) + (screen_get_size(p_screen) - p_resolution) / 2; + Rect2i scr_rect = screen_get_usable_rect(p_screen); + window_position = scr_rect.position + (scr_rect.size - p_resolution) / 2; } WindowID main_window = _create_window(p_mode, p_vsync_mode, Rect2i(window_position, p_resolution)); diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index e8d81405f0c..bbb4ab87287 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4705,7 +4705,8 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win if (p_screen == SCREEN_OF_MAIN_WINDOW) { p_screen = SCREEN_PRIMARY; } - window_position = screen_get_position(p_screen) + (screen_get_size(p_screen) - p_resolution) / 2; + Rect2i scr_rect = screen_get_usable_rect(p_screen); + window_position = scr_rect.position + (scr_rect.size - p_resolution) / 2; } WindowID main_window = _create_window(p_mode, p_vsync_mode, p_flags, Rect2i(window_position, p_resolution));