Repository navigation
fix(linux): redraw windows when late fallback preference reads resolve and sync preference tests on condvar - #2128
Merged
Merged
Conversation
…e and sync preference tests on condvar
Hona
added a commit
that referenced
this pull request
Nov 25, 2026
…une and procwatch (#2370) A feature-set warning sweep across Linux, macOS, Windows, and wasm32 found eight dead-code warnings under optional and non-default feature sets: - `crates/rune/src/open_path.rs:203` (`file_uri_from_bytes`, added in #1947): used on Unix only under `feature = "dbus"` (FileManager1) and tests; gate with `feature = "dbus"` alongside `test`. - `crates/rune/src/platform/preferences.rs:77` (`DEFAULT_DOUBLE_CLICK_SECS`, added in #1923/#2128): used on Linux only under `feature = "dbus"` and tests; gate with `all(target_os = "linux", feature = "dbus")` alongside `test`. - `crates/rune/src/window/titlebar/linux.rs:82` (`Sides::ALL`, added in #2244): used only in `linux_tests.rs`; gate with `#[cfg(test)]`. - `crates/rune/src/frame/live_log.rs:33` (`CAPTURED` / `capture_frames`, added in #2309): used only in `window/win32/resize_sync/tests.rs` under `frame-profile`; gate with `#[cfg(all(test, target_os = "windows"))]`. - `crates/procwatch/src/alloc/sites.rs:222,271,413,418` (`report`, `unsampled`, `os::modules`, `os::nt_heaps`, added in #744): `alloc-sites` sampling and dumper are Windows-only; gate the implementation behind `#[cfg(windows)]` with clean `#[cfg(not(windows))]` no-op stubs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Platform audit of
reduced_motion()anddouble_click_interval():CachedReducedMotion/CachedDoubleClick(macOS readsNSWorkspace/NSEventsynchronously with liveNSWorkspaceAccessibilityDisplayOptionsDidChangeNotification; Windows readsSystemParametersInfoW/GetDoubleClickTimesynchronously; Web receivesmatchMediaevents).dbus(default):portal_appearance.rswaits up to 100 ms at launch, then updates atomics and callsredraw_windows()when a late answer arrives so open windows immediately rereadpreferences::reduced_motion()andpreferences::double_click_interval().dbus(--no-default-features):CachedReducedMotion(fix(linux): follow Settings portal reduced-motion off the UI thread and cache fallback #1766) andCachedDoubleClick(feat(linux): read double-click interval from XDG Settings portal with kdeglobals and GSettings fallback #1923) incrates/rune/src/platform/preferences.rswaited 100 ms (FIRST_ANSWER) and returned the default (false/0.5 s) on timeout. When the worker finished late, it wrote the real value into its atomic (so a later redraw/focus change would read it), but never notified open windows or overlays to redraw—leaving an idle window on the default until an unrelated redraw or focus change.crates/rune/src/platform/preferences_tests.rs,cached_fallback_reads_once_off_the_calling_threadandcached_double_click_fallback_reads_once_off_the_calling_threadasserted the worker's answer on the firstget_or_initcall without waiting for the worker thread, so under heavy CPU load they raced the 100 ms launch timeout.Changes
crates/rune/src/platform/preferences.rs:OnceLock+Atomic*+mpsc::sync_channelinCachedReducedMotionandCachedDoubleClickwith an explicitCacheState<T>(Unstarted/Pending { timed_out }/Ready { value, late_changed }) state machine backed byMutex+Condvar, keepingFIRST_ANSWER = 100 msso launch never waits longer.on_late(redraw_fallback_windows()) outside the lock; register Linux non-dbuswindows inpreferences::window_darkand overlays incrates/rune/src/overlay/lifetime.rsviafollow_fallback(&window)(which also requests a redraw if a late non-default answer already landed before registration).#[cfg(test)]helpersget_or_init_with,wait_ready, andlate_changed.crates/rune/src/platform/preferences_tests.rs:wait_ready()instead of racing the 100 ms launch timeout.slow_reduced_motion_fallback_returns_default_then_publishes_and_notifies_on_late_answerandslow_double_click_fallback_returns_default_then_publishes_and_notifies_on_late_answer(usingDuration::ZEROwait and aCondvargate, no sleeps).changelog/unreleased/2026-11-25-platform-prefs-late-redraw.md: record the fix.Verification
platform::preferences::tests passed 208/208 under 64-thread CPU load;platform::andno_motionpassed;cargo clippy -p rune --lib --bins --tests(0 errors),cargo check-wasm(0 errors), andscripts/file-size.shpassed.cargo test -p rune --lib platform::(290/290) andcargo clippy -p rune --lib --bins --tests(0 errors) passed.cargo clippy -p rune --lib --bins --tests(withdbus) andcargo clippy -p rune --no-default-features --lib --bins --tests(withoutdbus) both passed with 0 errors (compiled in Linux aarch64 container, not executed there).