diff --git a/server/proxy/pf_client.c b/server/proxy/pf_client.c index 0ea01ab32..4f5430bb6 100644 --- a/server/proxy/pf_client.c +++ b/server/proxy/pf_client.c @@ -48,6 +48,7 @@ #include "pf_common.h" #include "pf_client.h" #include "pf_context.h" +#include "pf_update.h" #include "pf_log.h" #define TAG PROXY_TAG("client") @@ -65,31 +66,6 @@ static void proxy_server_reactivate(rdpContext* client, rdpContext* target) client->update->DesktopResize(client); } -/** - * This function is called whenever a new frame starts. - * It can be used to reset invalidated areas. - */ -static BOOL pf_client_begin_paint(rdpContext* context) -{ - pClientContext* pc = (pClientContext*) context; - proxyData* pdata = pc->pdata; - rdpContext* ps = (rdpContext*)pdata->ps; - return ps->update->BeginPaint(ps); -} - -/** - * This function is called when the library completed composing a new - * frame. Read out the changed areas and blit them to your output device. - * The image buffer will have the format specified by gdi_init - */ -static BOOL pf_client_end_paint(rdpContext* context) -{ - pClientContext* pc = (pClientContext*) context; - proxyData* pdata = pc->pdata; - rdpContext* ps = (rdpContext*)pdata->ps; - return ps->update->EndPaint(ps); -} - static void pf_OnErrorInfo(void* ctx, ErrorInfoEventArgs* e) { pClientContext* pc = (pClientContext*) ctx; @@ -148,23 +124,6 @@ static BOOL pf_client_pre_connect(freerdp* instance) return TRUE; } - -static BOOL pf_client_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmap) -{ - pClientContext* pc = (pClientContext*) context; - proxyData* pdata = pc->pdata; - rdpContext* ps = (rdpContext*)pdata->ps; - return ps->update->BitmapUpdate(ps, bitmap); -} - -static BOOL pf_client_desktop_resize(rdpContext* context) -{ - pClientContext* pc = (pClientContext*) context; - proxyData* pdata = pc->pdata; - rdpContext* ps = (rdpContext*)pdata->ps; - return ps->update->DesktopResize(ps); -} - /** * Called after a RDP connection was successfully established. * Settings might have changed during negociation of client / server feature @@ -202,17 +161,14 @@ static BOOL pf_client_post_connect(freerdp* instance) } pf_gdi_register_update_callbacks(update); - brush_cache_register_callbacks(instance->update); - glyph_cache_register_callbacks(instance->update); - bitmap_cache_register_callbacks(instance->update); - offscreen_cache_register_callbacks(instance->update); - palette_cache_register_callbacks(instance->update); + brush_cache_register_callbacks(update); + glyph_cache_register_callbacks(update); + bitmap_cache_register_callbacks(update); + offscreen_cache_register_callbacks(update); + palette_cache_register_callbacks(update); } - - update->BeginPaint = pf_client_begin_paint; - update->EndPaint = pf_client_end_paint; - update->BitmapUpdate = pf_client_bitmap_update; - update->DesktopResize = pf_client_desktop_resize; + + pf_client_register_update_callbacks(update); ps = (rdpContext*) pc->pdata->ps; proxy_server_reactivate(ps, context); return TRUE; diff --git a/server/proxy/pf_update.c b/server/proxy/pf_update.c index a2d0a792e..998161e93 100644 --- a/server/proxy/pf_update.c +++ b/server/proxy/pf_update.c @@ -22,6 +22,8 @@ #include "pf_update.h" #include "pf_context.h" +/* server callbacks */ + static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas) { @@ -38,6 +40,108 @@ static BOOL pf_server_suppress_output(rdpContext* context, BYTE allow, return pc->update->SuppressOutput(pc, allow, area); } +/* client callbacks */ + +/** + * This function is called whenever a new frame starts. + * It can be used to reset invalidated areas. + */ +static BOOL pf_client_begin_paint(rdpContext* context) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->BeginPaint(ps); +} + +/** + * This function is called when the library completed composing a new + * frame. Read out the changed areas and blit them to your output device. + * The image buffer will have the format specified by gdi_init + */ +static BOOL pf_client_end_paint(rdpContext* context) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->EndPaint(ps); +} + +static BOOL pf_client_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmap) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->BitmapUpdate(ps, bitmap); +} + +static BOOL pf_client_desktop_resize(rdpContext* context) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->DesktopResize(ps); +} + +static BOOL pf_client_send_pointer_system(rdpContext* context, + const POINTER_SYSTEM_UPDATE* pointer_system) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->pointer->PointerSystem(ps, pointer_system); +} + +static BOOL pf_client_send_pointer_position(rdpContext* context, + const POINTER_POSITION_UPDATE* pointerPosition) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->pointer->PointerPosition(ps, pointerPosition); +} + +static BOOL pf_client_send_pointer_color(rdpContext* context, + const POINTER_COLOR_UPDATE* pointer_color) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->pointer->PointerColor(ps, pointer_color); +} + +static BOOL pf_client_send_pointer_new(rdpContext* context, + const POINTER_NEW_UPDATE* pointer_new) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->pointer->PointerNew(ps, pointer_new); +} + +static BOOL pf_client_send_pointer_cached(rdpContext* context, + const POINTER_CACHED_UPDATE* pointer_cached) +{ + pClientContext* pc = (pClientContext*) context; + proxyData* pdata = pc->pdata; + rdpContext* ps = (rdpContext*)pdata->ps; + return ps->update->pointer->PointerCached(ps, pointer_cached); +} + +void pf_client_register_update_callbacks(rdpUpdate* update) +{ + update->BeginPaint = pf_client_begin_paint; + update->EndPaint = pf_client_end_paint; + update->BitmapUpdate = pf_client_bitmap_update; + update->DesktopResize = pf_client_desktop_resize; + + update->pointer->PointerSystem = pf_client_send_pointer_system; + update->pointer->PointerPosition = pf_client_send_pointer_position; + update->pointer->PointerColor = pf_client_send_pointer_color; + update->pointer->PointerNew = pf_client_send_pointer_new; + update->pointer->PointerCached = pf_client_send_pointer_cached; +} + void pf_server_register_update_callbacks(rdpUpdate* update) { update->RefreshRect = pf_server_refresh_rect; diff --git a/server/proxy/pf_update.h b/server/proxy/pf_update.h index 828c32b92..7f704aa60 100644 --- a/server/proxy/pf_update.h +++ b/server/proxy/pf_update.h @@ -24,6 +24,7 @@ #include -void pf_server_register_update_callbacks(rdpUpdate* input); +void pf_server_register_update_callbacks(rdpUpdate* update); +void pf_client_register_update_callbacks(rdpUpdate* update); #endif /* FREERDP_SERVER_PROXY_PFUPDATE_H */