wayland: Ignore content sizes from libdecor when hiding a window

When hiding a window, libdecor can report bogus content region sizes that are +/- the height of the title bar. Ignore any size values from libdecor when hiding a window, or the size may be incorrect when restored.
This commit is contained in:
Frank Praznik 2022-09-03 13:30:49 -04:00 committed by Sam Lantinga
parent 6de12b4a0d
commit 07aea476ba
1 changed files with 8 additions and 1 deletions

View File

@ -897,8 +897,15 @@ decoration_frame_configure(struct libdecor_frame *frame,
height = window->windowed.h; height = window->windowed.h;
wind->floating_resize_pending = SDL_FALSE; wind->floating_resize_pending = SDL_FALSE;
} else { } else {
/*
* XXX: When hiding a floating window, libdecor can send bogus content sizes that
* are +/- the height of the title bar, which distorts the window size.
* Ignore any values from libdecor when hiding a floating window.
*/
const SDL_bool use_cached_size = (window->is_hiding || !!(window->flags & SDL_WINDOW_HIDDEN));
/* This will never set 0 for width/height unless the function returns false */ /* This will never set 0 for width/height unless the function returns false */
if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) { if (use_cached_size || !libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {
if (floating) { if (floating) {
/* This usually happens when we're being restored from a /* This usually happens when we're being restored from a
* non-floating state, so use the cached floating size here. * non-floating state, so use the cached floating size here.