Skip to content

Commit

Permalink
Block resize if already this size.
Browse files Browse the repository at this point in the history
While this feature is part of other branches for testing EGFX
integration, it somehow never made it into devel. This should fix
#1928, for real this time!
  • Loading branch information
Nexarian committed Jul 8, 2022
1 parent 521e5e0 commit d01ce57
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions xrdp/xrdp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,29 @@ dynamic_monitor_data_first(intptr_t id, int chan_id, char *data, int bytes,
return 0;
}

/******************************************************************************/
static const int MAXIMUM_MONITOR_SIZE
= sizeof(struct monitor_info) * CLIENT_MONITOR_DATA_MAXIMUM_MONITORS;

/******************************************************************************/
static void
sync_dynamic_monitor_data(struct xrdp_wm *wm,
struct display_size_description *description)
{
struct display_size_description *display_sizes
= &(wm->client_info->display_sizes);

display_sizes->monitorCount = description->monitorCount;
display_sizes->session_width = description->session_width;
display_sizes->session_height = description->session_height;
g_memcpy(display_sizes->minfo,
description->minfo,
MAXIMUM_MONITOR_SIZE);
g_memcpy(display_sizes->minfo_wm,
description->minfo_wm,
MAXIMUM_MONITOR_SIZE);
}

/******************************************************************************/
static int
process_dynamic_monitor_description(struct xrdp_wm *wm,
Expand Down Expand Up @@ -1041,6 +1064,18 @@ process_dynamic_monitor_description(struct xrdp_wm *wm,
description->session_width, description->session_height);
return 0;
}
if (description->session_width
== wm->client_info->display_sizes.session_width
&& description->session_height
== wm->client_info->display_sizes.session_height)
{
LOG(LOG_LEVEL_WARNING, "process_dynamic_monitor_description:"
" Not resizing. Already this size. (w: %d x h: %d)",
description->session_width,
description->session_height);
sync_dynamic_monitor_data(wm, description);
return 0;
}

// TODO: Unify this logic with server_reset
error = libxrdp_reset(wm->session,
Expand Down Expand Up @@ -1141,17 +1176,7 @@ process_dynamic_monitor_description(struct xrdp_wm *wm,
mm->encoder = xrdp_encoder_create(mm);
}

wm->client_info->display_sizes.monitorCount = description->monitorCount;
wm->client_info->display_sizes.session_width = description->session_width;
wm->client_info->display_sizes.session_height = description->session_height;
g_memcpy(wm->client_info->display_sizes.minfo,
description->minfo,
sizeof(struct monitor_info)
* CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
g_memcpy(wm->client_info->display_sizes.minfo_wm,
description->minfo_wm,
sizeof(struct monitor_info)
* CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
sync_dynamic_monitor_data(wm, description);
return 0;
}

Expand Down

0 comments on commit d01ce57

Please sign in to comment.