video: wayland: Handle 0x0 xdg_toplevel_configure in fullscreen

The xdg_shell spec seems to state[1] that xdg_toplevel_configure events can
always provide a 0×0 width/height to signal that the compositor doesn't
care. SDL previously assumed the provided width/height was always valid
for fullscreen windows, and so applied it as-is.

This broke SDL applications on KDE/KWin 5.23, which now sends 0×0
configure events (and, in 5.23.3, 1×1 events for some reason), breaking
all SDL applications in fullscreen[2].

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/6
[2]: https://bugs.kde.org/show_bug.cgi?id=444962#c6
This commit is contained in:
David Gow 2021-12-04 14:14:47 +08:00 committed by Sam Lantinga
parent 2f0edc2906
commit a709b5b602
1 changed files with 4 additions and 2 deletions

View File

@ -290,8 +290,10 @@ handle_configure_xdg_toplevel(void *data,
/* For fullscreen, foolishly do what the compositor says. If it's wrong, /* For fullscreen, foolishly do what the compositor says. If it's wrong,
* don't blame us, we were explicitly instructed to do this. * don't blame us, we were explicitly instructed to do this.
*/ */
window->w = width; if (width != 0 && height != 0) {
window->h = height; window->w = width;
window->h = height;
}
/* This part is good though. */ /* This part is good though. */
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {