Skip to content

Commit 5bfd83a

Browse files
committed
Unify monitor processing logic.
There are two places where monitor descriptions are passed through the RDP protocol: - TS_UD_CS_MONITOR - DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT The processing logic for both of them is similar enough that they should be unified. Also update to define the constants for the maximum and minimum desktop width/height for monitors and total area. Note that this is also the first step to making resizing work with the extension GFX channel. Also some misc logging updates.
1 parent d126a31 commit 5bfd83a

File tree

4 files changed

+348
-182
lines changed

4 files changed

+348
-182
lines changed

common/ms-rdpbcgr.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,21 @@
7878
/* This isn't explicitly named in MS-RDPBCGR */
7979
#define CHANNEL_NAME_LEN 7
8080

81-
/* 2.2.1.3.6 Client Monitor Data - */
81+
/* 2.2.1.3.6 Client Monitor Data */
8282
/* monitorCount (4 bytes): A 32-bit, unsigned integer. The number of display */
8383
/* monitor definitions in the monitorDefArray field (the maximum allowed is 16). */
84-
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16
84+
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16
85+
86+
/* 2.2.1.3.6 Client Monitor Data */
87+
/* The maximum width of the virtual desktop resulting from the union of the monitors */
88+
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. Similarly, */
89+
/* the maximum height of the virtual desktop resulting from the union of the monitors */
90+
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. */
91+
/* The minimum permitted size of the virtual desktop is 200 x 200 pixels. */
92+
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_WIDTH 0xC8 // 200
93+
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_HEIGHT 0xC8 // 200
94+
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_WIDTH 0x7FFE // 32766
95+
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_HEIGHT 0x7FFE // 32766
8596

8697
/* Options field */
8798
/* NOTE: XR_ prefixed to avoid conflict with FreeRDP */

common/xrdp_client_info.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,42 @@
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;
39+
int flags;
40+
41+
/* From 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT */
42+
int width;
43+
int height;
44+
int physical_width;
45+
int physical_height;
46+
int orientation;
47+
int desktop_scale_factor;
48+
int device_scale_factor;
49+
50+
/* Derived setting */
3351
int is_primary;
3452
};
3553

54+
struct display_size_description
55+
{
56+
int monitorCount; /* number of monitors detected (max = 16) */
57+
struct monitor_info minfo[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data */
58+
struct monitor_info minfo_wm[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data, non-negative values */
59+
int session_width;
60+
int session_height;
61+
};
62+
3663
/**
3764
* Information about the xrdp client
3865
*

0 commit comments

Comments
 (0)