GUACAMOLE-249: Centralize handling of connected channels.
This commit is contained in:
parent
16be3af03c
commit
cc7cd78e5b
@ -18,9 +18,27 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "rdp.h"
|
||||
|
||||
#include <freerdp/channels/channels.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <guacamole/client.h>
|
||||
|
||||
void guac_rdp_channel_connected(rdpContext* context,
|
||||
ChannelConnectedEventArgs* e) {
|
||||
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
|
||||
|
||||
guac_client_log(client, GUAC_LOG_DEBUG, "Channel \"%s\" connected.", e->name);
|
||||
|
||||
/* Display update channel */
|
||||
if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
|
||||
DispClientContext* disp = (DispClientContext*) e->pInterface;
|
||||
guac_rdp_disp_connect(rdp_client->disp, context, disp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int guac_freerdp_channels_load_plugin(rdpChannels* channels,
|
||||
rdpSettings* settings, const char* name, void* data) {
|
||||
|
@ -25,6 +25,20 @@
|
||||
#include <freerdp/channels/channels.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
/**
|
||||
* Called whenever a channel connects via the PubSub event system within
|
||||
* FreeRDP.
|
||||
*
|
||||
* @param context
|
||||
* The rdpContext associated with the active RDP session.
|
||||
*
|
||||
* @param e
|
||||
* Event-specific arguments, mainly the name of the channel, and a
|
||||
* reference to the associated plugin loaded for that channel by FreeRDP.
|
||||
*/
|
||||
void guac_rdp_channel_connected(rdpContext* context,
|
||||
ChannelConnectedEventArgs* e);
|
||||
|
||||
/**
|
||||
* Loads the FreeRDP plugin having the given name. This function is a drop-in
|
||||
* replacement for freerdp_channels_load_plugin() which additionally loads
|
||||
|
@ -80,45 +80,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
/**
|
||||
* Called whenever a channel connects via the PubSub event system within
|
||||
* FreeRDP.
|
||||
*
|
||||
* @param context
|
||||
* The rdpContext associated with the active RDP session.
|
||||
*
|
||||
* @param e
|
||||
* Event-specific arguments, mainly the name of the channel, and a
|
||||
* reference to the associated plugin loaded for that channel by FreeRDP.
|
||||
*/
|
||||
static void guac_rdp_channel_connected(rdpContext* context,
|
||||
ChannelConnectedEventArgs* e) {
|
||||
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
|
||||
guac_rdp_settings* settings = rdp_client->settings;
|
||||
|
||||
if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE) {
|
||||
/* Store reference to the display update plugin once it's connected */
|
||||
if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
|
||||
|
||||
DispClientContext* disp = (DispClientContext*) e->pInterface;
|
||||
|
||||
/* Init module with current display size */
|
||||
guac_rdp_disp_set_size(rdp_client->disp, rdp_client->settings,
|
||||
context->instance, guac_rdp_get_width(context->instance),
|
||||
guac_rdp_get_height(context->instance));
|
||||
|
||||
/* Store connected channel */
|
||||
guac_rdp_disp_connect(rdp_client->disp, disp);
|
||||
guac_client_log(client, GUAC_LOG_DEBUG,
|
||||
"Display update channel connected.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOL rdp_freerdp_pre_connect(freerdp* instance) {
|
||||
|
||||
rdpContext* context = instance->context;
|
||||
|
@ -59,8 +59,29 @@ void guac_rdp_disp_load_plugin(rdpContext* context, guac_rdp_dvc_list* list) {
|
||||
|
||||
}
|
||||
|
||||
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp) {
|
||||
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, rdpContext* context,
|
||||
DispClientContext* disp) {
|
||||
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
|
||||
guac_rdp_settings* settings = rdp_client->settings;
|
||||
|
||||
/* Ignore connected channel if not configured to use the display update
|
||||
* channel for resize */
|
||||
if (settings->resize_method != GUAC_RESIZE_DISPLAY_UPDATE)
|
||||
return;
|
||||
|
||||
/* Init module with current display size */
|
||||
guac_rdp_disp_set_size(rdp_client->disp, rdp_client->settings,
|
||||
context->instance, guac_rdp_get_width(context->instance),
|
||||
guac_rdp_get_height(context->instance));
|
||||
|
||||
/* Store reference to the display update plugin once it's connected */
|
||||
guac_disp->disp = disp;
|
||||
|
||||
guac_client_log(client, GUAC_LOG_DEBUG, "Display update channel "
|
||||
"will be used for display size changes.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,9 +91,6 @@ guac_rdp_disp* guac_rdp_disp_alloc();
|
||||
*/
|
||||
void guac_rdp_disp_free(guac_rdp_disp* disp);
|
||||
|
||||
/**
|
||||
* @param context The rdpContext associated with the active RDP session.
|
||||
*/
|
||||
/**
|
||||
* Adds FreeRDP's "disp" plugin to the list of dynamic virtual channel plugins
|
||||
* to be loaded by FreeRDP's "drdynvc" plugin. The plugin will only be loaded
|
||||
@ -117,12 +114,19 @@ void guac_rdp_disp_load_plugin(rdpContext* context, guac_rdp_dvc_list* list);
|
||||
* display updates can be properly sent. Until this is called, changes to the
|
||||
* display size will be deferred.
|
||||
*
|
||||
* @param guac_disp The display update module to associate with the connected
|
||||
* display update channel.
|
||||
* @param disp The DispClientContext associated by FreeRDP with the connected
|
||||
* display update channel.
|
||||
* @param guac_disp
|
||||
* The display update module to associate with the connected display update
|
||||
* channel.
|
||||
*
|
||||
* @param context
|
||||
* The rdpContext associated with the active RDP session.
|
||||
*
|
||||
* @param disp
|
||||
* The DispClientContext associated by FreeRDP with the connected display
|
||||
* update channel.
|
||||
*/
|
||||
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp);
|
||||
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, rdpContext* context,
|
||||
DispClientContext* disp);
|
||||
|
||||
/**
|
||||
* Requests a display size update, which may then be sent immediately to the
|
||||
|
Loading…
Reference in New Issue
Block a user