Skip to content

Commit

Permalink
Fix the window getting smaller each time it's opened (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
Insprill authored May 13, 2023
1 parent b5760d5 commit f94af14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion psst-gui/src/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct Delegate {
main_window: Option<WindowId>,
preferences_window: Option<WindowId>,
image_pool: ThreadPool,
size_updated: bool,
}

impl Delegate {
Expand All @@ -28,6 +29,7 @@ impl Delegate {
main_window: None,
preferences_window: None,
image_pool: ThreadPool::with_name("image_loading".into(), MAX_IMAGE_THREADS),
size_updated: false,
}
}

Expand Down Expand Up @@ -155,7 +157,12 @@ impl AppDelegate<AppState> for Delegate {
) -> Option<Event> {
if self.main_window == Some(window_id) {
if let Event::WindowSize(size) = event {
data.config.window_size = size;
// This is a little hacky, but without it, the window will slowly get smaller each time the application is opened.
if !self.size_updated {
self.size_updated = true;
} else {
data.config.window_size = size;
}
}
}
Some(event)
Expand Down

0 comments on commit f94af14

Please sign in to comment.