channels/disp: cleanup

This commit is contained in:
Marc-André Moreau 2014-06-02 22:40:01 -04:00
parent 267e95590b
commit eb65777328
2 changed files with 19 additions and 30 deletions

View File

@ -83,11 +83,7 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback
disp = (DISP_PLUGIN*) callback->plugin; disp = (DISP_PLUGIN*) callback->plugin;
#ifdef DISP_PREVIEW
MonitorLayoutSize = 32;
#else
MonitorLayoutSize = 40; MonitorLayoutSize = 40;
#endif
length = 8 + 8 + (NumMonitors * MonitorLayoutSize); length = 8 + 8 + (NumMonitors * MonitorLayoutSize);
@ -101,11 +97,7 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback
if (NumMonitors > disp->MaxNumMonitors) if (NumMonitors > disp->MaxNumMonitors)
NumMonitors = disp->MaxNumMonitors; NumMonitors = disp->MaxNumMonitors;
#ifdef DISP_PREVIEW
Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */
#else
Stream_Write_UINT32(s, MonitorLayoutSize); /* MonitorLayoutSize (4 bytes) */ Stream_Write_UINT32(s, MonitorLayoutSize); /* MonitorLayoutSize (4 bytes) */
#endif
Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */ Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */
@ -147,10 +139,8 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback
fprintf(stderr, "\t: Orientation: %d\n", Monitors[index].Orientation); fprintf(stderr, "\t: Orientation: %d\n", Monitors[index].Orientation);
#endif #endif
#ifndef DISP_PREVIEW
Stream_Write_UINT32(s, Monitors[index].DesktopScaleFactor); /* DesktopScaleFactor (4 bytes) */ Stream_Write_UINT32(s, Monitors[index].DesktopScaleFactor); /* DesktopScaleFactor (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].DeviceScaleFactor); /* DeviceScaleFactor (4 bytes) */ Stream_Write_UINT32(s, Monitors[index].DeviceScaleFactor); /* DeviceScaleFactor (4 bytes) */
#endif
} }
Stream_SealLength(s); Stream_SealLength(s);
@ -308,33 +298,34 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
disp = (DISP_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "disp"); disp = (DISP_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "disp");
if (disp == NULL) if (!disp)
{ {
disp = (DISP_PLUGIN*) malloc(sizeof(DISP_PLUGIN)); disp = (DISP_PLUGIN*) calloc(1, sizeof(DISP_PLUGIN));
if (disp) if (!disp)
{ return -1;
ZeroMemory(disp, sizeof(DISP_PLUGIN));
disp->iface.Initialize = disp_plugin_initialize; disp->iface.Initialize = disp_plugin_initialize;
disp->iface.Connected = NULL; disp->iface.Connected = NULL;
disp->iface.Disconnected = NULL; disp->iface.Disconnected = NULL;
disp->iface.Terminated = disp_plugin_terminated; disp->iface.Terminated = disp_plugin_terminated;
context = (DispClientContext*) malloc(sizeof(DispClientContext)); context = (DispClientContext*) calloc(1, sizeof(DispClientContext));
context->handle = (void*) disp; if (!context)
return -1;
context->SendMonitorLayout = disp_send_monitor_layout; context->handle = (void*) disp;
disp->iface.pInterface = (void*) context; context->SendMonitorLayout = disp_send_monitor_layout;
disp->MaxNumMonitors = 16; disp->iface.pInterface = (void*) context;
disp->MaxMonitorWidth = 8192;
disp->MaxMonitorHeight = 8192;
error = pEntryPoints->RegisterPlugin(pEntryPoints, "disp", (IWTSPlugin*) disp); disp->MaxNumMonitors = 16;
} disp->MaxMonitorWidth = 8192;
disp->MaxMonitorHeight = 8192;
error = pEntryPoints->RegisterPlugin(pEntryPoints, "disp", (IWTSPlugin*) disp);
} }
return error; return error;

View File

@ -34,7 +34,5 @@
#define DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002 #define DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002
#define DISPLAY_CONTROL_PDU_TYPE_CAPS 0x00000003 #define DISPLAY_CONTROL_PDU_TYPE_CAPS 0x00000003
#define DISP_PREVIEW 1
#endif /* FREERDP_CHANNEL_DISP_CLIENT_MAIN_H */ #endif /* FREERDP_CHANNEL_DISP_CLIENT_MAIN_H */