Skip to content

Instantly share code, notes, and snippets.

@nedix
Created October 4, 2024 23:19
Show Gist options
  • Save nedix/67c4418a87ca06af55d09cceb81d0457 to your computer and use it in GitHub Desktop.
Save nedix/67c4418a87ca06af55d09cceb81d0457 to your computer and use it in GitHub Desktop.
Conflicts xrdp_mm.c
From aaf5477ae3fa28ddf47383b34969a0013b2648e8 Mon Sep 17 00:00:00 2001
From: NEDIX <[email protected]>
Date: Sat, 5 Oct 2024 01:17:12 +0200
Subject: [PATCH] Conflicts xrdp_mm.c
---
xrdp/xrdp_mm.c | 457 +++++++++++++++++++++----------------------------
1 file changed, 194 insertions(+), 263 deletions(-)
diff --git xrdp/xrdp_mm.c xrdp/xrdp_mm.c
index 03a9a620..0cc54772 100644
--- xrdp/xrdp_mm.c
+++ xrdp/xrdp_mm.c
@@ -1185,23 +1185,30 @@ cleanup:
static int
xrdp_mm_egfx_invalidate_wm_screen(struct xrdp_mm *self)
{
- struct xrdp_rect xr_rect;
- struct xrdp_bitmap *screen;
- int error;
-
- LOG(LOG_LEVEL_INFO, "xrdp_mm_egfx_invalidate_all:");
+ int error = 0;
- screen = self->wm->screen;
+ LOG(LOG_LEVEL_INFO, "xrdp_mm_egfx_invalidate_wm_screen:");
- xr_rect.left = 0;
- xr_rect.top = 0;
- xr_rect.right = screen->width;
- xr_rect.bottom = screen->height;
- if (self->wm->screen_dirty_region == NULL)
+ // Only invalidate the WM screen if the module is using the WM screen,
+ // or we haven't loaded the module yet.
+ //
+ // Otherwise we may send client updates which conflict with the
+ // updates sent directly from the module via the encoder.
+ if (self->mod_uses_wm_screen_for_gfx || self->mod_handle == 0)
{
- self->wm->screen_dirty_region = xrdp_region_create(self->wm);
+ struct xrdp_bitmap *screen = self->wm->screen;
+ struct xrdp_rect xr_rect;
+
+ xr_rect.left = 0;
+ xr_rect.top = 0;
+ xr_rect.right = screen->width;
+ xr_rect.bottom = screen->height;
+ if (self->wm->screen_dirty_region == NULL)
+ {
+ self->wm->screen_dirty_region = xrdp_region_create(self->wm);
+ }
+ error = xrdp_region_add_rect(self->wm->screen_dirty_region, &xr_rect);
}
- error = xrdp_region_add_rect(self->wm->screen_dirty_region, &xr_rect);
return error;
}
@@ -1434,34 +1441,31 @@ xrdp_mm_egfx_caps_advertise(void *user, int caps_count,
/* prefer h264, todo use setting in xrdp.ini for this */
if (best_h264_index >= 0)
{
-#if defined(XRDP_X264) || defined(XRDP_OPENH264) || defined(XRDP_NVENC) || defined(XRDP_VANILLA_NVIDIA_CODEC)
+#if defined(XRDP_X264) || defined(XRDP_NVENC)
best_index = best_h264_index;
- self->egfx_flags = 1;
+ self->egfx_flags = XRDP_EGFX_H264;
#endif
}
if (best_index >= 0)
{
LOG(LOG_LEVEL_INFO, " replying version 0x%8.8x flags 0x%8.8x",
- versions[best_index], flagss[best_index]);
+ ver_flags[best_index].version, ver_flags[best_index].flags);
error = xrdp_egfx_send_capsconfirm(self->egfx,
- versions[best_index],
- flagss[best_index]);
+ ver_flags[best_index].version,
+ ver_flags[best_index].flags);
LOG(LOG_LEVEL_INFO, "xrdp_mm_egfx_caps_advertise: xrdp_egfx_send_capsconfirm "
"error %d best_index %d", error, best_index);
error = xrdp_egfx_send_reset_graphics(self->egfx,
screen->width, screen->height,
self->wm->client_info->display_sizes.monitorCount,
- self->wm->client_info->display_sizes.minfo_wm);
+ self->wm->client_info->display_sizes.minfo);
LOG(LOG_LEVEL_INFO, "xrdp_mm_egfx_caps_advertise: xrdp_egfx_send_reset_graphics "
"error %d monitorCount %d",
error, self->wm->client_info->display_sizes.monitorCount);
self->egfx_up = 1;
- xrdp_egfx_send_create_surface(self->egfx, self->egfx->surface_id,
- screen->width, screen->height,
- XR_PIXEL_FORMAT_XRGB_8888);
- xrdp_egfx_send_map_surface(self->egfx, self->egfx->surface_id, 0, 0);
+ xrdp_mm_egfx_create_surfaces(self);
self->encoder = xrdp_encoder_create(self);
- xrdp_mm_egfx_invalidate_all(self);
+ xrdp_mm_egfx_invalidate_wm_screen(self);
if (self->resize_data != NULL
&& self->resize_data->state == WMRZ_EGFX_INITALIZING)
@@ -1506,8 +1510,8 @@ xrdp_mm_update_module_frame_ack(struct xrdp_mm *self)
{
if (encoder->frame_id_server > encoder->frame_id_server_sent)
{
- LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_update_module_ack: frame_id_server %d",
- encoder->frame_id_server);
+ LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_update_module_ack: "
+ "frame_id_server %d", encoder->frame_id_server);
encoder->frame_id_server_sent = encoder->frame_id_server;
self->mod->mod_frame_ack(self->mod, 0, encoder->frame_id_server);
}
@@ -1576,23 +1580,21 @@ xrdp_mm_egfx_frame_ack(void *user, uint32_t queue_depth, int frame_id,
static int
egfx_initialize(struct xrdp_mm *self)
{
- /* 0x100 RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL */
- if (self->wm->client_info->mcs_early_capability_flags & 0x100)
+ LOG_DEVEL(LOG_LEVEL_TRACE, "egfx_initialize");
+ if (!(self->wm->client_info->gfx))
{
- LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_mm_drdynvc_up: gfx capable client");
- if (xrdp_egfx_create(self, &(self->egfx)) == 0)
- {
- self->egfx->user = self;
- self->egfx->caps_advertise = xrdp_mm_egfx_caps_advertise;
- self->egfx->frame_ack = xrdp_mm_egfx_frame_ack;
- }
- else
- {
- LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_mm_drdynvc_up: xrdp_egfx_create failed");
- return 1;
- }
+ return 0;
}
- return 0;
+ LOG_DEVEL(LOG_LEVEL_INFO, "egfx_initialize: gfx capable client");
+ if (xrdp_egfx_create(self, &(self->egfx)) == 0)
+ {
+ self->egfx->user = self;
+ self->egfx->caps_advertise = xrdp_mm_egfx_caps_advertise;
+ self->egfx->frame_ack = xrdp_mm_egfx_frame_ack;
+ return 0;
+ }
+ LOG_DEVEL(LOG_LEVEL_INFO, "egfx_initialize: xrdp_egfx_create failed");
+ return 1;
}
/******************************************************************************/
@@ -1889,30 +1891,27 @@ process_display_control_monitor_layout_data(struct xrdp_wm *wm)
" mod_server_monitor_resize failed %d", error);
return advance_error(error, mm);
}
- advance_resize_state_machine(
- mm, WMRZ_SERVER_VERSION_MESSAGE_START);
- break;
- case WMRZ_SERVER_VERSION_MESSAGE_START:
- error = module->mod_server_version_message(module);
- if (error != 0)
+ else if (in_progress)
{
- LOG_DEVEL(LOG_LEVEL_INFO,
- "process_display_control_monitor_layout_data:"
- " mod_server_version_message failed %d", error);
- return advance_error(error, mm);
+ // Call is proceeding asynchronously
+ advance_resize_state_machine(
+ mm, WMRZ_SERVER_MONITOR_MESSAGE_PROCESSING);
+ }
+ else
+ {
+ // Call is done
+ advance_resize_state_machine(
+ mm, WMRZ_SERVER_MONITOR_MESSAGE_PROCESSED);
}
- advance_resize_state_machine(
- mm, WMRZ_SERVER_MONITOR_MESSAGE_PROCESSING);
break;
- // Not processed here. Processed in server_reset
+ // Not processed here. Processed in client_monitor_resize
// case WMRZ_SERVER_MONITOR_MESSAGE_PROCESSING:
case WMRZ_SERVER_MONITOR_MESSAGE_PROCESSED:
- advance_resize_state_machine(mm, WMRZ_XRDP_CORE_RESIZE);
+ advance_resize_state_machine(mm, WMRZ_XRDP_CORE_RESET);
break;
- case WMRZ_XRDP_CORE_RESIZE:
- // TODO: Unify this logic with server_reset
- error = libxrdp_reset(
- wm->session, desc_width, desc_height, wm->screen->bpp);
+ case WMRZ_XRDP_CORE_RESET:
+ sync_dynamic_monitor_data(wm, &(description->description));
+ error = libxrdp_reset(wm->session);
if (error != 0)
{
LOG_DEVEL(LOG_LEVEL_INFO,
@@ -1967,7 +1966,7 @@ process_display_control_monitor_layout_data(struct xrdp_wm *wm)
advance_resize_state_machine(mm, WMRZ_EGFX_INITIALIZE);
break;
case WMRZ_EGFX_INITIALIZE:
- if (error == 0 && mm->egfx == NULL && mm->egfx_up == 0)
+ if (mm->resize_data->using_egfx)
{
egfx_initialize(mm);
advance_resize_state_machine(mm, WMRZ_EGFX_INITALIZING);
@@ -2531,7 +2530,7 @@ xrdp_mm_trans_process_drdynvc_data(struct xrdp_mm *self,
}
in_uint32_le(s, chansrv_chan_id);
in_uint32_le(s, data_bytes);
- if (!s_check_rem(s, data_bytes))
+ if ((!s_check_rem(s, data_bytes)))
{
return 1;
}
@@ -3049,7 +3048,7 @@ cleanup_states(struct xrdp_mm *self)
*/
static int
-parse_chansrvport(const char *value, char *dest, int dest_size)
+parse_chansrvport(const char *value, char *dest, int dest_size, int uid)
{
int rv = 0;
@@ -3281,7 +3280,6 @@ static void
xrdp_mm_connect_sm(struct xrdp_mm *self)
{
int status = 0;
- int waiting_for_msg = 0; /* Set this to leave the sm to wait for a reply */
/* we set self->mmcs_expecting_msg in the loop when we've send a
message to sesman, and we need to wait for a response */
@@ -3631,18 +3629,19 @@ xrdp_mm_check_chan(struct xrdp_mm *self)
return 0;
}
-#define AVC444 1
-
/*****************************************************************************/
static int
xrdp_mm_process_enc_done(struct xrdp_mm *self)
{
+ XRDP_ENC_DATA *enc;
XRDP_ENC_DATA_DONE *enc_done;
- short x;
- short y;
- short cx;
- short cy;
- struct xrdp_egfx_rect rect;
+ int x;
+ int y;
+ int cx;
+ int cy;
+ int is_gfx;
+ int got_frame_id;
+ int client_ack;
LOG(LOG_LEVEL_TRACE, "xrdp_mm_process_enc_done:");
@@ -3656,121 +3655,88 @@ xrdp_mm_process_enc_done(struct xrdp_mm *self)
{
break;
}
- /* do something with msg */
- x = enc_done->rect.x;
- y = enc_done->rect.y;
- cx = enc_done->rect.cx;
- cy = enc_done->rect.cy;
- if (enc_done->comp_bytes1 > 0)
+ is_gfx = ENC_IS_BIT_SET(enc_done->flags, ENC_DONE_FLAGS_GFX_BIT);
+ if (is_gfx)
{
- if (enc_done->flags & 1) /* gfx h264 */
- {
- rect.x1 = x;
- rect.y1 = y;
- rect.x2 = x + cx;
- rect.y2 = y + cy;
-#if AVC444
- xrdp_egfx_send_frame_start(self->egfx,
- enc_done->enc->frame_id, 0);
- xrdp_egfx_send_wire_to_surface1(self->egfx, self->egfx->surface_id,
- XR_RDPGFX_CODECID_AVC444V2,
- XR_PIXEL_FORMAT_XRGB_8888,
- &rect,
- enc_done->comp_pad_data1 + enc_done->pad_bytes1,
- enc_done->comp_bytes1);
- if (enc_done->comp_bytes2 > 0) {
- xrdp_egfx_send_frame_end(self->egfx, enc_done->enc->frame_id);
- ++enc_done->enc->frame_id;
- xrdp_egfx_send_frame_start(self->egfx,
- enc_done->enc->frame_id, 0);
- xrdp_egfx_send_wire_to_surface1(self->egfx, self->egfx->surface_id,
- XR_RDPGFX_CODECID_AVC444V2,
- XR_PIXEL_FORMAT_XRGB_8888,
- &rect,
- enc_done->comp_pad_data2 + enc_done->pad_bytes2,
- enc_done->comp_bytes2);
- }
- xrdp_egfx_send_frame_end(self->egfx, enc_done->enc->frame_id);
-#else
- xrdp_egfx_send_frame_start(self->egfx,
- enc_done->enc->frame_id, 0);
-
- xrdp_egfx_send_wire_to_surface1(self->egfx, self->egfx->surface_id,
- XR_RDPGFX_CODECID_AVC420,
- XR_PIXEL_FORMAT_XRGB_8888,
- &rect,
- enc_done->comp_pad_data1 + enc_done->pad_bytes1,
- enc_done->comp_bytes1);
-
- xrdp_egfx_send_frame_end(self->egfx, enc_done->enc->frame_id);
-#endif
-
- }
- else if (enc_done->flags & 2) /* gfx progressive rfx */
+ got_frame_id = ENC_IS_BIT_SET(enc_done->flags,
+ ENC_DONE_FLAGS_FRAME_ID_BIT);
+ client_ack = self->encoder->gfx_ack_off == 0;
+ }
+ else
+ {
+ got_frame_id = 1;
+ client_ack = self->wm->client_info->use_frame_acks;
+ }
+ LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_process_enc_done: message back "
+ "bytes %d", enc_done->comp_bytes);
+ if (enc_done->comp_bytes > 0)
+ {
+ if (is_gfx)
{
- xrdp_egfx_send_frame_start(self->egfx,
- enc_done->enc->frame_id, 0);
- xrdp_egfx_send_wire_to_surface2(self->egfx, self->egfx->surface_id, 9, 1,
- XR_PIXEL_FORMAT_XRGB_8888,
- enc_done->comp_pad_data1 + enc_done->pad_bytes1,
- enc_done->comp_bytes1);
- xrdp_egfx_send_frame_end(self->egfx, enc_done->enc->frame_id);
+ xrdp_egfx_send_data(self->egfx,
+ enc_done->comp_pad_data +
+ enc_done->pad_bytes,
+ enc_done->comp_bytes);
}
else
{
- libxrdp_fastpath_send_frame_marker(self->wm->session, 0,
- enc_done->enc->frame_id);
+ x = enc_done->x;
+ y = enc_done->y;
+ cx = enc_done->cx;
+ cy = enc_done->cy;
+ if (client_ack && !enc_done->continuation)
+ {
+ libxrdp_fastpath_send_frame_marker(self->wm->session, 0,
+ enc_done->frame_id);
+ }
libxrdp_fastpath_send_surface(self->wm->session,
- enc_done->comp_pad_data1,
- enc_done->pad_bytes1,
- enc_done->comp_bytes1,
+ enc_done->comp_pad_data,
+ enc_done->pad_bytes,
+ enc_done->comp_bytes,
x, y, x + cx, y + cy,
32, self->encoder->codec_id,
cx, cy);
- libxrdp_fastpath_send_frame_marker(self->wm->session, 1,
- enc_done->enc->frame_id);
+ if (client_ack && enc_done->last)
+ {
+ libxrdp_fastpath_send_frame_marker(self->wm->session, 1,
+ enc_done->frame_id);
+ }
}
}
/* free enc_done */
if (enc_done->last)
{
+ enc = enc_done->enc;
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_process_enc_done: last set");
- if (enc_done->flags & 3) /* gfx */
+ if (got_frame_id)
{
- if (self->encoder->gfx_ack_off)
+ if (client_ack)
{
- /* gfx and client turned off client frame acks */
- self->mod->mod_frame_ack(self->mod,
- enc_done->enc->flags,
- enc_done->enc->frame_id);
+ self->encoder->frame_id_server = enc_done->frame_id;
+ xrdp_mm_update_module_frame_ack(self);
}
else
{
- self->encoder->frame_id_server = enc_done->enc->frame_id;
- xrdp_mm_update_module_frame_ack(self);
+ self->mod->mod_frame_ack(self->mod, 0,
+ enc_done->frame_id);
}
}
+ if (is_gfx)
+ {
+ g_free(enc->u.gfx.cmd);
+ }
else
{
- if (self->wm->client_info->use_frame_acks == 0)
- {
- /* surface commmand and client does not do frame acks */
- self->mod->mod_frame_ack(self->mod,
- enc_done->enc->flags,
- enc_done->enc->frame_id);
- }
- else
- {
- self->encoder->frame_id_server = enc_done->enc->frame_id;
- xrdp_mm_update_module_frame_ack(self);
- }
+ g_free(enc->u.sc.drects);
+ g_free(enc->u.sc.crects);
+ }
+ if (enc->shmem_ptr != NULL)
+ {
+ g_munmap(enc->shmem_ptr, enc->shmem_bytes);
}
- g_free(enc_done->enc->drects);
- g_free(enc_done->enc->crects);
- g_free(enc_done->enc);
+ g_free(enc);
}
- g_free(enc_done->comp_pad_data1);
- g_free(enc_done->comp_pad_data2);
+ g_free(enc_done->comp_pad_data);
g_free(enc_done);
}
return 0;
@@ -3963,8 +3929,6 @@ xrdp_mm_check_wait_objs(struct xrdp_mm *self)
{
if (xrdp_region_not_empty(self->wm->screen_dirty_region))
{
- int error;
- struct xrdp_rect rect;
int now = g_time3();
int diff = now - self->wm->last_screen_draw_time;
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_mm_check_wait_objs: not empty diff %d", diff);
@@ -3972,11 +3936,7 @@ xrdp_mm_check_wait_objs(struct xrdp_mm *self)
{
if (self->egfx_up)
{
- error = xrdp_region_get_bounds(self->wm->screen_dirty_region, &rect);
- if (error == 0)
- {
- xrdp_mm_egfx_send_planar_bitmap(self, self->wm->screen, &rect);
- }
+ rv = xrdp_mm_draw_dirty(self);
xrdp_region_delete(self->wm->screen_dirty_region);
self->wm->screen_dirty_region = NULL;
self->wm->last_screen_draw_time = now;
@@ -4338,45 +4298,71 @@ server_paint_rects_ex(struct xrdp_mod *mod,
wm = (struct xrdp_wm *)(mod->wm);
mm = wm->mm;
- LOG(LOG_LEVEL_TRACE, "server_paint_rects: %p", mm->encoder);
+ LOG(LOG_LEVEL_TRACE, "server_paint_rects_ex: %p", mm->encoder);
if (mm->encoder != 0)
{
- if (flags & CONTAINS_DUAL_FRAME_AVC444) {
- enc_data = create_enc_data(num_drects, drects, num_crects, crects,
- data, width, height, flags, frame_id);
- enc_data->mod = mod;
- enc_data->flags = CONTAINS_SINGLE_FRAME_AVC444_YUV420;
- /* insert into fifo for encoder thread to process */
- tc_mutex_lock(mm->encoder->mutex);
- fifo_add_item(mm->encoder->fifo_to_proc, (void *) enc_data);
- tc_mutex_unlock(mm->encoder->mutex);
-
- // // Add two encodes here.
- // enc_data = create_enc_data(num_drects, drects, num_crects, crects,
- // data, width, height, flags, frame_id);
- // enc_data->mod = mod;
- // enc_data->data = data + (height * width) * 3 / 2;
- // enc_data->flags = CONTAINS_SINGLE_FRAME_AVC444_CHROMA420;
- // /* insert into fifo for encoder thread to process */
- // tc_mutex_lock(mm->encoder->mutex);
- // fifo_add_item(mm->encoder->fifo_to_proc, (void *) enc_data);
- // tc_mutex_unlock(mm->encoder->mutex);
-
- // CONTAINS_SINGLE_FRAME_AVC444_YUV420 = 1 << 2,
- // CONTAINS_SINGLE_FRAME_AVC444_CHROMA420 = 1 << 3,
+ /* copy formal params to XRDP_ENC_DATA */
+ enc_data = (XRDP_ENC_DATA *) g_malloc(sizeof(XRDP_ENC_DATA), 1);
+ if (enc_data == 0)
+ {
+ if (shmem_ptr != NULL)
+ {
+ g_munmap(shmem_ptr, shmem_bytes);
+ }
+ return 1;
}
- else
+
+ enc_data->u.sc.drects = (short *)
+ g_malloc(sizeof(short) * num_drects * 4, 0);
+ if (enc_data->u.sc.drects == 0)
{
- enc_data = create_enc_data(num_drects, drects, num_crects, crects,
- data, width, height, flags, frame_id);
- enc_data->mod = mod;
- /* insert into fifo for encoder thread to process */
- tc_mutex_lock(mm->encoder->mutex);
- fifo_add_item(mm->encoder->fifo_to_proc, (void *) enc_data);
- tc_mutex_unlock(mm->encoder->mutex);
+ if (shmem_ptr != NULL)
+ {
+ g_munmap(shmem_ptr, shmem_bytes);
+ }
+ g_free(enc_data);
+ return 1;
+ }
+
+ enc_data->u.sc.crects = (short *)
+ g_malloc(sizeof(short) * num_crects * 4, 0);
+ if (enc_data->u.sc.crects == 0)
+ {
+ if (shmem_ptr != NULL)
+ {
+ g_munmap(shmem_ptr, shmem_bytes);
+ }
+ g_free(enc_data->u.sc.drects);
+ g_free(enc_data);
+ return 1;
}
+ g_memcpy(enc_data->u.sc.drects, drects, sizeof(short) * num_drects * 4);
+ g_memcpy(enc_data->u.sc.crects, crects, sizeof(short) * num_crects * 4);
+
+ enc_data->mod = mod;
+ enc_data->u.sc.num_drects = num_drects;
+ enc_data->u.sc.num_crects = num_crects;
+ enc_data->u.sc.data = data;
+ enc_data->u.sc.left = left;
+ enc_data->u.sc.top = top;
+ enc_data->u.sc.width = width;
+ enc_data->u.sc.height = height;
+ enc_data->u.sc.flags = flags;
+ enc_data->u.sc.frame_id = frame_id;
+ enc_data->shmem_ptr = shmem_ptr;
+ enc_data->shmem_bytes = shmem_bytes;
+ if (width == 0 || height == 0)
+ {
+ LOG_DEVEL(LOG_LEVEL_WARNING, "server_paint_rects: error");
+ }
+
+ /* insert into fifo for encoder thread to process */
+ tc_mutex_lock(mm->encoder->mutex);
+ fifo_add_item(mm->encoder->fifo_to_proc, (void *) enc_data);
+ tc_mutex_unlock(mm->encoder->mutex);
+
/* signal xrdp_encoder thread */
g_set_wait_obj(mm->encoder->xrdp_encoder_event_to_proc);
@@ -4827,80 +4813,25 @@ server_monitor_resize_done(struct xrdp_mod *mod)
return 1;
}
mm = wm->mm;
-
- if (wm->client_info == 0)
+ if (mm == 0)
{
return 1;
}
- /* older client can't resize */
- if (wm->client_info->build <= 419)
- {
- return 0;
- }
-
- // bpp of zero is impossible.
- // This is a signal from xup that
- // It is finished resizing.
- if (bpp == 0)
- {
- if (mm == 0)
- {
- return 1;
- }
- if (!xrdp_wm_can_resize(wm))
- {
- return 1;
- }
- if (mm->resize_data == NULL)
- {
- mm->mod->mod_server_monitor_full_invalidate(mm->mod, width, height);
- return 0;
- }
- if (mm->resize_data != NULL
- && mm->resize_data->state
- == WMRZ_SERVER_MONITOR_MESSAGE_PROCESSING)
- {
- LOG(LOG_LEVEL_INFO,
- "server_reset: Advancing server monitor resized.");
- advance_resize_state_machine(
- mm, WMRZ_SERVER_MONITOR_MESSAGE_PROCESSED);
- }
- else if (mm->resize_data != NULL
- && mm->resize_data->description.session_height == 0
- && mm->resize_data->description.session_width == 0)
- {
- mm->mod->mod_server_monitor_full_invalidate(mm->mod, width, height);
- }
- return 0;
- }
-
- /* if same (and only one monitor on client) don't need to do anything */
- if (wm->client_info->display_sizes.session_width == (uint32_t)width &&
- wm->client_info->display_sizes.session_height == (uint32_t)height &&
- wm->client_info->bpp == bpp &&
- (wm->client_info->display_sizes.monitorCount == 0 ||
- wm->client_info->multimon == 0))
+ if (wm->client_info == 0)
{
- return 0;
+ return 1;
}
- LOG(LOG_LEVEL_INFO, "server_reset: Actually resetting the server.");
-
- /* reset lib, client_info gets updated in libxrdp_reset */
- if (libxrdp_reset(wm->session, width, height, bpp) != 0)
+ if (mm->resize_data != NULL
+ && mm->resize_data->state
+ == WMRZ_SERVER_MONITOR_MESSAGE_PROCESSING)
{
- return 1;
+ LOG(LOG_LEVEL_INFO,
+ "server_monitor_resize_done: Advancing server monitor resized.");
+ advance_resize_state_machine(
+ mm, WMRZ_SERVER_MONITOR_MESSAGE_PROCESSED);
}
-
- /* reset cache */
- xrdp_cache_reset(wm->cache, wm->client_info);
- /* resize the main window */
- xrdp_bitmap_resize(wm->screen, wm->client_info->display_sizes.session_width,
- wm->client_info->display_sizes.session_height);
- /* load some stuff */
- xrdp_wm_load_static_colors_plus(wm, 0);
- xrdp_wm_load_static_pointers(wm);
return 0;
}
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment