Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport MSTSC resize fix. #2292

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 41 additions & 21 deletions xrdp/xrdp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,27 +1107,47 @@ dynamic_monitor_data(intptr_t id, int chan_id, char *data, int bytes)
}
session_width = rect.right - rect.left;
session_height = rect.bottom - rect.top;
if ((session_width > 0) && (session_height > 0))
{
// TODO: Unify this logic with server_reset
libxrdp_reset(wm->session, session_width, session_height, wm->screen->bpp);
/* reset cache */
xrdp_cache_reset(wm->cache, wm->client_info);
/* resize the main window */
xrdp_bitmap_resize(wm->screen, session_width, session_height);
/* load some stuff */
xrdp_wm_load_static_colors_plus(wm, 0);
xrdp_wm_load_static_pointers(wm);
/* redraw */
xrdp_bitmap_invalidate(wm->screen, 0);

struct xrdp_mod *v = wm->mm->mod;
if (v != 0)
{
v->mod_server_version_message(v);
v->mod_server_monitor_resize(v, session_width, session_height);
v->mod_server_monitor_full_invalidate(v, session_width, session_height);
}

if (session_width <= 0 && session_height <= 0)
{
return 0;
}
if (session_width == wm->client_info->width
&& session_height == wm->client_info->height)
{
return 0;
}

// TODO: Unify this logic with server_reset
libxrdp_reset(wm->session, session_width, session_height, wm->screen->bpp);
/* reset cache */
xrdp_cache_reset(wm->cache, wm->client_info);
/* resize the main window */
xrdp_bitmap_resize(wm->screen, session_width, session_height);
/* load some stuff */
xrdp_wm_load_static_colors_plus(wm, 0);
xrdp_wm_load_static_pointers(wm);
/* redraw */
xrdp_bitmap_invalidate(wm->screen, 0);

struct xrdp_mod *v = wm->mm->mod;
if (v == 0)
{
return 0;
}
v->mod_server_version_message(v);
v->mod_server_monitor_resize(v, session_width, session_height);
v->mod_server_monitor_full_invalidate(v, session_width, session_height);

// Need to recreate the encoder for connections that use it.
if (wm->mm->encoder != NULL)
{
xrdp_encoder_delete(wm->mm->encoder);
wm->mm->encoder = NULL;
}
if (wm->mm->encoder == NULL)
{
wm->mm->encoder = xrdp_encoder_create(wm->mm);
}
return 0;
}
Expand Down