--- vinagre-3.22.0/configure.ac +++ vinagre-3.22.0/configure.ac @@ -59,16 +59,25 @@ AM_CONDITIONAL([VINAGRE_ENABLE_SSH], [te # Whether to enable support for RDP. RDP_DEPS="freerdp x11" +RDP_2_DEPS="freerdp2 x11" AC_ARG_ENABLE([rdp], [AS_HELP_STRING([--disable-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])], [])], - [have_rdp=no])], + 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 + 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 #include #include -#if HAVE_FREERDP_1_1 +#ifdef HAVE_FREERDP_1_1 #include #else #include @@ -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; @@ -478,16 +478,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; @@ -497,7 +509,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; @@ -519,6 +537,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 @@ -526,7 +548,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; @@ -589,15 +611,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; @@ -707,7 +728,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 @@ -715,7 +736,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); @@ -938,11 +959,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; @@ -972,17 +1003,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; @@ -1027,7 +1074,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 @@ -1057,11 +1108,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); @@ -1074,7 +1125,7 @@ init_freerdp (VinagreRdpTab *rdp_tab) settings = priv->freerdp_session->settings; /* Security settings */ -#if HAVE_FREERDP_1_1 +#ifdef HAVE_FREERDP_1_1 #include #if (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 2 && FREERDP_VERSION_REVISION >= 1) || (FREERDP_VERSION_MAJOR == 2) settings->UseRdpSecurityLayer = FALSE; @@ -1096,7 +1147,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 @@ -1105,7 +1156,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; @@ -1116,7 +1167,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);