Merge pull request #5418 from kubistika/feat/proxy/cursor

server/proxy: Proxy pointer updates
This commit is contained in:
David Fort 2019-06-03 13:09:05 +02:00 committed by GitHub
commit aa318e03ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 114 additions and 53 deletions

View File

@ -48,6 +48,7 @@
#include "pf_common.h" #include "pf_common.h"
#include "pf_client.h" #include "pf_client.h"
#include "pf_context.h" #include "pf_context.h"
#include "pf_update.h"
#include "pf_log.h" #include "pf_log.h"
#define TAG PROXY_TAG("client") #define TAG PROXY_TAG("client")
@ -65,31 +66,6 @@ static void proxy_server_reactivate(rdpContext* client, rdpContext* target)
client->update->DesktopResize(client); 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) static void pf_OnErrorInfo(void* ctx, ErrorInfoEventArgs* e)
{ {
pClientContext* pc = (pClientContext*) ctx; pClientContext* pc = (pClientContext*) ctx;
@ -148,23 +124,6 @@ static BOOL pf_client_pre_connect(freerdp* instance)
return TRUE; 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. * Called after a RDP connection was successfully established.
* Settings might have changed during negociation of client / server feature * 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); pf_gdi_register_update_callbacks(update);
brush_cache_register_callbacks(instance->update); brush_cache_register_callbacks(update);
glyph_cache_register_callbacks(instance->update); glyph_cache_register_callbacks(update);
bitmap_cache_register_callbacks(instance->update); bitmap_cache_register_callbacks(update);
offscreen_cache_register_callbacks(instance->update); offscreen_cache_register_callbacks(update);
palette_cache_register_callbacks(instance->update); palette_cache_register_callbacks(update);
} }
update->BeginPaint = pf_client_begin_paint; pf_client_register_update_callbacks(update);
update->EndPaint = pf_client_end_paint;
update->BitmapUpdate = pf_client_bitmap_update;
update->DesktopResize = pf_client_desktop_resize;
ps = (rdpContext*) pc->pdata->ps; ps = (rdpContext*) pc->pdata->ps;
proxy_server_reactivate(ps, context); proxy_server_reactivate(ps, context);
return TRUE; return TRUE;

View File

@ -22,6 +22,8 @@
#include "pf_update.h" #include "pf_update.h"
#include "pf_context.h" #include "pf_context.h"
/* server callbacks */
static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count, static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count,
const RECTANGLE_16* areas) 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); 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) void pf_server_register_update_callbacks(rdpUpdate* update)
{ {
update->RefreshRect = pf_server_refresh_rect; update->RefreshRect = pf_server_refresh_rect;

View File

@ -24,6 +24,7 @@
#include <freerdp/freerdp.h> #include <freerdp/freerdp.h>
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 */ #endif /* FREERDP_SERVER_PROXY_PFUPDATE_H */