From 05220779635dd880fb2e0b1f921e8ec5432138ea Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 6 Jan 2014 16:21:23 -0800 Subject: [PATCH] Migrate RDP to common pointer code. --- src/protocols/rdp/Makefile.am | 6 +- src/protocols/rdp/client.c | 4 +- src/protocols/rdp/default_pointer.c | 92 ----------------------------- src/protocols/rdp/default_pointer.h | 64 -------------------- src/protocols/rdp/rdp_pointer.c | 1 - 5 files changed, 4 insertions(+), 163 deletions(-) delete mode 100644 src/protocols/rdp/default_pointer.c delete mode 100644 src/protocols/rdp/default_pointer.h diff --git a/src/protocols/rdp/Makefile.am b/src/protocols/rdp/Makefile.am index 7ad8e0d8..d47404cd 100644 --- a/src/protocols/rdp/Makefile.am +++ b/src/protocols/rdp/Makefile.am @@ -23,14 +23,13 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 -AM_CFLAGS = -Werror -Wall -Iinclude @LIBGUAC_INCLUDE@ +AM_CFLAGS = -Werror -Wall -Iinclude @LIBGUAC_INCLUDE@ @COMMON_INCLUDE@ lib_LTLIBRARIES = libguac-client-rdp.la libguac_client_rdp_la_SOURCES = \ _generated_keymaps.c \ client.c \ - default_pointer.c \ guac_handlers.c \ rdp_bitmap.c \ rdp_cliprdr.c \ @@ -72,7 +71,6 @@ noinst_HEADERS = \ guac_rdpsnd/rdpsnd_service.h \ client.h \ debug.h \ - default_pointer.h \ guac_handlers.h \ rdp_bitmap.h \ rdp_cliprdr.h \ @@ -96,7 +94,7 @@ libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0 @RDP_LIBS@ @PTHREAD_LIBS@ @C guacsnd_ldflags = -module -avoid-version -shared @RDP_LIBS@ @PTHREAD_LIBS@ guacdr_ldflags = -module -avoid-version -shared @RDP_LIBS@ @PTHREAD_LIBS@ -libguac_client_rdp_la_LIBADD = @LIBGUAC_LTLIB@ +libguac_client_rdp_la_LIBADD = @LIBGUAC_LTLIB@ @COMMON_LTLIB@ guacsnd_libadd = @LIBGUAC_LTLIB@ guacdr_libadd = @LIBGUAC_LTLIB@ diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index 55ed94e9..293c69a4 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -25,8 +25,8 @@ #include "config.h" #include "client.h" -#include "default_pointer.h" #include "guac_handlers.h" +#include "guac_pointer_cursor.h" #include "rdp_bitmap.h" #include "rdp_gdi.h" #include "rdp_glyph.h" @@ -616,7 +616,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { CAIRO_FORMAT_ARGB32, settings->width, settings->height); /* Set default pointer */ - guac_rdp_set_default_pointer(client); + guac_common_set_pointer_cursor(client); /* Success */ return 0; diff --git a/src/protocols/rdp/default_pointer.c b/src/protocols/rdp/default_pointer.c deleted file mode 100644 index 4e993a8d..00000000 --- a/src/protocols/rdp/default_pointer.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013 Glyptodon LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "config.h" - -#include -#include -#include -#include - -/* Macros for prettying up the embedded image. */ -#define X 0x00,0x00,0x00,0xFF -#define O 0xFF,0xFF,0xFF,0xFF -#define _ 0x00,0x00,0x00,0x00 - -/* Dimensions */ -const int guac_rdp_default_pointer_width = 11; -const int guac_rdp_default_pointer_height = 16; - -/* Format */ -const cairo_format_t guac_rdp_default_pointer_format = CAIRO_FORMAT_ARGB32; -const int guac_rdp_default_pointer_stride = 44; - -/* Embedded pointer graphic */ -unsigned char guac_rdp_default_pointer[] = { - - O,_,_,_,_,_,_,_,_,_,_, - O,O,_,_,_,_,_,_,_,_,_, - O,X,O,_,_,_,_,_,_,_,_, - O,X,X,O,_,_,_,_,_,_,_, - O,X,X,X,O,_,_,_,_,_,_, - O,X,X,X,X,O,_,_,_,_,_, - O,X,X,X,X,X,O,_,_,_,_, - O,X,X,X,X,X,X,O,_,_,_, - O,X,X,X,X,X,X,X,O,_,_, - O,X,X,X,X,X,X,X,X,O,_, - O,X,X,X,X,X,O,O,O,O,O, - O,X,X,O,X,X,O,_,_,_,_, - O,X,O,_,O,X,X,O,_,_,_, - O,O,_,_,O,X,X,O,_,_,_, - O,_,_,_,_,O,X,X,O,_,_, - _,_,_,_,_,O,O,O,O,_,_ - -}; - -void guac_rdp_set_default_pointer(guac_client* client) { - - guac_socket* socket = client->socket; - - /* Draw to buffer */ - guac_layer* cursor = guac_client_alloc_buffer(client); - - cairo_surface_t* graphic = cairo_image_surface_create_for_data( - guac_rdp_default_pointer, - guac_rdp_default_pointer_format, - guac_rdp_default_pointer_width, - guac_rdp_default_pointer_height, - guac_rdp_default_pointer_stride); - - guac_protocol_send_png(socket, GUAC_COMP_SRC, cursor, 0, 0, graphic); - cairo_surface_destroy(graphic); - - /* Set cursor */ - guac_protocol_send_cursor(socket, 0, 0, cursor, - 0, 0, - guac_rdp_default_pointer_width, - guac_rdp_default_pointer_height); - - /* Free buffer */ - guac_client_free_buffer(client, cursor); - -} - diff --git a/src/protocols/rdp/default_pointer.h b/src/protocols/rdp/default_pointer.h deleted file mode 100644 index fcc677f1..00000000 --- a/src/protocols/rdp/default_pointer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2013 Glyptodon LLC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - - -#ifndef _GUAC_RDP_DEFAULT_POINTER_H -#define _GUAC_RDP_DEFAULT_POINTER_H - -#include "config.h" - -#include -#include - -/** - * Width of the embedded mouse cursor graphic. - */ -extern const int guac_rdp_default_pointer_width; - -/** - * Height of the embedded mouse cursor graphic. - */ -extern const int guac_rdp_default_pointer_height; - -/** - * Number of bytes in each row of the embedded mouse cursor graphic. - */ -extern const int guac_rdp_default_pointer_stride; - -/** - * The Cairo grapic format of the mouse cursor graphic. - */ -extern const cairo_format_t guac_rdp_default_pointer_format; - -/** - * Embedded mouse cursor graphic. - */ -extern unsigned char guac_rdp_default_pointer[]; - -/** - * Set the cursor of the remote display to the embedded cursor graphic. - * - * @param client The guac_client to send the cursor to. - */ -void guac_rdp_set_default_pointer(guac_client* client); - -#endif diff --git a/src/protocols/rdp/rdp_pointer.c b/src/protocols/rdp/rdp_pointer.c index 9c3803c4..4ef36e35 100644 --- a/src/protocols/rdp/rdp_pointer.c +++ b/src/protocols/rdp/rdp_pointer.c @@ -23,7 +23,6 @@ #include "config.h" #include "client.h" -#include "default_pointer.h" #include "rdp_pointer.h" #include