Skip to content

Commit

Permalink
Unify monitor processing logic.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nexarian committed Jun 3, 2021
1 parent d126a31 commit 5bfd83a
Show file tree
Hide file tree
Showing 4 changed files with 348 additions and 182 deletions.
15 changes: 13 additions & 2 deletions common/ms-rdpbcgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,21 @@
/* This isn't explicitly named in MS-RDPBCGR */
#define CHANNEL_NAME_LEN 7

/* 2.2.1.3.6 Client Monitor Data - */
/* 2.2.1.3.6 Client Monitor Data */
/* monitorCount (4 bytes): A 32-bit, unsigned integer. The number of display */
/* monitor definitions in the monitorDefArray field (the maximum allowed is 16). */
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16

/* 2.2.1.3.6 Client Monitor Data */
/* The maximum width of the virtual desktop resulting from the union of the monitors */
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. Similarly, */
/* the maximum height of the virtual desktop resulting from the union of the monitors */
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. */
/* The minimum permitted size of the virtual desktop is 200 x 200 pixels. */
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_WIDTH 0xC8 // 200
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_HEIGHT 0xC8 // 200
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_WIDTH 0x7FFE // 32766
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_HEIGHT 0x7FFE // 32766

/* Options field */
/* NOTE: XR_ prefixed to avoid conflict with FreeRDP */
Expand Down
27 changes: 27 additions & 0 deletions common/xrdp_client_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,42 @@
#if !defined(XRDP_CLIENT_INFO_H)
#define XRDP_CLIENT_INFO_H

/*
* 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF)
* 2.2.1.3.9.1 Monitor Attributes (TS_MONITOR_ATTRIBUTES)
* 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT
*/
struct monitor_info
{
/* From 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF) */
int left;
int top;
int right;
int bottom;
int flags;

/* From 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT */
int width;
int height;
int physical_width;
int physical_height;
int orientation;
int desktop_scale_factor;
int device_scale_factor;

/* Derived setting */
int is_primary;
};

struct display_size_description
{
int monitorCount; /* number of monitors detected (max = 16) */
struct monitor_info minfo[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data */
struct monitor_info minfo_wm[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data, non-negative values */
int session_width;
int session_height;
};

/**
* Information about the xrdp client
*
Expand Down
Loading

0 comments on commit 5bfd83a

Please sign in to comment.