GUAC-240: Associate Guacamole client with surface.
This commit is contained in:
parent
364d2842ab
commit
d07d8ba2d2
@ -25,6 +25,7 @@
|
|||||||
#include "guac_surface.h"
|
#include "guac_surface.h"
|
||||||
|
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
|
#include <guacamole/client.h>
|
||||||
#include <guacamole/layer.h>
|
#include <guacamole/layer.h>
|
||||||
#include <guacamole/protocol.h>
|
#include <guacamole/protocol.h>
|
||||||
#include <guacamole/socket.h>
|
#include <guacamole/socket.h>
|
||||||
@ -660,12 +661,14 @@ static void __guac_common_surface_transfer(guac_common_surface* src, int* sx, in
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guac_common_surface* guac_common_surface_alloc(guac_socket* socket, const guac_layer* layer, int w, int h) {
|
guac_common_surface* guac_common_surface_alloc(guac_client* client,
|
||||||
|
guac_socket* socket, const guac_layer* layer, int w, int h) {
|
||||||
|
|
||||||
/* Init surface */
|
/* Init surface */
|
||||||
guac_common_surface* surface = malloc(sizeof(guac_common_surface));
|
guac_common_surface* surface = malloc(sizeof(guac_common_surface));
|
||||||
surface->layer = layer;
|
surface->client = client;
|
||||||
surface->socket = socket;
|
surface->socket = socket;
|
||||||
|
surface->layer = layer;
|
||||||
surface->width = w;
|
surface->width = w;
|
||||||
surface->height = h;
|
surface->height = h;
|
||||||
surface->dirty = 0;
|
surface->dirty = 0;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "guac_rect.h"
|
#include "guac_rect.h"
|
||||||
|
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
|
#include <guacamole/client.h>
|
||||||
#include <guacamole/layer.h>
|
#include <guacamole/layer.h>
|
||||||
#include <guacamole/protocol.h>
|
#include <guacamole/protocol.h>
|
||||||
#include <guacamole/socket.h>
|
#include <guacamole/socket.h>
|
||||||
@ -65,6 +66,11 @@ typedef struct guac_common_surface {
|
|||||||
*/
|
*/
|
||||||
const guac_layer* layer;
|
const guac_layer* layer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client associated with this surface.
|
||||||
|
*/
|
||||||
|
guac_client* client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The socket to send instructions on when flushing.
|
* The socket to send instructions on when flushing.
|
||||||
*/
|
*/
|
||||||
@ -131,13 +137,26 @@ typedef struct guac_common_surface {
|
|||||||
/**
|
/**
|
||||||
* Allocates a new guac_common_surface, assigning it to the given layer.
|
* Allocates a new guac_common_surface, assigning it to the given layer.
|
||||||
*
|
*
|
||||||
* @param socket The socket to send instructions on when flushing.
|
* @param client
|
||||||
* @param layer The layer to associate with the new surface.
|
* The client associated with the given layer.
|
||||||
* @param w The width of the surface.
|
*
|
||||||
* @param h The height of the surface.
|
* @param socket
|
||||||
* @return A newly-allocated guac_common_surface.
|
* The socket to send instructions on when flushing.
|
||||||
|
*
|
||||||
|
* @param layer
|
||||||
|
* The layer to associate with the new surface.
|
||||||
|
*
|
||||||
|
* @param w
|
||||||
|
* The width of the surface.
|
||||||
|
*
|
||||||
|
* @param h
|
||||||
|
* The height of the surface.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* A newly-allocated guac_common_surface.
|
||||||
*/
|
*/
|
||||||
guac_common_surface* guac_common_surface_alloc(guac_socket* socket, const guac_layer* layer, int w, int h);
|
guac_common_surface* guac_common_surface_alloc(guac_client* client,
|
||||||
|
guac_socket* socket, const guac_layer* layer, int w, int h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees the given guac_common_surface. Beware that this will NOT free any
|
* Frees the given guac_common_surface. Beware that this will NOT free any
|
||||||
|
@ -933,7 +933,8 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create default surface */
|
/* Create default surface */
|
||||||
guac_client_data->default_surface = guac_common_surface_alloc(client->socket, GUAC_DEFAULT_LAYER,
|
guac_client_data->default_surface = guac_common_surface_alloc(client,
|
||||||
|
client->socket, GUAC_DEFAULT_LAYER,
|
||||||
settings->width, settings->height);
|
settings->width, settings->height);
|
||||||
guac_client_data->current_surface = guac_client_data->default_surface;
|
guac_client_data->current_surface = guac_client_data->default_surface;
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ void guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
|
|||||||
|
|
||||||
/* Allocate surface */
|
/* Allocate surface */
|
||||||
guac_layer* buffer = guac_client_alloc_buffer(client);
|
guac_layer* buffer = guac_client_alloc_buffer(client);
|
||||||
guac_common_surface* surface = guac_common_surface_alloc(socket, buffer, bitmap->width, bitmap->height);
|
guac_common_surface* surface = guac_common_surface_alloc(client, socket,
|
||||||
|
buffer, bitmap->width, bitmap->height);
|
||||||
|
|
||||||
/* Cache image data if present */
|
/* Cache image data if present */
|
||||||
if (bitmap->data != NULL) {
|
if (bitmap->data != NULL) {
|
||||||
|
@ -549,7 +549,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);
|
||||||
|
|
||||||
/* Create default surface */
|
/* Create default surface */
|
||||||
guac_client_data->default_surface = guac_common_surface_alloc(client->socket, GUAC_DEFAULT_LAYER,
|
guac_client_data->default_surface = guac_common_surface_alloc(client,
|
||||||
|
client->socket, GUAC_DEFAULT_LAYER,
|
||||||
rfb_client->width, rfb_client->height);
|
rfb_client->width, rfb_client->height);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -276,8 +276,8 @@ guac_terminal_display* guac_terminal_display_alloc(guac_client* client,
|
|||||||
/* Create default surface */
|
/* Create default surface */
|
||||||
display->display_layer = guac_client_alloc_layer(client);
|
display->display_layer = guac_client_alloc_layer(client);
|
||||||
display->select_layer = guac_client_alloc_layer(client);
|
display->select_layer = guac_client_alloc_layer(client);
|
||||||
display->display_surface = guac_common_surface_alloc(client->socket,
|
display->display_surface = guac_common_surface_alloc(client,
|
||||||
display->display_layer, 0, 0);
|
client->socket, display->display_layer, 0, 0);
|
||||||
|
|
||||||
/* Select layer is a child of the display layer */
|
/* Select layer is a child of the display layer */
|
||||||
guac_protocol_send_move(client->socket, display->select_layer,
|
guac_protocol_send_move(client->socket, display->select_layer,
|
||||||
|
Loading…
Reference in New Issue
Block a user