Skip to content

Commit c5e2e23

Browse files
committed
Fixing resizing not working.
1 parent a9a72bd commit c5e2e23

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

xrdp/xrdp_mm.c

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,8 @@ dynamic_monitor_data(intptr_t id, int chan_id, char *data, int bytes)
11371137
}
11381138
list_add_item(wm->mm->resize_queue, (tintptr)display_size_data);
11391139
g_set_wait_obj(wm->mm->resize_ready);
1140+
LOG(LOG_LEVEL_DEBUG, "dynamic_monitor_data:"
1141+
" received width %d, received height %d.", display_size_data->session_width, display_size_data->session_height);
11401142
return 0;
11411143
}
11421144

@@ -1303,7 +1305,7 @@ process_display_control_monitor_layout_data(struct xrdp_wm *wm)
13031305
static int
13041306
dynamic_monitor_process_queue(struct xrdp_mm *self)
13051307
{
1306-
LOG_DEVEL(LOG_LEVEL_INFO, "dynamic_monitor_process_queue:");
1308+
LOG_DEVEL(LOG_LEVEL_TRACE, "dynamic_monitor_process_queue:");
13071309

13081310
if (self == 0)
13091311
{
@@ -1321,10 +1323,11 @@ dynamic_monitor_process_queue(struct xrdp_mm *self)
13211323
{
13221324
if (self->resize_queue->count <= 0)
13231325
{
1326+
LOG_DEVEL(LOG_LEVEL_DEBUG, "Resize queue is empty.");
13241327
return 0;
13251328
}
1326-
LOG_DEVEL(LOG_LEVEL_INFO, "dynamic_monitor_process_queue: Queue is"
1327-
"not empty. Filling out description.");
1329+
LOG_DEVEL(LOG_LEVEL_DEBUG, "dynamic_monitor_process_queue: Queue is"
1330+
" not empty. Filling out description.");
13281331
const struct display_size_description *queue_head =
13291332
(struct display_size_description *)
13301333
list_get_item(self->resize_queue, 0);
@@ -1334,8 +1337,8 @@ dynamic_monitor_process_queue(struct xrdp_mm *self)
13341337

13351338
if (invalid_dimensions)
13361339
{
1337-
LOG(LOG_LEVEL_INFO,
1338-
"process_display_control_monitor_layout_data: Not allowing"
1340+
LOG(LOG_LEVEL_DEBUG,
1341+
"dynamic_monitor_process_queue: Not allowing"
13391342
" resize due to invalid dimensions (w: %d x h: %d)",
13401343
queue_head->session_width,
13411344
queue_head->session_height);
@@ -1351,9 +1354,9 @@ dynamic_monitor_process_queue(struct xrdp_mm *self)
13511354

13521355
if (already_this_size)
13531356
{
1354-
LOG(LOG_LEVEL_INFO,
1355-
"process_display_control_monitor_layout_data: Not"
1356-
" resizing. Already this size. (w: %d x h: %d)",
1357+
LOG(LOG_LEVEL_DEBUG,
1358+
"dynamic_monitor_process_queue: Not resizing."
1359+
" Already this size. (w: %d x h: %d)",
13571360
queue_head->session_width,
13581361
queue_head->session_height);
13591362
}
@@ -1371,9 +1374,18 @@ dynamic_monitor_process_queue(struct xrdp_mm *self)
13711374
self->resize_data->last_state_update_timestamp = time;
13721375
advance_resize_state_machine(self, WMRZ_ENCODER_DELETE);
13731376
}
1377+
else
1378+
{
1379+
g_set_wait_obj(self->resize_ready);
1380+
}
13741381
list_remove_item(self->resize_queue, 0);
13751382
return 0;
13761383
}
1384+
else
1385+
{
1386+
LOG_DEVEL(LOG_LEVEL_DEBUG, "dynamic_monitor_process_queue:"
1387+
" Resize data is not null.");
1388+
}
13771389

13781390
if (self->resize_data->state == WMRZ_COMPLETE)
13791391
{
@@ -1382,13 +1394,15 @@ dynamic_monitor_process_queue(struct xrdp_mm *self)
13821394
self->resize_data->description.session_width,
13831395
self->resize_data->description.session_height,
13841396
g_time3() - self->resize_data->start_time);
1397+
g_set_wait_obj(self->resize_ready);
13851398
}
13861399
else if (self->resize_data->state == WMRZ_ERROR)
13871400
{
13881401
LOG(LOG_LEVEL_INFO, "dynamic_monitor_process_queue: Clearing"
13891402
" failed request to resize to: (w: %d x h: %d)",
13901403
self->resize_data->description.session_width,
13911404
self->resize_data->description.session_height);
1405+
g_set_wait_obj(self->resize_ready);
13921406
}
13931407
else
13941408
{
@@ -3082,13 +3096,10 @@ xrdp_mm_check_wait_objs(struct xrdp_mm *self)
30823096
}
30833097
}
30843098

3085-
if (self->resize_queue != 0 && self->resize_queue->count > 0)
3099+
if (g_is_wait_obj_set(self->resize_ready))
30863100
{
3087-
if (g_is_wait_obj_set(self->resize_ready))
3088-
{
3089-
g_reset_wait_obj(self->resize_ready);
3090-
dynamic_monitor_process_queue(self);
3091-
}
3101+
g_reset_wait_obj(self->resize_ready);
3102+
dynamic_monitor_process_queue(self);
30923103
}
30933104

30943105
if (self->encoder != NULL)

0 commit comments

Comments
 (0)