Add size/video/audio instruction handlers.
This commit is contained in:
parent
fe30cd3073
commit
875c2108e8
@ -99,6 +99,27 @@ int __guac_handle_key(guac_client* client, guac_instruction* instruction);
|
|||||||
*/
|
*/
|
||||||
int __guac_handle_clipboard(guac_client* client, guac_instruction* instruction);
|
int __guac_handle_clipboard(guac_client* client, guac_instruction* instruction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal initial handler for the size instruction. When a size instruction
|
||||||
|
* is received, this handler will be called. The client's size handler will
|
||||||
|
* be invoked if defined.
|
||||||
|
*/
|
||||||
|
int __guac_handle_size(guac_client* client, guac_instruction* instruction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal initial handler for the video instruction. When a video instruction
|
||||||
|
* is received, this handler will be called. The client's video handler will
|
||||||
|
* be invoked if defined.
|
||||||
|
*/
|
||||||
|
int __guac_handle_video(guac_client* client, guac_instruction* instruction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal initial handler for the audio instruction. When a audio instruction
|
||||||
|
* is received, this handler will be called. The client's audio handler will
|
||||||
|
* be invoked if defined.
|
||||||
|
*/
|
||||||
|
int __guac_handle_audio(guac_client* client, guac_instruction* instruction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal initial handler for the disconnect instruction. When a disconnect instruction
|
* Internal initial handler for the disconnect instruction. When a disconnect instruction
|
||||||
* is received, this handler will be called. Disconnect instructions are automatically
|
* is received, this handler will be called. Disconnect instructions are automatically
|
||||||
|
@ -77,6 +77,22 @@ typedef int guac_client_key_handler(guac_client* client, int keysym, int pressed
|
|||||||
*/
|
*/
|
||||||
typedef int guac_client_clipboard_handler(guac_client* client, char* copied);
|
typedef int guac_client_clipboard_handler(guac_client* client, char* copied);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for Guacamole screen size events.
|
||||||
|
*/
|
||||||
|
typedef int guac_client_size_handler(guac_client* client,
|
||||||
|
int width, int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for Guacamole audio format events.
|
||||||
|
*/
|
||||||
|
typedef int guac_client_audio_handler(guac_client* client, char* mimetype);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for Guacamole video format events.
|
||||||
|
*/
|
||||||
|
typedef int guac_client_video_handler(guac_client* client, char* mimetype);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for freeing up any extra data allocated by the client
|
* Handler for freeing up any extra data allocated by the client
|
||||||
* implementation.
|
* implementation.
|
||||||
@ -280,6 +296,57 @@ struct guac_client {
|
|||||||
*/
|
*/
|
||||||
guac_client_clipboard_handler* clipboard_handler;
|
guac_client_clipboard_handler* clipboard_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for size events sent by the Guacamole web-client.
|
||||||
|
*
|
||||||
|
* The handler takes an integer width and integer height, representing
|
||||||
|
* the current visible screen area of the client.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* int size_handler(guac_client* client, int width, int height);
|
||||||
|
*
|
||||||
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
|
* client->size_handler = size_handler;
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
guac_client_size_handler* size_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for audio format events sent by the Guacamole web-client.
|
||||||
|
*
|
||||||
|
* The handler takes the mimetype of the audio format being advertised
|
||||||
|
* as supported by the client.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* int audio_handler(guac_client* client, char* mimetype);
|
||||||
|
*
|
||||||
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
|
* client->audio_handler = audio_handler;
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
guac_client_audio_handler* audio_handler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for video format events sent by the Guacamole web-client.
|
||||||
|
*
|
||||||
|
* The handler takes the mimetype of the video format being advertised
|
||||||
|
* as supported by the client.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* int video_handler(guac_client* client, char* mimetype);
|
||||||
|
*
|
||||||
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
|
* client->video_handler = video_handler;
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
guac_client_video_handler* video_handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for freeing data when the client is being unloaded.
|
* Handler for freeing data when the client is being unloaded.
|
||||||
*
|
*
|
||||||
|
@ -50,6 +50,9 @@ __guac_instruction_handler_mapping __guac_instruction_handler_map[] = {
|
|||||||
{"key", __guac_handle_key},
|
{"key", __guac_handle_key},
|
||||||
{"clipboard", __guac_handle_clipboard},
|
{"clipboard", __guac_handle_clipboard},
|
||||||
{"disconnect", __guac_handle_disconnect},
|
{"disconnect", __guac_handle_disconnect},
|
||||||
|
{"size", __guac_handle_size},
|
||||||
|
{"audio", __guac_handle_audio},
|
||||||
|
{"video", __guac_handle_video},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +118,34 @@ int __guac_handle_clipboard(guac_client* client, guac_instruction* instruction)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __guac_handle_size(guac_client* client, guac_instruction* instruction) {
|
||||||
|
if (client->size_handler)
|
||||||
|
return client->size_handler(
|
||||||
|
client,
|
||||||
|
atoi(instruction->argv[0]), /* width */
|
||||||
|
atoi(instruction->argv[1]) /* height */
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __guac_handle_video(guac_client* client, guac_instruction* instruction) {
|
||||||
|
if (client->video_handler)
|
||||||
|
return client->video_handler(
|
||||||
|
client,
|
||||||
|
instruction->argv[0] /* mimetype */
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __guac_handle_audio(guac_client* client, guac_instruction* instruction) {
|
||||||
|
if (client->audio_handler)
|
||||||
|
return client->audio_handler(
|
||||||
|
client,
|
||||||
|
instruction->argv[0] /* mimetype */
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __guac_handle_disconnect(guac_client* client, guac_instruction* instruction) {
|
int __guac_handle_disconnect(guac_client* client, guac_instruction* instruction) {
|
||||||
/* Return error code to force disconnect */
|
/* Return error code to force disconnect */
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user