File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,6 +103,9 @@ impl PartialEq<X11Surface> for CosmicSurface {
103103 }
104104}
105105
106+ #[ derive( Default ) ]
107+ struct WasMaximized ( AtomicBool ) ;
108+
106109#[ derive( Default ) ]
107110struct Minimized ( AtomicBool ) ;
108111
@@ -399,6 +402,16 @@ impl CosmicSurface {
399402 }
400403
401404 pub fn set_maximized ( & self , maximized : bool ) {
405+ let was_maximized = self . is_maximized ( false ) ;
406+
407+ // update was_maximized flag
408+ self . 0
409+ . user_data ( )
410+ . get_or_insert_threadsafe ( WasMaximized :: default)
411+ . 0
412+ . store ( was_maximized && !maximized, Ordering :: SeqCst ) ;
413+
414+
402415 match self . 0 . underlying_surface ( ) {
403416 WindowSurface :: Wayland ( toplevel) => toplevel. with_pending_state ( |state| {
404417 if maximized {
@@ -436,6 +449,14 @@ impl CosmicSurface {
436449 }
437450 }
438451
452+ pub fn was_maximized ( & self ) -> bool {
453+ self . 0
454+ . user_data ( )
455+ . get_or_insert_threadsafe ( WasMaximized :: default)
456+ . 0
457+ . load ( Ordering :: SeqCst )
458+ }
459+
439460 pub fn is_sticky ( & self ) -> bool {
440461 self . 0
441462 . user_data ( )
Original file line number Diff line number Diff line change @@ -686,11 +686,11 @@ impl FloatingLayout {
686686 mapped_geometry. size = last_size;
687687 }
688688 } else if !window. is_maximized ( true ) {
689- if window. active_window ( ) . has_pending_changes ( ) {
689+ if window. active_window ( ) . has_pending_changes ( ) || window . active_window ( ) . was_maximized ( ) {
690690 if let Some ( pending_size) = window. pending_size ( ) {
691691 mapped_geometry. size = pending_size. as_local ( ) ;
692692 }
693- }
693+ }
694694 * window. last_geometry . lock ( ) . unwrap ( ) = Some ( mapped_geometry) ;
695695 }
696696
You can’t perform that action at this time.
0 commit comments