seat: implement input methods
This commit is contained in:
parent
5e2cdef388
commit
daf52299db
44 changed files with 2165 additions and 75 deletions
50
src/it/test_ifs/test_input_method_manager.rs
Normal file
50
src/it/test_ifs/test_input_method_manager.rs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{
|
||||
test_error::TestResult,
|
||||
test_ifs::{test_input_method::TestInputMethod, test_seat::TestSeat},
|
||||
test_object::TestObject,
|
||||
test_transport::TestTransport,
|
||||
},
|
||||
wire::{zwp_input_method_manager_v2::GetInputMethod, ZwpInputMethodManagerV2Id},
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct TestInputMethodManager {
|
||||
pub id: ZwpInputMethodManagerV2Id,
|
||||
pub tran: Rc<TestTransport>,
|
||||
}
|
||||
|
||||
impl TestInputMethodManager {
|
||||
pub fn new(tran: &Rc<TestTransport>) -> Self {
|
||||
Self {
|
||||
id: tran.id(),
|
||||
tran: tran.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_input_method(&self, seat: &TestSeat) -> TestResult<Rc<TestInputMethod>> {
|
||||
let obj = Rc::new(TestInputMethod {
|
||||
id: self.tran.id(),
|
||||
tran: self.tran.clone(),
|
||||
destroyed: Cell::new(false),
|
||||
activate: Rc::new(Default::default()),
|
||||
done: Rc::new(Default::default()),
|
||||
done_received: Default::default(),
|
||||
});
|
||||
self.tran.add_obj(obj.clone())?;
|
||||
self.tran.send(GetInputMethod {
|
||||
self_id: self.id,
|
||||
seat: seat.id,
|
||||
input_method: obj.id,
|
||||
})?;
|
||||
Ok(obj)
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestInputMethodManager, ZwpInputMethodManagerV2;
|
||||
}
|
||||
|
||||
impl TestObject for TestInputMethodManager {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue