From a4f8705e99997e0d2fbe6273d06066f17a8b2b07 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 3 Aug 2015 17:12:46 -0700 Subject: [PATCH] multimon fix, mstsc reports desktop width and height of primary only --- libxrdp/xrdp_sec.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c index 1d3b0061..2783fbce 100644 --- a/libxrdp/xrdp_sec.c +++ b/libxrdp/xrdp_sec.c @@ -1871,6 +1871,10 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s) int index; int monitorCount; int flags; + int x1; + int y1; + int x2; + int y2; struct xrdp_client_info *client_info = (struct xrdp_client_info *)NULL; client_info = &(self->rdp_layer->client_info); @@ -1904,6 +1908,10 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s) client_info->monitorCount = monitorCount; + x1 = 0; + y1 = 0; + x2 = 0; + y2 = 0; /* Add client_monitor_data to client_info struct, will later pass to X11rdp */ for (index = 0; index < monitorCount; index++) { @@ -1912,10 +1920,31 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s) in_uint32_le(s, client_info->minfo[index].right); in_uint32_le(s, client_info->minfo[index].bottom); in_uint32_le(s, client_info->minfo[index].is_primary); + if (index == 0) + { + x1 = client_info->minfo[index].left; + y1 = client_info->minfo[index].top; + x2 = client_info->minfo[index].right; + y2 = client_info->minfo[index].bottom; + } + else + { + x1 = MIN(x1, client_info->minfo[index].left); + y1 = MIN(y1, client_info->minfo[index].top); + x2 = MAX(x2, client_info->minfo[index].right); + y2 = MAX(y2, client_info->minfo[index].bottom); + } g_writeln("got a monitor: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d", client_info->minfo[index].left, client_info->minfo[index].top, client_info->minfo[index].right, client_info->minfo[index].bottom, client_info->minfo[index].is_primary); } + + if ((x2 > x1) && (y2 > y1)) + { + client_info->width = (x2 - x1) + 1; + client_info->height = (y2 - y1) + 1; + } + return 0; }