multimon: flag the primary monitor according to the /monitors option
The first monitor of the list is considered like the primary monitor.
@@ -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;
}
