Skip to content

Commit 98f3f4a

Browse files
committed
Try skip extra resizes
1 parent b4beefd commit 98f3f4a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/glass.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ impl ApplicationHandler for Glass {
104104
if let Some(window) = context.windows.get_mut(&window_id) {
105105
match event {
106106
WindowEvent::Resized(physical_size) => {
107-
// On windows, minimized app can have 0,0 size
108-
if physical_size.width > 0 && physical_size.height > 0 {
109-
window.configure_surface_with_size(
110-
context.device_context.device(),
111-
physical_size,
112-
);
113-
is_extra_update = true;
107+
if runner_state.is_init {
108+
// On windows, minimized app can have 0,0 size
109+
if physical_size.width > 0 && physical_size.height > 0 {
110+
window.configure_surface_with_size(
111+
context.device_context.device(),
112+
physical_size,
113+
);
114+
is_extra_update = true;
115+
}
114116
}
115117
}
116118
WindowEvent::ScaleFactorChanged {

src/window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl GlassWindow {
8989
) -> Result<GlassWindow, CreateSurfaceError> {
9090
let size = [window.inner_size().width, window.inner_size().height];
9191
let surface = context.instance().create_surface(window.clone())?;
92-
let formats = surface.get_capabilities(&context.adapter()).formats;
92+
let formats = surface.get_capabilities(context.adapter()).formats;
9393
if !formats.contains(&config.surface_format) {
9494
panic!(
9595
"{:?} not allowed. Allowed formats: {:?}",

0 commit comments

Comments
 (0)