Commit 78d4f4b
authored
xilem: WindowView::with_default_properties for runtime theme swap (#1822)
Scope
One file: `xilem/src/window_view.rs`.
Background
[`RenderRoot::set_default_properties`] (added in #1821) lets a host swap
the tree-wide default property set at runtime, but it's only reachable
from code that holds a `RenderRoot`. Xilem apps go through `WindowView`,
so they can't reach the new method at the moment.
Fix
Adds `WindowView::with_default_properties(Arc<DefaultProperties>)`. The
new set gets pushed to the render root in `rebuild` only when the `Arc`
identity changes (`Arc::ptr_eq`), so steady-state frames don't re-apply.
`None` (the default) leaves the startup set untouched.
Testing
No tests in this PR. Xilem doesn't have masonry's `TestHarness`, and the
propagation invariant is already covered by the test that landed with
#1821. Anecdotally, when applied to my fork in my app, a theme toggle
correctly recolors ContentColor-defaulted widgets without restart. I
have screenshots or screen recordings available if desired.
Disclosure: AI-assisted; still my responsibility.
Closes #1819.
Relevant issues:
- #1765: related, still leaves `background_color()`, system light/dark
detection, and the per-widget override API to that issue.
- #1786: related, leaves per-widget-type styling for later.
Signed-off-by: Markik <54276851+mark-ik@users.noreply.github.com>1 parent cbd97ce commit 78d4f4b
1 file changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
| |||
110 | 124 | | |
111 | 125 | | |
112 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
113 | 136 | | |
114 | 137 | | |
115 | 138 | | |
| |||
0 commit comments