@@ -479,6 +479,8 @@ impl iron_remote_desktop::Session for Session {
479
479
connection_result. desktop_size . height ,
480
480
) ;
481
481
482
+ let mut requested_resize = None ;
483
+
482
484
let mut active_stage = ActiveStage :: new ( connection_result) ;
483
485
484
486
let disconnect_reason = ' outer: loop {
@@ -542,9 +544,7 @@ impl iron_remote_desktop::Session for Session {
542
544
warn!( "Resize event ignored: width or height is zero" ) ;
543
545
Vec :: new( )
544
546
} else if let Some ( response_frame) = active_stage. encode_resize( width, height, scale_factor, physical_size) {
545
- self . render_canvas. set_width( width) ;
546
- self . render_canvas. set_height( height) ;
547
- gui. resize( NonZeroU32 :: new( width) . unwrap( ) , NonZeroU32 :: new( height) . unwrap( ) ) ;
547
+ requested_resize = Some ( ( NonZeroU32 :: new( width) . unwrap( ) , NonZeroU32 :: new( height) . unwrap( ) ) ) ;
548
548
vec![ ActiveStageOutput :: ResponseFrame ( response_frame?) ]
549
549
} else {
550
550
debug!( "Resize event ignored" ) ;
@@ -675,6 +675,16 @@ impl iron_remote_desktop::Session for Session {
675
675
// Execute the Deactivation-Reactivation Sequence:
676
676
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/dfc234ce-481a-4674-9a5d-2a7bafb14432
677
677
debug ! ( "Received Server Deactivate All PDU, executing Deactivation-Reactivation Sequence" ) ;
678
+
679
+ // We need to perform resize after receiving the Deactivate All PDU, because there may be frames
680
+ // with the previous dimensions arriving between the resize request and this message.
681
+ if let Some ( ( width, height) ) = requested_resize {
682
+ self . render_canvas . set_width ( width. get ( ) ) ;
683
+ self . render_canvas . set_height ( height. get ( ) ) ;
684
+ gui. resize ( width, height) ;
685
+ requested_resize = None ;
686
+ }
687
+
678
688
let mut buf = WriteBuf :: new ( ) ;
679
689
' activation_seq: loop {
680
690
let written =
0 commit comments