Refactor supporting buffered cursor instruction.
This commit is contained in:
parent
6741c3c92f
commit
546e352374
@ -51,6 +51,8 @@ typedef struct vnc_guac_client_data {
|
|||||||
char* password;
|
char* password;
|
||||||
char* encodings;
|
char* encodings;
|
||||||
|
|
||||||
|
guac_layer* cursor;
|
||||||
|
|
||||||
} vnc_guac_client_data;
|
} vnc_guac_client_data;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,6 +140,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
/* Set remaining client data */
|
/* Set remaining client data */
|
||||||
guac_client_data->rfb_client = rfb_client;
|
guac_client_data->rfb_client = rfb_client;
|
||||||
guac_client_data->copy_rect_used = 0;
|
guac_client_data->copy_rect_used = 0;
|
||||||
|
guac_client_data->cursor = guac_client_alloc_buffer(client);
|
||||||
|
|
||||||
/* Set handlers */
|
/* Set handlers */
|
||||||
client->handle_messages = vnc_guac_client_handle_messages;
|
client->handle_messages = vnc_guac_client_handle_messages;
|
||||||
@ -155,7 +156,8 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
guac_protocol_send_name(client->socket, rfb_client->desktopName);
|
guac_protocol_send_name(client->socket, rfb_client->desktopName);
|
||||||
|
|
||||||
/* Send size */
|
/* Send size */
|
||||||
guac_protocol_send_size(client->socket, rfb_client->width, rfb_client->height);
|
guac_protocol_send_size(client->socket,
|
||||||
|
GUAC_DEFAULT_LAYER, rfb_client->width, rfb_client->height);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
|
|||||||
|
|
||||||
guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT);
|
guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT);
|
||||||
guac_socket* socket = gc->socket;
|
guac_socket* socket = gc->socket;
|
||||||
|
const guac_layer* cursor_layer = ((vnc_guac_client_data*) gc->data)->cursor;
|
||||||
|
|
||||||
/* Cairo image buffer */
|
/* Cairo image buffer */
|
||||||
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, w);
|
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, w);
|
||||||
@ -118,9 +119,13 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SEND CURSOR */
|
/* Send cursor data*/
|
||||||
surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, w, h, stride);
|
surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, w, h, stride);
|
||||||
guac_protocol_send_cursor(socket, x, y, surface);
|
guac_protocol_send_png(socket,
|
||||||
|
GUAC_COMP_SRC, cursor_layer, 0, 0, surface);
|
||||||
|
|
||||||
|
/* Update cursor */
|
||||||
|
guac_protocol_send_cursor(socket, x, y, cursor_layer, 0, 0, w, h);
|
||||||
|
|
||||||
/* Free surface */
|
/* Free surface */
|
||||||
cairo_surface_destroy(surface);
|
cairo_surface_destroy(surface);
|
||||||
@ -244,7 +249,8 @@ rfbBool guac_vnc_malloc_framebuffer(rfbClient* rfb_client) {
|
|||||||
vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) gc->data;
|
vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) gc->data;
|
||||||
|
|
||||||
/* Send new size */
|
/* Send new size */
|
||||||
guac_protocol_send_size(gc->socket, rfb_client->width, rfb_client->height);
|
guac_protocol_send_size(gc->socket,
|
||||||
|
GUAC_DEFAULT_LAYER, rfb_client->width, rfb_client->height);
|
||||||
|
|
||||||
/* Use original, wrapped proc */
|
/* Use original, wrapped proc */
|
||||||
return guac_client_data->rfb_MallocFrameBuffer(rfb_client);
|
return guac_client_data->rfb_MallocFrameBuffer(rfb_client);
|
||||||
|
Loading…
Reference in New Issue
Block a user