Updating to refactor xrdp_client_info
- Eliminate duplicaiton for display_size_description - monitorCount needs to be uint32_t - width/height -> session_width/session_height - Update CLIENT_INFO_CURRENT_VERSION - Also some misc unit test updates. - Minor log updates.
This commit is contained in:
+11
-15
@@ -39,14 +39,14 @@ struct monitor_info
|
|||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
/* From 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT */
|
/* From 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT */
|
||||||
int physical_width;
|
unsigned int physical_width;
|
||||||
int physical_height;
|
unsigned int physical_height;
|
||||||
int orientation;
|
unsigned int orientation;
|
||||||
int desktop_scale_factor;
|
unsigned int desktop_scale_factor;
|
||||||
int device_scale_factor;
|
unsigned int device_scale_factor;
|
||||||
|
|
||||||
/* Derived setting */
|
/* Derived setting */
|
||||||
int is_primary;
|
unsigned int is_primary;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* xrdp keyboard overrids */
|
/* xrdp keyboard overrids */
|
||||||
@@ -59,11 +59,11 @@ struct xrdp_keyboard_overrides
|
|||||||
|
|
||||||
struct display_size_description
|
struct display_size_description
|
||||||
{
|
{
|
||||||
int monitorCount; /* number of monitors detected (max = 16) */
|
unsigned int monitorCount; /* 2.2.2.2 DISPLAYCONTROL_MONITOR_LAYOUT_PDU: number of monitors detected (max = 16) */
|
||||||
struct monitor_info minfo[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data */
|
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 */
|
struct monitor_info minfo_wm[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data, non-negative values */
|
||||||
int session_width;
|
unsigned int session_width;
|
||||||
int session_height;
|
unsigned int session_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,8 +79,6 @@ struct xrdp_client_info
|
|||||||
int size; /* bytes for this structure */
|
int size; /* bytes for this structure */
|
||||||
int version; /* Should be CLIENT_INFO_CURRENT_VERSION */
|
int version; /* Should be CLIENT_INFO_CURRENT_VERSION */
|
||||||
int bpp;
|
int bpp;
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
/* bitmap cache info */
|
/* bitmap cache info */
|
||||||
int cache1_entries;
|
int cache1_entries;
|
||||||
int cache1_size;
|
int cache1_size;
|
||||||
@@ -153,9 +151,7 @@ struct xrdp_client_info
|
|||||||
|
|
||||||
int security_layer; /* 0 = rdp, 1 = tls , 2 = hybrid */
|
int security_layer; /* 0 = rdp, 1 = tls , 2 = hybrid */
|
||||||
int multimon; /* 0 = deny , 1 = allow */
|
int multimon; /* 0 = deny , 1 = allow */
|
||||||
int monitorCount; /* number of monitors detected (max = 16) */
|
struct display_size_description display_sizes;
|
||||||
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 keyboard_type;
|
int keyboard_type;
|
||||||
int keyboard_subtype;
|
int keyboard_subtype;
|
||||||
@@ -211,6 +207,6 @@ struct xrdp_client_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* yyyymmdd of last incompatible change to xrdp_client_info */
|
/* yyyymmdd of last incompatible change to xrdp_client_info */
|
||||||
#define CLIENT_INFO_CURRENT_VERSION 20210723
|
#define CLIENT_INFO_CURRENT_VERSION 20220320
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+67
-10
@@ -1134,7 +1134,7 @@ libxrdp_orders_send_font(struct xrdp_session *session,
|
|||||||
* to a single monitor */
|
* 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)
|
unsigned int width, unsigned int height, int bpp)
|
||||||
{
|
{
|
||||||
if (session->client_info != 0)
|
if (session->client_info != 0)
|
||||||
{
|
{
|
||||||
@@ -1147,18 +1147,18 @@ libxrdp_reset(struct xrdp_session *session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if same (and only one monitor on client) don't need to do anything */
|
/* if same (and only one monitor on client) don't need to do anything */
|
||||||
if (client_info->width == width &&
|
if (client_info->display_sizes.session_width == width &&
|
||||||
client_info->height == height &&
|
client_info->display_sizes.session_height == height &&
|
||||||
client_info->bpp == bpp &&
|
client_info->bpp == bpp &&
|
||||||
(client_info->monitorCount == 0 || client_info->multimon == 0))
|
(client_info->display_sizes.monitorCount == 0 || client_info->multimon == 0))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
client_info->width = width;
|
client_info->display_sizes.session_width = width;
|
||||||
client_info->height = height;
|
client_info->display_sizes.session_height = height;
|
||||||
|
client_info->display_sizes.monitorCount = 0;
|
||||||
client_info->bpp = bpp;
|
client_info->bpp = bpp;
|
||||||
client_info->monitorCount = 0;
|
|
||||||
client_info->multimon = 0;
|
client_info->multimon = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1908,8 +1908,39 @@ libxrdp_process_monitor_stream(struct stream *s,
|
|||||||
in_uint32_le(s, monitor_layout->physical_width);
|
in_uint32_le(s, monitor_layout->physical_width);
|
||||||
in_uint32_le(s, monitor_layout->physical_height);
|
in_uint32_le(s, monitor_layout->physical_height);
|
||||||
|
|
||||||
|
/* Per spec (2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT),
|
||||||
|
* if EITHER physical_width or physical_height are
|
||||||
|
* out of range, BOTH must be ignored.
|
||||||
|
*/
|
||||||
|
if (monitor_layout->physical_width > 10000
|
||||||
|
|| monitor_layout->physical_width < 10)
|
||||||
|
{
|
||||||
|
LOG(LOG_LEVEL_WARNING, "libxrdp_process_monitor_stream:"
|
||||||
|
" physical_width is not within valid range."
|
||||||
|
" Setting physical_width to 0mm,"
|
||||||
|
" Setting physical_height to 0mm,"
|
||||||
|
" physical_width was: %d",
|
||||||
|
monitor_layout->physical_width);
|
||||||
|
monitor_layout->physical_width = 0;
|
||||||
|
monitor_layout->physical_height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitor_layout->physical_height > 10000
|
||||||
|
|| monitor_layout->physical_height < 10)
|
||||||
|
{
|
||||||
|
LOG(LOG_LEVEL_WARNING, "libxrdp_process_monitor_stream:"
|
||||||
|
" physical_height is not within valid range."
|
||||||
|
" Setting physical_width to 0mm,"
|
||||||
|
" Setting physical_height to 0mm,"
|
||||||
|
" physical_height was: %d",
|
||||||
|
monitor_layout->physical_height);
|
||||||
|
monitor_layout->physical_width = 0;
|
||||||
|
monitor_layout->physical_height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
in_uint32_le(s, monitor_layout->orientation);
|
in_uint32_le(s, monitor_layout->orientation);
|
||||||
switch (monitor_layout->orientation) {
|
switch (monitor_layout->orientation)
|
||||||
|
{
|
||||||
case ORIENTATION_LANDSCAPE:
|
case ORIENTATION_LANDSCAPE:
|
||||||
case ORIENTATION_PORTRAIT:
|
case ORIENTATION_PORTRAIT:
|
||||||
case ORIENTATION_LANDSCAPE_FLIPPED:
|
case ORIENTATION_LANDSCAPE_FLIPPED:
|
||||||
@@ -1918,21 +1949,47 @@ libxrdp_process_monitor_stream(struct stream *s,
|
|||||||
default:
|
default:
|
||||||
LOG(LOG_LEVEL_WARNING, "libxrdp_process_monitor_stream:"
|
LOG(LOG_LEVEL_WARNING, "libxrdp_process_monitor_stream:"
|
||||||
" Orientation is not one of %d, %d, %d, or %d."
|
" Orientation is not one of %d, %d, %d, or %d."
|
||||||
" Value was %d and ignored.",
|
" Value was %d and ignored and set to default value of LANDSCAPE.",
|
||||||
ORIENTATION_LANDSCAPE,
|
ORIENTATION_LANDSCAPE,
|
||||||
ORIENTATION_PORTRAIT,
|
ORIENTATION_PORTRAIT,
|
||||||
ORIENTATION_LANDSCAPE_FLIPPED,
|
ORIENTATION_LANDSCAPE_FLIPPED,
|
||||||
ORIENTATION_PORTRAIT_FLIPPED,
|
ORIENTATION_PORTRAIT_FLIPPED,
|
||||||
monitor_layout->orientation);
|
monitor_layout->orientation);
|
||||||
|
monitor_layout->orientation = ORIENTATION_LANDSCAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_uint32_le(s, monitor_layout->desktop_scale_factor);
|
in_uint32_le(s, monitor_layout->desktop_scale_factor);
|
||||||
|
if (monitor_layout->desktop_scale_factor < 100
|
||||||
|
|| monitor_layout->desktop_scale_factor > 500
|
||||||
|
|| (monitor_layout->desktop_scale_factor != 100
|
||||||
|
&& monitor_layout->desktop_scale_factor != 140
|
||||||
|
&& monitor_layout->desktop_scale_factor != 180))
|
||||||
|
{
|
||||||
|
LOG(LOG_LEVEL_WARNING, "libxrdp_process_monitor_stream:"
|
||||||
|
" desktop_scale_factor is not within valid range. Assuming 100."
|
||||||
|
" Value was: %d",
|
||||||
|
monitor_layout->desktop_scale_factor);
|
||||||
|
monitor_layout->desktop_scale_factor = 100;
|
||||||
|
}
|
||||||
|
|
||||||
in_uint32_le(s, monitor_layout->device_scale_factor);
|
in_uint32_le(s, monitor_layout->device_scale_factor);
|
||||||
|
if (monitor_layout->device_scale_factor < 100
|
||||||
|
|| monitor_layout->device_scale_factor > 500
|
||||||
|
|| (monitor_layout->device_scale_factor != 100
|
||||||
|
&& monitor_layout->device_scale_factor != 140
|
||||||
|
&& monitor_layout->device_scale_factor != 180))
|
||||||
|
{
|
||||||
|
LOG(LOG_LEVEL_WARNING, "libxrdp_process_monitor_stream:"
|
||||||
|
" device_scale_factor is not within valid range. Assuming 100."
|
||||||
|
" Value was: %d",
|
||||||
|
monitor_layout->device_scale_factor);
|
||||||
|
monitor_layout->device_scale_factor = 100;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT
|
* 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT
|
||||||
*/
|
*/
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "libxrdp_process_monitor_stream:"
|
LOG_DEVEL(LOG_LEVEL_INFO, "libxrdp_process_monitor_stream:"
|
||||||
" Received [MS-RDPEDISP] 2.2.2.2.1"
|
" Received [MS-RDPEDISP] 2.2.2.2.1"
|
||||||
" DISPLAYCONTROL_MONITOR_LAYOUT_PDU"
|
" DISPLAYCONTROL_MONITOR_LAYOUT_PDU"
|
||||||
".DISPLAYCONTROL_MONITOR_LAYOUT"
|
".DISPLAYCONTROL_MONITOR_LAYOUT"
|
||||||
|
|||||||
+4
-2
@@ -361,8 +361,10 @@ xrdp_mcs_disconnect(struct xrdp_mcs *self);
|
|||||||
/* xrdp_sec.c */
|
/* xrdp_sec.c */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These are return values for xrdp_sec_process_mcs_data_monitors
|
These are error return codes for both:
|
||||||
to clarify any reason for a non-zero response code.
|
1. xrdp_sec_process_mcs_data_monitors
|
||||||
|
2. libxrdp_process_monitor_stream
|
||||||
|
To clarify any reason for a non-zero response code.
|
||||||
*/
|
*/
|
||||||
#define SEC_PROCESS_MONITORS_ERR 1
|
#define SEC_PROCESS_MONITORS_ERR 1
|
||||||
#define SEC_PROCESS_MONITORS_ERR_TOO_MANY_MONITORS 2
|
#define SEC_PROCESS_MONITORS_ERR_TOO_MANY_MONITORS 2
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ libxrdp_orders_send_font(struct xrdp_session *session,
|
|||||||
int font_index, int char_index);
|
int font_index, int char_index);
|
||||||
int
|
int
|
||||||
libxrdp_reset(struct xrdp_session *session,
|
libxrdp_reset(struct xrdp_session *session,
|
||||||
int width, int height, int bpp);
|
unsigned int width, unsigned int height, int bpp);
|
||||||
int
|
int
|
||||||
libxrdp_orders_send_raw_bitmap2(struct xrdp_session *session,
|
libxrdp_orders_send_raw_bitmap2(struct xrdp_session *session,
|
||||||
int width, int height, int bpp, char *data,
|
int width, int height, int bpp, char *data,
|
||||||
|
|||||||
+16
-13
@@ -45,7 +45,8 @@ static int
|
|||||||
xrdp_caps_send_monitorlayout(struct xrdp_rdp *self)
|
xrdp_caps_send_monitorlayout(struct xrdp_rdp *self)
|
||||||
{
|
{
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
int i;
|
uint32_t i;
|
||||||
|
struct display_size_description *description;
|
||||||
|
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
init_stream(s, 8192);
|
init_stream(s, 8192);
|
||||||
@@ -56,16 +57,18 @@ xrdp_caps_send_monitorlayout(struct xrdp_rdp *self)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_uint32_le(s, self->client_info.monitorCount); /* monitorCount (4 bytes) */
|
description = &self->client_info.display_sizes;
|
||||||
|
|
||||||
|
out_uint32_le(s, description->monitorCount); /* monitorCount (4 bytes) */
|
||||||
|
|
||||||
/* TODO: validate for allowed monitors in terminal server (maybe by config?) */
|
/* TODO: validate for allowed monitors in terminal server (maybe by config?) */
|
||||||
for (i = 0; i < self->client_info.monitorCount; i++)
|
for (i = 0; i < description->monitorCount; i++)
|
||||||
{
|
{
|
||||||
out_uint32_le(s, self->client_info.minfo[i].left);
|
out_uint32_le(s, description->minfo[i].left);
|
||||||
out_uint32_le(s, self->client_info.minfo[i].top);
|
out_uint32_le(s, description->minfo[i].top);
|
||||||
out_uint32_le(s, self->client_info.minfo[i].right);
|
out_uint32_le(s, description->minfo[i].right);
|
||||||
out_uint32_le(s, self->client_info.minfo[i].bottom);
|
out_uint32_le(s, description->minfo[i].bottom);
|
||||||
out_uint32_le(s, self->client_info.minfo[i].is_primary);
|
out_uint32_le(s, description->minfo[i].is_primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
s_mark_end(s);
|
s_mark_end(s);
|
||||||
@@ -883,8 +886,8 @@ unsigned int calculate_multifragmentupdate_len(const struct xrdp_rdp *self)
|
|||||||
{
|
{
|
||||||
unsigned int result = MAX_MULTIFRAGMENTUPDATE_SIZE;
|
unsigned int result = MAX_MULTIFRAGMENTUPDATE_SIZE;
|
||||||
|
|
||||||
unsigned int x_tiles = (self->client_info.width + 63) / 64;
|
unsigned int x_tiles = (self->client_info.display_sizes.session_width + 63) / 64;
|
||||||
unsigned int y_tiles = (self->client_info.height + 63) / 64;
|
unsigned int y_tiles = (self->client_info.display_sizes.session_height + 63) / 64;
|
||||||
|
|
||||||
/* Check for overflow on calculation if bad parameters are supplied */
|
/* Check for overflow on calculation if bad parameters are supplied */
|
||||||
if ((x_tiles * y_tiles + 1) < (UINT_MAX / 16384))
|
if ((x_tiles * y_tiles + 1) < (UINT_MAX / 16384))
|
||||||
@@ -979,8 +982,8 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
|
|||||||
out_uint16_le(s, 1); /* Receive 1 BPP */
|
out_uint16_le(s, 1); /* Receive 1 BPP */
|
||||||
out_uint16_le(s, 1); /* Receive 4 BPP */
|
out_uint16_le(s, 1); /* Receive 4 BPP */
|
||||||
out_uint16_le(s, 1); /* Receive 8 BPP */
|
out_uint16_le(s, 1); /* Receive 8 BPP */
|
||||||
out_uint16_le(s, self->client_info.width); /* width */
|
out_uint16_le(s, self->client_info.display_sizes.session_width); /* width */
|
||||||
out_uint16_le(s, self->client_info.height); /* height */
|
out_uint16_le(s, self->client_info.display_sizes.session_height); /* height */
|
||||||
out_uint16_le(s, 0); /* Pad */
|
out_uint16_le(s, 0); /* Pad */
|
||||||
out_uint16_le(s, 1); /* Allow resize */
|
out_uint16_le(s, 1); /* Allow resize */
|
||||||
out_uint16_le(s, 1); /* bitmap compression */
|
out_uint16_le(s, 1); /* bitmap compression */
|
||||||
@@ -1242,7 +1245,7 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send Monitor Layout PDU for dual monitor */
|
/* send Monitor Layout PDU for dual monitor */
|
||||||
if (self->client_info.monitorCount > 0 &&
|
if (self->client_info.display_sizes.monitorCount > 0 &&
|
||||||
self->client_info.multimon == 1)
|
self->client_info.multimon == 1)
|
||||||
{
|
{
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_send_demand_active: sending monitor layout pdu");
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_caps_send_demand_active: sending monitor layout pdu");
|
||||||
|
|||||||
+9
-9
@@ -1953,8 +1953,8 @@ xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec *self, struct stream *s)
|
|||||||
|
|
||||||
/* TS_UD_CS_CORE requiered fields */
|
/* TS_UD_CS_CORE requiered fields */
|
||||||
in_uint8s(s, 4); /* version */
|
in_uint8s(s, 4); /* version */
|
||||||
in_uint16_le(s, self->rdp_layer->client_info.width);
|
in_uint16_le(s, self->rdp_layer->client_info.display_sizes.session_width);
|
||||||
in_uint16_le(s, self->rdp_layer->client_info.height);
|
in_uint16_le(s, self->rdp_layer->client_info.display_sizes.session_height);
|
||||||
in_uint16_le(s, colorDepth);
|
in_uint16_le(s, colorDepth);
|
||||||
switch (colorDepth)
|
switch (colorDepth)
|
||||||
{
|
{
|
||||||
@@ -1981,8 +1981,8 @@ xrdp_sec_process_mcs_data_CS_CORE(struct xrdp_sec *self, struct stream *s)
|
|||||||
"clientName %s, keyboardType (ignored), "
|
"clientName %s, keyboardType (ignored), "
|
||||||
"keyboardSubType (ignored), keyboardFunctionKey (ignored), "
|
"keyboardSubType (ignored), keyboardFunctionKey (ignored), "
|
||||||
"imeFileName (ignroed)",
|
"imeFileName (ignroed)",
|
||||||
self->rdp_layer->client_info.width,
|
self->rdp_layer->client_info.display_sizes.session_width,
|
||||||
self->rdp_layer->client_info.height,
|
self->rdp_layer->client_info.display_sizes.session_height,
|
||||||
(colorDepth == 0xca00 ? "RNS_UD_COLOR_4BPP" :
|
(colorDepth == 0xca00 ? "RNS_UD_COLOR_4BPP" :
|
||||||
colorDepth == 0xca01 ? "RNS_UD_COLOR_8BPP" : "unknown"),
|
colorDepth == 0xca01 ? "RNS_UD_COLOR_8BPP" : "unknown"),
|
||||||
clientName);
|
clientName);
|
||||||
@@ -2370,17 +2370,17 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
|
|||||||
error = libxrdp_process_monitor_stream(s, description, 0);
|
error = libxrdp_process_monitor_stream(s, description, 0);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
{
|
{
|
||||||
client_info->monitorCount = description->monitorCount;
|
client_info->display_sizes.monitorCount = description->monitorCount;
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_sec_process_mcs_data_monitors:"
|
LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_sec_process_mcs_data_monitors:"
|
||||||
" Received [MS-RDPBCGR] TS_UD_CS_MONITOR"
|
" Received [MS-RDPBCGR] TS_UD_CS_MONITOR"
|
||||||
" flags 0x%8.8x, monitorCount %d",
|
" flags 0x%8.8x, monitorCount %d",
|
||||||
flags, description->monitorCount);
|
flags, description->monitorCount);
|
||||||
|
|
||||||
client_info->width = description->session_width;
|
client_info->display_sizes.session_width = description->session_width;
|
||||||
client_info->height = description->session_height;
|
client_info->display_sizes.session_height = description->session_height;
|
||||||
g_memcpy(client_info->minfo, description->minfo, sizeof(struct monitor_info) * CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
g_memcpy(client_info->display_sizes.minfo, description->minfo, sizeof(struct monitor_info) * CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
||||||
g_memcpy(client_info->minfo_wm, description->minfo_wm, sizeof(struct monitor_info) * CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
g_memcpy(client_info->display_sizes.minfo_wm, description->minfo_wm, sizeof(struct monitor_info) * CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free(description);
|
g_free(description);
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ check_PROGRAMS = test_libxrdp
|
|||||||
test_libxrdp_SOURCES = \
|
test_libxrdp_SOURCES = \
|
||||||
test_libxrdp.h \
|
test_libxrdp.h \
|
||||||
test_libxrdp_main.c \
|
test_libxrdp_main.c \
|
||||||
test_monitor_processing.c
|
test_libxrdp_process_monitor_stream.c \
|
||||||
|
test_xrdp_sec_process_mcs_data_monitors.c
|
||||||
|
|
||||||
test_libxrdp_CFLAGS = \
|
test_libxrdp_CFLAGS = \
|
||||||
@CHECK_CFLAGS@
|
@CHECK_CFLAGS@
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
|
|
||||||
|
Suite *make_suite_test_xrdp_sec_process_mcs_data_monitors(void);
|
||||||
Suite *make_suite_test_monitor_processing(void);
|
Suite *make_suite_test_monitor_processing(void);
|
||||||
|
|
||||||
#endif /* TEST_LIBXRDP_H */
|
#endif /* TEST_LIBXRDP_H */
|
||||||
@@ -11,8 +11,8 @@ int main (void)
|
|||||||
int number_failed;
|
int number_failed;
|
||||||
SRunner *sr;
|
SRunner *sr;
|
||||||
|
|
||||||
sr = srunner_create (make_suite_test_monitor_processing());
|
sr = srunner_create(make_suite_test_xrdp_sec_process_mcs_data_monitors());
|
||||||
// srunner_add_suite(sr, make_list_suite());
|
srunner_add_suite(sr, make_suite_test_monitor_processing());
|
||||||
|
|
||||||
srunner_set_tap(sr, "-");
|
srunner_set_tap(sr, "-");
|
||||||
srunner_run_all (sr, CK_ENV);
|
srunner_run_all (sr, CK_ENV);
|
||||||
|
|||||||
@@ -0,0 +1,406 @@
|
|||||||
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
#include "config_ac.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "libxrdp.h"
|
||||||
|
#include "os_calls.h"
|
||||||
|
|
||||||
|
#include "test_libxrdp.h"
|
||||||
|
|
||||||
|
START_TEST(test_libxrdp_process_monitor_stream__when_description_is_null__fail)
|
||||||
|
{
|
||||||
|
struct stream *s = (struct stream *)NULL;
|
||||||
|
make_stream(s);
|
||||||
|
init_stream(s, 4);
|
||||||
|
|
||||||
|
//Dummy data.
|
||||||
|
out_uint32_le(s, 0);
|
||||||
|
s_mark_end(s);
|
||||||
|
//Reset the read counter of the stream so the processing function handles it properly.
|
||||||
|
s->p = s->data;
|
||||||
|
|
||||||
|
int error = libxrdp_process_monitor_stream(s, NULL, 1);
|
||||||
|
ck_assert_int_eq(error, SEC_PROCESS_MONITORS_ERR);
|
||||||
|
|
||||||
|
free_stream(s);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(test_libxrdp_process_monitor_stream__when_stream_is_too_small__fail)
|
||||||
|
{
|
||||||
|
struct stream *s = (struct stream *)NULL;
|
||||||
|
make_stream(s);
|
||||||
|
init_stream(s, 2);
|
||||||
|
|
||||||
|
//Dummy data.
|
||||||
|
out_uint16_le(s, 0);
|
||||||
|
s_mark_end(s);
|
||||||
|
//Reset the read counter of the stream so the processing function handles it properly.
|
||||||
|
s->p = s->data;
|
||||||
|
|
||||||
|
struct display_size_description *description =
|
||||||
|
(struct display_size_description *)
|
||||||
|
g_malloc(sizeof(struct display_size_description), 1);
|
||||||
|
|
||||||
|
int error = libxrdp_process_monitor_stream(s, description, 1);
|
||||||
|
ck_assert_int_eq(error, SEC_PROCESS_MONITORS_ERR);
|
||||||
|
|
||||||
|
free(description);
|
||||||
|
free_stream(s);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(test_libxrdp_process_monitor_stream__when_monitor_count_is_greater_than_sixteen__fail)
|
||||||
|
{
|
||||||
|
struct stream *s = (struct stream *)NULL;
|
||||||
|
make_stream(s);
|
||||||
|
init_stream(s, 4);
|
||||||
|
|
||||||
|
//Dummy data.
|
||||||
|
out_uint32_le(s, 17);
|
||||||
|
s_mark_end(s);
|
||||||
|
//Reset the read counter of the stream so the processing function handles it properly.
|
||||||
|
s->p = s->data;
|
||||||
|
|
||||||
|
struct display_size_description *description =
|
||||||
|
(struct display_size_description *)
|
||||||
|
g_malloc(sizeof(struct display_size_description), 1);
|
||||||
|
|
||||||
|
int error = libxrdp_process_monitor_stream(s, description, 1);
|
||||||
|
ck_assert_int_eq(error, SEC_PROCESS_MONITORS_ERR_TOO_MANY_MONITORS);
|
||||||
|
|
||||||
|
free(description);
|
||||||
|
free_stream(s);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(test_libxrdp_process_monitor_stream__with_single_monitor_happy_path)
|
||||||
|
{
|
||||||
|
struct stream *s = (struct stream *)NULL;
|
||||||
|
make_stream(s);
|
||||||
|
init_stream(s, 44);
|
||||||
|
|
||||||
|
out_uint32_le(s, 1); //monitorCount
|
||||||
|
|
||||||
|
// Pretend we have a 4k monitor
|
||||||
|
out_uint32_le(s, TS_MONITOR_PRIMARY); //flags
|
||||||
|
out_uint32_le(s, 0); //monitor left
|
||||||
|
out_uint32_le(s, 0); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor right
|
||||||
|
out_uint32_le(s, 2160); //monitor bottom
|
||||||
|
out_uint32_le(s, 2000); //physical width
|
||||||
|
out_uint32_le(s, 2000); //physical height
|
||||||
|
out_uint32_le(s, 0); //orientation
|
||||||
|
out_uint32_le(s, 100); //desktop scale factor
|
||||||
|
out_uint32_le(s, 100); //device scale factor
|
||||||
|
|
||||||
|
s_mark_end(s);
|
||||||
|
//Reset the read counter of the stream so the processing function handles it properly.
|
||||||
|
s->p = s->data;
|
||||||
|
|
||||||
|
struct display_size_description *description =
|
||||||
|
(struct display_size_description *)
|
||||||
|
g_malloc(sizeof(struct display_size_description), 1);
|
||||||
|
|
||||||
|
int error = libxrdp_process_monitor_stream(s, description, 1);
|
||||||
|
|
||||||
|
//Verify function call passed.
|
||||||
|
ck_assert_int_eq(error, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->monitorCount, 1);
|
||||||
|
|
||||||
|
// Verify normal monitor
|
||||||
|
ck_assert_int_eq(description->minfo[0].left, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].right, 3840);
|
||||||
|
ck_assert_int_eq(description->minfo[0].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo[0].physical_width, 2000);
|
||||||
|
ck_assert_int_eq(description->minfo[0].physical_height, 2000);
|
||||||
|
ck_assert_int_eq(description->minfo[0].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[0].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[0].is_primary, 1);
|
||||||
|
|
||||||
|
// Verify normalized monitor
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].left, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].right, 3840);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].physical_width, 2000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].physical_height, 2000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].is_primary, 1);
|
||||||
|
|
||||||
|
// Verify geometry (+1 greater than )
|
||||||
|
ck_assert_int_eq(description->session_width, 3841);
|
||||||
|
ck_assert_int_eq(description->session_height, 2161);
|
||||||
|
|
||||||
|
free(description);
|
||||||
|
free_stream(s);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(test_libxrdp_process_monitor_stream__with_sextuple_monitor_happy_path)
|
||||||
|
{
|
||||||
|
struct stream *s = (struct stream *)NULL;
|
||||||
|
make_stream(s);
|
||||||
|
init_stream(s, 233);
|
||||||
|
|
||||||
|
out_uint32_le(s, 6); //monitorCount
|
||||||
|
|
||||||
|
// 4k monitor at position (0, 0)
|
||||||
|
out_uint32_le(s, 0); //flags
|
||||||
|
out_uint32_le(s, 0); //monitor left
|
||||||
|
out_uint32_le(s, 0); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor width
|
||||||
|
out_uint32_le(s, 2160); //monitor height
|
||||||
|
out_uint32_le(s, 9); //physical width
|
||||||
|
out_uint32_le(s, 9); //physical height
|
||||||
|
out_uint32_le(s, -10); //orientation
|
||||||
|
out_uint32_le(s, -100); //desktop scale factor
|
||||||
|
out_uint32_le(s, 600); //device scale factor
|
||||||
|
|
||||||
|
// 4k monitor at position (1, 0)
|
||||||
|
out_uint32_le(s, TS_MONITOR_PRIMARY); //flags
|
||||||
|
out_uint32_le(s, 3841); //monitor left
|
||||||
|
out_uint32_le(s, 0); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor right
|
||||||
|
out_uint32_le(s, 2160); //monitor bottom
|
||||||
|
out_uint32_le(s, 5); //physical width
|
||||||
|
out_uint32_le(s, 11000); //physical height
|
||||||
|
out_uint32_le(s, 10); //orientation (Expect to be reset to 0)
|
||||||
|
out_uint32_le(s, 360); //desktop scale factor
|
||||||
|
out_uint32_le(s, 720); //device scale factor
|
||||||
|
|
||||||
|
// 4k monitor at position (2, 0)
|
||||||
|
out_uint32_le(s, 0); //flags
|
||||||
|
out_uint32_le(s, 7682); //monitor left
|
||||||
|
out_uint32_le(s, 0); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor width
|
||||||
|
out_uint32_le(s, 2160); //monitor height
|
||||||
|
out_uint32_le(s, 1000); //physical width
|
||||||
|
out_uint32_le(s, 1000); //physical height
|
||||||
|
out_uint32_le(s, 5000); //orientation
|
||||||
|
out_uint32_le(s, 80); //desktop scale factor
|
||||||
|
out_uint32_le(s, 140); //device scale factor
|
||||||
|
|
||||||
|
// 4k monitor at position (0, 1)
|
||||||
|
out_uint32_le(s, 0); //flags
|
||||||
|
out_uint32_le(s, 0); //monitor left
|
||||||
|
out_uint32_le(s, 2161); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor width
|
||||||
|
out_uint32_le(s, 2160); //monitor height
|
||||||
|
out_uint32_le(s, 1000); //physical width
|
||||||
|
out_uint32_le(s, 1000); //physical height
|
||||||
|
out_uint32_le(s, 91); //orientation
|
||||||
|
out_uint32_le(s, 180); //desktop scale factor
|
||||||
|
out_uint32_le(s, 100); //device scale factor
|
||||||
|
|
||||||
|
// 4k monitor at position (1, 1)
|
||||||
|
out_uint32_le(s, 0); //flags
|
||||||
|
out_uint32_le(s, 3841); //monitor left
|
||||||
|
out_uint32_le(s, 2161); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor width
|
||||||
|
out_uint32_le(s, 2160); //monitor height
|
||||||
|
out_uint32_le(s, 1000); //physical width
|
||||||
|
out_uint32_le(s, 1000); //physical height
|
||||||
|
out_uint32_le(s, 0); //orientation
|
||||||
|
out_uint32_le(s, 20); //desktop scale factor
|
||||||
|
out_uint32_le(s, 50); //device scale factor
|
||||||
|
|
||||||
|
// 4k monitor at position (2, 1)
|
||||||
|
out_uint32_le(s, 0); //flags
|
||||||
|
out_uint32_le(s, 7682); //monitor left
|
||||||
|
out_uint32_le(s, 2161); //monitor top
|
||||||
|
out_uint32_le(s, 3840); //monitor width
|
||||||
|
out_uint32_le(s, 2160); //monitor height
|
||||||
|
out_uint32_le(s, 1000); //physical width
|
||||||
|
out_uint32_le(s, 1000); //physical height
|
||||||
|
out_uint32_le(s, 0); //orientation
|
||||||
|
out_uint32_le(s, 300); //desktop scale factor
|
||||||
|
out_uint32_le(s, 400); //device scale factor
|
||||||
|
|
||||||
|
s_mark_end(s);
|
||||||
|
// Reset the read counter of the stream so the processing function handles it properly.
|
||||||
|
s->p = s->data;
|
||||||
|
|
||||||
|
struct display_size_description *description =
|
||||||
|
(struct display_size_description *)
|
||||||
|
g_malloc(sizeof(struct display_size_description), 1);
|
||||||
|
|
||||||
|
int error = libxrdp_process_monitor_stream(s, description, 1);
|
||||||
|
|
||||||
|
//Verify function call passed.
|
||||||
|
ck_assert_int_eq(error, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->monitorCount, 6);
|
||||||
|
|
||||||
|
/*************************************************
|
||||||
|
* Verify standard monitors
|
||||||
|
*************************************************/
|
||||||
|
ck_assert_int_eq(description->minfo[0].left, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].right, 3840);
|
||||||
|
ck_assert_int_eq(description->minfo[0].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo[0].physical_width, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].physical_height, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[0].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[0].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[0].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo[1].left, 3841);
|
||||||
|
ck_assert_int_eq(description->minfo[1].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[1].right, 7681);
|
||||||
|
ck_assert_int_eq(description->minfo[1].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo[1].physical_width, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[1].physical_height, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[1].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[1].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[1].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[1].is_primary, 1);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo[2].left, 7682);
|
||||||
|
ck_assert_int_eq(description->minfo[2].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[2].right, 11522);
|
||||||
|
ck_assert_int_eq(description->minfo[2].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo[2].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[2].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[2].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[2].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[2].device_scale_factor, 140);
|
||||||
|
ck_assert_int_eq(description->minfo[2].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo[3].left, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[3].top, 2161);
|
||||||
|
ck_assert_int_eq(description->minfo[3].right, 3840);
|
||||||
|
ck_assert_int_eq(description->minfo[3].bottom, 4321);
|
||||||
|
ck_assert_int_eq(description->minfo[3].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[3].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[3].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[3].desktop_scale_factor, 180);
|
||||||
|
ck_assert_int_eq(description->minfo[3].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[3].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo[4].left, 3841);
|
||||||
|
ck_assert_int_eq(description->minfo[4].top, 2161);
|
||||||
|
ck_assert_int_eq(description->minfo[4].right, 7681);
|
||||||
|
ck_assert_int_eq(description->minfo[4].bottom, 4321);
|
||||||
|
ck_assert_int_eq(description->minfo[4].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[4].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[4].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[4].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[4].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[4].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo[5].left, 7682);
|
||||||
|
ck_assert_int_eq(description->minfo[5].top, 2161);
|
||||||
|
ck_assert_int_eq(description->minfo[5].right, 11522);
|
||||||
|
ck_assert_int_eq(description->minfo[5].bottom, 4321);
|
||||||
|
ck_assert_int_eq(description->minfo[5].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[5].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo[5].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo[5].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[5].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo[5].is_primary, 0);
|
||||||
|
|
||||||
|
/*************************************************
|
||||||
|
* Verify normalized monitors
|
||||||
|
*************************************************/
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].left, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].right, 3840);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].physical_width, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].physical_height, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[0].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].left, 3841);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].right, 7681);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].physical_width, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].physical_height, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[1].is_primary, 1);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].left, 7682);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].top, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].right, 11522);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].bottom, 2160);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].device_scale_factor, 140);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[2].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].left, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].top, 2161);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].right, 3840);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].bottom, 4321);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].desktop_scale_factor, 180);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[3].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].left, 3841);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].top, 2161);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].right, 7681);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].bottom, 4321);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[4].is_primary, 0);
|
||||||
|
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].left, 7682);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].top, 2161);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].right, 11522);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].bottom, 4321);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].physical_width, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].physical_height, 1000);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].orientation, 0);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].desktop_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].device_scale_factor, 100);
|
||||||
|
ck_assert_int_eq(description->minfo_wm[5].is_primary, 0);
|
||||||
|
|
||||||
|
// Verify geometry
|
||||||
|
ck_assert_int_eq(description->session_width, 11523);
|
||||||
|
ck_assert_int_eq(description->session_height, 4322);
|
||||||
|
|
||||||
|
free(description);
|
||||||
|
free_stream(s);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
Suite *
|
||||||
|
make_suite_test_monitor_processing(void)
|
||||||
|
{
|
||||||
|
Suite *s;
|
||||||
|
TCase *tc_process_monitors;
|
||||||
|
|
||||||
|
s = suite_create("test_libxrdp_process_monitor_stream");
|
||||||
|
|
||||||
|
tc_process_monitors = tcase_create("libxrdp_process_monitor_stream");
|
||||||
|
tcase_add_test(tc_process_monitors, test_libxrdp_process_monitor_stream__when_description_is_null__fail);
|
||||||
|
tcase_add_test(tc_process_monitors, test_libxrdp_process_monitor_stream__when_stream_is_too_small__fail);
|
||||||
|
tcase_add_test(tc_process_monitors, test_libxrdp_process_monitor_stream__when_monitor_count_is_greater_than_sixteen__fail);
|
||||||
|
tcase_add_test(tc_process_monitors, test_libxrdp_process_monitor_stream__with_single_monitor_happy_path);
|
||||||
|
tcase_add_test(tc_process_monitors, test_libxrdp_process_monitor_stream__with_sextuple_monitor_happy_path);
|
||||||
|
|
||||||
|
suite_add_tcase(s, tc_process_monitors);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
+44
-44
@@ -29,7 +29,7 @@ void teardown(void)
|
|||||||
g_free(rdp_layer);
|
g_free(rdp_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_flags_is_not_zero__fail)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_flags_is_not_zero__fail)
|
||||||
{
|
{
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
@@ -48,7 +48,7 @@ START_TEST(test_process_monitors__when_flags_is_not_zero__fail)
|
|||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_mounter_count_is_greater_than_sixteen__fail)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_monitor_count_is_greater_than_sixteen__fail)
|
||||||
{
|
{
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
@@ -67,7 +67,7 @@ START_TEST(test_process_monitors__when_mounter_count_is_greater_than_sixteen__fa
|
|||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__with_single_monitor_happy_path)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__with_single_monitor_happy_path)
|
||||||
{
|
{
|
||||||
struct xrdp_client_info *client_info = &(rdp_layer->client_info);
|
struct xrdp_client_info *client_info = &(rdp_layer->client_info);
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
@@ -92,31 +92,31 @@ START_TEST(test_process_monitors__with_single_monitor_happy_path)
|
|||||||
int error = xrdp_sec_process_mcs_data_monitors(sec_layer, s);
|
int error = xrdp_sec_process_mcs_data_monitors(sec_layer, s);
|
||||||
ck_assert_int_eq(error, 0);
|
ck_assert_int_eq(error, 0);
|
||||||
|
|
||||||
ck_assert_int_eq(client_info->monitorCount, 1);
|
ck_assert_int_eq(client_info->display_sizes.monitorCount, 1);
|
||||||
|
|
||||||
// Verify normal monitor
|
// Verify normal monitor
|
||||||
ck_assert_int_eq(client_info->minfo[0].left, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].left, 0);
|
||||||
ck_assert_int_eq(client_info->minfo[0].top, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].top, 0);
|
||||||
ck_assert_int_eq(client_info->minfo[0].right, 3840);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].right, 3840);
|
||||||
ck_assert_int_eq(client_info->minfo[0].bottom, 2160);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].bottom, 2160);
|
||||||
ck_assert_int_eq(client_info->minfo[0].is_primary, 1);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].is_primary, 1);
|
||||||
|
|
||||||
// Verify normalized monitor
|
// Verify normalized monitor
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].left, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].left, 0);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].top, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].top, 0);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].right, 3840);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].right, 3840);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].bottom, 2160);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].bottom, 2160);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].is_primary, 1);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].is_primary, 1);
|
||||||
|
|
||||||
// Verify geometry (+1 greater than )
|
// Verify geometry (+1 greater than )
|
||||||
ck_assert_int_eq(client_info->width, 3841);
|
ck_assert_int_eq(client_info->display_sizes.session_width, 3841);
|
||||||
ck_assert_int_eq(client_info->height, 2161);
|
ck_assert_int_eq(client_info->display_sizes.session_height, 2161);
|
||||||
|
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_no_primary_monitor_is_specified_one_is_selected)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_no_primary_monitor_is_specified_one_is_selected)
|
||||||
{
|
{
|
||||||
struct xrdp_client_info *client_info = &(rdp_layer->client_info);
|
struct xrdp_client_info *client_info = &(rdp_layer->client_info);
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
@@ -141,31 +141,31 @@ START_TEST(test_process_monitors__when_no_primary_monitor_is_specified_one_is_se
|
|||||||
int error = xrdp_sec_process_mcs_data_monitors(sec_layer, s);
|
int error = xrdp_sec_process_mcs_data_monitors(sec_layer, s);
|
||||||
ck_assert_int_eq(error, 0);
|
ck_assert_int_eq(error, 0);
|
||||||
|
|
||||||
ck_assert_int_eq(client_info->monitorCount, 1);
|
ck_assert_int_eq(client_info->display_sizes.monitorCount, 1);
|
||||||
|
|
||||||
// Verify normal monitor
|
// Verify normal monitor
|
||||||
ck_assert_int_eq(client_info->minfo[0].left, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].left, 0);
|
||||||
ck_assert_int_eq(client_info->minfo[0].top, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].top, 0);
|
||||||
ck_assert_int_eq(client_info->minfo[0].right, 3840);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].right, 3840);
|
||||||
ck_assert_int_eq(client_info->minfo[0].bottom, 2160);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].bottom, 2160);
|
||||||
ck_assert_int_eq(client_info->minfo[0].is_primary, 1);
|
ck_assert_int_eq(client_info->display_sizes.minfo[0].is_primary, 1);
|
||||||
|
|
||||||
// Verify normalized monitor
|
// Verify normalized monitor
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].left, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].left, 0);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].top, 0);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].top, 0);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].right, 3840);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].right, 3840);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].bottom, 2160);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].bottom, 2160);
|
||||||
ck_assert_int_eq(client_info->minfo_wm[0].is_primary, 1);
|
ck_assert_int_eq(client_info->display_sizes.minfo_wm[0].is_primary, 1);
|
||||||
|
|
||||||
// Verify geometry (+1 greater than )
|
// Verify geometry (+1 greater than )
|
||||||
ck_assert_int_eq(client_info->width, 3841);
|
ck_assert_int_eq(client_info->display_sizes.session_width, 3841);
|
||||||
ck_assert_int_eq(client_info->height, 2161);
|
ck_assert_int_eq(client_info->display_sizes.session_height, 2161);
|
||||||
|
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_virtual_desktop_width_is_too_large)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_width_is_too_large)
|
||||||
{
|
{
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
@@ -193,7 +193,7 @@ START_TEST(test_process_monitors__when_virtual_desktop_width_is_too_large)
|
|||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_virtual_desktop_width_is_too_small)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_width_is_too_small)
|
||||||
{
|
{
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
@@ -221,7 +221,7 @@ START_TEST(test_process_monitors__when_virtual_desktop_width_is_too_small)
|
|||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_virtual_desktop_height_is_too_large)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_height_is_too_large)
|
||||||
{
|
{
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
@@ -249,7 +249,7 @@ START_TEST(test_process_monitors__when_virtual_desktop_height_is_too_large)
|
|||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_process_monitors__when_virtual_desktop_height_is_too_small)
|
START_TEST(test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_height_is_too_small)
|
||||||
{
|
{
|
||||||
struct stream *s = (struct stream *)NULL;
|
struct stream *s = (struct stream *)NULL;
|
||||||
make_stream(s);
|
make_stream(s);
|
||||||
@@ -279,23 +279,23 @@ END_TEST
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
Suite *
|
Suite *
|
||||||
make_suite_test_monitor_processing(void)
|
make_suite_test_xrdp_sec_process_mcs_data_monitors(void)
|
||||||
{
|
{
|
||||||
Suite *s;
|
Suite *s;
|
||||||
TCase *tc_process_monitors;
|
TCase *tc_process_monitors;
|
||||||
|
|
||||||
s = suite_create("Monitor_Processing");
|
s = suite_create("test_xrdp_sec_process_mcs_data_monitors");
|
||||||
|
|
||||||
tc_process_monitors = tcase_create("xrdp_sec_process_mcs_data_monitors");
|
tc_process_monitors = tcase_create("xrdp_sec_process_mcs_data_monitors");
|
||||||
tcase_add_checked_fixture(tc_process_monitors, setup, teardown);
|
tcase_add_checked_fixture(tc_process_monitors, setup, teardown);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_flags_is_not_zero__fail);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_flags_is_not_zero__fail);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_mounter_count_is_greater_than_sixteen__fail);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_monitor_count_is_greater_than_sixteen__fail);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__with_single_monitor_happy_path);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__with_single_monitor_happy_path);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_no_primary_monitor_is_specified_one_is_selected);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_no_primary_monitor_is_specified_one_is_selected);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_virtual_desktop_width_is_too_large);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_width_is_too_large);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_virtual_desktop_width_is_too_small);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_width_is_too_small);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_virtual_desktop_height_is_too_large);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_height_is_too_large);
|
||||||
tcase_add_test(tc_process_monitors, test_process_monitors__when_virtual_desktop_height_is_too_small);
|
tcase_add_test(tc_process_monitors, test_xrdp_sec_process_mcs_data_monitors__when_virtual_desktop_height_is_too_small);
|
||||||
|
|
||||||
suite_add_tcase(s, tc_process_monitors);
|
suite_add_tcase(s, tc_process_monitors);
|
||||||
|
|
||||||
@@ -2039,25 +2039,25 @@ static void
|
|||||||
init_client_layout(struct vnc_screen_layout *layout,
|
init_client_layout(struct vnc_screen_layout *layout,
|
||||||
const struct xrdp_client_info *client_info)
|
const struct xrdp_client_info *client_info)
|
||||||
{
|
{
|
||||||
int i;
|
uint32_t i;
|
||||||
|
|
||||||
layout->total_width = client_info->width;
|
layout->total_width = client_info->display_sizes.session_width;
|
||||||
layout->total_height = client_info->height;
|
layout->total_height = client_info->display_sizes.session_height;
|
||||||
|
|
||||||
layout->count = client_info->monitorCount;
|
layout->count = client_info->display_sizes.monitorCount;
|
||||||
layout->s = g_new(struct vnc_screen, layout->count);
|
layout->s = g_new(struct vnc_screen, layout->count);
|
||||||
|
|
||||||
for (i = 0 ; i < client_info->monitorCount ; ++i)
|
for (i = 0 ; i < client_info->display_sizes.monitorCount ; ++i)
|
||||||
{
|
{
|
||||||
/* Use minfo_wm, as this is normalised for a top-left of (0,0)
|
/* Use minfo_wm, as this is normalised for a top-left of (0,0)
|
||||||
* as required by RFC6143 */
|
* as required by RFC6143 */
|
||||||
layout->s[i].id = i;
|
layout->s[i].id = i;
|
||||||
layout->s[i].x = client_info->minfo_wm[i].left;
|
layout->s[i].x = client_info->display_sizes.minfo_wm[i].left;
|
||||||
layout->s[i].y = client_info->minfo_wm[i].top;
|
layout->s[i].y = client_info->display_sizes.minfo_wm[i].top;
|
||||||
layout->s[i].width = client_info->minfo_wm[i].right -
|
layout->s[i].width = client_info->display_sizes.minfo_wm[i].right -
|
||||||
client_info->minfo_wm[i].left + 1;
|
client_info->display_sizes.minfo_wm[i].left + 1;
|
||||||
layout->s[i].height = client_info->minfo_wm[i].bottom -
|
layout->s[i].height = client_info->display_sizes.minfo_wm[i].bottom -
|
||||||
client_info->minfo_wm[i].top + 1;
|
client_info->display_sizes.minfo_wm[i].top + 1;
|
||||||
layout->s[i].flags = 0;
|
layout->s[i].flags = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2106,11 +2106,11 @@ lib_mod_set_param(struct vnc *v, const char *name, const char *value)
|
|||||||
g_free(v->client_layout.s);
|
g_free(v->client_layout.s);
|
||||||
|
|
||||||
/* Save monitor information from the client */
|
/* Save monitor information from the client */
|
||||||
if (!client_info->multimon || client_info->monitorCount < 1)
|
if (!client_info->multimon || client_info->display_sizes.monitorCount < 1)
|
||||||
{
|
{
|
||||||
set_single_screen_layout(&v->client_layout,
|
set_single_screen_layout(&v->client_layout,
|
||||||
client_info->width,
|
client_info->display_sizes.session_width,
|
||||||
client_info->height);
|
client_info->display_sizes.session_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
|||||||
int primary_height;
|
int primary_height;
|
||||||
int primary_x_offset; /* Offset of centre of primary screen */
|
int primary_x_offset; /* Offset of centre of primary screen */
|
||||||
int primary_y_offset;
|
int primary_y_offset;
|
||||||
int index;
|
uint32_t index;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
int cx;
|
int cx;
|
||||||
@@ -684,16 +684,16 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* multimon scenario, draw login window on primary monitor */
|
/* multimon scenario, draw login window on primary monitor */
|
||||||
if (self->client_info->monitorCount > 1)
|
if (self->client_info->display_sizes.monitorCount > 1)
|
||||||
{
|
{
|
||||||
for (index = 0; index < self->client_info->monitorCount; index++)
|
for (index = 0; index < self->client_info->display_sizes.monitorCount; index++)
|
||||||
{
|
{
|
||||||
if (self->client_info->minfo_wm[index].is_primary)
|
if (self->client_info->display_sizes.minfo_wm[index].is_primary)
|
||||||
{
|
{
|
||||||
x = self->client_info->minfo_wm[index].left;
|
x = self->client_info->display_sizes.minfo_wm[index].left;
|
||||||
y = self->client_info->minfo_wm[index].top;
|
y = self->client_info->display_sizes.minfo_wm[index].top;
|
||||||
cx = self->client_info->minfo_wm[index].right;
|
cx = self->client_info->display_sizes.minfo_wm[index].right;
|
||||||
cy = self->client_info->minfo_wm[index].bottom;
|
cy = self->client_info->display_sizes.minfo_wm[index].bottom;
|
||||||
|
|
||||||
primary_width = cx - x;
|
primary_width = cx - x;
|
||||||
primary_height = cy - y;
|
primary_height = cy - y;
|
||||||
|
|||||||
+10
-10
@@ -1144,14 +1144,14 @@ process_dynamic_monitor_description(struct xrdp_wm *wm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wm->client_info->monitorCount = description->monitorCount;
|
wm->client_info->display_sizes.monitorCount = description->monitorCount;
|
||||||
wm->client_info->width = description->session_width;
|
wm->client_info->display_sizes.session_width = description->session_width;
|
||||||
wm->client_info->height = description->session_height;
|
wm->client_info->display_sizes.session_height = description->session_height;
|
||||||
g_memcpy(wm->client_info->minfo,
|
g_memcpy(wm->client_info->display_sizes.minfo,
|
||||||
description->minfo,
|
description->minfo,
|
||||||
sizeof(struct monitor_info)
|
sizeof(struct monitor_info)
|
||||||
* CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
* CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
||||||
g_memcpy(wm->client_info->minfo_wm,
|
g_memcpy(wm->client_info->display_sizes.minfo_wm,
|
||||||
description->minfo_wm,
|
description->minfo_wm,
|
||||||
sizeof(struct monitor_info)
|
sizeof(struct monitor_info)
|
||||||
* CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
* CLIENT_MONITOR_DATA_MAXIMUM_MONITORS);
|
||||||
@@ -3603,10 +3603,10 @@ server_reset(struct xrdp_mod *mod, int width, int height, int bpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if same (and only one monitor on client) 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->display_sizes.session_width == (uint32_t)width &&
|
||||||
wm->client_info->height == height &&
|
wm->client_info->display_sizes.session_height == (uint32_t)height &&
|
||||||
wm->client_info->bpp == bpp &&
|
wm->client_info->bpp == bpp &&
|
||||||
(wm->client_info->monitorCount == 0 || wm->client_info->multimon == 0))
|
(wm->client_info->display_sizes.monitorCount == 0 || wm->client_info->multimon == 0))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3620,8 +3620,8 @@ server_reset(struct xrdp_mod *mod, int width, int height, int bpp)
|
|||||||
/* reset cache */
|
/* reset cache */
|
||||||
xrdp_cache_reset(wm->cache, wm->client_info);
|
xrdp_cache_reset(wm->cache, wm->client_info);
|
||||||
/* resize the main window */
|
/* resize the main window */
|
||||||
xrdp_bitmap_resize(wm->screen, wm->client_info->width,
|
xrdp_bitmap_resize(wm->screen, wm->client_info->display_sizes.session_width,
|
||||||
wm->client_info->height);
|
wm->client_info->display_sizes.session_height);
|
||||||
/* load some stuff */
|
/* load some stuff */
|
||||||
xrdp_wm_load_static_colors_plus(wm, 0);
|
xrdp_wm_load_static_colors_plus(wm, 0);
|
||||||
xrdp_wm_load_static_pointers(wm);
|
xrdp_wm_load_static_pointers(wm);
|
||||||
|
|||||||
+8
-8
@@ -45,8 +45,8 @@ xrdp_wm_create(struct xrdp_process *owner,
|
|||||||
|
|
||||||
self = (struct xrdp_wm *)g_malloc(sizeof(struct xrdp_wm), 1);
|
self = (struct xrdp_wm *)g_malloc(sizeof(struct xrdp_wm), 1);
|
||||||
self->client_info = client_info;
|
self->client_info = client_info;
|
||||||
self->screen = xrdp_bitmap_create(client_info->width,
|
self->screen = xrdp_bitmap_create(client_info->display_sizes.session_width,
|
||||||
client_info->height,
|
client_info->display_sizes.session_height,
|
||||||
client_info->bpp,
|
client_info->bpp,
|
||||||
WND_TYPE_SCREEN, self);
|
WND_TYPE_SCREEN, self);
|
||||||
self->screen->wm = self;
|
self->screen->wm = self;
|
||||||
@@ -2088,7 +2088,7 @@ xrdp_wm_show_log(struct xrdp_wm *self)
|
|||||||
int h;
|
int h;
|
||||||
int xoffset;
|
int xoffset;
|
||||||
int yoffset;
|
int yoffset;
|
||||||
int index;
|
uint32_t index;
|
||||||
int primary_x_offset;
|
int primary_x_offset;
|
||||||
int primary_y_offset;
|
int primary_y_offset;
|
||||||
|
|
||||||
@@ -2124,14 +2124,14 @@ xrdp_wm_show_log(struct xrdp_wm *self)
|
|||||||
primary_y_offset = 0;
|
primary_y_offset = 0;
|
||||||
|
|
||||||
/* multimon scenario, draw log window on primary monitor */
|
/* multimon scenario, draw log window on primary monitor */
|
||||||
if (self->client_info->monitorCount > 1)
|
if (self->client_info->display_sizes.monitorCount > 1)
|
||||||
{
|
{
|
||||||
for (index = 0; index < self->client_info->monitorCount; index++)
|
for (index = 0; index < self->client_info->display_sizes.monitorCount; index++)
|
||||||
{
|
{
|
||||||
if (self->client_info->minfo_wm[index].is_primary)
|
if (self->client_info->display_sizes.minfo_wm[index].is_primary)
|
||||||
{
|
{
|
||||||
primary_x_offset = self->client_info->minfo_wm[index].left;
|
primary_x_offset = self->client_info->display_sizes.minfo_wm[index].left;
|
||||||
primary_y_offset = self->client_info->minfo_wm[index].top;
|
primary_y_offset = self->client_info->display_sizes.minfo_wm[index].top;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user