1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 14:54:16 +03:00

A window renders now

This commit is contained in:
Timmy Xiao 2024-01-07 02:07:30 -05:00 committed by Wez Furlong
parent 9e14a4c929
commit 4ce398bc19
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 15 additions and 8 deletions

View File

@ -206,7 +206,13 @@ impl CompositorHandler for WaylandState {
time: u32, time: u32,
) { ) {
log::trace!("frame: CompositorHandler"); 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(())
});
} }
} }

View File

@ -547,16 +547,10 @@ impl WaylandWindowInner {
let conn = WaylandConnection::get().unwrap().wayland(); let conn = WaylandConnection::get().unwrap().wayland();
let qh = conn.event_queue.borrow().handle(); 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()); let callback = self.surface().frame(&qh, self.surface().clone());
log::trace!("do_paint - callback: {:?}", callback); 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); self.frame_callback.replace(callback);
// The repaint has the side of effect of committing the surface, // The repaint has the side of effect of committing the surface,
@ -576,6 +570,13 @@ impl WaylandWindowInner {
.expect("Window should exist") .expect("Window should exist")
.wl_surface() .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 { unsafe impl HasRawDisplayHandle for WaylandWindowInner {