fix(a11y): close magnifier overlay and sync view moves
This commit is contained in:
parent
e2efacd3f8
commit
9795cf9c31
4 changed files with 79 additions and 3 deletions
|
|
@ -39,6 +39,8 @@ use cosmic::{
|
|||
settings, text_input,
|
||||
},
|
||||
};
|
||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
||||
use cosmic_comp_config::CosmicCompConfig;
|
||||
#[cfg(feature = "wayland")]
|
||||
use cosmic_panel_config::CosmicPanelConfig;
|
||||
use cosmic_settings_page::{self as page, section};
|
||||
|
|
@ -163,6 +165,8 @@ pub enum Message {
|
|||
PageMessage(crate::pages::Message),
|
||||
#[cfg(feature = "wayland")]
|
||||
PanelConfig(CosmicPanelConfig),
|
||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
||||
CompConfig(CosmicCompConfig),
|
||||
SearchActivate,
|
||||
SearchChanged(String),
|
||||
SearchClear,
|
||||
|
|
@ -343,6 +347,16 @@ impl cosmic::Application for SettingsApp {
|
|||
Message::PanelConfig(update.config)
|
||||
}),
|
||||
page.subscription(self.core()).map(Message::PageMessage),
|
||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
||||
self.core()
|
||||
.watch_config::<CosmicCompConfig>("com.system76.CosmicComp")
|
||||
.map(|update| {
|
||||
for why in update.errors {
|
||||
tracing::error!(?why, "comp config load error");
|
||||
}
|
||||
|
||||
Message::CompConfig(update.config)
|
||||
}),
|
||||
];
|
||||
|
||||
Subscription::batch(subscriptions)
|
||||
|
|
@ -754,6 +768,41 @@ impl cosmic::Application for SettingsApp {
|
|||
return Task::batch(tasks);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
||||
Message::CompConfig(comp_config) => {
|
||||
let mut tasks = Vec::new();
|
||||
|
||||
#[cfg(feature = "page-window-management")]
|
||||
if let Some(page) = self
|
||||
.pages
|
||||
.page_mut::<crate::pages::desktop::window_management::Page>()
|
||||
{
|
||||
tasks.push(
|
||||
page.update(
|
||||
crate::pages::desktop::window_management::Message::CompConfigUpdate(
|
||||
comp_config.clone(),
|
||||
),
|
||||
)
|
||||
.map(Into::into),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "page-accessibility")]
|
||||
if let Some(page) = self.pages.page_mut::<accessibility::magnifier::Page>() {
|
||||
tasks.push(
|
||||
page.update(
|
||||
self.active_page,
|
||||
crate::pages::accessibility::magnifier::Message::CompConfigUpdate(
|
||||
comp_config.clone(),
|
||||
),
|
||||
)
|
||||
.map(Into::into),
|
||||
);
|
||||
}
|
||||
|
||||
return Task::batch(tasks);
|
||||
}
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
Message::PanelConfig(_) => {}
|
||||
#[cfg(feature = "wayland")]
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ pub struct Page {
|
|||
#[derive(Debug, Clone)]
|
||||
pub enum Message {
|
||||
Event(wayland::AccessibilityEvent),
|
||||
CompConfigUpdate(cosmic_comp_config::CosmicCompConfig),
|
||||
ProtocolUnavailable,
|
||||
SetMagnifier(bool),
|
||||
SetMouseShortcuts(bool),
|
||||
|
|
@ -339,6 +340,23 @@ impl Page {
|
|||
message: Message,
|
||||
) -> cosmic::iced::Task<crate::app::Message> {
|
||||
match message {
|
||||
Message::CompConfigUpdate(comp_config) => {
|
||||
if self.zoom_config.show_overlay != comp_config.accessibility_zoom.show_overlay {
|
||||
self.zoom_config.show_overlay = comp_config.accessibility_zoom.show_overlay;
|
||||
}
|
||||
if self.zoom_config.increment != comp_config.accessibility_zoom.increment {
|
||||
self.zoom_config.increment = comp_config.accessibility_zoom.increment;
|
||||
|
||||
self.increment_idx = self.increment_values.iter().position(|s| {
|
||||
s.split('%').next().and_then(|val| str::parse(val).ok())
|
||||
== Some(self.zoom_config.increment)
|
||||
});
|
||||
}
|
||||
|
||||
if self.zoom_config.view_moves != comp_config.accessibility_zoom.view_moves {
|
||||
self.zoom_config.view_moves = comp_config.accessibility_zoom.view_moves;
|
||||
}
|
||||
}
|
||||
Message::Event(AccessibilityEvent::Magnifier(value)) => {
|
||||
self.magnifier_state = value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use cosmic::{
|
|||
widget::{self, settings, toggler},
|
||||
};
|
||||
|
||||
use cosmic_comp_config::CosmicCompConfig;
|
||||
use cosmic_config::{ConfigGet, ConfigSet};
|
||||
use cosmic_settings_config::{Action, Binding, Shortcuts, shortcuts};
|
||||
use cosmic_settings_page::Section;
|
||||
|
|
@ -19,6 +20,7 @@ use tracing::error;
|
|||
#[derive(Clone, Debug)]
|
||||
pub enum Message {
|
||||
SuperKey(usize),
|
||||
CompConfigUpdate(CosmicCompConfig),
|
||||
SetFocusFollowsCursor(bool),
|
||||
SaveFocusFollowsCursorDelay(bool),
|
||||
SetFocusFollowsCursorDelay(String),
|
||||
|
|
@ -182,6 +184,11 @@ impl Page {
|
|||
error!(?err, "Failed to set config 'active_hint'");
|
||||
}
|
||||
}
|
||||
Message::CompConfigUpdate(comp_config) => {
|
||||
if comp_config.active_hint != self.show_active_hint {
|
||||
self.show_active_hint = comp_config.active_hint;
|
||||
}
|
||||
}
|
||||
Message::SetEdgeSnapThreshold(value) => {
|
||||
self.edge_snap_threshold = value;
|
||||
if let Err(err) = self.comp_config.set("edge_snap_threshold", value) {
|
||||
|
|
|
|||
|
|
@ -404,7 +404,9 @@ fn get_lspci_gpu_names() -> HashMap<u32, String> {
|
|||
// Extract the GPU name between ": " and the last "["
|
||||
if let Some(name_start) = line.find(": ") {
|
||||
let full_name = line[name_start + 2..ids_start].trim();
|
||||
let gpu_name = full_name.replace(" Corporation", "").replace(" [Intel Graphics]", "");
|
||||
let gpu_name = full_name
|
||||
.replace(" Corporation", "")
|
||||
.replace(" [Intel Graphics]", "");
|
||||
if !gpu_name.is_empty() {
|
||||
gpu_map.insert(device_id, gpu_name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue