libfreerdp-core: add +async-update and +async-input command-line options

This commit is contained in:
Marc-André Moreau 2013-01-27 18:22:46 -05:00
parent d8afffd3a8
commit 10a35a9224
6 changed files with 205 additions and 198 deletions

View File

@ -1249,7 +1249,6 @@ int main(int argc, char* argv[])
instance->context_size = sizeof(xfContext);
instance->ContextNew = (pContextNew) xf_context_new;
instance->ContextFree = (pContextFree) xf_context_free;
//instance->flags = FREERDP_FLAG_ASYNC_UPDATE;
freerdp_context_new(instance);
instance->context->argc = argc;

View File

@ -109,6 +109,8 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "glyph-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "glyph cache" },
{ "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "<rfx|nsc|jpeg>", NULL, NULL, -1, NULL, "bitmap codec cache" },
{ "fast-path", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "fast-path input/output" },
{ "async-input", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous input" },
{ "async-update", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "asynchronous update" },
{ "version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION, NULL, NULL, NULL, -1, NULL, "print version" },
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
{ NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
@ -1305,6 +1307,14 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
settings->FastPathInput = arg->Value ? TRUE : FALSE;
settings->FastPathOutput = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "async-input")
{
settings->AsyncInput = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchCase(arg, "async-update")
{
settings->AsyncUpdate = arg->Value ? TRUE : FALSE;
}
CommandLineSwitchDefault(arg)
{

View File

@ -103,8 +103,6 @@ struct rdp_context
UINT32 paddingC[64 - 41]; /* 41 */
};
#define FREERDP_FLAG_ASYNC_UPDATE 0x00000001
/** Defines the options for a given instance of RDP connection.
* This is built by the client and given to the FreeRDP library to create the connection
* with the expected options.
@ -122,9 +120,7 @@ struct rdp_freerdp
Can be allocated by a call to freerdp_context_new().
Must be deallocated by a call to freerdp_context_free() before deallocating the current instance. */
UINT32 flags; /**< (offset 1) context flags, can be set prior to freerdp_context_new() */
UINT32 paddingA[16 - 2]; /* 2 */
UINT32 paddingA[16 - 1]; /* 1 */
rdpInput* input; /* (offset 16)
Input handle for the connection.

View File

@ -676,7 +676,9 @@ struct rdp_settings
ALIGN64 BOOL MouseMotion; /* 1541 */
ALIGN64 char* WindowTitle; /* 1542 */
ALIGN64 UINT64 ParentWindowId; /* 1543 */
UINT64 padding1600[1600 - 1544]; /* 1544 */
ALIGN64 BOOL AsyncInput; /* 1544 */
ALIGN64 BOOL AsyncUpdate; /* 1545 */
UINT64 padding1600[1600 - 1546]; /* 1546 */
/* Miscellaneous */
ALIGN64 BOOL SoftwareGdi; /* 1601 */

View File

@ -934,185 +934,6 @@ static void message_PointerCached(rdpContext* context, POINTER_CACHED_UPDATE* po
/* Message Queue */
void message_register_interface(rdpMessage* message, rdpUpdate* update)
{
rdpPrimaryUpdate* primary;
rdpSecondaryUpdate* secondary;
rdpAltSecUpdate* altsec;
rdpWindowUpdate* window;
rdpPointerUpdate* pointer;
primary = update->primary;
secondary = update->secondary;
altsec = update->altsec;
window = update->window;
pointer = update->pointer;
/* Update */
message->BeginPaint = update->BeginPaint;
message->EndPaint = update->EndPaint;
message->SetBounds = update->SetBounds;
message->Synchronize = update->Synchronize;
message->DesktopResize = update->DesktopResize;
message->BitmapUpdate = update->BitmapUpdate;
message->Palette = update->Palette;
message->PlaySound = update->PlaySound;
message->RefreshRect = update->RefreshRect;
message->SuppressOutput = update->SuppressOutput;
message->SurfaceCommand = update->SurfaceCommand;
message->SurfaceBits = update->SurfaceBits;
message->SurfaceFrameMarker = update->SurfaceFrameMarker;
message->SurfaceFrameAcknowledge = update->SurfaceFrameAcknowledge;
update->BeginPaint = message_BeginPaint;
update->EndPaint = message_EndPaint;
update->SetBounds = message_SetBounds;
update->Synchronize = message_Synchronize;
update->DesktopResize = message_DesktopResize;
update->BitmapUpdate = message_BitmapUpdate;
update->Palette = message_Palette;
update->PlaySound = message_PlaySound;
update->RefreshRect = message_RefreshRect;
update->SuppressOutput = message_SuppressOutput;
update->SurfaceCommand = message_SurfaceCommand;
update->SurfaceBits = message_SurfaceBits;
update->SurfaceFrameMarker = message_SurfaceFrameMarker;
update->SurfaceFrameAcknowledge = message_SurfaceFrameAcknowledge;
/* Primary Update */
message->DstBlt = primary->DstBlt;
message->PatBlt = primary->PatBlt;
message->ScrBlt = primary->ScrBlt;
message->OpaqueRect = primary->OpaqueRect;
message->DrawNineGrid = primary->DrawNineGrid;
message->MultiDstBlt = primary->MultiDstBlt;
message->MultiPatBlt = primary->MultiPatBlt;
message->MultiScrBlt = primary->MultiScrBlt;
message->MultiOpaqueRect = primary->MultiOpaqueRect;
message->MultiDrawNineGrid = primary->MultiDrawNineGrid;
message->LineTo = primary->LineTo;
message->Polyline = primary->Polyline;
message->MemBlt = primary->MemBlt;
message->Mem3Blt = primary->Mem3Blt;
message->SaveBitmap = primary->SaveBitmap;
message->GlyphIndex = primary->GlyphIndex;
message->FastIndex = primary->FastIndex;
message->FastGlyph = primary->FastGlyph;
message->PolygonSC = primary->PolygonSC;
message->PolygonCB = primary->PolygonCB;
message->EllipseSC = primary->EllipseSC;
message->EllipseCB = primary->EllipseCB;
primary->DstBlt = message_DstBlt;
primary->PatBlt = message_PatBlt;
primary->ScrBlt = message_ScrBlt;
primary->OpaqueRect = message_OpaqueRect;
primary->DrawNineGrid = message_DrawNineGrid;
primary->MultiDstBlt = message_MultiDstBlt;
primary->MultiPatBlt = message_MultiPatBlt;
primary->MultiScrBlt = message_MultiScrBlt;
primary->MultiOpaqueRect = message_MultiOpaqueRect;
primary->MultiDrawNineGrid = message_MultiDrawNineGrid;
primary->LineTo = message_LineTo;
primary->Polyline = message_Polyline;
primary->MemBlt = message_MemBlt;
primary->Mem3Blt = message_Mem3Blt;
primary->SaveBitmap = message_SaveBitmap;
primary->GlyphIndex = message_GlyphIndex;
primary->FastIndex = message_FastIndex;
primary->FastGlyph = message_FastGlyph;
primary->PolygonSC = message_PolygonSC;
primary->PolygonCB = message_PolygonCB;
primary->EllipseSC = message_EllipseSC;
primary->EllipseCB = message_EllipseCB;
/* Secondary Update */
message->CacheBitmap = secondary->CacheBitmap;
message->CacheBitmapV2 = secondary->CacheBitmapV2;
message->CacheBitmapV3 = secondary->CacheBitmapV3;
message->CacheColorTable = secondary->CacheColorTable;
message->CacheGlyph = secondary->CacheGlyph;
message->CacheGlyphV2 = secondary->CacheGlyphV2;
message->CacheBrush = secondary->CacheBrush;
secondary->CacheBitmap = message_CacheBitmap;
secondary->CacheBitmapV2 = message_CacheBitmapV2;
secondary->CacheBitmapV3 = message_CacheBitmapV3;
secondary->CacheColorTable = message_CacheColorTable;
secondary->CacheGlyph = message_CacheGlyph;
secondary->CacheGlyphV2 = message_CacheGlyphV2;
secondary->CacheBrush = message_CacheBrush;
/* Alternate Secondary Update */
message->CreateOffscreenBitmap = altsec->CreateOffscreenBitmap;
message->SwitchSurface = altsec->SwitchSurface;
message->CreateNineGridBitmap = altsec->CreateNineGridBitmap;
message->FrameMarker = altsec->FrameMarker;
message->StreamBitmapFirst = altsec->StreamBitmapFirst;
message->StreamBitmapNext = altsec->StreamBitmapNext;
message->DrawGdiPlusFirst = altsec->DrawGdiPlusFirst;
message->DrawGdiPlusNext = altsec->DrawGdiPlusNext;
message->DrawGdiPlusEnd = altsec->DrawGdiPlusEnd;
message->DrawGdiPlusCacheFirst = altsec->DrawGdiPlusCacheFirst;
message->DrawGdiPlusCacheNext = altsec->DrawGdiPlusCacheNext;
message->DrawGdiPlusCacheEnd = altsec->DrawGdiPlusCacheEnd;
altsec->CreateOffscreenBitmap = message_CreateOffscreenBitmap;
altsec->SwitchSurface = message_SwitchSurface;
altsec->CreateNineGridBitmap = message_CreateNineGridBitmap;
altsec->FrameMarker = message_FrameMarker;
altsec->StreamBitmapFirst = message_StreamBitmapFirst;
altsec->StreamBitmapNext = message_StreamBitmapNext;
altsec->DrawGdiPlusFirst = message_DrawGdiPlusFirst;
altsec->DrawGdiPlusNext = message_DrawGdiPlusNext;
altsec->DrawGdiPlusEnd = message_DrawGdiPlusEnd;
altsec->DrawGdiPlusCacheFirst = message_DrawGdiPlusCacheFirst;
altsec->DrawGdiPlusCacheNext = message_DrawGdiPlusCacheNext;
altsec->DrawGdiPlusCacheEnd = message_DrawGdiPlusCacheEnd;
/* Window Update */
message->WindowCreate = window->WindowCreate;
message->WindowUpdate = window->WindowUpdate;
message->WindowIcon = window->WindowIcon;
message->WindowCachedIcon = window->WindowCachedIcon;
message->WindowDelete = window->WindowDelete;
message->NotifyIconCreate = window->NotifyIconCreate;
message->NotifyIconUpdate = window->NotifyIconUpdate;
message->NotifyIconDelete = window->NotifyIconDelete;
message->MonitoredDesktop = window->MonitoredDesktop;
message->NonMonitoredDesktop = window->NonMonitoredDesktop;
window->WindowCreate = message_WindowCreate;
window->WindowUpdate = message_WindowUpdate;
window->WindowIcon = message_WindowIcon;
window->WindowCachedIcon = message_WindowCachedIcon;
window->WindowDelete = message_WindowDelete;
window->NotifyIconCreate = message_NotifyIconCreate;
window->NotifyIconUpdate = message_NotifyIconUpdate;
window->NotifyIconDelete = message_NotifyIconDelete;
window->MonitoredDesktop = message_MonitoredDesktop;
window->NonMonitoredDesktop = message_NonMonitoredDesktop;
/* Pointer Update */
message->PointerPosition = pointer->PointerPosition;
message->PointerSystem = pointer->PointerSystem;
message->PointerColor = pointer->PointerColor;
message->PointerNew = pointer->PointerNew;
message->PointerCached = pointer->PointerCached;
pointer->PointerPosition = message_PointerPosition;
pointer->PointerSystem = message_PointerSystem;
pointer->PointerColor = message_PointerColor;
pointer->PointerNew = message_PointerNew;
pointer->PointerCached = message_PointerCached;
}
int message_process_update_class(rdpMessage* update, wMessage* msg, int type)
{
int status = 0;
@ -1724,12 +1545,198 @@ int message_process_pending_updates(rdpUpdate* update)
return 0;
}
rdpMessage* message_new()
void message_register_interface(rdpMessage* message, rdpUpdate* update)
{
rdpPrimaryUpdate* primary;
rdpSecondaryUpdate* secondary;
rdpAltSecUpdate* altsec;
rdpWindowUpdate* window;
rdpPointerUpdate* pointer;
primary = update->primary;
secondary = update->secondary;
altsec = update->altsec;
window = update->window;
pointer = update->pointer;
/* Update */
message->BeginPaint = update->BeginPaint;
message->EndPaint = update->EndPaint;
message->SetBounds = update->SetBounds;
message->Synchronize = update->Synchronize;
message->DesktopResize = update->DesktopResize;
message->BitmapUpdate = update->BitmapUpdate;
message->Palette = update->Palette;
message->PlaySound = update->PlaySound;
message->RefreshRect = update->RefreshRect;
message->SuppressOutput = update->SuppressOutput;
message->SurfaceCommand = update->SurfaceCommand;
message->SurfaceBits = update->SurfaceBits;
message->SurfaceFrameMarker = update->SurfaceFrameMarker;
message->SurfaceFrameAcknowledge = update->SurfaceFrameAcknowledge;
update->BeginPaint = message_BeginPaint;
update->EndPaint = message_EndPaint;
update->SetBounds = message_SetBounds;
update->Synchronize = message_Synchronize;
update->DesktopResize = message_DesktopResize;
update->BitmapUpdate = message_BitmapUpdate;
update->Palette = message_Palette;
update->PlaySound = message_PlaySound;
update->RefreshRect = message_RefreshRect;
update->SuppressOutput = message_SuppressOutput;
update->SurfaceCommand = message_SurfaceCommand;
update->SurfaceBits = message_SurfaceBits;
update->SurfaceFrameMarker = message_SurfaceFrameMarker;
update->SurfaceFrameAcknowledge = message_SurfaceFrameAcknowledge;
/* Primary Update */
message->DstBlt = primary->DstBlt;
message->PatBlt = primary->PatBlt;
message->ScrBlt = primary->ScrBlt;
message->OpaqueRect = primary->OpaqueRect;
message->DrawNineGrid = primary->DrawNineGrid;
message->MultiDstBlt = primary->MultiDstBlt;
message->MultiPatBlt = primary->MultiPatBlt;
message->MultiScrBlt = primary->MultiScrBlt;
message->MultiOpaqueRect = primary->MultiOpaqueRect;
message->MultiDrawNineGrid = primary->MultiDrawNineGrid;
message->LineTo = primary->LineTo;
message->Polyline = primary->Polyline;
message->MemBlt = primary->MemBlt;
message->Mem3Blt = primary->Mem3Blt;
message->SaveBitmap = primary->SaveBitmap;
message->GlyphIndex = primary->GlyphIndex;
message->FastIndex = primary->FastIndex;
message->FastGlyph = primary->FastGlyph;
message->PolygonSC = primary->PolygonSC;
message->PolygonCB = primary->PolygonCB;
message->EllipseSC = primary->EllipseSC;
message->EllipseCB = primary->EllipseCB;
primary->DstBlt = message_DstBlt;
primary->PatBlt = message_PatBlt;
primary->ScrBlt = message_ScrBlt;
primary->OpaqueRect = message_OpaqueRect;
primary->DrawNineGrid = message_DrawNineGrid;
primary->MultiDstBlt = message_MultiDstBlt;
primary->MultiPatBlt = message_MultiPatBlt;
primary->MultiScrBlt = message_MultiScrBlt;
primary->MultiOpaqueRect = message_MultiOpaqueRect;
primary->MultiDrawNineGrid = message_MultiDrawNineGrid;
primary->LineTo = message_LineTo;
primary->Polyline = message_Polyline;
primary->MemBlt = message_MemBlt;
primary->Mem3Blt = message_Mem3Blt;
primary->SaveBitmap = message_SaveBitmap;
primary->GlyphIndex = message_GlyphIndex;
primary->FastIndex = message_FastIndex;
primary->FastGlyph = message_FastGlyph;
primary->PolygonSC = message_PolygonSC;
primary->PolygonCB = message_PolygonCB;
primary->EllipseSC = message_EllipseSC;
primary->EllipseCB = message_EllipseCB;
/* Secondary Update */
message->CacheBitmap = secondary->CacheBitmap;
message->CacheBitmapV2 = secondary->CacheBitmapV2;
message->CacheBitmapV3 = secondary->CacheBitmapV3;
message->CacheColorTable = secondary->CacheColorTable;
message->CacheGlyph = secondary->CacheGlyph;
message->CacheGlyphV2 = secondary->CacheGlyphV2;
message->CacheBrush = secondary->CacheBrush;
secondary->CacheBitmap = message_CacheBitmap;
secondary->CacheBitmapV2 = message_CacheBitmapV2;
secondary->CacheBitmapV3 = message_CacheBitmapV3;
secondary->CacheColorTable = message_CacheColorTable;
secondary->CacheGlyph = message_CacheGlyph;
secondary->CacheGlyphV2 = message_CacheGlyphV2;
secondary->CacheBrush = message_CacheBrush;
/* Alternate Secondary Update */
message->CreateOffscreenBitmap = altsec->CreateOffscreenBitmap;
message->SwitchSurface = altsec->SwitchSurface;
message->CreateNineGridBitmap = altsec->CreateNineGridBitmap;
message->FrameMarker = altsec->FrameMarker;
message->StreamBitmapFirst = altsec->StreamBitmapFirst;
message->StreamBitmapNext = altsec->StreamBitmapNext;
message->DrawGdiPlusFirst = altsec->DrawGdiPlusFirst;
message->DrawGdiPlusNext = altsec->DrawGdiPlusNext;
message->DrawGdiPlusEnd = altsec->DrawGdiPlusEnd;
message->DrawGdiPlusCacheFirst = altsec->DrawGdiPlusCacheFirst;
message->DrawGdiPlusCacheNext = altsec->DrawGdiPlusCacheNext;
message->DrawGdiPlusCacheEnd = altsec->DrawGdiPlusCacheEnd;
altsec->CreateOffscreenBitmap = message_CreateOffscreenBitmap;
altsec->SwitchSurface = message_SwitchSurface;
altsec->CreateNineGridBitmap = message_CreateNineGridBitmap;
altsec->FrameMarker = message_FrameMarker;
altsec->StreamBitmapFirst = message_StreamBitmapFirst;
altsec->StreamBitmapNext = message_StreamBitmapNext;
altsec->DrawGdiPlusFirst = message_DrawGdiPlusFirst;
altsec->DrawGdiPlusNext = message_DrawGdiPlusNext;
altsec->DrawGdiPlusEnd = message_DrawGdiPlusEnd;
altsec->DrawGdiPlusCacheFirst = message_DrawGdiPlusCacheFirst;
altsec->DrawGdiPlusCacheNext = message_DrawGdiPlusCacheNext;
altsec->DrawGdiPlusCacheEnd = message_DrawGdiPlusCacheEnd;
/* Window Update */
message->WindowCreate = window->WindowCreate;
message->WindowUpdate = window->WindowUpdate;
message->WindowIcon = window->WindowIcon;
message->WindowCachedIcon = window->WindowCachedIcon;
message->WindowDelete = window->WindowDelete;
message->NotifyIconCreate = window->NotifyIconCreate;
message->NotifyIconUpdate = window->NotifyIconUpdate;
message->NotifyIconDelete = window->NotifyIconDelete;
message->MonitoredDesktop = window->MonitoredDesktop;
message->NonMonitoredDesktop = window->NonMonitoredDesktop;
window->WindowCreate = message_WindowCreate;
window->WindowUpdate = message_WindowUpdate;
window->WindowIcon = message_WindowIcon;
window->WindowCachedIcon = message_WindowCachedIcon;
window->WindowDelete = message_WindowDelete;
window->NotifyIconCreate = message_NotifyIconCreate;
window->NotifyIconUpdate = message_NotifyIconUpdate;
window->NotifyIconDelete = message_NotifyIconDelete;
window->MonitoredDesktop = message_MonitoredDesktop;
window->NonMonitoredDesktop = message_NonMonitoredDesktop;
/* Pointer Update */
message->PointerPosition = pointer->PointerPosition;
message->PointerSystem = pointer->PointerSystem;
message->PointerColor = pointer->PointerColor;
message->PointerNew = pointer->PointerNew;
message->PointerCached = pointer->PointerCached;
pointer->PointerPosition = message_PointerPosition;
pointer->PointerSystem = message_PointerSystem;
pointer->PointerColor = message_PointerColor;
pointer->PointerNew = message_PointerNew;
pointer->PointerCached = message_PointerCached;
}
rdpMessage* message_new(rdpUpdate* update)
{
rdpMessage* message;
message = (rdpMessage*) malloc(sizeof(rdpMessage));
if (message)
{
message->update = update;
update->queue = MessageQueue_New();
message_register_interface(message, update);
}
return message;
}
@ -1737,6 +1744,7 @@ void message_free(rdpMessage* message)
{
if (message)
{
MessageQueue_Free(message->update->queue);
free(message);
}
}

View File

@ -415,8 +415,10 @@ void update_reset_state(rdpUpdate* update)
void update_post_connect(rdpUpdate* update)
{
update->asynchronous = update->context->settings->AsyncUpdate;
if (update->asynchronous)
message_register_interface(update->message, update);
update->message = message_new(update);
update->altsec->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE;
IFCALL(update->altsec->SwitchSurface, update->context, &(update->altsec->switch_surface));
@ -764,13 +766,6 @@ rdpUpdate* update_new(rdpRdp* rdp)
update->SuppressOutput = update_send_suppress_output;
update->initialState = TRUE;
update->asynchronous = (rdp->instance->flags & FREERDP_FLAG_ASYNC_UPDATE) ? TRUE : FALSE;
if (update->asynchronous)
{
update->queue = MessageQueue_New();
update->message = message_new();
}
}
return update;
@ -795,10 +790,7 @@ void update_free(rdpUpdate* update)
free(update->window);
if (update->asynchronous)
{
message_free(update->message);
MessageQueue_Free(update->queue);
}
free(update);
}