desktop: Skip waiting for resize event after resize fails

This commit is contained in:
Colin 2024-05-06 10:44:35 +01:00 committed by GitHub
parent 1e11f5f693
commit 12bc0b7e71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -420,12 +420,14 @@ impl App {
);
let viewport_size = self.window.inner_size();
let mut window_resize_denied = false;
if let Some(new_viewport_size) = self.window.request_inner_size(window_size) {
if new_viewport_size != viewport_size {
self.gui.borrow_mut().resize(new_viewport_size);
} else {
tracing::warn!("Unable to resize window");
window_resize_denied = true;
}
}
self.window.set_fullscreen(if self.start_fullscreen {
@ -438,9 +440,9 @@ impl App {
let viewport_size = self.window.inner_size();
// On X11 (and possibly other platforms), the window size is not updated immediately.
// Wait for the window to be resized to the requested size before we start running
// the SWF (which can observe the viewport size in "noScale" mode)
if window_size != viewport_size.into() {
// On a successful resize request, wait for the window to be resized to the requested size
// before we start running the SWF (which can observe the viewport size in "noScale" mode)
if !window_resize_denied && window_size != viewport_size.into() {
loaded = LoadingState::WaitingForResize;
} else {
loaded = LoadingState::Loaded;