🔒 Repository is read-only – file editing is disabled.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
use crate::{grabs::resize_grab, state::ClientState, Smallvil};
use smithay::{
backend::renderer::utils::on_commit_buffer_handler,
delegate_compositor, delegate_shm,
reexports::wayland_server::{
protocol::{wl_buffer, wl_surface::WlSurface},
Client,
},
wayland::{
buffer::BufferHandler,
compositor::{
get_parent, is_sync_subsurface, CompositorClientState, CompositorHandler, CompositorState,
},
shm::{ShmHandler, ShmState},
},
};
use super::xdg_shell;
impl CompositorHandler for Smallvil {
fn compositor_state(&mut self) -> &mut CompositorState {
&mut self.compositor_state
}
fn client_compositor_state<'a>(&self, client: &'a Client) -> &'a CompositorClientState {
&client.get_data::<ClientState>().unwrap().compositor_state
}
fn commit(&mut self, surface: &WlSurface) {
on_commit_buffer_handler::<Self>(surface);
if !is_sync_subsurface(surface) {
let mut root = surface.clone();
while let Some(parent) = get_parent(&root) {
root = parent;
}
if let Some(window) = self
.space
.elements()
.find(|w| w.toplevel().unwrap().wl_surface() == &root)
{
window.on_commit();
}
};
xdg_shell::handle_commit(&mut self.popups, &self.space, surface);
resize_grab::handle_commit(&mut self.space, surface);
}
}
impl BufferHandler for Smallvil {
fn buffer_destroyed(&mut self, _buffer: &wl_buffer::WlBuffer) {}
}
impl ShmHandler for Smallvil {
fn shm_state(&self) -> &ShmState {
&self.shm_state
}
}
delegate_compositor!(Smallvil);
delegate_shm!(Smallvil);