From d7c5ec5ed0a52a88e65db37c8d568b45c16953b6 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 16 May 2012 19:52:43 -0700 Subject: [PATCH] Implement default pointer (currently drawn with draw instructions - not an embedded bitmap). --- protocols/rdp/include/rdp_pointer.h | 1 + protocols/rdp/src/client.c | 3 +++ protocols/rdp/src/rdp_pointer.c | 35 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/protocols/rdp/include/rdp_pointer.h b/protocols/rdp/include/rdp_pointer.h index ff870913..516f36ac 100644 --- a/protocols/rdp/include/rdp_pointer.h +++ b/protocols/rdp/include/rdp_pointer.h @@ -59,5 +59,6 @@ typedef struct guac_rdp_pointer { void guac_rdp_pointer_new(rdpContext* context, rdpPointer* pointer); void guac_rdp_pointer_set(rdpContext* context, rdpPointer* pointer); void guac_rdp_pointer_free(rdpContext* context, rdpPointer* pointer); +void guac_rdp_pointer_set_default(guac_client* client); #endif diff --git a/protocols/rdp/src/client.c b/protocols/rdp/src/client.c index 3a7c5f61..690427c7 100644 --- a/protocols/rdp/src/client.c +++ b/protocols/rdp/src/client.c @@ -429,6 +429,9 @@ int guac_client_init(guac_client* client, int argc, char** argv) { guac_client_data->trans_glyph_surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, settings->width, settings->height); + /* Set default pointer */ + guac_rdp_pointer_set_default(client); + /* Success */ return 0; diff --git a/protocols/rdp/src/rdp_pointer.c b/protocols/rdp/src/rdp_pointer.c index 00ea93fe..b8b1f118 100644 --- a/protocols/rdp/src/rdp_pointer.c +++ b/protocols/rdp/src/rdp_pointer.c @@ -100,3 +100,38 @@ void guac_rdp_pointer_free(rdpContext* context, rdpPointer* pointer) { } +void guac_rdp_pointer_set_default(guac_client* client) { + + guac_socket* socket = client->socket; + + /* Draw to buffer */ + guac_layer* cursor = guac_client_alloc_buffer(client); + guac_protocol_send_size(socket, cursor, 110, 160); + + /* Draw cursor */ + guac_protocol_send_start(socket, cursor, 0, 0); + guac_protocol_send_line(socket, cursor, 10, 10); + guac_protocol_send_line(socket, cursor, 6, 10); + guac_protocol_send_line(socket, cursor, 8, 15); + guac_protocol_send_line(socket, cursor, 5, 15); + guac_protocol_send_line(socket, cursor, 3, 11); + guac_protocol_send_line(socket, cursor, 0, 14); + guac_protocol_send_close(socket, cursor); + + /* Fill */ + guac_protocol_send_cfill(socket, GUAC_COMP_OVER, cursor, + 0x00, 0x00, 0x00, 0xFF); + + /* Stroke */ + guac_protocol_send_cstroke(socket, GUAC_COMP_OVER, cursor, + GUAC_LINE_CAP_SQUARE, GUAC_LINE_JOIN_BEVEL, 1, + 0xFF, 0xFF, 0xFF, 0xFF); + + /* Set cursor */ + guac_protocol_send_cursor(socket, 0, 0, cursor, 0, 0, 11, 16); + + /* Free buffer */ + guac_client_free_buffer(client, cursor); + +} +