seat: implement input methods
This commit is contained in:
parent
5e2cdef388
commit
daf52299db
44 changed files with 2165 additions and 75 deletions
|
|
@ -1,37 +1,24 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{
|
||||
test_error::{TestError, TestResult},
|
||||
test_ifs::{
|
||||
test_single_pixel_buffer_manager::TestSinglePixelBufferManager,
|
||||
test_surface::TestSurface, test_viewport::TestViewport,
|
||||
test_xdg_surface::TestXdgSurface, test_xdg_toplevel::TestXdgToplevel,
|
||||
},
|
||||
},
|
||||
theme::Color,
|
||||
crate::it::{
|
||||
test_error::{TestError, TestResult},
|
||||
test_ifs::{test_xdg_surface::TestXdgSurface, test_xdg_toplevel::TestXdgToplevel},
|
||||
test_utils::test_surface_ext::TestSurfaceExt,
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct TestWindow {
|
||||
pub surface: Rc<TestSurface>,
|
||||
pub spbm: Rc<TestSinglePixelBufferManager>,
|
||||
pub viewport: Rc<TestViewport>,
|
||||
pub surface: TestSurfaceExt,
|
||||
pub xdg: Rc<TestXdgSurface>,
|
||||
pub tl: Rc<TestXdgToplevel>,
|
||||
pub color: Cell<Color>,
|
||||
}
|
||||
|
||||
impl TestWindow {
|
||||
pub async fn map(&self) -> Result<(), TestError> {
|
||||
let buffer = self.spbm.create_buffer(self.color.get())?;
|
||||
self.surface.attach(buffer.id)?;
|
||||
self.viewport.set_source(0, 0, 1, 1)?;
|
||||
self.viewport
|
||||
.set_destination(self.tl.core.width.get(), self.tl.core.height.get())?;
|
||||
self.xdg.ack_configure(self.xdg.last_serial.get())?;
|
||||
self.surface.commit()?;
|
||||
self.surface.tran.sync().await;
|
||||
self.surface
|
||||
.map(self.tl.core.width.get(), self.tl.core.height.get())
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -40,8 +27,7 @@ impl TestWindow {
|
|||
self.map().await
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn set_color(&self, r: u8, g: u8, b: u8, a: u8) {
|
||||
self.color.set(Color::from_rgba_straight(r, g, b, a));
|
||||
self.surface.set_color(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue