Skip to content

Commit

Permalink
Regression: Support fixed-size VNC sessions
Browse files Browse the repository at this point in the history
This is a regression introduced in v0.10.x

This version introduced a state machine to handle resizes requested
by the client and the server. Most configurations support resizeable
sessions, but one that doesn't is xrdp connecting to x11vnc on (e.g.) a
Raspberry PI.

If the session size requested by a client is differnt from the x11vnc
size, an error is logged and the state machine fails to complete,
resulting in a black screen.

This PR handles the problem by queueing a resize to the supported
server size and then continuing with the state machine. It's not an
optimal solution, but involves the least change to v0.10.x code.
  • Loading branch information
matt335672 committed Sep 9, 2024
1 parent ea69f9a commit 984b714
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions vnc/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,21 +1248,30 @@ lib_framebuffer_waiting_for_resize_confirm(struct vnc *v)
LOG(LOG_LEVEL_DEBUG, "VNC server successfully resized");
log_screen_layout(LOG_LEVEL_INFO, "NewLayout", &layout);
v->server_layout = layout;
// If this resize was requested by the client mid-session
// (dynamic resize), we need to tell xrdp_mm that
// it's OK to continue with the resize state machine.
error = v->server_monitor_resize_done(v);
}
else
{
LOG(LOG_LEVEL_WARNING,
"VNC server resize failed - error code %d [%s]",
response_code,
rfb_get_eds_status_msg(response_code));
/* Force client to same size as server */
// This is awkward. The client has asked for a specific size
// which we can't support.
//
// Currently we handle this by queueing a resize to our
// supported size, and continuing with the resize state
// machine in xrdp_mm.c
LOG(LOG_LEVEL_WARNING, "Resizing client to server");
error = resize_client_to_server(v, 0);
}

if (error == 0)
{
// If this resize was requested by the client mid-session
// (dynamic resize), we need to tell xrdp_mm that
// it's OK to continue with the resize state machine.
error = v->server_monitor_resize_done(v);
}
v->resize_status = VRS_DONE;
}
}
Expand Down

0 comments on commit 984b714

Please sign in to comment.