Merge pull request #1343 from matt335672/extended-vnc

Add resizeable backend VNC support
This commit is contained in:
matt335672 2020-06-04 15:36:00 +01:00 committed by GitHub
commit f37d1ba46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1213 additions and 210 deletions

View File

@ -148,12 +148,12 @@ This works only with xorgxrdp session. Moreover, xorgxrdp must be v0.2.9 or late
.TP .TP
\fBPolicy\fR=\fI[Default|UBD|UBI|UBC|UBDI|UBDC]\fR \fBPolicy\fR=\fI[Default|UBD|UBI|UBC|UBDI|UBDC]\fR
Session allocation policy. By default, a new session is created Session allocation policy. Used to decide when to allocate a
for the combination <User,BitPerPixel> when using Xrdp, and new session. Set to one of the following values:
for the combination <User,BitPerPixel,DisplaySize> when using Xvnc.
This behavior can be changed by setting session policy to:
.br .br
.br
\fBDefault\fR - session per <User,BitPerPixel>
.br .br
\fBUBD\fR - session per <User,BitPerPixel,DisplaySize> \fBUBD\fR - session per <User,BitPerPixel,DisplaySize>
.br .br
@ -168,7 +168,8 @@ This behavior can be changed by setting session policy to:
.br .br
Note that the \fBUser\fR and \fBBitPerPixel\fR criteria cannot be turned Note that the \fBUser\fR and \fBBitPerPixel\fR criteria cannot be turned
off. For Xvnc connections, \fBDisplaySize\fR is always enabled as well. off. \fBDisplaySize\fR refers to the initial geometry of a connection,
as actual display sizes can change dynamically.
.br .br
.SH "SECURITY" .SH "SECURITY"

View File

@ -302,6 +302,14 @@ Specifies color depth of the backend X server. The default is the color
depth of the client. Only Xvnc and X11rdp use that setting. Xorg runs at depth of the client. Only Xvnc and X11rdp use that setting. Xorg runs at
\fI24\fR bpp. \fI24\fR bpp.
.TP
\fBdisabled_encodings_mask\fR=\fI<number>\fR
Set this bitmask to a non-zero value to prevent \fBxrdp\fR(8) requesting
some features from the Xvnc server. You should only need to set this
to a non-zero value to work around bugs in your Xvnc server. The bit
values supported for a particular release of \fBxrdp\fR(8) are documented in
\fBxrdp.ini\fR.
.TP .TP
\fBcode\fR=\fI<number>\fR|\fI0\fR \fBcode\fR=\fI<number>\fR|\fI0\fR
Specifies the session type. The default, \fI0\fR, is Xvnc, \fI10\fR is Specifies the session type. The default, \fI0\fR, is Xvnc, \fI10\fR is

View File

@ -1044,29 +1044,36 @@ libxrdp_orders_send_font(struct xrdp_session *session,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Note : if this is called on a multimon setup, the client is resized
* to a single monitor */
int EXPORT_CC int EXPORT_CC
libxrdp_reset(struct xrdp_session *session, libxrdp_reset(struct xrdp_session *session,
int width, int height, int bpp) int width, int height, int bpp)
{ {
if (session->client_info != 0) if (session->client_info != 0)
{ {
struct xrdp_client_info *client_info = session->client_info;
/* older client can't resize */ /* older client can't resize */
if (session->client_info->build <= 419) if (client_info->build <= 419)
{ {
return 0; return 0;
} }
/* if same, don't need to do anything */ /* if same (and only one monitor on client) don't need to do anything */
if (session->client_info->width == width && if (client_info->width == width &&
session->client_info->height == height && client_info->height == height &&
session->client_info->bpp == bpp) client_info->bpp == bpp &&
(client_info->monitorCount == 0 || client_info->multimon == 0))
{ {
return 0; return 0;
} }
session->client_info->width = width; client_info->width = width;
session->client_info->height = height; client_info->height = height;
session->client_info->bpp = bpp; client_info->bpp = bpp;
client_info->monitorCount = 0;
client_info->multimon = 0;
} }
else else
{ {

View File

@ -105,9 +105,6 @@ session_get_bydata(const char *name, int width, int height, int bpp, int type,
{ {
case SCP_SESSION_TYPE_XVNC: /* 0 */ case SCP_SESSION_TYPE_XVNC: /* 0 */
type = SESMAN_SESSION_TYPE_XVNC; /* 2 */ type = SESMAN_SESSION_TYPE_XVNC; /* 2 */
/* Xvnc cannot resize */
policy = (enum SESMAN_CFG_SESS_POLICY)
(policy | SESMAN_CFG_SESS_POLICY_D);
break; break;
case SCP_SESSION_TYPE_XRDP: /* 1 */ case SCP_SESSION_TYPE_XRDP: /* 1 */
type = SESMAN_SESSION_TYPE_XRDP; /* 1 */ type = SESMAN_SESSION_TYPE_XRDP; /* 1 */

View File

@ -31,6 +31,10 @@
#include "sesman.h" #include "sesman.h"
#include "tcp.h" #include "tcp.h"
#if !defined(PACKAGE_VERSION)
#define PACKAGE_VERSION "???"
#endif
struct config_sesman g_cfg; /* config.h */ struct config_sesman g_cfg; /* config.h */
/******************************************************************************/ /******************************************************************************/
@ -61,9 +65,9 @@ main(int argc, char **argv)
if (argc == 1) if (argc == 1)
{ {
g_printf("xrdp session starter v0.1\n"); g_printf("xrdp session starter v" PACKAGE_VERSION "\n");
g_printf("\nusage:\n"); g_printf("\nusage:\n");
g_printf("sesrun <server> <username> <password> <width> <height> <bpp> <session_cod>\n"); g_printf("sesrun <server> <username> <password> <width> <height> <bpp> <session_code>\n");
g_printf("session code 0 for Xvnc, 10 for X11RDP, 20 for Xorg\n"); g_printf("session code 0 for Xvnc, 10 for X11RDP, 20 for Xorg\n");
} }
else if (argc == 8) else if (argc == 8)

1121
vnc/vnc.c

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,36 @@
#define CURRENT_MOD_VER 4 #define CURRENT_MOD_VER 4
/* Screen used for ExtendedDesktopSize / Set DesktopSize */
struct vnc_screen
{
int id;
int x;
int y;
int width;
int height;
int flags;
};
struct vnc_screen_layout
{
int total_width;
int total_height;
unsigned int count;
/* For comparison, screens are sorted in increasing order of ID */
struct vnc_screen *s;
};
/**
* Keep track of resize status at start of connection
*/
enum vnc_resize_status
{
VRS_WAITING_FOR_FIRST_UPDATE,
VRS_WAITING_FOR_RESIZE_CONFIRM,
VRS_DONE
};
struct vnc struct vnc
{ {
int size; /* size of this struct */ int size; /* size of this struct */
@ -99,9 +129,6 @@ struct vnc
int server_width; int server_width;
int server_height; int server_height;
int server_bpp; int server_bpp;
int mod_width;
int mod_height;
int mod_bpp;
char mod_name[256]; char mod_name[256];
int mod_mouse_state; int mod_mouse_state;
int palette[256]; int palette[256];
@ -120,4 +147,8 @@ struct vnc
int got_guid; int got_guid;
tui8 guid[16]; tui8 guid[16];
int suppress_output; int suppress_output;
unsigned int enabled_encodings_mask;
/* Resizeable support */
struct vnc_screen_layout client_layout;
enum vnc_resize_status initial_resize_status;
}; };

View File

@ -196,6 +196,10 @@ ip=127.0.0.1
port=-1 port=-1
#xserverbpp=24 #xserverbpp=24
#delay_ms=2000 #delay_ms=2000
; Disable requested encodings to support buggy VNC servers
; (1 = ExtendedDesktopSize)
#disabled_encodings_mask=0
[vnc-any] [vnc-any]
name=vnc-any name=vnc-any

View File

@ -3261,6 +3261,9 @@ server_draw_text(struct xrdp_mod *mod, int font,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Note : if this is called on a multimon setup, the client is resized
* to a single monitor */
int int
server_reset(struct xrdp_mod *mod, int width, int height, int bpp) server_reset(struct xrdp_mod *mod, int width, int height, int bpp)
{ {
@ -3279,10 +3282,11 @@ server_reset(struct xrdp_mod *mod, int width, int height, int bpp)
return 0; return 0;
} }
/* if same, don't need to do anything */ /* if same (and only one monitor on client) don't need to do anything */
if (wm->client_info->width == width && if (wm->client_info->width == width &&
wm->client_info->height == height && wm->client_info->height == height &&
wm->client_info->bpp == bpp) wm->client_info->bpp == bpp &&
(wm->client_info->monitorCount == 0 || wm->client_info->multimon == 0))
{ {
return 0; return 0;
} }