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:
Samuel Onoja committed 2026-09-29 09:49:04 +01:00
1 parent 391f6b4e37
commit 67192c0c04
25 files changed
+886 -700

No files matched your search

+11 -9
View File
@@ -92,6 +92,14 @@ pub(crate) fn init_font_loader(
Ok(())
}
type OverviewStateLabel = HashMap<
(String, u64, [u32; 4]),
(
MemoryRenderBuffer,
smithay::utils::Size<i32, smithay::utils::Buffer>,
),
>;
#[derive(Debug)]
pub(crate) struct OverviewState {
active: bool,
@@ -103,13 +111,7 @@ pub(crate) struct OverviewState {
font_family: String,
font_requests: Option<FontRequests>,
font: Option<FontArc>,
labels: HashMap<
(String, u64, [u32; 4]),
(
MemoryRenderBuffer,
smithay::utils::Size<i32, smithay::utils::Buffer>,
),
>,
labels: OverviewStateLabel,
}
impl Default for OverviewState {
@@ -480,6 +482,7 @@ impl Ferese {
let selected = self
.window_under_visual(point)
.and_then(|w| self.window_ids.get(&w).copied());
if selected.is_some() && self.overview.selected != selected {
self.overview.selected = selected;
crate::backends::direct::render_all(self);
@@ -655,8 +658,7 @@ impl Ferese {
let card_width =
((strip.width - 24.0 - WORKSPACE_CARD_GAP * capacity.saturating_sub(1) as f64)
/ capacity as f64)
.min(160.0)
.max(1.0);
.clamp(1.0, 160.0);
let visible_count = workspaces.len().saturating_sub(offset).min(capacity);
let start_x = centered_row_start(strip, visible_count, card_width);
workspaces