From a0e4da84efc01e4d0dd26b496279c3c907b19d41 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 16 Sep 2010 20:55:39 +0000 Subject: [PATCH] typedefs for handlers --- guacamole/libguac/client.c | 2 +- guacamole/libguac/guacio.c | 2 +- guacamole/libguac/include/client.h | 25 +++++++++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/guacamole/libguac/client.c b/guacamole/libguac/client.c index 859620f09..a2550678c 100644 --- a/guacamole/libguac/client.c +++ b/guacamole/libguac/client.c @@ -53,7 +53,7 @@ void guac_free_png_buffer(png_byte** png_buffer, int h) { } -guac_client* guac_get_client(int client_fd, void (*client_init)(guac_client* client, const char* hostname, int port), const char* hostname, int port) { +guac_client* guac_get_client(int client_fd, guac_client_init_handler* client_init, const char* hostname, int port) { guac_client* client = malloc(sizeof(guac_client)); diff --git a/guacamole/libguac/guacio.c b/guacamole/libguac/guacio.c index 3deff95f9..3c4567aa7 100644 --- a/guacamole/libguac/guacio.c +++ b/guacamole/libguac/guacio.c @@ -49,7 +49,7 @@ GUACIO* guac_open(int fd) { io->instructionbuf_used_length = 0; /* Set limit */ - io->transfer_limit = 0; + io->transfer_limit = 256; return io; diff --git a/guacamole/libguac/include/client.h b/guacamole/libguac/include/client.h index e5f5303a8..674260012 100644 --- a/guacamole/libguac/include/client.h +++ b/guacamole/libguac/include/client.h @@ -24,13 +24,21 @@ #include "guacio.h" +typedef struct guac_client guac_client; + +typedef void guac_client_handle_messages(guac_client* client); +typedef void guac_client_mouse_handler(guac_client* client, int x, int y, int button_mask); +typedef void guac_client_key_handler(guac_client* client, int keysym, int pressed); +typedef void guac_client_clipboard_handler(guac_client* client, char* copied); +typedef void guac_client_free_handler(void* client); + /** * Guacamole proxy client. * * Represents a Guacamole proxy client (the client which communicates to * a server on behalf of Guacamole, on behalf of the web-client). */ -typedef struct guac_client { +struct guac_client { /** * The GUACIO structure to be used to communicate with the web-client. It is @@ -47,15 +55,16 @@ typedef struct guac_client { */ void* data; - void (*handle_messages)(struct guac_client* client); - void (*mouse_handler)(struct guac_client* client, int x, int y, int button_mask); - void (*key_handler)(struct guac_client* client, int keysym, int pressed); - void (*clipboard_handler)(struct guac_client* client, char* copied); - void (*free_handler)(void* client); + guac_client_handle_messages* handle_messages; + guac_client_mouse_handler* mouse_handler; + guac_client_key_handler* key_handler; + guac_client_clipboard_handler* clipboard_handler; + guac_client_free_handler* free_handler; -} guac_client; +}; -guac_client* guac_get_client(int client_fd, void (*client_init)(guac_client* client, const char* hostname, int port), const char* hostname, int port); +typedef void guac_client_init_handler(guac_client* client, const char* hostname, int port); +guac_client* guac_get_client(int client_fd, guac_client_init_handler* client_init, const char* hostname, int port); void guac_start_client(guac_client* client); void guac_free_client(guac_client* client); png_byte** guac_alloc_png_buffer(int w, int h, int bpp);