wayland: Set xdg surface geometry

It was previously thought that these function calls were unnecessary as the initial bug and reproduction case that necessitated their addition seemed to be fixed, but apparently there are still cases where this needs to be set explicitly. Set the xdg surface geometry at creation time and when the window size changes.

Partially reverts #6361.  This is not needed in the libdecor path, as libdecor calls this for the content surface internally.

(cherry picked from commit 90a964f132)
This commit is contained in:
Frank Praznik 2022-12-05 15:33:01 -05:00 committed by Sam Lantinga
parent 802b5ef7dc
commit dfd7efaf13

View file

@ -279,10 +279,16 @@ static void ConfigureWindowGeometry(SDL_Window *window)
}
/*
* The opaque and pointer confinement regions only need to be recalculated
* if the output size has changed.
* The surface geometry, opaque region and pointer confinement region only
* need to be recalculated if the output size has changed.
*/
if (window_size_changed) {
/* libdecor does this internally on frame commits, so it's only needed for xdg surfaces. */
if (data->shell_surface_type != WAYLAND_SURFACE_LIBDECOR &&
viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) {
xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->window_width, data->window_height);
}
if (!viddata->egl_transparency_enabled) {
region = wl_compositor_create_region(viddata->compositor);
wl_region_add(region, 0, 0,
@ -1378,6 +1384,9 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
&decoration_listener,
window);
}
/* Set the geometry */
xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->window_width, data->window_height);
} else {
/* Nothing to see here, just commit. */
wl_surface_commit(data->surface);