@@ -16,8 +16,8 @@ use bitflags::bitflags;
1616use serde:: { Deserialize , Serialize } ;
1717use tauri:: {
1818 plugin:: { Builder as PluginBuilder , TauriPlugin } ,
19- LogicalSize , Manager , Monitor , PhysicalPosition , PhysicalSize , RunEvent , Runtime , Window ,
20- WindowEvent ,
19+ LogicalSize , Manager , Monitor , PhysicalPosition , PhysicalSize , RunEvent , Runtime ,
20+ WebviewWindow , Window , WindowEvent ,
2121} ;
2222
2323use std:: {
@@ -118,7 +118,7 @@ impl<R: Runtime> AppHandleExt for tauri::AppHandle<R> {
118118 let mut state = cache. 0 . lock ( ) . unwrap ( ) ;
119119 for ( label, s) in state. iter_mut ( ) {
120120 if let Some ( window) = self . get_webview_window ( label) {
121- window. as_ref ( ) . window ( ) . update_state ( s, flags) ?;
121+ window. update_state ( s, flags) ?;
122122 }
123123 }
124124
@@ -141,6 +141,11 @@ pub trait WindowExt {
141141 fn restore_state ( & self , flags : StateFlags ) -> tauri:: Result < ( ) > ;
142142}
143143
144+ impl < R : Runtime > WindowExt for WebviewWindow < R > {
145+ fn restore_state ( & self , flags : StateFlags ) -> tauri:: Result < ( ) > {
146+ self . as_ref ( ) . window ( ) . restore_state ( flags)
147+ }
148+ }
144149impl < R : Runtime > WindowExt for Window < R > {
145150 fn restore_state ( & self , flags : StateFlags ) -> tauri:: Result < ( ) > {
146151 let cache = self . state :: < WindowStateCache > ( ) ;
@@ -246,6 +251,12 @@ trait WindowExtInternal {
246251 fn update_state ( & self , state : & mut WindowState , flags : StateFlags ) -> tauri:: Result < ( ) > ;
247252}
248253
254+ impl < R : Runtime > WindowExtInternal for WebviewWindow < R > {
255+ fn update_state ( & self , state : & mut WindowState , flags : StateFlags ) -> tauri:: Result < ( ) > {
256+ self . as_ref ( ) . window ( ) . update_state ( state, flags)
257+ }
258+ }
259+
249260impl < R : Runtime > WindowExtInternal for Window < R > {
250261 fn update_state ( & self , state : & mut WindowState , flags : StateFlags ) -> tauri:: Result < ( ) > {
251262 let is_maximized = match flags. intersects ( StateFlags :: MAXIMIZED | StateFlags :: SIZE ) {
0 commit comments