diff --git a/src/wayland/wl_registry.rs b/src/wayland/wl_registry.rs index 33feabc..43763f1 100644 --- a/src/wayland/wl_registry.rs +++ b/src/wayland/wl_registry.rs @@ -19,12 +19,12 @@ impl WlClient { self.wl_compositor_create_surface()?; self.layer_shell_get_layer_surface()?; - self.layer_surface_set_size(800, 800)?; + self.layer_surface_set_size(18, 5)?; self.layer_surface_set_keyboard_interactivity()?; self.wl_surface_commit()?; - self.wl_shm_create_pool(800, 800)?; - self.wl_shm_pool_create_buffer(0, 800, 800)?; + self.wl_shm_create_pool(18, 5)?; + self.wl_shm_pool_create_buffer(0, 18, 5)?; Ok(()) } diff --git a/src/wayland/wl_shm.rs b/src/wayland/wl_shm.rs index ddd5a1f..368ac5b 100644 --- a/src/wayland/wl_shm.rs +++ b/src/wayland/wl_shm.rs @@ -12,10 +12,13 @@ impl WlClient { pub fn wl_shm_create_pool(&mut self, width: usize, height: usize) -> Result<(), Box> { self.current_id += 1; self.shm_pool = Some(shm::ShmPool::new(width, height, self.current_id)?); - self.shm_pool.as_mut().unwrap().write(&vec![0xffff0000; width * height], 0); - self.shm_pool.as_mut().unwrap().rectangle(50, 50, 50, 50, 0xff00ff00); - self.shm_pool.as_mut().unwrap().circle(300, 300, 200, 0xff0000ff); - self.shm_pool.as_mut().unwrap().rounded_rectangle(450, 400, 60, 40, 16, 0xffffff00); + let mut grid: Vec = vec![0xffffffff; width * height]; + for (pos, color) in grid.iter_mut().enumerate() { + if (pos & 1) == 0 { + *color = 0xff000000; + } + } + self.shm_pool.as_mut().unwrap().write(&grid, 0); let object = self.shm_id.ok_or(UnsetErr("shm_id".to_string()))?; const OPCODE: u16 = 0;