@@ -93,7 +93,7 @@ pub struct ToplevelHandleStateInner<W: Window> {
9393 workspaces : Vec < WorkspaceHandle > ,
9494 title : String ,
9595 app_id : String ,
96- states : Vec < States > ,
96+ states : Option < Vec < States > > ,
9797 pub ( super ) window : Option < W > ,
9898}
9999pub type ToplevelHandleState < W > = Mutex < ToplevelHandleStateInner < W > > ;
@@ -107,7 +107,7 @@ impl<W: Window> ToplevelHandleStateInner<W> {
107107 workspaces : Vec :: new ( ) ,
108108 title : String :: new ( ) ,
109109 app_id : String :: new ( ) ,
110- states : Vec :: new ( ) ,
110+ states : None ,
111111 window : Some ( window. clone ( ) ) ,
112112 } )
113113 }
@@ -120,7 +120,7 @@ impl<W: Window> ToplevelHandleStateInner<W> {
120120 workspaces : Vec :: new ( ) ,
121121 title : String :: new ( ) ,
122122 app_id : String :: new ( ) ,
123- states : Vec :: new ( ) ,
123+ states : None ,
124124 window : None ,
125125 } )
126126 }
@@ -502,11 +502,12 @@ where
502502 changed = true ;
503503 }
504504
505- if ( handle_state. states . contains ( & States :: Maximized ) != window. is_maximized ( ) )
506- || ( handle_state. states . contains ( & States :: Fullscreen ) != window. is_fullscreen ( ) )
507- || ( handle_state. states . contains ( & States :: Activated ) != window. is_activated ( ) )
508- || ( handle_state. states . contains ( & States :: Minimized ) != window. is_minimized ( ) )
509- {
505+ if handle_state. states . as_ref ( ) . map_or ( true , |states| {
506+ ( states. contains ( & States :: Maximized ) != window. is_maximized ( ) )
507+ || ( states. contains ( & States :: Fullscreen ) != window. is_fullscreen ( ) )
508+ || ( states. contains ( & States :: Activated ) != window. is_activated ( ) )
509+ || ( states. contains ( & States :: Minimized ) != window. is_minimized ( ) )
510+ } ) {
510511 let mut states = Vec :: new ( ) ;
511512 if window. is_maximized ( ) {
512513 states. push ( States :: Maximized ) ;
@@ -525,7 +526,7 @@ where
525526 {
526527 states. push ( States :: Sticky ) ;
527528 }
528- handle_state. states = states. clone ( ) ;
529+ handle_state. states = Some ( states. clone ( ) ) ;
529530
530531 let states = states
531532 . iter ( )
0 commit comments