1
0
Fork 0
forked from wry/wry

it: test cursor-shape protocol

This commit is contained in:
Julian Orth 2024-04-02 20:06:13 +02:00
parent 9c8131e145
commit 6448a14fb1
10 changed files with 154 additions and 2 deletions

View file

@ -5,7 +5,8 @@ use {
it::{
test_error::TestError,
test_ifs::{
test_compositor::TestCompositor, test_data_device_manager::TestDataDeviceManager,
test_compositor::TestCompositor, test_cursor_shape_manager::TestCursorShapeManager,
test_data_device_manager::TestDataDeviceManager,
test_ext_foreign_toplevel_list::TestExtForeignToplevelList,
test_jay_compositor::TestJayCompositor, test_shm::TestShm,
test_single_pixel_buffer_manager::TestSinglePixelBufferManager,
@ -42,6 +43,7 @@ pub struct TestRegistrySingletons {
pub xdg_activation_v1: u32,
pub ext_foreign_toplevel_list_v1: u32,
pub wl_data_device_manager: u32,
pub wp_cursor_shape_manager_v1: u32,
}
pub struct TestRegistry {
@ -59,6 +61,7 @@ pub struct TestRegistry {
pub activation: CloneCell<Option<Rc<TestXdgActivation>>>,
pub foreign_toplevel_list: CloneCell<Option<Rc<TestExtForeignToplevelList>>>,
pub data_device_manager: CloneCell<Option<Rc<TestDataDeviceManager>>>,
pub cursor_shape_manager: CloneCell<Option<Rc<TestCursorShapeManager>>>,
pub seats: CopyHashMap<GlobalName, Rc<WlSeatGlobal>>,
}
@ -111,6 +114,7 @@ impl TestRegistry {
xdg_activation_v1,
ext_foreign_toplevel_list_v1,
wl_data_device_manager,
wp_cursor_shape_manager_v1,
};
self.singletons.set(Some(singletons.clone()));
Ok(singletons)
@ -256,6 +260,20 @@ impl TestRegistry {
Ok(jc)
}
pub async fn get_cursor_shape_manager(&self) -> Result<Rc<TestCursorShapeManager>, TestError> {
singleton!(self.cursor_shape_manager);
let singletons = self.get_singletons().await?;
singleton!(self.cursor_shape_manager);
let jc = Rc::new(TestCursorShapeManager {
id: self.tran.id(),
tran: self.tran.clone(),
destroyed: Cell::new(false),
});
self.bind(&jc, singletons.wp_cursor_shape_manager_v1, 1)?;
self.cursor_shape_manager.set(Some(jc.clone()));
Ok(jc)
}
pub fn bind<O: TestObject>(
&self,
obj: &Rc<O>,