Blob Blame History Raw
--- vinagre-3.22.0/configure.ac
+++ vinagre-3.22.0/configure.ac
@@ -65,14 +65,19 @@ AC_ARG_ENABLE([rdp],
     [Disable Remote Desktop Protocol (RDP) support])])
 
 AS_IF([test "x$enable_rdp" != "xno"],
-  [PKG_CHECK_EXISTS([$RDP_DEPS],
+  [PKG_CHECK_EXISTS([$RDP_2_DEPS],
     [have_rdp=yes
-     PKG_CHECK_EXISTS(freerdp >= 1.1,
-       [AC_DEFINE([HAVE_FREERDP_1_1], [1], [FreeRDP is of version 1.1 or newer])], [])],
-    [PKG_CHECK_EXISTS([$RDP_2_DEPS],
+     RDP_DEPS=$RDP_2_DEPS
+     AC_DEFINE([HAVE_FREERDP_2], [1], [FreeRDP is of version 2 or newer])
+     AC_DEFINE([HAVE_FREERDP_1_1], [1], [FreeRDP is of version 1.1 or newer])
+     AC_DEFINE([HAVE_FREERDP_1_2], [1], [FreeRDP is of version 1.2 or newer])],
+    [PKG_CHECK_EXISTS([$RDP_DEPS],
        [have_rdp=yes
-        RDP_DEPS=$RDP_2_DEPS
-        AC_DEFINE([HAVE_FREERDP_1_1], [1], [FreeRDP is of version 1.1 or newer])], [have_rdp=no])])],
+        PKG_CHECK_EXISTS(freerdp >= 1.1,
+          [AC_DEFINE([HAVE_FREERDP_1_1], [1], [FreeRDP is of version 1.1 or newer])], [])
+        PKG_CHECK_EXISTS(freerdp >= 1.2,
+          [AC_DEFINE([HAVE_FREERDP_1_2], [1], [FreeRDP is of version 1.2 or newer])], [])],
+       [have_rdp=no])])],
   [have_rdp=no])
 
 AS_IF([test "x$have_rdp" = "xyes"],
--- vinagre-3.22.0/plugins/rdp/vinagre-rdp-tab.c
+++ vinagre-3.22.0/plugins/rdp/vinagre-rdp-tab.c
@@ -29,7 +29,7 @@
 #include <freerdp/types.h>
 #include <freerdp/freerdp.h>
 #include <freerdp/gdi/gdi.h>
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
 #include <freerdp/locale/keyboard.h>
 #else
 #include <freerdp/kbd/vkcodes.h>
@@ -44,7 +44,7 @@
 
 #define SELECT_TIMEOUT 50
 
-#if !HAVE_FREERDP_1_1
+#ifndef HAVE_FREERDP_1_1
 typedef boolean BOOL;
 typedef uint8   UINT8;
 typedef uint16  UINT16;
@@ -476,16 +476,28 @@ frdp_drawing_area_draw (GtkWidget *area,
   return TRUE;
 }
 
+#ifdef HAVE_FREERDP_2
+static BOOL
+#else
 static void
+#endif
 frdp_begin_paint (rdpContext *context)
 {
   rdpGdi *gdi = context->gdi;
 
   gdi->primary->hdc->hwnd->invalid->null = 1;
   gdi->primary->hdc->hwnd->ninvalid = 0;
+
+#ifdef HAVE_FREERDP_2
+  return TRUE;
+#endif
 }
 
+#ifdef HAVE_FREERDP_2
+static BOOL
+#else
 static void
+#endif
 frdp_end_paint (rdpContext *context)
 {
   VinagreRdpTab        *rdp_tab = ((frdpContext *) context)->rdp_tab;
@@ -495,7 +507,13 @@ frdp_end_paint (rdpContext *context)
   gint                  x, y, w, h;
 
   if (gdi->primary->hdc->hwnd->invalid->null)
-    return;
+    {
+#ifdef HAVE_FREERDP_2
+      return TRUE;
+#else
+      return;
+#endif
+    }
 
   x = gdi->primary->hdc->hwnd->invalid->x;
   y = gdi->primary->hdc->hwnd->invalid->y;
@@ -517,6 +535,10 @@ frdp_end_paint (rdpContext *context)
     {
       gtk_widget_queue_draw_area (priv->display, x, y, w, h);
     }
+
+#ifdef HAVE_FREERDP_2
+  return TRUE;
+#endif
 }
 
 static BOOL
@@ -524,7 +546,7 @@ frdp_pre_connect (freerdp *instance)
 {
   rdpSettings *settings = instance->settings;
 
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE;
   settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE;
   settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
@@ -587,15 +609,14 @@ frdp_post_connect (freerdp *instance)
   rdpGdi               *gdi;
   int                   stride;
 
-  gdi_init (instance,
-#if defined(FREERDP_VERSION_MAJOR) && defined(FREERDP_VERSION_MINOR) && \
-    !(FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && \
-    FREERDP_VERSION_MINOR >= 2))
-                    CLRBUF_24BPP,
+#ifdef HAVE_FREERDP_2
+  gdi_init (instance, PIXEL_FORMAT_BGRX32);
+#elif defined(HAVE_FREERDP_1_1)
+  gdi_init (instance, CLRBUF_32BPP, NULL);
 #else
-                    CLRBUF_32BPP,
+  gdi_init (instance, CLRBUF_24BPP, NULL);
 #endif
-                    NULL);
+
   gdi = instance->context->gdi;
 
   instance->update->BeginPaint = frdp_begin_paint;
@@ -705,7 +726,7 @@ frdp_key_pressed (GtkWidget   *widget,
   VinagreRdpTab        *rdp_tab = (VinagreRdpTab *) user_data;
   VinagreRdpTabPrivate *priv = rdp_tab->priv;
   frdpEventKey         *frdp_event;
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   UINT16                scancode;
 #endif
 
@@ -713,7 +734,7 @@ frdp_key_pressed (GtkWidget   *widget,
   frdp_event->type = FRDP_EVENT_TYPE_KEY;
   frdp_event->flags = event->type == GDK_KEY_PRESS ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE;
 
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode (event->hardware_keycode);
   frdp_event->code = RDP_SCANCODE_CODE(scancode);
   frdp_event->extended = RDP_SCANCODE_EXTENDED(scancode);
@@ -934,11 +955,21 @@ frdp_authenticate (freerdp  *instance,
   return TRUE;
 }
 
+#ifdef HAVE_FREERDP_2
+static DWORD
+frdp_certificate_verify (freerdp    *instance,
+                         const char *common_name,
+                         const char *subject,
+                         const char *issuer,
+                         const char *fingerprint,
+                         BOOL        host_mismatch)
+#else
 static BOOL
 frdp_certificate_verify (freerdp *instance,
                          char    *subject,
                          char    *issuer,
                          char    *fingerprint)
+#endif
 {
   VinagreTab *tab = VINAGRE_TAB (((frdpContext *) instance->context)->rdp_tab);
   GtkBuilder *builder;
@@ -968,17 +999,33 @@ frdp_certificate_verify (freerdp *instan
   gtk_widget_hide (dialog);
 
 
+#ifdef HAVE_FREERDP_2
+  return response == GTK_RESPONSE_YES ? 1 : 0;
+#else
   return response == GTK_RESPONSE_YES;
+#endif
 }
 
 
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_2
+static DWORD
+frdp_changed_certificate_verify (freerdp    *instance,
+                                 const char *common_name,
+                                 const char *subject,
+                                 const char *issuer,
+                                 const char *new_fingerprint,
+                                 const char *old_subject,
+                                 const char *old_issuer,
+                                 const char *old_fingerprint)
+#else
 static BOOL
 frdp_changed_certificate_verify (freerdp *instance,
                                  char    *subject,
                                  char    *issuer,
                                  char    *new_fingerprint,
                                  char    *old_fingerprint)
+#endif
 {
   VinagreTab *tab = VINAGRE_TAB (((frdpContext *) instance->context)->rdp_tab);
   GtkBuilder *builder;
@@ -1023,7 +1070,11 @@ frdp_changed_certificate_verify (freerdp
   gtk_widget_hide (dialog);
 
 
+#ifdef HAVE_FREERDP_2
+  return response == GTK_RESPONSE_YES ? 1 : 0;
+#else
   return response == GTK_RESPONSE_YES;
+#endif
 }
 #endif
 
@@ -1053,11 +1104,11 @@ init_freerdp (VinagreRdpTab *rdp_tab)
   priv->freerdp_session->PostConnect = frdp_post_connect;
   priv->freerdp_session->Authenticate = frdp_authenticate;
   priv->freerdp_session->VerifyCertificate = frdp_certificate_verify;
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   priv->freerdp_session->VerifyChangedCertificate = frdp_changed_certificate_verify;
 #endif
 
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   priv->freerdp_session->ContextSize = sizeof (frdpContext);
 #else
   priv->freerdp_session->context_size = sizeof (frdpContext);
@@ -1070,7 +1121,7 @@ init_freerdp (VinagreRdpTab *rdp_tab)
   settings = priv->freerdp_session->settings;
 
   /* Security settings */
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   settings->RdpSecurity = TRUE;
   settings->TlsSecurity = TRUE;
   settings->NlaSecurity = TRUE;
@@ -1092,7 +1143,7 @@ init_freerdp (VinagreRdpTab *rdp_tab)
 #endif
 
   /* Set display size */
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   settings->DesktopWidth = width;
   settings->DesktopHeight = height;
 #else
@@ -1101,7 +1152,7 @@ init_freerdp (VinagreRdpTab *rdp_tab)
 #endif
 
   /* Set hostname */
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   settings->WindowTitle = g_strdup (hostname);
   settings->ServerHostname = g_strdup (hostname);
   settings->ServerPort = port;
@@ -1112,7 +1163,7 @@ init_freerdp (VinagreRdpTab *rdp_tab)
 #endif
 
   /* Set keyboard layout */
-#if HAVE_FREERDP_1_1
+#ifdef HAVE_FREERDP_1_1
   freerdp_keyboard_init (KBD_US);
 #else
   freerdp_kbd_init (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), KBD_US);