[gnome-remote-desktop] rdp: Add support for FreeRDP 2.3
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] rdp: Add support for FreeRDP 2.3
- Date: Wed, 17 Mar 2021 12:40:39 +0000 (UTC)
commit 706df4827311b4b07966e70ab653216e0cf74be1
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Fri Feb 26 18:14:53 2021 +0100
rdp: Add support for FreeRDP 2.3
FreeRDP 2.3 broke the API, which means that compiling
gnome-remote-desktop with FreeRDP 2.3 results in an error.
Additionally, some warnings are now appearing due to the API breaking
changes.
However, bumping the FreeRDP version to 2.3 is too late for Gnome 40,
so just ensure that building with FreeRDP 2.3.x just works by adding
a #ifdef around the API changes.
config.h.meson | 3 +++
meson.build | 9 ++++++++-
src/grd-clipboard-rdp.c | 29 ++++++++++++++++++++++++++++-
src/grd-rdp-fuse-clipboard.c | 15 +++++++++++++++
src/grd-rdp-fuse-clipboard.h | 6 ++++++
src/grd-session-rdp.c | 18 ++++++++++++++++++
6 files changed, 78 insertions(+), 2 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index dd1b26e..e7fa370 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -11,3 +11,6 @@
/* Defined if VNC backend is enabled */
#mesondefine HAVE_VNC
+
+/* Defined if FreeRDP >= 2.3.x is available */
+#mesondefine HAVE_FREERDP_2_3
diff --git a/meson.build b/meson.build
index 4b7f81f..405837e 100644
--- a/meson.build
+++ b/meson.build
@@ -21,6 +21,7 @@ libnotify_dep = dependency('libnotify')
have_rdp = get_option('rdp')
have_vnc = get_option('vnc')
+have_freerdp_2_3 = true
if not have_rdp and not have_vnc
error('Must enable at least one backend')
@@ -29,7 +30,12 @@ endif
if have_rdp
add_global_arguments('-D_GNU_SOURCE', language : 'c')
- freerdp_dep = dependency('freerdp2', version: freerdp_req)
+ freerdp_dep = dependency('freerdp2', version: '>= 2.3.0', required: false)
+ if not freerdp_dep.found()
+ freerdp_dep = dependency('freerdp2', version: freerdp_req)
+ have_freerdp_2_3 = false
+ endif
+
freerdp_client_dep = dependency('freerdp-client2', version: freerdp_req)
freerdp_server_dep = dependency('freerdp-server2', version: freerdp_req)
fuse_dep = dependency('fuse3', version: fuse_req)
@@ -48,6 +54,7 @@ cdata.set_quoted('VERSION', meson.project_version())
cdata.set('HAVE_RDP', have_rdp)
cdata.set('HAVE_VNC', have_vnc)
+cdata.set('HAVE_FREERDP_2_3', have_freerdp_2_3)
configure_file(input: 'config.h.meson',
output: 'config.h',
diff --git a/src/grd-clipboard-rdp.c b/src/grd-clipboard-rdp.c
index b37ff94..1b90d13 100644
--- a/src/grd-clipboard-rdp.c
+++ b/src/grd-clipboard-rdp.c
@@ -422,8 +422,13 @@ get_uri_list_from_packet_file_list (GrdClipboardRdp *clipboard_rdp,
uint32_t src_size,
uint32_t *dst_size)
{
+#ifdef HAVE_FREERDP_2_3
+ FILEDESCRIPTORW *files = NULL;
+ FILEDESCRIPTORW *file;
+#else
FILEDESCRIPTOR *files = NULL;
FILEDESCRIPTOR *file;
+#endif /* HAVE_FREERDP_2_3 */
uint32_t n_files = 0;
char *filename = NULL;
char *escaped_name;
@@ -550,8 +555,13 @@ convert_client_content_for_server (GrdClipboardRdp *clipboard_rdp,
if (mime_type == GRD_MIME_TYPE_TEXT_URILIST ||
mime_type == GRD_MIME_TYPE_XS_GNOME_COPIED_FILES)
{
+#ifdef HAVE_FREERDP_2_3
+ FILEDESCRIPTORW *files = NULL;
+ FILEDESCRIPTORW *file;
+#else
FILEDESCRIPTOR *files = NULL;
FILEDESCRIPTOR *file;
+#endif /* HAVE_FREERDP_2_3 */
uint32_t n_files = 0;
char *filename = NULL;
char *escaped_name;
@@ -1005,12 +1015,21 @@ cliprdr_client_format_list_response (CliprdrServerContext *cliprdr
}
static void
-serialize_file_list (FILEDESCRIPTOR *files,
+#ifdef HAVE_FREERDP_2_3
+serialize_file_list (FILEDESCRIPTORW *files,
+ uint32_t n_files,
+ uint8_t **dst_data,
+ uint32_t *dst_size)
+{
+ FILEDESCRIPTORW *file;
+#else
+serialize_file_list (FILEDESCRIPTOR *files,
uint32_t n_files,
uint8_t **dst_data,
uint32_t *dst_size)
{
FILEDESCRIPTOR *file;
+#endif /* HAVE_FREERDP_2_3 */
wStream* s = NULL;
uint64_t last_write_time;
uint32_t i, j;
@@ -1098,11 +1117,19 @@ request_server_format_data (gpointer user_data)
if (dst_data && mime_type == GRD_MIME_TYPE_TEXT_URILIST)
{
+#ifdef HAVE_FREERDP_2_3
+ FILEDESCRIPTORW *files;
+ uint32_t n_files;
+
+ files = (FILEDESCRIPTORW *) dst_data;
+ n_files = dst_size / sizeof (FILEDESCRIPTORW);
+#else
FILEDESCRIPTOR *files;
uint32_t n_files;
files = (FILEDESCRIPTOR *) dst_data;
n_files = dst_size / sizeof (FILEDESCRIPTOR);
+#endif /* HAVE_FREERDP_2_3 */
dst_data = NULL;
dst_size = 0;
diff --git a/src/grd-rdp-fuse-clipboard.c b/src/grd-rdp-fuse-clipboard.c
index b03690b..10c5910 100644
--- a/src/grd-rdp-fuse-clipboard.c
+++ b/src/grd-rdp-fuse-clipboard.c
@@ -242,10 +242,17 @@ get_parent_directory (GrdRdpFuseClipboard *rdp_fuse_clipboard,
return parent;
}
+#ifdef HAVE_FREERDP_2_3
+gboolean
+grd_rdp_fuse_clipboard_set_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard,
+ FILEDESCRIPTORW *files,
+ uint32_t n_files)
+#else
gboolean
grd_rdp_fuse_clipboard_set_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard,
FILEDESCRIPTOR *files,
uint32_t n_files)
+#endif /* HAVE_FREERDP_2_3 */
{
uint32_t i;
@@ -256,7 +263,11 @@ grd_rdp_fuse_clipboard_set_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard,
for (i = 0; i < n_files; ++i)
{
+#ifdef HAVE_FREERDP_2_3
+ FILEDESCRIPTORW *file;
+#else
FILEDESCRIPTOR *file;
+#endif /* HAVE_FREERDP_2_3 */
FuseFile *fuse_file, *parent;
char *filename = NULL;
uint32_t j;
@@ -307,7 +318,11 @@ grd_rdp_fuse_clipboard_set_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard,
file->nFileSizeLow;
fuse_file->has_size = TRUE;
}
+#ifdef HAVE_FREERDP_2_3
+ if (file->dwFlags & FD_WRITETIME)
+#else
if (file->dwFlags & FD_WRITESTIME)
+#endif /* HAVE_FREERDP_2_3 */
{
uint64_t filetime;
diff --git a/src/grd-rdp-fuse-clipboard.h b/src/grd-rdp-fuse-clipboard.h
index 423057a..8cc5e78 100644
--- a/src/grd-rdp-fuse-clipboard.h
+++ b/src/grd-rdp-fuse-clipboard.h
@@ -36,9 +36,15 @@ void grd_rdp_fuse_clipboard_dismiss_all_requests (GrdRdpFuseClipboard *rdp_fuse_
void grd_rdp_fuse_clipboard_clear_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard);
+#ifdef HAVE_FREERDP_2_3
+gboolean grd_rdp_fuse_clipboard_set_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard,
+ FILEDESCRIPTORW *files,
+ uint32_t n_files);
+#else
gboolean grd_rdp_fuse_clipboard_set_selection (GrdRdpFuseClipboard *rdp_fuse_clipboard,
FILEDESCRIPTOR *files,
uint32_t n_files);
+#endif /* HAVE_FREERDP_2_3 */
void grd_rdp_fuse_clipboard_submit_file_contents_response (GrdRdpFuseClipboard *rdp_fuse_clipboard,
uint32_t stream_id,
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 49fc545..5b59eb9 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -566,9 +566,15 @@ rdp_peer_refresh_rfx (freerdp_peer *peer,
RFX_RECT *rfx_rects, *rfx_rect;
int n_rects;
RFX_MESSAGE *rfx_messages;
+#ifdef HAVE_FREERDP_2_3
+ size_t n_messages;
+ BOOL first, last;
+ size_t i;
+#else
int n_messages;
BOOL first, last;
int i;
+#endif /* HAVE_FREERDP_2_3 */
n_rects = cairo_region_num_rectangles (region);
rfx_rects = g_malloc0 (n_rects * sizeof (RFX_RECT));
@@ -583,6 +589,17 @@ rdp_peer_refresh_rfx (freerdp_peer *peer,
rfx_rect->height = cairo_rect.height;
}
+#ifdef HAVE_FREERDP_2_3
+ rfx_messages = rfx_encode_messages_ex (rdp_peer_context->rfx_context,
+ rfx_rects,
+ n_rects,
+ data,
+ desktop_width,
+ desktop_height,
+ src_stride,
+ &n_messages,
+ rdp_settings->MultifragMaxRequestSize);
+#else
rfx_messages = rfx_encode_messages (rdp_peer_context->rfx_context,
rfx_rects,
n_rects,
@@ -592,6 +609,7 @@ rdp_peer_refresh_rfx (freerdp_peer *peer,
src_stride,
&n_messages,
rdp_settings->MultifragMaxRequestSize);
+#endif /* HAVE_FREERDP_2_3 */
cmd.cmdType = CMDTYPE_STREAM_SURFACE_BITS;
cmd.bmp.codecID = rdp_settings->RemoteFxCodecId;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]