Speed up per-frame layout, hit testing, and stacking paths
Split ScrollingLayout validation so the per-frame geometry solve only checks scalars and keeps the full tree validation behind debug_assert, removing a HashSet build from every frame. Replace the per-region Vec in decode_regions with a stack array via as_chunks, and skip the window hit test in PointerMotion when Overview is not presenting, where visual_scale_for_window returns 1.0 regardless. Guard sync_window_stacking behind a check that the space already matches the target order with uniform z_index, avoiding an O(n^2) raise_element loop on every redraw. Narrow window_under_visual to the space iterator outside Overview, keeping the collected and sorted candidate list for the Overview branch where front-to-back order is load-bearing. Raise rust-version to 1.98 and clear the resulting Clippy findings across the workspace: let-chain collapses, clamp, and while-let loops.
This commit is contained in:
1 parent
391f6b4e37
commit
67192c0c04
25 files changed
+886
-700
No files matched your search
@@ -274,10 +274,8 @@ impl cosmic::Application for App {
|
||||
|result| cosmic::Action::App(Message::LockPreviewStarted(result)),
|
||||
);
|
||||
}
|
||||
Message::LockPreviewStarted(result) => {
|
||||
if let Err(error) = result {
|
||||
self.error = Some(error);
|
||||
}
|
||||
Message::LockPreviewStarted(Err(error)) => {
|
||||
self.error = Some(error);
|
||||
}
|
||||
Message::Page(page) => {
|
||||
self.page = page;
|
||||
@@ -1286,16 +1284,16 @@ impl App {
|
||||
// When a gradient exists, changing Accent also changes its
|
||||
// leading stop; otherwise the visible focus border would stay
|
||||
// on the old palette despite the control saying it changed.
|
||||
if let Edit::Set(path, value) = &edit {
|
||||
if path == "theme.colors.accent"
|
||||
&& self.draft.item("theme.focus_ring.gradient").is_some()
|
||||
{
|
||||
let gradient = set("theme.focus_ring.gradient.from", value.clone());
|
||||
if self.draft.edit(&gradient).is_ok() {
|
||||
self.pending.push(gradient);
|
||||
}
|
||||
if let Edit::Set(path, value) = &edit
|
||||
&& path == "theme.colors.accent"
|
||||
&& self.draft.item("theme.focus_ring.gradient").is_some()
|
||||
{
|
||||
let gradient = set("theme.focus_ring.gradient.from", value.clone());
|
||||
if self.draft.edit(&gradient).is_ok() {
|
||||
self.pending.push(gradient);
|
||||
}
|
||||
}
|
||||
|
||||
self.pending.push(edit);
|
||||
self.error = None;
|
||||
self.flush()
|
||||
|
||||
@@ -451,7 +451,12 @@ pub fn preview(snapshot: &Snapshot) -> Element<'static, Message> {
|
||||
let bar_height = snapshot.number("theme.geometry.top_bar_height", 30.) * 0.65;
|
||||
let bar_radius = snapshot.number("theme.geometry.shell_radius", 14.) * 0.65;
|
||||
let opacity = if snapshot.string("theme.material.style", "solid") == "translucent" {
|
||||
snapshot.number("theme.material.opacity", ferese_config::DEFAULT_MATERIAL_OPACITY).clamp(0., 1.)
|
||||
snapshot
|
||||
.number(
|
||||
"theme.material.opacity",
|
||||
ferese_config::DEFAULT_MATERIAL_OPACITY,
|
||||
)
|
||||
.clamp(0., 1.)
|
||||
} else {
|
||||
1.
|
||||
};
|
||||
@@ -556,11 +561,12 @@ mod tests {
|
||||
fn default_uses_logo_blue_and_native_controls_follow_lightness() {
|
||||
let logo = include_str!("../../../packaging/icons/ferese.svg").to_ascii_uppercase();
|
||||
assert!(logo.contains(PRESETS[0].accent));
|
||||
for index in 0..PRESETS.len() {
|
||||
|
||||
for (index, item) in PRESETS.iter().enumerate() {
|
||||
let snapshot = configured_preset(index);
|
||||
assert_eq!(
|
||||
native_theme(Some(&snapshot)).cosmic().is_dark,
|
||||
PRESETS[index].name != "Ayu Light"
|
||||
item.name != "Ayu Light"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user