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 399ec0f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/protocols/rdp/channels/disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ 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 + 1 < monitors_count)
monitors_count = settings->max_secondary_monitors + 1;

/* At least one monitor is required */
if (monitors_count < 1)
monitors_count = 1;

/* 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 399ec0f

Please sign in to comment.