Skip to content

Commit

Permalink
Merge pull request #75489 from bruvzg/init_pos_usable
Browse files Browse the repository at this point in the history
[DisplayServer] Use screen "usable rect" instead of full rect to calculate initial window rect.
  • Loading branch information
YuriSizov committed Dec 19, 2023
2 parents 1f5d4a6 + b02cf35 commit aee8a3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion platform/linuxbsd/x11/display_server_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion platform/macos/display_server_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4667,7 +4667,8 @@ - (void)popupAction:(id)sender {
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));
Expand Down
3 changes: 2 additions & 1 deletion platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4763,7 +4763,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));
Expand Down

0 comments on commit aee8a3b

Please sign in to comment.