Skip to content

Commit 46e23eb

Browse files
authored
Merge pull request #1895 from Nexarian/unify_monitor_description_processing_resize_sec
Unify monitor processing logic.
2 parents f3c37e2 + bd9147d commit 46e23eb

17 files changed

+1186
-330
lines changed

common/ms-rdpbcgr.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,24 @@
8383
#define RDPSND_SVC_CHANNEL_NAME "rdpsnd"
8484
#define RDPDR_SVC_CHANNEL_NAME "rdpdr"
8585

86-
/* 2.2.1.3.6 Client Monitor Data - */
86+
/* 2.2.1.3.6 Client Monitor Data */
8787
/* monitorCount (4 bytes): A 32-bit, unsigned integer. The number of display */
8888
/* monitor definitions in the monitorDefArray field (the maximum allowed is 16). */
89-
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16
89+
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16
90+
91+
/* 2.2.1.3.6 Client Monitor Data */
92+
/* The maximum width of the virtual desktop resulting from the union of the monitors */
93+
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. Similarly, */
94+
/* the maximum height of the virtual desktop resulting from the union of the monitors */
95+
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. */
96+
/* The minimum permitted size of the virtual desktop is 200 x 200 pixels. */
97+
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_WIDTH 0xC8
98+
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_HEIGHT 0xC8
99+
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_WIDTH 0x7FFE
100+
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_HEIGHT 0x7FFE
101+
102+
/* 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF) */
103+
#define TS_MONITOR_PRIMARY 0x00000001
90104

91105
/* Options field */
92106
/* NOTE: XR_ prefixed to avoid conflict with FreeRDP */

common/ms-rdpedisp.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,19 @@
2323
#define MS_RDPEDISP_H
2424

2525
/* Display Control Messages: Display Virtual Channel Extension (2.2.2) */
26-
#define DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002
27-
#define DISPLAYCONTROL_PDU_TYPE_CAPS 0x00000005
26+
#define DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002
27+
#define DISPLAYCONTROL_PDU_TYPE_CAPS 0x00000005
28+
29+
/* Display Control Monitor Layout (2.2.2.2.1) */
30+
#define DISPLAYCONTROL_MONITOR_PRIMARY 0x00000001
31+
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_MONITOR_WIDTH 0xC8
32+
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_MONITOR_HEIGHT 0xC8
33+
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_MONITOR_WIDTH 0x2000
34+
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_MONITOR_HEIGHT 0x2000
35+
36+
#define ORIENTATION_LANDSCAPE 0
37+
#define ORIENTATION_PORTRAIT 90
38+
#define ORIENTATION_LANDSCAPE_FLIPPED 180
39+
#define ORIENTATION_PORTRAIT_FLIPPED 270
2840

2941
#endif /* MS_RDPEDISP_H */

common/xrdp_client_info.h

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,29 @@
2424
#if !defined(XRDP_CLIENT_INFO_H)
2525
#define XRDP_CLIENT_INFO_H
2626

27+
/*
28+
* 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF)
29+
* 2.2.1.3.9.1 Monitor Attributes (TS_MONITOR_ATTRIBUTES)
30+
* 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT
31+
*/
2732
struct monitor_info
2833
{
34+
/* From 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF) */
2935
int left;
3036
int top;
3137
int right;
3238
int bottom;
33-
int is_primary;
39+
int flags;
40+
41+
/* From 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT */
42+
unsigned int physical_width;
43+
unsigned int physical_height;
44+
unsigned int orientation;
45+
unsigned int desktop_scale_factor;
46+
unsigned int device_scale_factor;
47+
48+
/* Derived setting */
49+
unsigned int is_primary;
3450
};
3551

3652
/* xrdp keyboard overrids */
@@ -41,6 +57,15 @@ struct xrdp_keyboard_overrides
4157
int layout;
4258
};
4359

60+
struct display_size_description
61+
{
62+
unsigned int monitorCount; /* 2.2.2.2 DISPLAYCONTROL_MONITOR_LAYOUT_PDU: number of monitors detected (max = 16) */
63+
struct monitor_info minfo[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data */
64+
struct monitor_info minfo_wm[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data, non-negative values */
65+
unsigned int session_width;
66+
unsigned int session_height;
67+
};
68+
4469
/**
4570
* Information about the xrdp client
4671
*
@@ -54,8 +79,6 @@ struct xrdp_client_info
5479
int size; /* bytes for this structure */
5580
int version; /* Should be CLIENT_INFO_CURRENT_VERSION */
5681
int bpp;
57-
int width;
58-
int height;
5982
/* bitmap cache info */
6083
int cache1_entries;
6184
int cache1_size;
@@ -128,9 +151,7 @@ struct xrdp_client_info
128151

129152
int security_layer; /* 0 = rdp, 1 = tls , 2 = hybrid */
130153
int multimon; /* 0 = deny , 1 = allow */
131-
int monitorCount; /* number of monitors detected (max = 16) */
132-
struct monitor_info minfo[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data */
133-
struct monitor_info minfo_wm[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data, non-negative values */
154+
struct display_size_description display_sizes;
134155

135156
int keyboard_type;
136157
int keyboard_subtype;
@@ -186,6 +207,6 @@ struct xrdp_client_info
186207
};
187208

188209
/* yyyymmdd of last incompatible change to xrdp_client_info */
189-
#define CLIENT_INFO_CURRENT_VERSION 20210723
210+
#define CLIENT_INFO_CURRENT_VERSION 20220320
190211

191212
#endif

0 commit comments

Comments
 (0)