add maximized to WindowInfo

update button text
fix clippy
This commit is contained in:
SunDoge 2022-11-14 20:53:22 +08:00
parent 634d506012
commit 817236f640
3 changed files with 7 additions and 3 deletions

View file

@ -836,6 +836,9 @@ pub struct WindowInfo {
/// Current monitor size in egui points (logical pixels) /// Current monitor size in egui points (logical pixels)
pub monitor_size: Option<egui::Vec2>, pub monitor_size: Option<egui::Vec2>,
/// Are we in maximize mode?
pub maximized: bool,
} }
/// Information about the URL. /// Information about the URL.

View file

@ -41,6 +41,7 @@ pub fn read_window_info(window: &winit::window::Window, pixels_per_point: f32) -
y: size.height, y: size.height,
}, },
monitor_size, monitor_size,
maximized: window.is_maximized(),
} }
} }
@ -194,7 +195,7 @@ pub fn handle_app_output(
} }
if let Some(minimized) = minimized { if let Some(minimized) = minimized {
window.set_minimized(minimized) window.set_minimized(minimized);
} }
if let Some(maximized) = maximized { if let Some(maximized) = maximized {

View file

@ -112,7 +112,7 @@ fn custom_window_frame(
rect.left_top() + vec2((height - 4.0) * 1.0, 0.0), rect.left_top() + vec2((height - 4.0) * 1.0, 0.0),
Vec2::splat(height), Vec2::splat(height),
), ),
Button::new(RichText::new("--").size(height - 4.0)).frame(false), Button::new(RichText::new("🗕").size(height - 4.0)).frame(false),
); );
if minimized_response.clicked() { if minimized_response.clicked() {
frame.set_minimized(true); frame.set_minimized(true);
@ -123,7 +123,7 @@ fn custom_window_frame(
rect.left_top() + vec2((height - 4.0) * 2.0, 0.0), rect.left_top() + vec2((height - 4.0) * 2.0, 0.0),
Vec2::splat(height), Vec2::splat(height),
), ),
Button::new(RichText::new("O").size(height - 4.0)).frame(false), Button::new(RichText::new("🗖").size(height - 4.0)).frame(false),
); );
if maximized_response.clicked() { if maximized_response.clicked() {
app.maximized = !app.maximized; app.maximized = !app.maximized;