@@ -70,7 +70,7 @@ pub(crate) struct WindowHandle {
70
70
size : RwSignal < Size > ,
71
71
theme : Option < Theme > ,
72
72
pub ( crate ) profile : Option < Profile > ,
73
- os_theme : RwSignal < Option < winit:: window:: Theme > > ,
73
+ os_theme : Option < winit:: window:: Theme > ,
74
74
is_maximized : bool ,
75
75
transparent : bool ,
76
76
pub ( crate ) scale : f64 ,
@@ -99,7 +99,7 @@ impl WindowHandle {
99
99
let size: LogicalSize < f64 > = size. unwrap_or ( window. surface_size ( ) . to_logical ( scale) ) ;
100
100
let size = Size :: new ( size. width , size. height ) ;
101
101
let size = scope. create_rw_signal ( Size :: new ( size. width , size. height ) ) ;
102
- let theme = scope . create_rw_signal ( window. theme ( ) ) ;
102
+ let os_theme = window. theme ( ) ;
103
103
let is_maximized = window. is_maximized ( ) ;
104
104
105
105
set_current_view ( id) ;
@@ -160,7 +160,7 @@ impl WindowHandle {
160
160
paint_state,
161
161
size,
162
162
theme : apply_default_theme. then ( default_theme) ,
163
- os_theme : theme ,
163
+ os_theme,
164
164
is_maximized,
165
165
transparent,
166
166
profile : None ,
@@ -174,7 +174,8 @@ impl WindowHandle {
174
174
dropper_file : None ,
175
175
} ;
176
176
window_handle. app_state . set_root_size ( size. get_untracked ( ) ) ;
177
- if let Some ( theme) = theme. get_untracked ( ) {
177
+ window_handle. app_state . os_theme = os_theme;
178
+ if let Some ( theme) = os_theme {
178
179
window_handle. event ( Event :: ThemeChanged ( theme) ) ;
179
180
}
180
181
window_handle
@@ -418,7 +419,10 @@ impl WindowHandle {
418
419
}
419
420
420
421
pub ( crate ) fn os_theme_changed ( & mut self , theme : winit:: window:: Theme ) {
421
- self . os_theme . set ( Some ( theme) ) ;
422
+ self . os_theme = Some ( theme) ;
423
+ self . app_state . os_theme = Some ( theme) ;
424
+ self . id . request_all ( ) ;
425
+ request_recursive_changes ( self . id , ChangeFlags :: STYLE ) ;
422
426
self . event ( Event :: ThemeChanged ( theme) ) ;
423
427
}
424
428
@@ -1278,6 +1282,13 @@ impl WindowHandle {
1278
1282
}
1279
1283
}
1280
1284
1285
+ fn request_recursive_changes ( id : ViewId , changes : ChangeFlags ) {
1286
+ id. state ( ) . borrow_mut ( ) . requested_changes = changes;
1287
+ for child in id. children ( ) {
1288
+ request_recursive_changes ( child, changes) ;
1289
+ }
1290
+ }
1291
+
1281
1292
pub ( crate ) fn get_current_view ( ) -> ViewId {
1282
1293
CURRENT_RUNNING_VIEW_HANDLE . with ( |running| * running. borrow ( ) )
1283
1294
}
0 commit comments