freerdp: separate pointer updates into sub-interface

This commit is contained in:
Marc-André Moreau 2011-11-21 17:48:03 -05:00
parent 0e88c6bae1
commit 7899915c78
10 changed files with 222 additions and 59 deletions

View File

@ -177,4 +177,40 @@ typedef void (*pDrawGdiPlusCacheFirst)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_FIR
typedef void (*pDrawGdiPlusCacheNext)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
typedef void (*pDrawGdiPlusCacheEnd)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
struct rdp_altsec_update
{
rdpContext* context; /* 0 */
uint32 paddingA[16 - 1]; /* 1 */
pCreateOffscreenBitmap CreateOffscreenBitmap; /* 16 */
pSwitchSurface SwitchSurface; /* 17 */
pCreateNineGridBitmap CreateNineGridBitmap; /* 18 */
pFrameMarker FrameMarker; /* 19 */
pStreamBitmapFirst StreamBitmapFirst; /* 20 */
pStreamBitmapNext StreamBitmapNext; /* 21 */
pDrawGdiPlusFirst DrawGdiPlusFirst; /* 22 */
pDrawGdiPlusNext DrawGdiPlusNext; /* 23 */
pDrawGdiPlusEnd DrawGdiPlusEnd; /* 24 */
pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst; /* 25 */
pDrawGdiPlusCacheNext DrawGdiPlusCacheNext; /* 26 */
pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; /* 27 */
uint32 paddingB[32 - 28]; /* 28 */
/* internal */
CREATE_OFFSCREEN_BITMAP_ORDER create_offscreen_bitmap;
SWITCH_SURFACE_ORDER switch_surface;
CREATE_NINE_GRID_BITMAP_ORDER create_nine_grid_bitmap;
FRAME_MARKER_ORDER frame_marker;
STREAM_BITMAP_FIRST_ORDER stream_bitmap_first;
STREAM_BITMAP_FIRST_ORDER stream_bitmap_next;
DRAW_GDIPLUS_CACHE_FIRST_ORDER draw_gdiplus_cache_first;
DRAW_GDIPLUS_CACHE_NEXT_ORDER draw_gdiplus_cache_next;
DRAW_GDIPLUS_CACHE_END_ORDER draw_gdiplus_cache_end;
DRAW_GDIPLUS_FIRST_ORDER draw_gdiplus_first;
DRAW_GDIPLUS_NEXT_ORDER draw_gdiplus_next;
DRAW_GDIPLUS_END_ORDER draw_gdiplus_end;
};
typedef struct rdp_altsec_update rdpAltSecUpdate;
#endif /* __UPDATE_ALTSEC_H */

View File

@ -71,10 +71,32 @@ struct _POINTER_CACHED_UPDATE
};
typedef struct _POINTER_CACHED_UPDATE POINTER_CACHED_UPDATE;
typedef void (*pPointerPosition)(rdpUpdate* update, POINTER_POSITION_UPDATE* pointer_position);
typedef void (*pPointerSystem)(rdpUpdate* update, POINTER_SYSTEM_UPDATE* pointer_system);
typedef void (*pPointerColor)(rdpUpdate* update, POINTER_COLOR_UPDATE* pointer_color);
typedef void (*pPointerNew)(rdpUpdate* update, POINTER_NEW_UPDATE* pointer_new);
typedef void (*pPointerCached)(rdpUpdate* update, POINTER_CACHED_UPDATE* pointer_cached);
typedef void (*pPointerPosition)(rdpContext* context, POINTER_POSITION_UPDATE* pointer_position);
typedef void (*pPointerSystem)(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system);
typedef void (*pPointerColor)(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color);
typedef void (*pPointerNew)(rdpContext* context, POINTER_NEW_UPDATE* pointer_new);
typedef void (*pPointerCached)(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached);
struct rdp_pointer_update
{
rdpContext* context; /* 0 */
uint32 paddingA[16 - 1]; /* 1 */
pPointerPosition PointerPosition; /* 16 */
pPointerSystem PointerSystem; /* 17 */
pPointerColor PointerColor; /* 18 */
pPointerNew PointerNew; /* 19 */
pPointerCached PointerCached; /* 20 */
uint32 paddingB[32 - 21]; /* 21 */
/* internal */
POINTER_POSITION_UPDATE pointer_position;
POINTER_SYSTEM_UPDATE pointer_system;
POINTER_COLOR_UPDATE pointer_color;
POINTER_NEW_UPDATE pointer_new;
POINTER_CACHED_UPDATE pointer_cached;
};
typedef struct rdp_pointer_update rdpPointerUpdate;
#endif /* __UPDATE_POINTER_H */

View File

@ -434,10 +434,61 @@ typedef void (*pPolygonCB)(rdpUpdate* update, POLYGON_CB_ORDER* polygon_cb);
typedef void (*pEllipseSC)(rdpUpdate* update, ELLIPSE_SC_ORDER* ellipse_sc);
typedef void (*pEllipseCB)(rdpUpdate* update, ELLIPSE_CB_ORDER* ellipse_cb);
struct rdp_primary
struct rdp_primary_update
{
rdpContext* context; /* 0 */
uint32 paddingA[16 - 1]; /* 1 */
pDstBlt DstBlt; /* 16 */
pPatBlt PatBlt; /* 17 */
pScrBlt ScrBlt; /* 18 */
pOpaqueRect OpaqueRect; /* 19 */
pDrawNineGrid DrawNineGrid; /* 20 */
pMultiDstBlt MultiDstBlt; /* 21 */
pMultiPatBlt MultiPatBlt; /* 22 */
pMultiScrBlt MultiScrBlt; /* 23 */
pMultiOpaqueRect MultiOpaqueRect; /* 24 */
pMultiDrawNineGrid MultiDrawNineGrid; /* 25 */
pLineTo LineTo; /* 26 */
pPolyline Polyline; /* 27 */
pMemBlt MemBlt; /* 28 */
pMem3Blt Mem3Blt; /* 29 */
pSaveBitmap SaveBitmap; /* 30 */
pGlyphIndex GlyphIndex; /* 31 */
pFastIndex FastIndex; /* 32 */
pFastGlyph FastGlyph; /* 33 */
pPolygonSC PolygonSC; /* 34 */
pPolygonCB PolygonCB; /* 35 */
pEllipseSC EllipseSC; /* 36 */
pEllipseCB EllipseCB; /* 37 */
uint32 paddingB[48 - 38]; /* 38 */
/* internal */
ORDER_INFO order_info;
DSTBLT_ORDER dstblt;
PATBLT_ORDER patblt;
SCRBLT_ORDER scrblt;
OPAQUE_RECT_ORDER opaque_rect;
DRAW_NINE_GRID_ORDER draw_nine_grid;
MULTI_DSTBLT_ORDER multi_dstblt;
MULTI_PATBLT_ORDER multi_patblt;
MULTI_SCRBLT_ORDER multi_scrblt;
MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
LINE_TO_ORDER line_to;
POLYLINE_ORDER polyline;
MEMBLT_ORDER memblt;
MEM3BLT_ORDER mem3blt;
SAVE_BITMAP_ORDER save_bitmap;
GLYPH_INDEX_ORDER glyph_index;
FAST_INDEX_ORDER fast_index;
FAST_GLYPH_ORDER fast_glyph;
POLYGON_SC_ORDER polygon_sc;
POLYGON_CB_ORDER polygon_cb;
ELLIPSE_SC_ORDER ellipse_sc;
ELLIPSE_CB_ORDER ellipse_cb;
};
typedef struct rdp_primary_update rdpPrimaryUpdate;
#endif /* __UPDATE_PRIMARY_H */

View File

@ -188,4 +188,30 @@ typedef void (*pCacheGlyph)(rdpUpdate* update, CACHE_GLYPH_ORDER* cache_glyph_or
typedef void (*pCacheGlyphV2)(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
typedef void (*pCacheBrush)(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush_order);
struct rdp_secondary_update
{
rdpContext* context; /* 0 */
uint32 paddingA[16 - 1]; /* 1 */
pCacheBitmap CacheBitmap; /* 16 */
pCacheBitmapV2 CacheBitmapV2; /* 17 */
pCacheBitmapV3 CacheBitmapV3; /* 18 */
pCacheColorTable CacheColorTable; /* 19 */
pCacheGlyph CacheGlyph; /* 20 */
pCacheGlyphV2 CacheGlyphV2; /* 21 */
pCacheBrush CacheBrush; /* 22 */
uint32 paddingE[32 - 23]; /* 23 */
/* internal */
CACHE_BITMAP_ORDER cache_bitmap_order;
CACHE_BITMAP_V2_ORDER cache_bitmap_v2_order;
CACHE_BITMAP_V3_ORDER cache_bitmap_v3_order;
CACHE_COLOR_TABLE_ORDER cache_color_table_order;
CACHE_GLYPH_ORDER cache_glyph_order;
CACHE_GLYPH_V2_ORDER cache_glyph_v2_order;
CACHE_BRUSH_ORDER cache_brush_order;
};
typedef struct rdp_secondary_update rdpSecondaryUpdate;
#endif /* __UPDATE_SECONDARY_H */

View File

@ -145,12 +145,8 @@ struct rdp_update
pPlaySound PlaySound; /* 23 */
uint32 paddingB[32 - 24]; /* 24 */
pPointerPosition PointerPosition; /* 32 */
pPointerSystem PointerSystem; /* 33 */
pPointerColor PointerColor; /* 34 */
pPointerNew PointerNew; /* 35 */
pPointerCached PointerCached; /* 36 */
uint32 paddingC[48 - 37]; /* 37 */
rdpPointerUpdate* pointer; /* 32 */
uint32 paddingC[48 - 33]; /* 33 */
pDstBlt DstBlt; /* 48 */
pPatBlt PatBlt; /* 49 */
@ -231,12 +227,6 @@ struct rdp_update
PALETTE_UPDATE palette_update;
PLAY_SOUND_UPDATE play_sound;
POINTER_POSITION_UPDATE pointer_position;
POINTER_SYSTEM_UPDATE pointer_system;
POINTER_COLOR_UPDATE pointer_color;
POINTER_NEW_UPDATE pointer_new;
POINTER_CACHED_UPDATE pointer_cached;
ORDER_INFO order_info;
DSTBLT_ORDER dstblt;
PATBLT_ORDER patblt;

View File

@ -230,4 +230,32 @@ typedef void (*pNotifyIconDelete)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInf
typedef void (*pMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop);
typedef void (*pNonMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
struct rdp_window_update
{
rdpContext* context; /* 0 */
uint32 paddingA[16 - 1]; /* 1 */
pWindowCreate WindowCreate; /* 16 */
pWindowUpdate WindowUpdate; /* 17 */
pWindowIcon WindowIcon; /* 18 */
pWindowCachedIcon WindowCachedIcon; /* 19 */
pWindowDelete WindowDelete; /* 20 */
pNotifyIconCreate NotifyIconCreate; /* 21 */
pNotifyIconUpdate NotifyIconUpdate; /* 22 */
pNotifyIconDelete NotifyIconDelete; /* 23 */
pMonitoredDesktop MonitoredDesktop; /* 24 */
pNonMonitoredDesktop NonMonitoredDesktop; /* 25 */
uint32 paddingB[32 - 26]; /* 26 */
/* internal */
WINDOW_ORDER_INFO orderInfo;
WINDOW_STATE_ORDER window_state;
WINDOW_ICON_ORDER window_icon;
WINDOW_CACHED_ICON_ORDER window_cached_icon;
NOTIFY_ICON_STATE_ORDER notify_icon_state;
MONITORED_DESKTOP_ORDER monitored_desktop;
};
typedef struct rdp_window_update rdpWindowUpdate;
#endif /* __UPDATE_WINDOW_H */

View File

@ -22,27 +22,27 @@
#include <freerdp/cache/pointer.h>
void update_pointer_position(rdpUpdate* update, POINTER_POSITION_UPDATE* pointer_position)
void update_pointer_position(rdpContext* context, POINTER_POSITION_UPDATE* pointer_position)
{
}
void update_pointer_system(rdpUpdate* update, POINTER_SYSTEM_UPDATE* pointer_system)
void update_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
{
}
void update_pointer_color(rdpUpdate* update, POINTER_COLOR_UPDATE* pointer_color)
void update_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
{
}
void update_pointer_new(rdpUpdate* update, POINTER_NEW_UPDATE* pointer_new)
void update_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
{
rdpPointer* pointer;
rdpCache* cache = (rdpCache*) update->context->cache;
rdpCache* cache = context->cache;
pointer = Pointer_Alloc(update->context);
pointer = Pointer_Alloc(context);
if (pointer != NULL)
{
@ -56,19 +56,19 @@ void update_pointer_new(rdpUpdate* update, POINTER_NEW_UPDATE* pointer_new)
pointer->xorMaskData = pointer_new->colorPtrAttr.xorMaskData;
pointer->andMaskData = pointer_new->colorPtrAttr.andMaskData;
pointer->New(update->context, pointer);
pointer->New(context, pointer);
pointer_cache_put(cache->pointer, pointer_new->colorPtrAttr.cacheIndex, pointer);
Pointer_Set(update->context, pointer);
Pointer_Set(context, pointer);
}
}
void update_pointer_cached(rdpUpdate* update, POINTER_CACHED_UPDATE* pointer_cached)
void update_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
{
rdpPointer* pointer;
rdpCache* cache = (rdpCache*) update->context->cache;
rdpCache* cache = context->cache;
pointer = pointer_cache_get(cache->pointer, pointer_cached->cacheIndex);
Pointer_Set(update->context, pointer);
Pointer_Set(context, pointer);
}
rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, uint16 index)
@ -99,11 +99,13 @@ void pointer_cache_put(rdpPointerCache* pointer_cache, uint16 index, rdpPointer*
void pointer_cache_register_callbacks(rdpUpdate* update)
{
update->PointerPosition = update_pointer_position;
update->PointerSystem = update_pointer_system;
update->PointerColor = update_pointer_color;
update->PointerNew = update_pointer_new;
update->PointerCached = update_pointer_cached;
rdpPointerUpdate* pointer = update->pointer;
pointer->PointerPosition = update_pointer_position;
pointer->PointerSystem = update_pointer_system;
pointer->PointerColor = update_pointer_color;
pointer->PointerNew = update_pointer_new;
pointer->PointerCached = update_pointer_cached;
}
rdpPointerCache* pointer_cache_new(rdpSettings* settings)

View File

@ -163,6 +163,8 @@ static void fastpath_recv_update_common(rdpFastPath* fastpath, STREAM* s)
static void fastpath_recv_update(rdpFastPath* fastpath, uint8 updateCode, uint32 size, STREAM* s)
{
rdpUpdate* update = fastpath->rdp->update;
rdpContext* context = fastpath->rdp->update->context;
rdpPointerUpdate* pointer = update->pointer;
switch (updateCode)
{
@ -176,41 +178,41 @@ static void fastpath_recv_update(rdpFastPath* fastpath, uint8 updateCode, uint32
break;
case FASTPATH_UPDATETYPE_SYNCHRONIZE:
IFCALL(fastpath->rdp->update->Synchronize, fastpath->rdp->update);
IFCALL(update->Synchronize, update);
break;
case FASTPATH_UPDATETYPE_SURFCMDS:
update_recv_surfcmds(fastpath->rdp->update, size, s);
update_recv_surfcmds(update, size, s);
break;
case FASTPATH_UPDATETYPE_PTR_NULL:
update->pointer_system.type = SYSPTR_NULL;
IFCALL(update->PointerSystem, update, &update->pointer_system);
pointer->pointer_system.type = SYSPTR_NULL;
IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
break;
case FASTPATH_UPDATETYPE_PTR_DEFAULT:
update->pointer_system.type = SYSPTR_DEFAULT;
IFCALL(update->PointerSystem, update, &update->pointer_system);
update->pointer->pointer_system.type = SYSPTR_DEFAULT;
IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
break;
case FASTPATH_UPDATETYPE_PTR_POSITION:
update_read_pointer_position(s, &update->pointer_position);
IFCALL(update->PointerPosition, update, &update->pointer_position);
update_read_pointer_position(s, &pointer->pointer_position);
IFCALL(pointer->PointerPosition, context, &pointer->pointer_position);
break;
case FASTPATH_UPDATETYPE_COLOR:
update_read_pointer_color(s, &update->pointer_color);
IFCALL(update->PointerColor, update, &update->pointer_color);
update_read_pointer_color(s, &pointer->pointer_color);
IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
break;
case FASTPATH_UPDATETYPE_CACHED:
update_read_pointer_cached(s, &update->pointer_cached);
IFCALL(update->PointerCached, update, &update->pointer_cached);
update_read_pointer_cached(s, &pointer->pointer_cached);
IFCALL(pointer->PointerCached, context, &pointer->pointer_cached);
break;
case FASTPATH_UPDATETYPE_POINTER:
update_read_pointer_new(s, &update->pointer_new);
IFCALL(update->PointerNew, update, &update->pointer_new);
update_read_pointer_new(s, &pointer->pointer_new);
IFCALL(pointer->PointerNew, context, &pointer->pointer_new);
break;
default:

View File

@ -145,6 +145,8 @@ void freerdp_context_new(freerdp* instance)
instance->context->rdp = rdp;
instance->update->context = instance->context;
instance->update->pointer->context = instance->context;
instance->input->context = instance->context;
input_register_client_callbacks(rdp->input);

View File

@ -203,6 +203,8 @@ void update_read_pointer_cached(STREAM* s, POINTER_CACHED_UPDATE* pointer_cached
void update_recv_pointer(rdpUpdate* update, STREAM* s)
{
uint16 messageType;
rdpContext* context = update->context;
rdpPointerUpdate* pointer = update->pointer;
stream_read_uint16(s, messageType); /* messageType (2 bytes) */
stream_seek_uint16(s); /* pad2Octets (2 bytes) */
@ -210,28 +212,28 @@ void update_recv_pointer(rdpUpdate* update, STREAM* s)
switch (messageType)
{
case PTR_MSG_TYPE_POSITION:
update_read_pointer_position(s, &update->pointer_position);
IFCALL(update->PointerPosition, update, &update->pointer_position);
update_read_pointer_position(s, &pointer->pointer_position);
IFCALL(pointer->PointerPosition, context, &pointer->pointer_position);
break;
case PTR_MSG_TYPE_SYSTEM:
update_read_pointer_system(s, &update->pointer_system);
IFCALL(update->PointerSystem, update, &update->pointer_system);
update_read_pointer_system(s, &pointer->pointer_system);
IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
break;
case PTR_MSG_TYPE_COLOR:
update_read_pointer_color(s, &update->pointer_color);
IFCALL(update->PointerColor, update, &update->pointer_color);
update_read_pointer_color(s, &pointer->pointer_color);
IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
break;
case PTR_MSG_TYPE_POINTER:
update_read_pointer_new(s, &update->pointer_new);
IFCALL(update->PointerNew, update, &update->pointer_new);
update_read_pointer_new(s, &pointer->pointer_new);
IFCALL(pointer->PointerNew, context, &pointer->pointer_new);
break;
case PTR_MSG_TYPE_CACHED:
update_read_pointer_cached(s, &update->pointer_cached);
IFCALL(update->PointerCached, update, &update->pointer_cached);
update_read_pointer_cached(s, &pointer->pointer_cached);
IFCALL(pointer->PointerCached, context, &pointer->pointer_cached);
break;
default:
@ -429,11 +431,11 @@ void update_register_server_callbacks(rdpUpdate* update)
update->EndPaint = update_end_paint;
update->Synchronize = update_send_synchronize;
update->DesktopResize = update_send_desktop_resize;
update->PointerSystem = update_send_pointer_system;
update->RefreshRect = update_send_refresh_rect;
update->SuppressOutput = update_send_suppress_output;
update->SurfaceBits = update_send_surface_bits;
update->SurfaceCommand = update_send_surface_command;
update->pointer->PointerSystem = update_send_pointer_system;
}
rdpUpdate* update_new(rdpRdp* rdp)
@ -446,6 +448,8 @@ rdpUpdate* update_new(rdpRdp* rdp)
{
update->bitmap_update.count = 64;
update->bitmap_update.rectangles = (BITMAP_DATA*) xzalloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
update->pointer = xnew(rdpPointerUpdate);
}
return update;