use cross::mem::FileMapping;
use uipc::PeerAddress;

pub struct Window<'d> {
    pub wid: u32,
    pub peer: PeerAddress,

    pub surface_mapping: FileMapping,
    pub surface_data: &'d [u32],
}

impl Window<'_> {
    pub fn resize(&mut self, w: u32, h: u32) {
        let new_surface_data = unsafe {
            std::slice::from_raw_parts_mut(
                self.surface_mapping.as_mut_ptr() as *mut u32,
                (w * h) as usize,
            )
        };

        self.surface_data = new_surface_data;
    }
}
