Skip to content

Commit

Permalink
GUACAMOLE-288: Add parameter to limit the usage of multiple monitors.
Browse files Browse the repository at this point in the history
  • Loading branch information
corentin-soriano committed Oct 29, 2024
1 parent 4d1fe5c commit 62e086b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/protocols/rdp/channels/disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp,
int height = disp->requested_height;
int monitors_count = disp->requested_monitors;

/* Prevent opening too many monitors than allowed */
if (settings->max_secondary_monitors < monitors_count)
monitors_count = settings->max_secondary_monitors;

/* Do not update size if no requests have been received */
if (width == 0 || height == 0)
return;
Expand Down
12 changes: 12 additions & 0 deletions src/protocols/rdp/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
"create-recording-path",
"recording-write-existing",
"resize-method",
"secondary-monitors",
"enable-audio-input",
"enable-touch",
"read-only",
Expand Down Expand Up @@ -598,6 +599,12 @@ enum RDP_ARGS_IDX {
*/
IDX_RESIZE_METHOD,

/**
* The maximum allowed count of secondary monitors.
* 0 to disable.
*/
IDX_SECONDARY_MONITORS,

/**
* "true" if audio input (microphone) should be enabled for the RDP
* connection, "false" or blank otherwise.
Expand Down Expand Up @@ -1234,6 +1241,11 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
settings->resize_method = GUAC_RESIZE_NONE;
}

/* Maximum secondary monitors (default 0 = disabled) */
settings->max_secondary_monitors =
guac_user_parse_args_int(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_SECONDARY_MONITORS, 0);

/* RDP Graphics Pipeline enable/disable */
settings->enable_gfx =
!guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
Expand Down
5 changes: 5 additions & 0 deletions src/protocols/rdp/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,11 @@ typedef struct guac_rdp_settings {
*/
guac_rdp_resize_method resize_method;

/**
* The maximum allowed count of secondary monitors.
*/
int max_secondary_monitors;

/**
* Whether audio input (microphone) is enabled.
*/
Expand Down

0 comments on commit 62e086b

Please sign in to comment.