diff options
-rw-r--r-- | src/osx/mod.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/osx/mod.rs b/src/osx/mod.rs index b338184..c7ce750 100644 --- a/src/osx/mod.rs +++ b/src/osx/mod.rs @@ -115,13 +115,10 @@ extern fn window_did_resize(this: id, _: id) -> id { let _: id = msg_send()(state.context, selector("update")); - match state.handler { - Some(handler) => { - let rect = NSView::frame(state.view); - let scale_factor = state.window.backingScaleFactor() as f32; - (handler)((scale_factor * rect.size.width as f32) as u32, (scale_factor * rect.size.height as f32) as u32); - } - None => {} + if let Some(handler) = state.handler { + let rect = NSView::frame(state.view); + let scale_factor = state.window.backingScaleFactor() as f32; + (handler)((scale_factor * rect.size.width as f32) as u32, (scale_factor * rect.size.height as f32) as u32); } } 0 @@ -374,7 +371,7 @@ impl Window { DELEGATE_STATE_IVAR.as_ptr() as *const i8, ptr::null_mut()); self.is_closed.set(ds.is_closed); -} + } match event.get_type() { NSLeftMouseDown => { events.push_back(MouseInput(Pressed, LeftMouseButton)); }, |