Add a client_resize_mode field

This stores what kind of resizing (if any) can be achieved with
a Deactivation-Reactivation sequence.
This commit is contained in:
matt335672 2024-02-15 14:31:29 +00:00
parent 74598d1cc3
commit 27ad405cd8
2 changed files with 51 additions and 1 deletions

View File

@ -67,6 +67,13 @@ struct display_size_description
unsigned int session_height; unsigned int session_height;
}; };
enum client_resize_mode
{
CRMODE_NONE,
CRMODE_SINGLE_SCREEN,
CRMODE_MULTI_SCREEN
};
/** /**
* Information about the xrdp client * Information about the xrdp client
* *
@ -218,6 +225,9 @@ struct xrdp_client_info
int large_pointer_support_flags; int large_pointer_support_flags;
int gfx; int gfx;
// Can we resize the desktop by using a Deactivation-Reactivation Sequence?
enum client_resize_mode client_resize_mode;
}; };
enum xrdp_encoder_flags enum xrdp_encoder_flags

View File

@ -120,6 +120,45 @@ xrdp_caps_process_general(struct xrdp_rdp *self, struct stream *s,
return 0; return 0;
} }
/*****************************************************************************/
static int
xrdp_caps_process_bitmap(struct xrdp_rdp *self, struct stream *s,
int len)
{
/* [MS-RDPBCGR] 2.2.7.1.2 */
int desktopResizeFlag;
if (len < 14 + 2)
{
LOG(LOG_LEVEL_ERROR, "Not enough bytes in the stream: "
"len 16, remaining %d", len);
return 1;
}
in_uint8s(s, 14);
in_uint16_le(s, desktopResizeFlag);
/* Work out what kind of client resizing we can do from the server */
int early_cap_flags = self->client_info.mcs_early_capability_flags;
if (desktopResizeFlag == 0)
{
self->client_info.client_resize_mode = CRMODE_NONE;
LOG(LOG_LEVEL_INFO, "Client cannot be resized by xrdp");
}
else if ((early_cap_flags & RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU) == 0)
{
self->client_info.client_resize_mode = CRMODE_SINGLE_SCREEN;
LOG(LOG_LEVEL_INFO, "Client supports single-screen resizes by xrdp");
}
else
{
self->client_info.client_resize_mode = CRMODE_MULTI_SCREEN;
LOG(LOG_LEVEL_INFO, "Client supports multi-screen resizes by xrdp");
}
return 0;
}
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Process [MS-RDPBCGR] TS_ORDER_CAPABILITYSET (2.2.7.1.3) message. * Process [MS-RDPBCGR] TS_ORDER_CAPABILITYSET (2.2.7.1.3) message.
@ -766,7 +805,8 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s)
break; break;
case CAPSTYPE_BITMAP: case CAPSTYPE_BITMAP:
LOG_DEVEL(LOG_LEVEL_INFO, "Received [MS-RDPBCGR] TS_CONFIRM_ACTIVE_PDU - TS_CAPS_SET " LOG_DEVEL(LOG_LEVEL_INFO, "Received [MS-RDPBCGR] TS_CONFIRM_ACTIVE_PDU - TS_CAPS_SET "
"capabilitySetType = CAPSTYPE_BITMAP - Ignored"); "capabilitySetType = CAPSTYPE_BITMAP");
xrdp_caps_process_bitmap(self, s, len);
break; break;
case CAPSTYPE_ORDER: case CAPSTYPE_ORDER:
LOG_DEVEL(LOG_LEVEL_INFO, "Received [MS-RDPBCGR] TS_CONFIRM_ACTIVE_PDU - TS_CAPS_SET " LOG_DEVEL(LOG_LEVEL_INFO, "Received [MS-RDPBCGR] TS_CONFIRM_ACTIVE_PDU - TS_CAPS_SET "