wayland: Add support for cosmic-a11y version 2
This commit is contained in:
parent
fc43b25421
commit
a748ea885e
2 changed files with 129 additions and 9 deletions
|
|
@ -1,4 +1,7 @@
|
|||
use tracing::warn;
|
||||
|
||||
use crate::{
|
||||
config::ColorFilter,
|
||||
state::State,
|
||||
wayland::protocols::a11y::{delegate_a11y, A11yHandler, A11yState},
|
||||
};
|
||||
|
|
@ -33,6 +36,30 @@ impl A11yHandler for State {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn request_screen_invert(&mut self, inverted: bool) {
|
||||
let mut config = self.common.config.dynamic_conf.screen_filter_mut();
|
||||
let mut updated = (*config).clone();
|
||||
updated.inverted = inverted;
|
||||
if let Err(err) = self.backend.update_screen_filter(&updated) {
|
||||
warn!("Failed to apply screen color invert: {}", err);
|
||||
} else {
|
||||
*config = updated;
|
||||
self.common.a11y_state.set_screen_inverted(inverted);
|
||||
}
|
||||
}
|
||||
|
||||
fn request_screen_filter(&mut self, filter: Option<ColorFilter>) {
|
||||
let mut config = self.common.config.dynamic_conf.screen_filter_mut();
|
||||
let mut updated = (*config).clone();
|
||||
updated.color_filter = filter;
|
||||
if let Err(err) = self.backend.update_screen_filter(&updated) {
|
||||
warn!("Failed to apply screen color filter: {}", err);
|
||||
} else {
|
||||
*config = updated;
|
||||
self.common.a11y_state.set_screen_filter(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate_a11y!(State);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue