wayland: Implement cosmic-a11y-v1
This commit is contained in:
parent
7af3650b83
commit
c45a58c16c
8 changed files with 223 additions and 22 deletions
38
src/wayland/handlers/a11y.rs
Normal file
38
src/wayland/handlers/a11y.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
use crate::{
|
||||
state::State,
|
||||
wayland::protocols::a11y::{delegate_a11y, A11yHandler, A11yState},
|
||||
};
|
||||
|
||||
impl A11yHandler for State {
|
||||
fn a11y_state(&mut self) -> &mut A11yState {
|
||||
&mut self.common.a11y_state
|
||||
}
|
||||
|
||||
fn request_screen_magnifier(&mut self, enabled: bool) {
|
||||
let mut shell = self.common.shell.write().unwrap();
|
||||
|
||||
if shell
|
||||
.zoom_state()
|
||||
.is_some_and(|state| state.current_level() != 1.0)
|
||||
!= enabled
|
||||
{
|
||||
let seat = shell.seats.last_active().clone();
|
||||
let level = if enabled {
|
||||
self.common.config.dynamic_conf.zoom_state().last_level
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let zoom_config = &self.common.config.cosmic_conf.accessibility_zoom;
|
||||
|
||||
shell.trigger_zoom(
|
||||
&seat,
|
||||
level,
|
||||
zoom_config,
|
||||
true,
|
||||
&self.common.event_loop_handle,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delegate_a11y!(State);
|
||||
Loading…
Add table
Add a link
Reference in a new issue