wayland: Don't send size events while the window is hidden

Some clients don't expect this, and it can cause issues, particularly if events are emitted while creating a hidden window.
This commit is contained in:
Frank Praznik 2025-01-31 12:05:44 -05:00
parent 8e766c9252
commit 0825d07a43
1 changed files with 8 additions and 6 deletions

View File

@ -441,13 +441,15 @@ static bool ConfigureWindowGeometry(SDL_Window *window)
*/
SetMinMaxDimensions(window);
// Unconditionally send the window and drawable size, the video core will deduplicate when required.
if (!data->scale_to_display) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window_width, window_height);
} else {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->current.pixel_width, data->current.pixel_height);
if (data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_HIDDEN) {
// Unconditionally send the window and drawable size, the video core will deduplicate when required.
if (!data->scale_to_display) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window_width, window_height);
} else {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, data->current.pixel_width, data->current.pixel_height);
}
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, data->current.pixel_width, data->current.pixel_height);
}
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED, data->current.pixel_width, data->current.pixel_height);
/* Send an exposure event if the window is in the shown state and the size has changed,
* even if the window is occluded, as the client needs to commit a new frame for the