From 5d66f8fdb3131c17be66ca92848300d59a2c1552 Mon Sep 17 00:00:00 2001 From: Drakulix Date: Fri, 2 Feb 2018 16:21:37 +0100 Subject: [PATCH] Give EventLoopHandle to DrmHandler --- src/backend/drm/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/drm/mod.rs b/src/backend/drm/mod.rs index 23a3440..76567d1 100644 --- a/src/backend/drm/mod.rs +++ b/src/backend/drm/mod.rs @@ -529,12 +529,12 @@ impl Drop for DrmDevice { pub trait DrmHandler { /// The `DrmBackend` of crtc has finished swapping buffers and new frame can now /// (and should be immediately) be rendered. - fn ready(&mut self, device: &mut DrmDevice, crtc: crtc::Handle, frame: u32, duration: Duration); + fn ready(&mut self, evlh: &mut EventLoopHandle, device: &mut DrmDevice, crtc: crtc::Handle, frame: u32, duration: Duration); /// The `DrmDevice` has thrown an error. /// /// The related backends are most likely *not* usable anymore and /// the whole stack has to be recreated.. - fn error(&mut self, device: &mut DrmDevice, error: DrmError); + fn error(&mut self, evlh: &mut EventLoopHandle, device: &mut DrmDevice, error: DrmError); } /// Bind a `DrmDevice` to an `EventLoop`, @@ -562,7 +562,7 @@ where H: DrmHandler + 'static, { FdEventSourceImpl { - ready: |_evlh, &mut (ref mut device, ref mut handler), _, _| { + ready: |evlh, &mut (ref mut device, ref mut handler), _, _| { match crtc::receive_events(device) { Ok(events) => for event in events { if let crtc::Event::PageFlip(event) = event { @@ -578,19 +578,19 @@ where backend.unlock_buffer(); trace!(device.logger, "Handling event for backend {:?}", event.crtc); // and then call the user to render the next frame - handler.ready(device, event.crtc, event.frame, event.duration); + handler.ready(evlh, device, event.crtc, event.frame, event.duration); } else { device.backends.borrow_mut().remove(&event.crtc); } } } }, - Err(err) => handler.error(device, err), + Err(err) => handler.error(evlh, device, err), }; }, error: |_evlh, &mut (ref mut device, ref mut handler), _, error| { warn!(device.logger, "DrmDevice errored: {}", error); - handler.error(device, error.into()); + handler.error(evlh, device, error.into()); }, } }