Skip to content

Commit

Permalink
desktop: Skip waiting for resize event after resize fails
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 authored May 6, 2024
1 parent 1e11f5f commit 12bc0b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions desktop/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 12bc0b7

Please sign in to comment.