GUAC-835: Add support for all RDP performance flags.

This commit is contained in:
Michael Jumper 2015-06-12 16:35:38 -07:00
parent 95ae50478b
commit 29b76243b9
3 changed files with 114 additions and 0 deletions

View File

@ -116,6 +116,12 @@ const char* GUAC_CLIENT_ARGS[] = {
"remote-app-args", "remote-app-args",
"static-channels", "static-channels",
"client-name", "client-name",
"enable-wallpaper",
"enable-theming",
"enable-font-smoothing",
"enable-full-window-drag",
"enable-desktop-composition",
"enable-menu-animations",
NULL NULL
}; };
@ -146,6 +152,12 @@ enum RDP_ARGS_IDX {
IDX_REMOTE_APP_ARGS, IDX_REMOTE_APP_ARGS,
IDX_STATIC_CHANNELS, IDX_STATIC_CHANNELS,
IDX_CLIENT_NAME, IDX_CLIENT_NAME,
IDX_ENABLE_WALLPAPER,
IDX_ENABLE_THEMING,
IDX_ENABLE_FONT_SMOOTHING,
IDX_ENABLE_FULL_WINDOW_DRAG,
IDX_ENABLE_DESKTOP_COMPOSITION,
IDX_ENABLE_MENU_ANIMATIONS,
RDP_ARGS_COUNT RDP_ARGS_COUNT
}; };
@ -698,6 +710,14 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
if (argv[IDX_STATIC_CHANNELS][0] != '\0') if (argv[IDX_STATIC_CHANNELS][0] != '\0')
settings->svc_names = guac_split(argv[IDX_STATIC_CHANNELS], ','); settings->svc_names = guac_split(argv[IDX_STATIC_CHANNELS], ',');
/* Performance flags */
settings->wallpaper_enabled = (strcmp(argv[IDX_ENABLE_WALLPAPER], "true") == 0);
settings->theming_enabled = (strcmp(argv[IDX_ENABLE_THEMING], "true") == 0);
settings->font_smoothing_enabled = (strcmp(argv[IDX_ENABLE_FONT_SMOOTHING], "true") == 0);
settings->full_window_drag_enabled = (strcmp(argv[IDX_ENABLE_FULL_WINDOW_DRAG], "true") == 0);
settings->desktop_composition_enabled = (strcmp(argv[IDX_ENABLE_DESKTOP_COMPOSITION], "true") == 0);
settings->menu_animations_enabled = (strcmp(argv[IDX_ENABLE_MENU_ANIMATIONS], "true") == 0);
/* Session color depth */ /* Session color depth */
settings->color_depth = RDP_DEFAULT_DEPTH; settings->color_depth = RDP_DEFAULT_DEPTH;
if (argv[IDX_COLOR_DEPTH][0] != '\0') if (argv[IDX_COLOR_DEPTH][0] != '\0')

View File

@ -25,6 +25,7 @@
#include "rdp_settings.h" #include "rdp_settings.h"
#include <freerdp/constants.h> #include <freerdp/constants.h>
#include <freerdp/settings.h>
#ifdef ENABLE_WINPR #ifdef ENABLE_WINPR
#include <winpr/wtypes.h> #include <winpr/wtypes.h>
@ -59,6 +60,51 @@ int guac_rdp_get_depth(freerdp* rdp) {
#endif #endif
} }
/**
* Given the settings structure of the Guacamole RDP client, calculates the
* standard performance flag value to send to the RDP server. The value of
* these flags is dictated by the RDP standard.
*
* @param guac_settings
* The settings structure to read performance settings from.
*
* @returns
* The standard RDP performance flag value representing the union of all
* performance settings within the given settings structure.
*/
static int guac_rdp_get_performance_flags(guac_rdp_settings* guac_settings) {
/* No performance flags initially */
int flags = PERF_FLAG_NONE;
/* Desktop wallpaper */
if (!guac_settings->wallpaper_enabled)
flags |= PERF_DISABLE_WALLPAPER;
/* Theming of desktop/windows */
if (!guac_settings->theming_enabled)
flags |= PERF_DISABLE_THEMING;
/* Font smoothing (ClearType) */
if (guac_settings->font_smoothing_enabled)
flags |= PERF_ENABLE_FONT_SMOOTHING;
/* Full-window drag */
if (!guac_settings->full_window_drag_enabled)
flags |= PERF_DISABLE_FULLWINDOWDRAG;
/* Desktop composition (Aero) */
if (guac_settings->desktop_composition_enabled)
flags |= PERF_ENABLE_DESKTOP_COMPOSITION;
/* Menu animations */
if (!guac_settings->menu_animations_enabled)
flags |= PERF_DISABLE_MENUANIMATIONS;
return flags;
}
void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) { void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
BOOL bitmap_cache; BOOL bitmap_cache;
@ -99,6 +145,13 @@ void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
rdp_settings->KeyboardLayout = guac_settings->server_layout->freerdp_keyboard_layout; rdp_settings->KeyboardLayout = guac_settings->server_layout->freerdp_keyboard_layout;
#endif #endif
/* Performance flags */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->performance_flags = guac_rdp_get_performance_flags(guac_settings);
#else
rdp_settings->PerformanceFlags = guac_rdp_get_performance_flags(guac_settings);
#endif
/* Client name */ /* Client name */
if (guac_settings->client_name != NULL) { if (guac_settings->client_name != NULL) {
#ifdef LEGACY_RDPSETTINGS #ifdef LEGACY_RDPSETTINGS

View File

@ -219,6 +219,47 @@ typedef struct guac_rdp_settings {
*/ */
char** svc_names; char** svc_names;
/**
* Whether the desktop wallpaper should be visible. If unset, the desktop
* wallpaper will be hidden, reducing the amount of bandwidth required.
*/
int wallpaper_enabled;
/**
* Whether desktop and window theming should be allowed. If unset, theming
* is temporarily disabled on the desktop of the RDP server for the sake of
* performance, reducing the amount of bandwidth required.
*/
int theming_enabled;
/**
* Whether glyphs should be smoothed with antialiasing (ClearType). If
* unset, glyphs will be rendered with sharp edges and using single colors,
* effectively 1-bit images, reducing the amount of bandwidth required.
*/
int font_smoothing_enabled;
/**
* Whether windows contents should be shown as they are moved. If unset,
* only a window border will be shown during window move operations,
* reducing the amount of bandwidth required.
*/
int full_window_drag_enabled;
/**
* Whether desktop composition (Aero) should be enabled during the session.
* As desktop composition provides alpha blending and other special
* effects, this increases the amount of bandwidth used. If unset, desktop
* composition will be disabled.
*/
int desktop_composition_enabled;
/**
* Whether menu animations should be shown. If unset, menus will not be
* animated, reducing the amount of bandwidth required.
*/
int menu_animations_enabled;
} guac_rdp_settings; } guac_rdp_settings;
/** /**