Bumped version number, migrated to new libguac API.

This commit is contained in:
Michael Jumper 2011-11-26 15:47:11 -08:00
parent 88d7b8ef70
commit a360430189
3 changed files with 105 additions and 82 deletions

View File

@ -35,7 +35,7 @@
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
AC_INIT(src/rdp_client.c) AC_INIT(src/rdp_client.c)
AM_INIT_AUTOMAKE([libguac-client-rdp], 0.4.0) AM_INIT_AUTOMAKE([libguac-client-rdp], 0.5.0)
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
# Checks for programs. # Checks for programs.
@ -44,7 +44,7 @@ AC_PROG_CC_C99
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
# Checks for libraries. # Checks for libraries.
AC_CHECK_LIB([guac], [guac_get_client],, AC_MSG_ERROR("libguac is required for communication via the guacamole protocol")) AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be installed first"))
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions")) AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
AC_CHECK_LIB([freerdp-core], [freerdp_new],, AC_MSG_ERROR("libfreerdp is required")) AC_CHECK_LIB([freerdp-core], [freerdp_new],, AC_MSG_ERROR("libfreerdp is required"))
AC_CHECK_LIB([freerdp-chanman], [freerdp_chanman_new],, AC_MSG_ERROR("libfreerdp is required")) AC_CHECK_LIB([freerdp-chanman], [freerdp_chanman_new],, AC_MSG_ERROR("libfreerdp is required"))

View File

@ -45,8 +45,7 @@
#include <freerdp/chanman.h> #include <freerdp/chanman.h>
#include <freerdp/constants/core.h> #include <freerdp/constants/core.h>
#include <guacamole/log.h> #include <guacamole/socket.h>
#include <guacamole/guacio.h>
#include <guacamole/protocol.h> #include <guacamole/protocol.h>
#include <guacamole/client.h> #include <guacamole/client.h>
@ -97,13 +96,13 @@ int rdp_guac_client_handle_messages(guac_client* client) {
/* get rdp fds */ /* get rdp fds */
if (rdp_inst->rdp_get_fds(rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) { if (rdp_inst->rdp_get_fds(rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
guac_log_error("Unable to read RDP file descriptors."); guac_client_log_error(client, "Unable to read RDP file descriptors.");
return 1; return 1;
} }
/* get channel fds */ /* get channel fds */
if (freerdp_chanman_get_fds(chanman, rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) { if (freerdp_chanman_get_fds(chanman, rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
guac_log_error("Unable to read RDP channel file descriptors."); guac_client_log_error(client, "Unable to read RDP channel file descriptors.");
return 1; return 1;
} }
@ -128,7 +127,7 @@ int rdp_guac_client_handle_messages(guac_client* client) {
/* If no file descriptors, error */ /* If no file descriptors, error */
if (max_fd == 0) { if (max_fd == 0) {
guac_log_error("No file descriptors"); guac_client_log_error(client, "No file descriptors");
return 1; return 1;
} }
@ -140,20 +139,20 @@ int rdp_guac_client_handle_messages(guac_client* client) {
(errno == EINPROGRESS) || (errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */ (errno == EINTR))) /* signal occurred */
{ {
guac_log_error("Error waiting for file descriptor."); guac_client_log_error(client, "Error waiting for file descriptor.");
return 1; return 1;
} }
} }
/* check the libfreerdp fds */ /* check the libfreerdp fds */
if (rdp_inst->rdp_check_fds(rdp_inst) != 0) { if (rdp_inst->rdp_check_fds(rdp_inst) != 0) {
guac_log_error("Error handling RDP file descriptors."); guac_client_log_error(client, "Error handling RDP file descriptors.");
return 1; return 1;
} }
/* check channel fds */ /* check channel fds */
if (freerdp_chanman_check_fds(chanman, rdp_inst) != 0) { if (freerdp_chanman_check_fds(chanman, rdp_inst) != 0) {
guac_log_error("Error handling RDP channel file descriptors."); guac_client_log_error(client, "Error handling RDP channel file descriptors.");
return 1; return 1;
} }
@ -174,8 +173,8 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
int port = RDP_DEFAULT_PORT; int port = RDP_DEFAULT_PORT;
if (argc < 2) { if (argc < 2) {
guac_send_error(client->io, "Wrong argument count received."); guac_protocol_send_error(client->socket, "Wrong argument count received.");
guac_flush(client->io); guac_socket_flush(client->socket);
return 1; return 1;
} }
@ -228,8 +227,8 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Init client */ /* Init client */
rdp_inst = freerdp_new(settings); rdp_inst = freerdp_new(settings);
if (rdp_inst == NULL) { if (rdp_inst == NULL) {
guac_send_error(client->io, "Error initializing RDP client"); guac_protocol_send_error(client->socket, "Error initializing RDP client");
guac_flush(client->io); guac_socket_flush(client->socket);
return 1; return 1;
} }
guac_client_data->rdp_inst = rdp_inst; guac_client_data->rdp_inst = rdp_inst;
@ -289,22 +288,22 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Init chanman (pre-connect) */ /* Init chanman (pre-connect) */
if (freerdp_chanman_pre_connect(chanman, rdp_inst)) { if (freerdp_chanman_pre_connect(chanman, rdp_inst)) {
guac_send_error(client->io, "Error initializing RDP client channel manager"); guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
guac_flush(client->io); guac_socket_flush(client->socket);
return 1; return 1;
} }
/* Connect to RDP server */ /* Connect to RDP server */
if (rdp_inst->rdp_connect(rdp_inst)) { if (rdp_inst->rdp_connect(rdp_inst)) {
guac_send_error(client->io, "Error connecting to RDP server"); guac_protocol_send_error(client->socket, "Error connecting to RDP server");
guac_flush(client->io); guac_socket_flush(client->socket);
return 1; return 1;
} }
/* Init chanman (post-connect) */ /* Init chanman (post-connect) */
if (freerdp_chanman_post_connect(chanman, rdp_inst)) { if (freerdp_chanman_post_connect(chanman, rdp_inst)) {
guac_send_error(client->io, "Error initializing RDP client channel manager"); guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager");
guac_flush(client->io); guac_socket_flush(client->socket);
return 1; return 1;
} }
@ -412,7 +411,7 @@ int rdp_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
keymap->flags & KBDFLAGS_EXTENDED, keymap->flags & KBDFLAGS_EXTENDED,
keymap->scancode); keymap->scancode);
else else
guac_log_info("unmapped keysym: 0x%x", keysym); guac_client_log_info(client, "unmapped keysym: 0x%x", keysym);
} }

View File

@ -40,8 +40,7 @@
#include <cairo/cairo.h> #include <cairo/cairo.h>
#include <guacamole/log.h> #include <guacamole/socket.h>
#include <guacamole/guacio.h>
#include <guacamole/client.h> #include <guacamole/client.h>
#include <guacamole/protocol.h> #include <guacamole/protocol.h>
@ -77,19 +76,21 @@ void guac_rdp_convert_color(int depth, int color, guac_rdp_color* comp) {
void guac_rdp_ui_error(rdpInst* inst, const char* text) { void guac_rdp_ui_error(rdpInst* inst, const char* text) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_send_error(io, text); guac_protocol_send_error(socket, text);
guac_flush(io); guac_socket_flush(socket);
} }
void guac_rdp_ui_warning(rdpInst* inst, const char* text) { void guac_rdp_ui_warning(rdpInst* inst, const char* text) {
guac_log_info("guac_rdp_ui_warning: %s\n", text); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_warning: %s\n", text);
} }
void guac_rdp_ui_unimpl(rdpInst* inst, const char* text) { void guac_rdp_ui_unimpl(rdpInst* inst, const char* text) {
guac_log_info("guac_rdp_ui_unimpl: %s\n", text); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_unimpl: %s\n", text);
} }
void guac_rdp_ui_begin_update(rdpInst* inst) { void guac_rdp_ui_begin_update(rdpInst* inst) {
@ -98,16 +99,18 @@ void guac_rdp_ui_begin_update(rdpInst* inst) {
void guac_rdp_ui_end_update(rdpInst* inst) { void guac_rdp_ui_end_update(rdpInst* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_flush(io); guac_socket_flush(socket);
} }
void guac_rdp_ui_desktop_save(rdpInst* inst, int offset, int x, int y, int cx, int cy) { void guac_rdp_ui_desktop_save(rdpInst* inst, int offset, int x, int y, int cx, int cy) {
guac_log_info("guac_rdp_ui_desktop_save: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_desktop_save: STUB\n");
} }
void guac_rdp_ui_desktop_restore(rdpInst* inst, int offset, int x, int y, int cx, int cy) { void guac_rdp_ui_desktop_restore(rdpInst* inst, int offset, int x, int y, int cx, int cy) {
guac_log_info("guac_rdp_ui_desktop_restore: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_desktop_restore: STUB\n");
} }
@ -115,7 +118,7 @@ RD_HBITMAP guac_rdp_ui_create_bitmap(rdpInst* inst, int width, int height, uint8
/* Allocate buffer */ /* Allocate buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_layer* buffer = guac_client_alloc_buffer(client); guac_layer* buffer = guac_client_alloc_buffer(client);
int x, y; int x, y;
@ -174,8 +177,8 @@ RD_HBITMAP guac_rdp_ui_create_bitmap(rdpInst* inst, int width, int height, uint8
} }
surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB24, width, height, stride); surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB24, width, height, stride);
guac_send_png(io, GUAC_COMP_SRC, buffer, 0, 0, surface); guac_protocol_send_png(socket, GUAC_COMP_SRC, buffer, 0, 0, surface);
guac_flush(io); guac_socket_flush(socket);
/* Free surface */ /* Free surface */
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
@ -190,7 +193,7 @@ void guac_rdp_ui_paint_bitmap(rdpInst* inst, int x, int y, int cx, int cy, int w
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
int dx, dy; int dx, dy;
int stride; int stride;
@ -256,8 +259,8 @@ void guac_rdp_ui_paint_bitmap(rdpInst* inst, int x, int y, int cx, int cy, int w
} }
surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB24, cx, cy, stride); surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB24, cx, cy, stride);
guac_send_png(io, GUAC_COMP_OVER, current_surface, x, y, surface); guac_protocol_send_png(socket, GUAC_COMP_OVER, current_surface, x, y, surface);
guac_flush(io); guac_socket_flush(socket);
/* Free surface */ /* Free surface */
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
@ -274,7 +277,8 @@ void guac_rdp_ui_destroy_bitmap(rdpInst* inst, RD_HBITMAP bmp) {
} }
void guac_rdp_ui_line(rdpInst* inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN* pen) { void guac_rdp_ui_line(rdpInst* inst, uint8 opcode, int startx, int starty, int endx, int endy, RD_PEN* pen) {
guac_log_info("guac_rdp_ui_line: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_line: STUB\n");
} }
void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 color) { void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 color) {
@ -282,7 +286,7 @@ void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 color)
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
unsigned char red, green, blue; unsigned char red, green, blue;
@ -306,22 +310,25 @@ void guac_rdp_ui_rect(rdpInst* inst, int x, int y, int cx, int cy, uint32 color)
} }
/* Send rectangle */ /* Send rectangle */
guac_send_rect(io, GUAC_COMP_OVER, current_surface, guac_protocol_send_rect(socket, GUAC_COMP_OVER, current_surface,
x, y, cx, cy, x, y, cx, cy,
red, green, blue, 0xFF); red, green, blue, 0xFF);
} }
void guac_rdp_ui_polygon(rdpInst* inst, uint8 opcode, uint8 fillmode, RD_POINT* point, int npoints, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_polygon(rdpInst* inst, uint8 opcode, uint8 fillmode, RD_POINT* point, int npoints, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) {
guac_log_info("guac_rdp_ui_polygon: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_polygon: STUB\n");
} }
void guac_rdp_ui_polyline(rdpInst* inst, uint8 opcode, RD_POINT* points, int npoints, RD_PEN* pen) { void guac_rdp_ui_polyline(rdpInst* inst, uint8 opcode, RD_POINT* points, int npoints, RD_PEN* pen) {
guac_log_info("guac_rdp_ui_polyline: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_polyline: STUB\n");
} }
void guac_rdp_ui_ellipse(rdpInst* inst, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_ellipse(rdpInst* inst, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) {
guac_log_info("guac_rdp_ui_ellipse: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_ellipse: STUB\n");
} }
void guac_rdp_ui_start_draw_glyphs(rdpInst* inst, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_start_draw_glyphs(rdpInst* inst, uint32 bgcolor, uint32 fgcolor) {
@ -346,13 +353,13 @@ void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int width, int height,
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
/* NOTE: Originally: Stencil=SRC, FG=ATOP, BG=RATOP */ /* NOTE: Originally: Stencil=SRC, FG=ATOP, BG=RATOP */
/* Temporarily removed BG drawing... */ /* Temporarily removed BG drawing... */
/* Foreground */ /* Foreground */
guac_send_rect(io, GUAC_COMP_ATOP, glyph, guac_protocol_send_rect(socket, GUAC_COMP_ATOP, glyph,
0, 0, width, height, 0, 0, width, height,
guac_client_data->foreground.red, guac_client_data->foreground.red,
guac_client_data->foreground.green, guac_client_data->foreground.green,
@ -360,7 +367,7 @@ void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int width, int height,
255); 255);
/* Background */ /* Background */
/*guac_send_rect(io, GUAC_COMP_OVER, current_surface, /*guac_protocol_send_rect(socket, GUAC_COMP_OVER, current_surface,
x, y, width, height, x, y, width, height,
guac_client_data->background.red, guac_client_data->background.red,
guac_client_data->background.green, guac_client_data->background.green,
@ -368,7 +375,7 @@ void guac_rdp_ui_draw_glyph(rdpInst* inst, int x, int y, int width, int height,
255);*/ 255);*/
/* Draw */ /* Draw */
guac_send_copy(io, guac_protocol_send_copy(socket,
(guac_layer*) glyph, 0, 0, width, height, (guac_layer*) glyph, 0, 0, width, height,
GUAC_COMP_OVER, current_surface, x, y); GUAC_COMP_OVER, current_surface, x, y);
@ -379,20 +386,24 @@ void guac_rdp_ui_end_draw_glyphs(rdpInst* inst, int x, int y, int cx, int cy) {
} }
uint32 guac_rdp_ui_get_toggle_keys_state(rdpInst* inst) { uint32 guac_rdp_ui_get_toggle_keys_state(rdpInst* inst) {
guac_log_info("guac_rdp_ui_get_toggle_keys_state: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_get_toggle_keys_state: STUB\n");
return 0; return 0;
} }
void guac_rdp_ui_bell(rdpInst* inst) { void guac_rdp_ui_bell(rdpInst* inst) {
guac_log_info("guac_rdp_ui_bell: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_bell: STUB\n");
} }
void guac_rdp_ui_destblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy) { void guac_rdp_ui_destblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy) {
guac_log_info("guac_rdp_ui_destblt: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_destblt: STUB\n");
} }
void guac_rdp_ui_patblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_patblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) {
guac_log_info("guac_rdp_ui_patblt: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_patblt: STUB\n");
} }
void guac_rdp_ui_screenblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy) { void guac_rdp_ui_screenblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy) {
@ -400,9 +411,9 @@ void guac_rdp_ui_screenblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, in
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_send_copy(io, guac_protocol_send_copy(socket,
GUAC_DEFAULT_LAYER, srcx, srcy, cx, cy, GUAC_DEFAULT_LAYER, srcx, srcy, cx, cy,
GUAC_COMP_OVER, current_surface, x, y); GUAC_COMP_OVER, current_surface, x, y);
@ -413,27 +424,29 @@ void guac_rdp_ui_memblt(rdpInst* inst, uint8 opcode, int x, int y, int width, in
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
if (opcode != 204) if (opcode != 204)
guac_log_info("guac_rdp_ui_memblt: opcode=%i, index=%i\n", opcode, guac_client_log_info(client,
"guac_rdp_ui_memblt: opcode=%i, index=%i\n", opcode,
((guac_layer*) src)->index); ((guac_layer*) src)->index);
guac_send_copy(io, guac_protocol_send_copy(socket,
(guac_layer*) src, srcx, srcy, width, height, (guac_layer*) src, srcx, srcy, width, height,
GUAC_COMP_OVER, current_surface, x, y); GUAC_COMP_OVER, current_surface, x, y);
} }
void guac_rdp_ui_triblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) { void guac_rdp_ui_triblt(rdpInst* inst, uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, RD_BRUSH* brush, uint32 bgcolor, uint32 fgcolor) {
guac_log_info("guac_rdp_ui_triblt: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_triblt: STUB\n");
} }
RD_HGLYPH guac_rdp_ui_create_glyph(rdpInst* inst, int width, int height, uint8* data) { RD_HGLYPH guac_rdp_ui_create_glyph(rdpInst* inst, int width, int height, uint8* data) {
/* Allocate buffer */ /* Allocate buffer */
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_layer* glyph = guac_client_alloc_buffer(client); guac_layer* glyph = guac_client_alloc_buffer(client);
int x, y, i; int x, y, i;
@ -480,8 +493,8 @@ RD_HGLYPH guac_rdp_ui_create_glyph(rdpInst* inst, int width, int height, uint8*
} }
surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_ARGB32, width, height, stride); surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_ARGB32, width, height, stride);
guac_send_png(io, GUAC_COMP_SRC, glyph, 0, 0, surface); guac_protocol_send_png(socket, GUAC_COMP_SRC, glyph, 0, 0, surface);
guac_flush(io); guac_socket_flush(socket);
/* Free surface */ /* Free surface */
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
@ -509,9 +522,9 @@ void guac_rdp_ui_set_clip(rdpInst* inst, int x, int y, int cx, int cy) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_send_clip(io, current_surface, x, y, cx, cy); guac_protocol_send_clip(socket, current_surface, x, y, cx, cy);
} }
@ -520,51 +533,59 @@ void guac_rdp_ui_reset_clip(rdpInst* inst) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
const guac_layer* current_surface = guac_client_data->current_surface; const guac_layer* current_surface = guac_client_data->current_surface;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_send_clip(io, current_surface, 0, 0, inst->settings->width, inst->settings->height); guac_protocol_send_clip(socket, current_surface, 0, 0, inst->settings->width, inst->settings->height);
} }
void guac_rdp_ui_resize_window(rdpInst* inst) { void guac_rdp_ui_resize_window(rdpInst* inst) {
guac_log_info("guac_rdp_ui_resize_window: %ix%i\n", inst->settings->width, inst->settings->height); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_resize_window: %ix%i\n", inst->settings->width, inst->settings->height);
} }
void guac_rdp_ui_set_cursor(rdpInst* inst, RD_HCURSOR cursor) { void guac_rdp_ui_set_cursor(rdpInst* inst, RD_HCURSOR cursor) {
guac_log_info("guac_rdp_ui_set_cursor: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_cursor: STUB\n");
} }
void guac_rdp_ui_destroy_cursor(rdpInst* inst, RD_HCURSOR cursor) { void guac_rdp_ui_destroy_cursor(rdpInst* inst, RD_HCURSOR cursor) {
guac_log_info("guac_rdp_ui_destroy_cursor: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_destroy_cursor: STUB\n");
} }
RD_HCURSOR guac_rdp_ui_create_cursor(rdpInst* inst, unsigned int x, unsigned int y, int width, int height, uint8* andmask, uint8* xormask, int bpp) { RD_HCURSOR guac_rdp_ui_create_cursor(rdpInst* inst, unsigned int x, unsigned int y, int width, int height, uint8* andmask, uint8* xormask, int bpp) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
guac_log_info("guac_rdp_ui_create_cursor: STUB\n"); guac_client_log_info(client, "guac_rdp_ui_create_cursor: STUB\n");
return guac_client_alloc_buffer(client); return guac_client_alloc_buffer(client);
} }
void guac_rdp_ui_set_null_cursor(rdpInst* inst) { void guac_rdp_ui_set_null_cursor(rdpInst* inst) {
guac_log_info("guac_rdp_ui_set_null_cursor: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_null_cursor: STUB\n");
} }
void guac_rdp_ui_set_default_cursor(rdpInst* inst) { void guac_rdp_ui_set_default_cursor(rdpInst* inst) {
guac_log_info("guac_rdp_ui_set_default_cursor: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_default_cursor: STUB\n");
} }
RD_HPALETTE guac_rdp_ui_create_colormap(rdpInst* inst, RD_PALETTE* colors) { RD_HPALETTE guac_rdp_ui_create_colormap(rdpInst* inst, RD_PALETTE* colors) {
guac_log_info("guac_rdp_ui_create_colormap: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_create_colormap: STUB\n");
return NULL; return NULL;
} }
void guac_rdp_ui_move_pointer(rdpInst* inst, int x, int y) { void guac_rdp_ui_move_pointer(rdpInst* inst, int x, int y) {
guac_log_info("guac_rdp_ui_move_pointer: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_move_pointer: STUB\n");
} }
void guac_rdp_ui_set_colormap(rdpInst* inst, RD_HPALETTE map) { void guac_rdp_ui_set_colormap(rdpInst* inst, RD_HPALETTE map) {
guac_log_info("guac_rdp_ui_set_colormap: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_colormap: STUB\n");
} }
RD_HBITMAP guac_rdp_ui_create_surface(rdpInst* inst, int width, int height, RD_HBITMAP old) { RD_HBITMAP guac_rdp_ui_create_surface(rdpInst* inst, int width, int height, RD_HBITMAP old) {
@ -585,16 +606,16 @@ void guac_rdp_ui_set_surface(rdpInst* inst, RD_HBITMAP surface) {
guac_client* client = (guac_client*) inst->param1; guac_client* client = (guac_client*) inst->param1;
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
GUACIO* io = client->io; guac_socket* socket = client->socket;
guac_log_info("guac_rdp_ui_set_surface: %p (index=%i)\n", surface, surface != NULL ? ((guac_layer*) surface)->index : 0); guac_client_log_info(client, "guac_rdp_ui_set_surface: %p (index=%i)\n", surface, surface != NULL ? ((guac_layer*) surface)->index : 0);
/* Init desktop */ /* Init desktop */
if (surface == NULL) { if (surface == NULL) {
guac_send_name(io, inst->settings->server); guac_protocol_send_name(socket, inst->settings->server);
guac_send_size(io, inst->settings->width, inst->settings->height); guac_protocol_send_size(socket, inst->settings->width, inst->settings->height);
guac_flush(io); guac_socket_flush(socket);
guac_client_data->current_surface = GUAC_DEFAULT_LAYER; guac_client_data->current_surface = GUAC_DEFAULT_LAYER;
} }
@ -613,15 +634,18 @@ void guac_rdp_ui_destroy_surface(rdpInst* inst, RD_HBITMAP surface) {
} }
void guac_rdp_ui_channel_data(rdpInst* inst, int chan_id, char* data, int data_size, int flags, int total_size) { void guac_rdp_ui_channel_data(rdpInst* inst, int chan_id, char* data, int data_size, int flags, int total_size) {
guac_log_info("guac_rdp_ui_channel_data: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_channel_data: STUB\n");
} }
RD_HPALETTE guac_rdp_ui_create_palette(rdpInst* inst, RD_PALETTE* colours) { RD_HPALETTE guac_rdp_ui_create_palette(rdpInst* inst, RD_PALETTE* colours) {
guac_log_info("guac_rdp_ui_create_palette: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_create_palette: STUB\n");
return NULL; return NULL;
} }
void guac_rdp_ui_set_palette(rdpInst* inst, RD_HPALETTE map) { void guac_rdp_ui_set_palette(rdpInst* inst, RD_HPALETTE map) {
guac_log_info("guac_rdp_ui_set_palette: STUB\n"); guac_client* client = (guac_client*) inst->param1;
guac_client_log_info(client, "guac_rdp_ui_set_palette: STUB\n");
} }