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 <cairo/cairo.h>
|
||||
#include <guacamole/client.h>
|
||||
#include <guacamole/layer.h>
|
||||
#include <guacamole/protocol.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 */
|
||||
guac_common_surface* surface = malloc(sizeof(guac_common_surface));
|
||||
surface->layer = layer;
|
||||
surface->client = client;
|
||||
surface->socket = socket;
|
||||
surface->layer = layer;
|
||||
surface->width = w;
|
||||
surface->height = h;
|
||||
surface->dirty = 0;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "guac_rect.h"
|
||||
|
||||
#include <cairo/cairo.h>
|
||||
#include <guacamole/client.h>
|
||||
#include <guacamole/layer.h>
|
||||
#include <guacamole/protocol.h>
|
||||
#include <guacamole/socket.h>
|
||||
@ -65,6 +66,11 @@ typedef struct guac_common_surface {
|
||||
*/
|
||||
const guac_layer* layer;
|
||||
|
||||
/**
|
||||
* The client associated with this surface.
|
||||
*/
|
||||
guac_client* client;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param socket 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.
|
||||
* @param client
|
||||
* The client associated with the given layer.
|
||||
*
|
||||
* @param socket
|
||||
* 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
|
||||
|
@ -933,7 +933,8 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
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 */
|
||||
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 */
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
return 0;
|
||||
|
||||
|
@ -276,8 +276,8 @@ guac_terminal_display* guac_terminal_display_alloc(guac_client* client,
|
||||
/* Create default surface */
|
||||
display->display_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_layer, 0, 0);
|
||||
display->display_surface = guac_common_surface_alloc(client,
|
||||
client->socket, display->display_layer, 0, 0);
|
||||
|
||||
/* Select layer is a child of the display layer */
|
||||
guac_protocol_send_move(client->socket, display->select_layer,
|
||||
|
Loading…
Reference in New Issue
Block a user