From c648c4a94dd34ef10e3c73c6246d7f93c13d9fdc Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sat, 24 Jan 2026 10:08:58 -0500 Subject: [PATCH] feat(server): expose client display size to RdpServerDisplay This allows the server implementation to handle the requested initial client display size. --- crates/ironrdp-server/src/display.rs | 10 ++++++++-- crates/ironrdp-server/src/server.rs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/ironrdp-server/src/display.rs b/crates/ironrdp-server/src/display.rs index 2450b2017..7c48ad0bd 100644 --- a/crates/ironrdp-server/src/display.rs +++ b/crates/ironrdp-server/src/display.rs @@ -284,10 +284,16 @@ pub trait RdpServerDisplayUpdates { #[async_trait::async_trait] pub trait RdpServerDisplay: Send { /// This method should return the current size of the display. - /// Currently, there is no way for the client to negotiate resolution, - /// so the size returned by this method will be enforced. async fn size(&mut self) -> DesktopSize; + /// Request an initial size for the display. + /// + /// This method should return the negotiated display size. + async fn request_initial_size(&mut self, client_size: DesktopSize) -> DesktopSize { + debug!(?client_size, "Requesting initial size"); + self.size().await + } + /// Return a display updates receiver async fn updates(&mut self) -> Result>; diff --git a/crates/ironrdp-server/src/server.rs b/crates/ironrdp-server/src/server.rs index 854020595..5b35b54c3 100644 --- a/crates/ironrdp-server/src/server.rs +++ b/crates/ironrdp-server/src/server.rs @@ -736,7 +736,7 @@ impl RdpServer { width: b.desktop_width, height: b.desktop_height, }; - let display_size = self.display.lock().await.size().await; + let display_size = self.display.lock().await.request_initial_size(client_size).await; // It's problematic when the client didn't resize, as we send bitmap updates that don't fit. // The client will likely drop the connection.