Move VNC pointers to common.

This commit is contained in:
Michael Jumper 2014-01-06 16:18:54 -08:00
parent 50bb5d132f
commit 93639cbf12
9 changed files with 68 additions and 58 deletions

View File

@ -32,8 +32,8 @@ DIST_SUBDIRS = \
tests
SUBDIRS = \
src/common \
src/libguac \
src/common \
src/guacd \
tests

View File

@ -92,6 +92,8 @@ AC_TYPE_SSIZE_T
# Bundled libguac
AC_SUBST([LIBGUAC_LTLIB], '$(top_builddir)/src/libguac/libguac.la')
AC_SUBST([LIBGUAC_INCLUDE], '-I$(top_srcdir)/src/libguac')
AC_SUBST([COMMON_LTLIB], '$(top_builddir)/src/common/libguac_common.la')
AC_SUBST([COMMON_INCLUDE], '-I$(top_builddir)/src/common')
# Options
AC_ARG_WITH(init_dir,

View File

@ -22,15 +22,21 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Werror -Wall -pedantic
AM_CFLAGS = -Werror -Wall -pedantic @LIBGUAC_INCLUDE@
noinst_LTLIBRARIES = libguac_common.la
noinst_HEADERS = \
guac_io.h \
guac_list.h
noinst_HEADERS = \
guac_io.h \
guac_dot_cursor.c \
guac_list.h \
guac_pointer_cursor.c
libguac_common_la_SOURCES = \
guac_io.c \
guac_list.c
guac_dot_cursor.c \
guac_list.c \
guac_pointer_cursor.c
libguac_common_la_LIBADD = @LIBGUAC_LTLIB@

View File

@ -33,15 +33,15 @@
#define _ 0x00,0x00,0x00,0x00
/* Dimensions */
const int guac_vnc_dot_cursor_width = 5;
const int guac_vnc_dot_cursor_height = 5;
const int guac_common_dot_cursor_width = 5;
const int guac_common_dot_cursor_height = 5;
/* Format */
const cairo_format_t guac_vnc_dot_cursor_format = CAIRO_FORMAT_ARGB32;
const int guac_vnc_dot_cursor_stride = 20;
const cairo_format_t guac_common_dot_cursor_format = CAIRO_FORMAT_ARGB32;
const int guac_common_dot_cursor_stride = 20;
/* Embedded pointer graphic */
unsigned char guac_vnc_dot_cursor[] = {
unsigned char guac_common_dot_cursor[] = {
_,O,O,O,_,
O,X,X,X,O,
@ -51,7 +51,7 @@ unsigned char guac_vnc_dot_cursor[] = {
};
void guac_vnc_set_dot_cursor(guac_client* client) {
void guac_common_set_dot_cursor(guac_client* client) {
guac_socket* socket = client->socket;
@ -59,11 +59,11 @@ void guac_vnc_set_dot_cursor(guac_client* client) {
guac_layer* cursor = guac_client_alloc_buffer(client);
cairo_surface_t* graphic = cairo_image_surface_create_for_data(
guac_vnc_dot_cursor,
guac_vnc_dot_cursor_format,
guac_vnc_dot_cursor_width,
guac_vnc_dot_cursor_height,
guac_vnc_dot_cursor_stride);
guac_common_dot_cursor,
guac_common_dot_cursor_format,
guac_common_dot_cursor_width,
guac_common_dot_cursor_height,
guac_common_dot_cursor_stride);
guac_protocol_send_png(socket, GUAC_COMP_SRC, cursor, 0, 0, graphic);
cairo_surface_destroy(graphic);
@ -71,8 +71,8 @@ void guac_vnc_set_dot_cursor(guac_client* client) {
/* Set cursor */
guac_protocol_send_cursor(socket, 2, 2, cursor,
0, 0,
guac_vnc_dot_cursor_width,
guac_vnc_dot_cursor_height);
guac_common_dot_cursor_width,
guac_common_dot_cursor_height);
/* Free buffer */
guac_client_free_buffer(client, cursor);

View File

@ -21,8 +21,8 @@
*/
#ifndef _GUAC_VNC_DOT_CURSOR_H
#define _GUAC_VNC_DOT_CURSOR_H
#ifndef _GUAC_COMMON_DOT_CURSOR_H
#define _GUAC_COMMON_DOT_CURSOR_H
#include "config.h"
@ -32,33 +32,33 @@
/**
* Width of the embedded mouse cursor graphic.
*/
extern const int guac_vnc_dot_cursor_width;
extern const int guac_common_dot_cursor_width;
/**
* Height of the embedded mouse cursor graphic.
*/
extern const int guac_vnc_dot_cursor_height;
extern const int guac_common_dot_cursor_height;
/**
* Number of bytes in each row of the embedded mouse cursor graphic.
*/
extern const int guac_vnc_dot_cursor_stride;
extern const int guac_common_dot_cursor_stride;
/**
* The Cairo grapic format of the mouse cursor graphic.
*/
extern const cairo_format_t guac_vnc_dot_cursor_format;
extern const cairo_format_t guac_common_dot_cursor_format;
/**
* Embedded mouse cursor graphic.
*/
extern unsigned char guac_vnc_dot_cursor[];
extern unsigned char guac_common_dot_cursor[];
/**
* Set the cursor of the remote display to the embedded cursor graphic.
*
* @param client The guac_client to send the cursor to.
*/
void guac_vnc_set_dot_cursor(guac_client* client);
void guac_common_set_dot_cursor(guac_client* client);
#endif

View File

@ -33,15 +33,15 @@
#define _ 0x00,0x00,0x00,0x00
/* Dimensions */
const int guac_vnc_pointer_cursor_width = 11;
const int guac_vnc_pointer_cursor_height = 16;
const int guac_common_pointer_cursor_width = 11;
const int guac_common_pointer_cursor_height = 16;
/* Format */
const cairo_format_t guac_vnc_pointer_cursor_format = CAIRO_FORMAT_ARGB32;
const int guac_vnc_pointer_cursor_stride = 44;
const cairo_format_t guac_common_pointer_cursor_format = CAIRO_FORMAT_ARGB32;
const int guac_common_pointer_cursor_stride = 44;
/* Embedded pointer graphic */
unsigned char guac_vnc_pointer_cursor[] = {
unsigned char guac_common_pointer_cursor[] = {
O,_,_,_,_,_,_,_,_,_,_,
O,O,_,_,_,_,_,_,_,_,_,
@ -62,7 +62,7 @@ unsigned char guac_vnc_pointer_cursor[] = {
};
void guac_vnc_set_pointer_cursor(guac_client* client) {
void guac_common_set_pointer_cursor(guac_client* client) {
guac_socket* socket = client->socket;
@ -70,11 +70,11 @@ void guac_vnc_set_pointer_cursor(guac_client* client) {
guac_layer* cursor = guac_client_alloc_buffer(client);
cairo_surface_t* graphic = cairo_image_surface_create_for_data(
guac_vnc_pointer_cursor,
guac_vnc_pointer_cursor_format,
guac_vnc_pointer_cursor_width,
guac_vnc_pointer_cursor_height,
guac_vnc_pointer_cursor_stride);
guac_common_pointer_cursor,
guac_common_pointer_cursor_format,
guac_common_pointer_cursor_width,
guac_common_pointer_cursor_height,
guac_common_pointer_cursor_stride);
guac_protocol_send_png(socket, GUAC_COMP_SRC, cursor, 0, 0, graphic);
cairo_surface_destroy(graphic);
@ -82,8 +82,8 @@ void guac_vnc_set_pointer_cursor(guac_client* client) {
/* Set cursor */
guac_protocol_send_cursor(socket, 0, 0, cursor,
0, 0,
guac_vnc_pointer_cursor_width,
guac_vnc_pointer_cursor_height);
guac_common_pointer_cursor_width,
guac_common_pointer_cursor_height);
/* Free buffer */
guac_client_free_buffer(client, cursor);

View File

@ -21,8 +21,8 @@
*/
#ifndef _GUAC_VNC_POINTER_CURSOR_H
#define _GUAC_VNC_POINTER_CURSOR_H
#ifndef _GUAC_COMMON_POINTER_CURSOR_H
#define _GUAC_COMMON_POINTER_CURSOR_H
#include "config.h"
@ -32,33 +32,33 @@
/**
* Width of the embedded mouse cursor graphic.
*/
extern const int guac_vnc_pointer_cursor_width;
extern const int guac_common_pointer_cursor_width;
/**
* Height of the embedded mouse cursor graphic.
*/
extern const int guac_vnc_pointer_cursor_height;
extern const int guac_common_pointer_cursor_height;
/**
* Number of bytes in each row of the embedded mouse cursor graphic.
*/
extern const int guac_vnc_pointer_cursor_stride;
extern const int guac_common_pointer_cursor_stride;
/**
* The Cairo grapic format of the mouse cursor graphic.
*/
extern const cairo_format_t guac_vnc_pointer_cursor_format;
extern const cairo_format_t guac_common_pointer_cursor_format;
/**
* Embedded mouse cursor graphic.
*/
extern unsigned char guac_vnc_pointer_cursor[];
extern unsigned char guac_common_pointer_cursor[];
/**
* Set the cursor of the remote display to the embedded cursor graphic.
*
* @param client The guac_client to send the cursor to.
*/
void guac_vnc_set_pointer_cursor(guac_client* client);
void guac_common_set_pointer_cursor(guac_client* client);
#endif

View File

@ -23,24 +23,22 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Werror -Wall -pedantic -Iinclude @LIBGUAC_INCLUDE@
AM_CFLAGS = -Werror -Wall -pedantic -Iinclude \
@COMMON_INCLUDE@ \
@LIBGUAC_INCLUDE@
lib_LTLIBRARIES = libguac-client-vnc.la
libguac_client_vnc_la_SOURCES = \
client.c \
convert.c \
dot_cursor.c \
guac_handlers.c \
pointer_cursor.c \
vnc_handlers.c
noinst_HEADERS = \
client.h \
convert.h \
dot_cursor.h \
guac_handlers.h \
pointer_cursor.h \
vnc_handlers.h
# Optional PulseAudio support
@ -49,6 +47,10 @@ libguac_client_vnc_la_SOURCES += pulse.c
noinst_HEADERS += pulse.h
endif
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0 @VNC_LIBS@ @CAIRO_LIBS@ @PULSE_LIBS@
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0 \
@CAIRO_LIBS@ \
@PULSE_LIBS@ \
@VNC_LIBS@
libguac_client_vnc_la_LIBADD = @LIBGUAC_LTLIB@

View File

@ -23,9 +23,9 @@
#include "config.h"
#include "client.h"
#include "dot_cursor.h"
#include "guac_dot_cursor.h"
#include "guac_handlers.h"
#include "pointer_cursor.h"
#include "guac_pointer_cursor.h"
#include "vnc_handlers.h"
#include <stdlib.h>
@ -356,11 +356,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* If not read-only but cursor is remote, set a dot cursor */
if (guac_client_data->remote_cursor)
guac_vnc_set_dot_cursor(client);
guac_common_set_dot_cursor(client);
/* Otherwise, set pointer until explicitly requested otherwise */
else
guac_vnc_set_pointer_cursor(client);
guac_common_set_pointer_cursor(client);
}