>From 404a56a11469ef24a1df632847465030d81db091 Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Fri, 15 May 2020 15:43:37 +0200
Subject: [PATCH] plugins/rdp: Fix hangs with recent FreeRDP versions

Connection to all my testing servers fails with "SERVER BUG: The support
for this feature was not announced! Use /relax-order-checks to ignore"
currently. This happens always with current FreeRDP versions after
https://github.com/FreeRDP/FreeRDP/pull/4926 has been merged. This can be
fixed by the usage of /relax-order-checks option, however, this option
should be used only if necessary needed and it should not be needed in
most of the cases. This currenlty happens always as it interfere with our
custom OrderSupports settings. Let's use the default OrderSupports
settings to fix this issue, which is possible thanks to
https://github.com/FreeRDP/FreeRDP/pull/5057.

See: https://gitlab.gnome.org/GNOME/gtk-frdp/-/issues/27
---
 configure.ac                  |  2 +-
 plugins/rdp/vinagre-rdp-tab.c | 27 ---------------------------
 2 files changed, 1 insertion(+), 28 deletions(-)

--- a/configure.ac
+++ b/configure.ac
@@ -58,7 +58,7 @@
 AM_CONDITIONAL([VINAGRE_ENABLE_SSH], [test "x$have_ssh" = "xyes"])
 
 # Whether to enable support for RDP.
-RDP_DEPS="freerdp2 x11"
+RDP_DEPS="freerdp2 >= 2.0.0 x11"
 AC_ARG_ENABLE([rdp],
   [AS_HELP_STRING([--disable-rdp],
     [Disable Remote Desktop Protocol (RDP) support])])
--- a/plugins/rdp/vinagre-rdp-tab.c
+++ b/plugins/rdp/vinagre-rdp-tab.c
@@ -522,9 +522,9 @@
 static BOOL
 frdp_pre_connect (freerdp *instance)
 {
+#if HAVE_FREERDP_1_1
   rdpSettings *settings = instance->settings;
 
-#if HAVE_FREERDP_1_1
   settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE;
   settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE;
   settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
@@ -549,31 +549,6 @@
   settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
   settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
   settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
-#else
-  settings->order_support[NEG_DSTBLT_INDEX] = true;
-  settings->order_support[NEG_PATBLT_INDEX] = true;
-  settings->order_support[NEG_SCRBLT_INDEX] = true;
-  settings->order_support[NEG_OPAQUE_RECT_INDEX] = true;
-  settings->order_support[NEG_DRAWNINEGRID_INDEX] = false;
-  settings->order_support[NEG_MULTIDSTBLT_INDEX] = false;
-  settings->order_support[NEG_MULTIPATBLT_INDEX] = false;
-  settings->order_support[NEG_MULTISCRBLT_INDEX] = false;
-  settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true;
-  settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = false;
-  settings->order_support[NEG_LINETO_INDEX] = true;
-  settings->order_support[NEG_POLYLINE_INDEX] = true;
-  settings->order_support[NEG_MEMBLT_INDEX] = true;
-  settings->order_support[NEG_MEM3BLT_INDEX] = false;
-  settings->order_support[NEG_MEMBLT_V2_INDEX] = true;
-  settings->order_support[NEG_MEM3BLT_V2_INDEX] = false;
-  settings->order_support[NEG_SAVEBITMAP_INDEX] = false;
-  settings->order_support[NEG_GLYPH_INDEX_INDEX] = true;
-  settings->order_support[NEG_FAST_INDEX_INDEX] = true;
-  settings->order_support[NEG_FAST_GLYPH_INDEX] = false;
-  settings->order_support[NEG_POLYGON_SC_INDEX] = false;
-  settings->order_support[NEG_POLYGON_CB_INDEX] = false;
-  settings->order_support[NEG_ELLIPSE_SC_INDEX] = false;
-  settings->order_support[NEG_ELLIPSE_CB_INDEX] = false;
 #endif
 
   return TRUE;
