diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a8b4c0..662a58f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Added `WindowBuilder::with_position` to allow setting the position of a `Window` on creation. Supported on Windows, macOS and X11. - Added `Window::drag_window`. Implemented on Windows, macOS, X11 and Wayland. - On X11, bump `mio` to 0.7. +- On macOS, emit `RedrawRequested` events immediately while the window is being resized. # 0.24.0 (2020-12-09) diff --git a/src/platform_impl/macos/app_state.rs b/src/platform_impl/macos/app_state.rs index fb67b4d6..59cf0f2a 100644 --- a/src/platform_impl/macos/app_state.rs +++ b/src/platform_impl/macos/app_state.rs @@ -327,6 +327,10 @@ impl AppState { } } + pub fn handle_redraw(window_id: WindowId) { + HANDLER.handle_nonuser_event(EventWrapper::StaticEvent(Event::RedrawRequested(window_id))); + } + pub fn queue_event(wrapper: EventWrapper) { if !unsafe { msg_send![class!(NSThread), isMainThread] } { panic!("Event queued from different thread: {:#?}", wrapper); diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs index 523cb665..aa7109f8 100644 --- a/src/platform_impl/macos/view.rs +++ b/src/platform_impl/macos/view.rs @@ -346,7 +346,7 @@ extern "C" fn draw_rect(this: &Object, _sel: Sel, rect: NSRect) { let state_ptr: *mut c_void = *this.get_ivar("winitState"); let state = &mut *(state_ptr as *mut ViewState); - AppState::queue_redraw(WindowId(get_window_id(state.ns_window))); + AppState::handle_redraw(WindowId(get_window_id(state.ns_window))); let superclass = util::superclass(this); let () = msg_send![super(this, superclass), drawRect: rect];