Migrate RDP to common pointer code.

This commit is contained in:
Michael Jumper 2014-01-06 16:21:23 -08:00
parent 93639cbf12
commit 0522077963
5 changed files with 4 additions and 163 deletions

View File

@ -23,14 +23,13 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4 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 lib_LTLIBRARIES = libguac-client-rdp.la
libguac_client_rdp_la_SOURCES = \ libguac_client_rdp_la_SOURCES = \
_generated_keymaps.c \ _generated_keymaps.c \
client.c \ client.c \
default_pointer.c \
guac_handlers.c \ guac_handlers.c \
rdp_bitmap.c \ rdp_bitmap.c \
rdp_cliprdr.c \ rdp_cliprdr.c \
@ -72,7 +71,6 @@ noinst_HEADERS = \
guac_rdpsnd/rdpsnd_service.h \ guac_rdpsnd/rdpsnd_service.h \
client.h \ client.h \
debug.h \ debug.h \
default_pointer.h \
guac_handlers.h \ guac_handlers.h \
rdp_bitmap.h \ rdp_bitmap.h \
rdp_cliprdr.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@ guacsnd_ldflags = -module -avoid-version -shared @RDP_LIBS@ @PTHREAD_LIBS@
guacdr_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@ guacsnd_libadd = @LIBGUAC_LTLIB@
guacdr_libadd = @LIBGUAC_LTLIB@ guacdr_libadd = @LIBGUAC_LTLIB@

View File

@ -25,8 +25,8 @@
#include "config.h" #include "config.h"
#include "client.h" #include "client.h"
#include "default_pointer.h"
#include "guac_handlers.h" #include "guac_handlers.h"
#include "guac_pointer_cursor.h"
#include "rdp_bitmap.h" #include "rdp_bitmap.h"
#include "rdp_gdi.h" #include "rdp_gdi.h"
#include "rdp_glyph.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); CAIRO_FORMAT_ARGB32, settings->width, settings->height);
/* Set default pointer */ /* Set default pointer */
guac_rdp_set_default_pointer(client); guac_common_set_pointer_cursor(client);
/* Success */ /* Success */
return 0; return 0;

View File

@ -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 <cairo/cairo.h>
#include <guacamole/client.h>
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
/* 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);
}

View File

@ -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 <cairo/cairo.h>
#include <guacamole/client.h>
/**
* 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

View File

@ -23,7 +23,6 @@
#include "config.h" #include "config.h"
#include "client.h" #include "client.h"
#include "default_pointer.h"
#include "rdp_pointer.h" #include "rdp_pointer.h"
#include <pthread.h> #include <pthread.h>