pub fn create(pool: &wl::Main<WlShmPool>, idx: usize, width: i32, height: i32) -> Self {
        let offset = i32::try_from(idx).unwrap() * width * height * PIXEL_WIDTH;
        let stride = width * PIXEL_WIDTH;
        let inner = pool.create_buffer(offset, width, height, stride, wl_shm::Format::Argb8888);
        let in_use = Rc::new(Cell::new(false));

        inner.quick_assign(with_cloned!(in_use; move |b, event, _dispatchdata| {
            tracing::trace!("buffer event: {:?} {:?}", b, event);
            match event {
                wl_buffer::Event::Release => {
                    in_use.set(false);
                }
                _ => tracing::warn!("unhandled wayland buffer event: {:?} {:?}", b, event),
            }
        }));

        Buffer { inner, in_use }
    }
/// Create a new buffer using the given backing storage. It is the responsibility of the caller
/// to ensure buffers don't overlap, and the backing storage has enough space.
// Window handle is needed for the callback.
Create a new buffer using the given backing storage. It is the responsibility of the caller
to ensure buffers don't overlap, and the backing storage has enough space.
Window handle is needed for the callback.
Create a new buffer using the given backing storage . It is the responsibility of the caller to ensure buffers don ' t overlap and the backing storage has enough space . Window handle is needed for the callback .
pub fn create(pool: &wl::Main<WlShmPool>, idx: usize, width: i32, height: i32) -> Self {
        let offset = i32::try_from(idx).unwrap() * width * height * PIXEL_WIDTH;
        let stride = width * PIXEL_WIDTH;
        let inner = pool.create_buffer(offset, width, height, stride, wl_shm::Format::Argb8888);
        let in_use = Rc::new(Cell::new(false));
        inner.quick_assign(with_cloned!(in_use; move |b, event, _dispatchdata| {
            tracing::trace!("buffer event: {:?} {:?}", b, event);
            match event {
                wl_buffer::Event::Release => {
                    in_use.set(false);
                }
                _ => tracing::warn!("unhandled wayland buffer event: {:?} {:?}", b, event),
            }
        }));
        Buffer { inner, in_use }
    }
pub fn create ( pool : & wl :: Main < WlShmPool > , idx : usize , width : i32 , height : i32 ) -> Self { let offset = i32 :: try_from ( idx ) . unwrap ( ) * width * height * PIXEL_WIDTH ; let stride = width * PIXEL_WIDTH ; let inner = pool . create_buffer ( offset , width , height , stride , wl_shm :: Format :: Argb8888 ) ; let in_use = Rc :: new ( Cell :: new ( false ) ) ; inner . quick_assign ( with_cloned ! ( in_use move b event _dispatchdata { tracing trace ( " " b event ) match event { wl_buffer Event Release { in_use set ( false ) } tracing warn ( " " b event ) } } ) ) ; Buffer { inner , in_use } }
Create a new buffer using the given backing storage.
Create a new buffer using the given backing storage .
pool
&wl::Main<WlShmPool>
idx
usize
width
i32
height
i32
pool
&wl::Main<WlShmPool>
idx
usize
width
i32
height
i32