Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize window maximized state in WindowSettings #5554

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,9 @@ pub fn apply_viewport_builder_to_window(
let pos = PhysicalPosition::new(pixels_per_point * pos.x, pixels_per_point * pos.y);
window.set_outer_position(pos);
}
if let Some(maximized) = builder.maximized {
window.set_maximized(maximized);
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion crates/egui-winit/src/window_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub struct WindowSettings {

fullscreen: bool,

maximized: bool,

/// Inner size of window in logical pixels
inner_size_points: Option<egui::Vec2>,
}
Expand All @@ -38,6 +40,7 @@ impl WindowSettings {
outer_position_pixels,

fullscreen: window.fullscreen().is_some(),
maximized: window.is_maximized(),

inner_size_points: Some(egui::vec2(
inner_size_points.width,
Expand Down Expand Up @@ -80,7 +83,8 @@ impl WindowSettings {
if let Some(inner_size_points) = self.inner_size_points {
viewport_builder = viewport_builder
.with_inner_size(inner_size_points)
.with_fullscreen(self.fullscreen);
.with_fullscreen(self.fullscreen)
.with_maximized(self.maximized);
}

viewport_builder
Expand Down
Loading