From f38e41ee8ed15fcd5ae673822ecae9bc9a1299e4 Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 14 Oct 2025 22:24:36 +0200 Subject: [PATCH 1/2] Ensure screen width is always even --- lib/srv/desktop/rdp/rdpclient/src/client.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/srv/desktop/rdp/rdpclient/src/client.rs b/lib/srv/desktop/rdp/rdpclient/src/client.rs index 6808ea3b3dec7..e3b3883f09183 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/client.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/client.rs @@ -503,12 +503,17 @@ impl Client { let mut pending_resize = Self::resize_manager_lock(pending_resize).map_err(ClientError::from)?; let pending_resize = pending_resize.pending_resize.take(); - if let Some((width, height)) = pending_resize { + if let Some((initial_width, initial_height)) = pending_resize { // If there was a resize pending, perform it now. debug!( "Pending resize for size [{:?}x{:?}] found, sending now", - width, height + initial_width, initial_height ); + let (width, height) = + MonitorLayoutEntry::adjust_display_size(initial_width, initial_height); + if width != initial_width || height != initial_height { + debug!("Adjusted screen resize to [{:?}x{:?}]", width, height); + } let pdu: DisplayControlPdu = DisplayControlMonitorLayout::new_single_primary_monitor( width, height, @@ -1369,6 +1374,12 @@ type RdpReadStream = Framed>>>; type RdpWriteStream = Framed>>>; fn create_config(params: &ConnectParams, pin: String, cgo_handle: CgoHandle) -> Config { + let initial_width = params.screen_width as u32; + let initial_height = params.screen_height as u32; + let (width, height) = MonitorLayoutEntry::adjust_display_size(initial_width, initial_height); + if width != initial_width || height != initial_height { + debug!("Adjusted screen size to [{:?}x{:?}]", width, height); + } Config { desktop_size: DesktopSize { width: params.screen_width, @@ -1422,7 +1433,7 @@ fn create_config(params: &ConnectParams, pin: String, cgo_handle: CgoHandle) -> } else { PerformanceFlags::empty() }, - desktop_scale_factor: 0, + desktop_scale_factor: 100, license_cache: Some(Arc::new(GoLicenseCache { cgo_handle })), hardware_id: Some(params.client_id), } From 998091e3ca607d0b36a7a71ad61d995c0308ec3d Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 14 Oct 2025 23:29:53 +0200 Subject: [PATCH 2/2] Update lib/srv/desktop/rdp/rdpclient/src/client.rs Co-authored-by: Zac Bergquist --- lib/srv/desktop/rdp/rdpclient/src/client.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/srv/desktop/rdp/rdpclient/src/client.rs b/lib/srv/desktop/rdp/rdpclient/src/client.rs index e3b3883f09183..5dd96b7d8f7f4 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/client.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/client.rs @@ -1433,6 +1433,7 @@ fn create_config(params: &ConnectParams, pin: String, cgo_handle: CgoHandle) -> } else { PerformanceFlags::empty() }, + // spec says that any value not in [100, 500] is ignored desktop_scale_factor: 100, license_cache: Some(Arc::new(GoLicenseCache { cgo_handle })), hardware_id: Some(params.client_id),