1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Wayland: Set window parent before commit

Fixes a timing issue where dialogs got configured right before having
their parent set. This gave compositors the time to resize/rearrange the
dialog as if it were a normal window, only to be marked as "floating"
right away. On niri, this manifested as huge dialog windows.

This is achieved with the addition of a `p_parent_id` parameter to
`window_create`, akin to its popup counterpart.

`window_create` now also accepts a single `Size2i` parameter instead of
two integers, in line with the rest of the `WaylandThread` API. The
original idea was to have a very "barebones" API, akin to the `drivers/`
directory, but that didn't pan out.
This commit is contained in:
Riteo Siuga
2025-10-21 08:15:25 +02:00
committed by Dery Almas
parent f50d7fa1e8
commit 4df96fc7ab
3 changed files with 11 additions and 9 deletions

View File

@@ -774,16 +774,12 @@ void DisplayServerWayland::show_window(WindowID p_window_id) {
wd.rect.position = Point2i();
DEBUG_LOG_WAYLAND(vformat("Creating regular window of size %s", wd.rect.size));
wayland_thread.window_create(p_window_id, wd.rect.size.width, wd.rect.size.height);
wayland_thread.window_create(p_window_id, wd.rect.size, wd.parent_id);
wayland_thread.window_set_min_size(p_window_id, wd.min_size);
wayland_thread.window_set_max_size(p_window_id, wd.max_size);
wayland_thread.window_set_app_id(p_window_id, _get_app_id_from_context(context));
wayland_thread.window_set_borderless(p_window_id, window_get_flag(WINDOW_FLAG_BORDERLESS, p_window_id));
if (wd.parent_id != INVALID_WINDOW_ID) {
wayland_thread.window_set_parent(wd.id, wd.parent_id);
}
// Since it can't have a position. Let's tell the window node the news by
// the actual rect to it.
if (wd.rect_changed_callback.is_valid()) {