Move Event::RedrawRequested to WindowEvent (#3049)
This commit is contained in:
parent
a3cba838ea
commit
67d3fd28f7
46 changed files with 572 additions and 562 deletions
|
|
@ -57,7 +57,13 @@ enum UserCallbackTransitionResult<'a> {
|
|||
|
||||
impl Event<Never> {
|
||||
fn is_redraw(&self) -> bool {
|
||||
matches!(self, Event::RedrawRequested(_))
|
||||
matches!(
|
||||
self,
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::RedrawRequested,
|
||||
..
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -755,7 +761,12 @@ pub unsafe fn handle_main_events_cleared() {
|
|||
let redraw_events: Vec<EventWrapper> = this
|
||||
.main_events_cleared_transition()
|
||||
.into_iter()
|
||||
.map(|window| EventWrapper::StaticEvent(Event::RedrawRequested(RootWindowId(window.id()))))
|
||||
.map(|window| {
|
||||
EventWrapper::StaticEvent(Event::WindowEvent {
|
||||
window_id: RootWindowId(window.id()),
|
||||
event: WindowEvent::RedrawRequested,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
drop(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,9 +43,10 @@ declare_class!(
|
|||
fn draw_rect(&self, rect: CGRect) {
|
||||
let window = self.window().unwrap();
|
||||
unsafe {
|
||||
app_state::handle_nonuser_event(EventWrapper::StaticEvent(Event::RedrawRequested(
|
||||
RootWindowId(window.id()),
|
||||
)));
|
||||
app_state::handle_nonuser_event(EventWrapper::StaticEvent(Event::WindowEvent {
|
||||
window_id: RootWindowId(window.id()),
|
||||
event: WindowEvent::RedrawRequested,
|
||||
}));
|
||||
}
|
||||
let _: () = unsafe { msg_send![super(self), drawRect: rect] };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue