diff --git a/src/wayland/buffer.rs b/src/wayland/buffer.rs index 6dd732a..3f05aac 100644 --- a/src/wayland/buffer.rs +++ b/src/wayland/buffer.rs @@ -108,15 +108,17 @@ impl AppData { ); Buffer { - backing: Arc::new(Shmbuf { - fd, - offset: 0, - width: buffer_info.width as i32, - height: buffer_info.height as i32, - stride: buffer_info.stride as i32, - format, - } - .into()), + backing: Arc::new( + Shmbuf { + fd, + offset: 0, + width: buffer_info.width as i32, + height: buffer_info.height as i32, + stride: buffer_info.stride as i32, + format, + } + .into(), + ), buffer, buffer_info: buffer_info.clone(), node: None, @@ -203,13 +205,16 @@ impl AppData { .0; Ok(Some(Buffer { - backing: Arc::new(Dmabuf { - width: buffer_info.width as i32, - height: buffer_info.height as i32, - planes, - format: buffer_info.format, - modifier: modifier.into(), - }.into()), + backing: Arc::new( + Dmabuf { + width: buffer_info.width as i32, + height: buffer_info.height as i32, + planes, + format: buffer_info.format, + modifier: modifier.into(), + } + .into(), + ), buffer, buffer_info: buffer_info.clone(), node: Some(node.clone()), diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index c29860f..a8e991a 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -262,7 +262,10 @@ fn start(conn: Connection) -> mpsc::Receiver { dmabuf_feedback: None, gbm: None, scheduler, - executor: futures::executor::ThreadPool::builder().pool_size(1).create().unwrap(), + executor: futures::executor::ThreadPool::builder() + .pool_size(1) + .create() + .unwrap(), }; app_data.send_event(Event::Seats(app_data.seat_state.seats().collect())); diff --git a/src/wayland/screencopy.rs b/src/wayland/screencopy.rs index a756807..267f13a 100644 --- a/src/wayland/screencopy.rs +++ b/src/wayland/screencopy.rs @@ -24,7 +24,7 @@ pub struct ScreencopySession { first_frame: bool, // Future signaled when buffer is signaled. // if triple buffer is used, will need more than one. - release: Option + release: Option, } impl ScreencopySession { @@ -159,23 +159,18 @@ impl ScreencopyHandler for AppData { let capture_clone = capture.clone(); let conn = conn.clone(); let release = session.release.take(); - //dbg!("schedule"); - self.scheduler.schedule(async move { - //self.executor.spawn_ok(async move { - let time = std::time::Instant::now(); - //dbg!(release.is_some()); + //self.scheduler.schedule(async move { + self.executor.spawn_ok(async move { if let Some(release) = release { - // Wait for buffer to be released by server + // Wait for buffer to be released by server release.await; } - // futures_timer::Delay::new(std::time::Duration::from_secs_f64(1. / 60.).saturating_sub(time.elapsed())).await; - futures_timer::Delay::new(std::time::Duration::from_secs_f64(1. / 60.).saturating_sub(time.elapsed())).await; let mut session = capture_clone.session.lock().unwrap(); let Some(session) = session.as_mut() else { return; }; session.attach_buffer_and_commit(&capture_clone, &conn); - });//.unwrap(); + }); //.unwrap(); let front = session.buffers.as_mut().unwrap().first_mut().unwrap(); let (buffer, release) = SubsurfaceBuffer::new(front.backing.clone());