diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-14 13:36:25 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-14 13:36:25 +0100 |
commit | 34b8f42118d0a0b852c65cdb60ff06a6b8257492 (patch) | |
tree | d110e875e413a845ea8de6f8a8b2c5f81767fe7e | |
parent | a1986729a576e26eee13a4a190103cd7d7703905 (diff) | |
parent | 8a17f94ab2151eb5d953e4f2899c2b09cfa800f7 (diff) |
Merge pull request #73278 from ttencate/fix/issue_70984
Some fixes for initial window position and size
-rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 5 | ||||
-rw-r--r-- | scene/main/window.cpp | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 525c62fbf2..5d70af56bd 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -4936,6 +4936,11 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, V win_rect.position = wpos; } + // Position and size hints are set from these values before they are updated to the actual + // window size, so we need to initialize them here. + wd.position = win_rect.position; + wd.size = win_rect.size; + { wd.x11_window = XCreateWindow(x11_display, RootWindow(x11_display, visualInfo.screen), win_rect.position.x, win_rect.position.y, win_rect.size.width > 0 ? win_rect.size.width : 1, win_rect.size.height > 0 ? win_rect.size.height : 1, 0, visualInfo.depth, InputOutput, visualInfo.visual, valuemask, &windowAttributes); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 9092be93e6..6fbf6ccb81 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1121,6 +1121,7 @@ void Window::_notification(int p_what) { position = DisplayServer::get_singleton()->window_get_position(window_id); size = DisplayServer::get_singleton()->window_get_size(window_id); } + _update_window_size(); // Inform DisplayServer of minimum and maximum size. _update_viewport_size(); // Then feed back to the viewport. _update_window_callbacks(); RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE); |