wayland: implement alpha_modifier_v1
This commit is contained in:
parent
131f0481e8
commit
ff54a8ab96
37 changed files with 655 additions and 89 deletions
41
src/it/test_ifs/test_alpha_modifier_surface.rs
Normal file
41
src/it/test_ifs/test_alpha_modifier_surface.rs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{test_error::TestError, test_object::TestObject, test_transport::TestTransport},
|
||||
wire::{wp_alpha_modifier_surface_v1::*, WpAlphaModifierSurfaceV1Id},
|
||||
},
|
||||
std::{cell::Cell, rc::Rc},
|
||||
};
|
||||
|
||||
pub struct TestAlphaModifierSurface {
|
||||
pub id: WpAlphaModifierSurfaceV1Id,
|
||||
pub tran: Rc<TestTransport>,
|
||||
pub destroyed: Cell<bool>,
|
||||
}
|
||||
|
||||
impl TestAlphaModifierSurface {
|
||||
pub fn destroy(&self) -> Result<(), TestError> {
|
||||
if !self.destroyed.replace(true) {
|
||||
self.tran.send(Destroy { self_id: self.id })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_multiplier(&self, factor: f64) -> Result<(), TestError> {
|
||||
self.tran.send(SetMultiplier {
|
||||
self_id: self.id,
|
||||
factor: (factor * u32::MAX as f64) as u32,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestAlphaModifierSurface {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
test_object! {
|
||||
TestAlphaModifierSurface, WpAlphaModifierSurfaceV1;
|
||||
}
|
||||
|
||||
impl TestObject for TestAlphaModifierSurface {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue