From 1bb82d68f8036ab853f7a17f9215bd4777362429 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 8 Feb 2012 14:16:05 -0800 Subject: [PATCH] Implement SetBounds. --- protocols/rdp/include/rdp_gdi.h | 1 + protocols/rdp/src/client.c | 1 + protocols/rdp/src/rdp_gdi.c | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/protocols/rdp/include/rdp_gdi.h b/protocols/rdp/include/rdp_gdi.h index b4df003b..894b2b4a 100644 --- a/protocols/rdp/include/rdp_gdi.h +++ b/protocols/rdp/include/rdp_gdi.h @@ -46,5 +46,6 @@ void guac_rdp_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt); void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt); void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect); void guac_rdp_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette); +void guac_rdp_gdi_set_bounds(rdpContext* context, rdpBounds* bounds); #endif diff --git a/protocols/rdp/src/client.c b/protocols/rdp/src/client.c index d8ca3a3b..798c488c 100644 --- a/protocols/rdp/src/client.c +++ b/protocols/rdp/src/client.c @@ -124,6 +124,7 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) { /* Set up GDI */ instance->update->Palette = guac_rdp_gdi_palette_update; + instance->update->SetBounds = guac_rdp_gdi_set_bounds; primary = instance->update->primary; primary->DstBlt = guac_rdp_gdi_dstblt; diff --git a/protocols/rdp/src/rdp_gdi.c b/protocols/rdp/src/rdp_gdi.c index ff792119..ac6507bd 100644 --- a/protocols/rdp/src/rdp_gdi.c +++ b/protocols/rdp/src/rdp_gdi.c @@ -88,3 +88,30 @@ void guac_rdp_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette) { clrconv->palette->entries = palette->entries; } + +void guac_rdp_gdi_set_bounds(rdpContext* context, rdpBounds* bounds) { + + guac_client* client = ((rdp_freerdp_context*) context)->client; + const guac_layer* current_layer = ((rdp_guac_client_data*) client->data)->current_surface; + + /* Set clip if specified */ + if (bounds != NULL) + guac_protocol_send_clip( + client->socket, + current_layer, + bounds->left, + bounds->top, + bounds->right - bounds->left + 1, + bounds->bottom - bounds->top + 1); + + /* Otherwise, reset clip */ + else + guac_protocol_send_clip( + client->socket, + current_layer, + 0, 0, + context->instance->settings->width, + context->instance->settings->height); + +} +