A window renders now

This commit is contained in:
Timmy Xiao authored and Wez Furlong committed 2024-02-03 14:54:45 -07:00
1 parent 9e14a4c929
commit 4ce398bc19
2 files changed
+15 -8

No files matched your search

+7 -1
View File
@@ -206,7 +206,13 @@ impl CompositorHandler for WaylandState {
time: u32,
) {
log::trace!("frame: CompositorHandler");
todo!()
let surface_data = SurfaceUserData::from_wl(surface);
let window_id = surface_data.window_id;
WaylandConnection::with_window_inner(window_id, |inner| {
inner.next_frame_is_ready();
Ok(())
});
}
}
+8 -7
View File
@@ -547,16 +547,10 @@ impl WaylandWindowInner {
let conn = WaylandConnection::get().unwrap().wayland();
let qh = conn.event_queue.borrow().handle();
// TODO: is this the current udata to pass in?, just following examples
let callback = self.surface().frame(&qh, self.surface().clone());
log::trace!("do_paint - callback: {:?}", callback);
// callback.quick_assign(move |_source, _event, _data| {
// WaylandConnection::with_window_inner(window_id, |inner| {
// inner.next_frame_is_ready();
// Ok(())
// });
// });
self.frame_callback.replace(callback);
// The repaint has the side of effect of committing the surface,
@@ -576,6 +570,13 @@ impl WaylandWindowInner {
.expect("Window should exist")
.wl_surface()
}
pub(crate) fn next_frame_is_ready(&mut self) {
self.frame_callback.take();
if self.invalidated {
self.do_paint().ok();
}
}
}
unsafe impl HasRawDisplayHandle for WaylandWindowInner {