server/proxy: Add multimon support

This commit is contained in:
kubistika 2019-05-20 14:09:12 +03:00
parent cd135ceacb
commit 6224109a1d
5 changed files with 63 additions and 3 deletions

View File

@ -29,7 +29,6 @@
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/display.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/utils/signal.h>
@ -38,10 +37,10 @@
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/channels.h>
#include <freerdp/log.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <freerdp/log.h>
#include "pf_channels.h"
#include "pf_gdi.h"
@ -83,7 +82,6 @@ static void pf_OnErrorInfo(void* ctx, ErrorInfoEventArgs* e)
}
}
/**
* Called before a connection is established.
*

View File

@ -51,6 +51,7 @@ void pf_common_copy_settings(rdpSettings* dst, rdpSettings* src)
dst->DesktopOrientation = src->DesktopOrientation;
dst->DesktopScaleFactor = src->DesktopScaleFactor;
dst->DeviceScaleFactor = src->DeviceScaleFactor;
dst->SupportMonitorLayoutPdu = src->SupportMonitorLayoutPdu;
/* client info */
dst->AutoLogonEnabled = src->AutoLogonEnabled;
dst->CompressionEnabled = src->CompressionEnabled;

View File

@ -77,5 +77,45 @@ rdpContext* p_client_context_create(rdpSettings* clientSettings,
settings->ServerPort = port;
settings->SoftwareGdi = FALSE;
settings->RedirectClipboard = FALSE;
/* Client Monitor Data */
settings->MonitorCount = clientSettings->MonitorCount;
settings->SpanMonitors = clientSettings->SpanMonitors;
settings->UseMultimon = clientSettings->UseMultimon;
settings->ForceMultimon = clientSettings->ForceMultimon;
settings->DesktopPosX = clientSettings->DesktopPosX;
settings->DesktopPosY = clientSettings->DesktopPosY;
settings->ListMonitors = clientSettings->ListMonitors;
settings->NumMonitorIds = clientSettings->NumMonitorIds;
settings->MonitorLocalShiftX = clientSettings->MonitorLocalShiftX;
settings->MonitorLocalShiftY = clientSettings->MonitorLocalShiftY;
settings->HasMonitorAttributes = clientSettings->HasMonitorAttributes;
settings->MonitorCount = clientSettings->MonitorCount;
settings->MonitorDefArraySize = clientSettings->MonitorDefArraySize;
if (clientSettings->MonitorDefArraySize > 0)
{
settings->MonitorDefArray = (rdpMonitor*) calloc(clientSettings->MonitorDefArraySize,
sizeof(rdpMonitor));
if (!settings->MonitorDefArray)
{
goto error;
}
CopyMemory(settings->MonitorDefArray, clientSettings->MonitorDefArray,
sizeof(rdpMonitor) * clientSettings->MonitorDefArraySize);
}
else
settings->MonitorDefArray = NULL;
settings->MonitorIds = (UINT32*) calloc(16, sizeof(UINT32));
if (!settings->MonitorIds)
goto error;
CopyMemory(settings->MonitorIds, clientSettings->MonitorIds, 16 * sizeof(UINT32));
return context;
error:
freerdp_client_context_free(context);
return NULL;
}

View File

@ -180,6 +180,12 @@ static BOOL pf_server_activate(freerdp_peer* client)
return TRUE;
}
static BOOL pf_server_adjust_monitor_layout(freerdp_peer* peer)
{
/* proxy as is, there's no need to do anything here */
return TRUE;
}
/**
* Handles an incoming client connection, to be run in it's own thread.
*
@ -232,8 +238,11 @@ static DWORD WINAPI pf_server_handle_client(LPVOID arg)
client->settings->ColorDepth = 32;
client->settings->SuppressOutput = TRUE;
client->settings->RefreshRect = TRUE;
client->settings->UseMultimon = TRUE;
client->settings->SupportMonitorLayoutPdu = TRUE;
client->PostConnect = pf_server_post_connect;
client->Activate = pf_server_activate;
client->AdjustMonitorsLayout = pf_server_adjust_monitor_layout;
pf_server_register_input_callbacks(client->input);
pf_server_register_update_callbacks(client->update);
client->settings->MultifragMaxRequestSize = 0xFFFFFF; /* FIXME */

View File

@ -19,6 +19,8 @@
* limitations under the License.
*/
#include <freerdp/update.h>
#include "pf_update.h"
#include "pf_context.h"
@ -83,6 +85,15 @@ static BOOL pf_client_desktop_resize(rdpContext* context)
return ps->update->DesktopResize(ps);
}
static BOOL pf_client_remote_monitors(rdpContext* context, UINT32 count,
const MONITOR_DEF* monitors)
{
pClientContext* pc = (pClientContext*) context;
proxyData* pdata = pc->pdata;
rdpContext* ps = (rdpContext*)pdata->ps;
return freerdp_display_send_monitor_layout(ps, count, monitors);
}
static BOOL pf_client_send_pointer_system(rdpContext* context,
const POINTER_SYSTEM_UPDATE* pointer_system)
{
@ -134,6 +145,7 @@ void pf_client_register_update_callbacks(rdpUpdate* update)
update->EndPaint = pf_client_end_paint;
update->BitmapUpdate = pf_client_bitmap_update;
update->DesktopResize = pf_client_desktop_resize;
update->RemoteMonitors = pf_client_remote_monitors;
update->pointer->PointerSystem = pf_client_send_pointer_system;
update->pointer->PointerPosition = pf_client_send_pointer_position;