From 46c7097a8638f5c9b650fd3a54da510749d6a91e Mon Sep 17 00:00:00 2001 From: David Fort Date: Tue, 17 Oct 2017 14:31:11 +0200 Subject: [PATCH] multimon: flag the primary monitor according to the /monitors option The first monitor of the list is considered like the primary monitor. --- client/X11/xf_monitor.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 31b8b0540..e1de5605d 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -115,7 +115,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight) { int i; int nmonitors = 0; - int primaryMonitorFound = FALSE; + BOOL primaryMonitorFound = FALSE; VIRTUAL_SCREEN* vscreen; rdpSettings* settings = xfc->context.settings; int mouse_x, mouse_y, _dummy_i; @@ -233,8 +233,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight) return TRUE; /* If single monitor fullscreen OR workarea without remote app */ - if ((settings->Fullscreen && !settings->UseMultimon && !settings->SpanMonitors) - || + if ((settings->Fullscreen && !settings->UseMultimon && !settings->SpanMonitors) || (settings->Workarea && !settings->RemoteApplicationMode)) { /* If no monitors were specified on the command-line then set the current monitor as active */ @@ -264,6 +263,10 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight) vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1, *pMaxHeight); settings->MonitorDefArray[nmonitors].orig_screen = i; + if (i == settings->MonitorIds[0]) { + settings->MonitorDefArray[nmonitors].is_primary = TRUE; + primaryMonitorFound = TRUE; + } nmonitors++; } @@ -385,5 +388,11 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight) *pMaxHeight = vscreen->area.bottom - vscreen->area.top + 1; } + /* some 2008 server freeze at logon if we announce support for monitor layout PDU with + * #monitors < 2. So let's announce it only if we have more than 1 monitor. + */ + if (settings->MonitorCount) + settings->SupportMonitorLayoutPdu = TRUE; + return TRUE; }