[vinagre/gnome-3-20] Fix "Share clipboard" functionality in Spice plugin



commit 991c70ed9c88e544f19362dd09f1380b4ca10f7c
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Jun 7 17:21:36 2017 +0200

    Fix "Share clipboard" functionality in Spice plugin
    
    Set "auto-clipboard" property on correct class. The correct one is SpiceDisplay
    for spice-gtk <= 0.31 and SpiceGtkSession for spice-gtk > 0.31.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783517

 configure.ac                      |    4 +++-
 plugins/spice/vinagre-spice-tab.c |   17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a2fb941..ba47457 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,9 @@ AC_ARG_ENABLE([spice],
 AS_IF([test "x$enable_spice" != "xno"],
   [PKG_CHECK_MODULES([SPICE],
     [$SPICE_DEPS],
-    [have_spice=yes],
+    [have_spice=yes
+     PKG_CHECK_EXISTS(spice-client-gtk-3.0 >= 0.32,
+       [AC_DEFINE([HAVE_SPICE_CLIENT_GTK_0_32], [1], [Spice Client Gtk 3.0 library is of version 0.32 or 
newer])], [])],
     [have_spice=no])],
   [have_spice=no])
 
diff --git a/plugins/spice/vinagre-spice-tab.c b/plugins/spice/vinagre-spice-tab.c
index 3365ee1..657a66f 100644
--- a/plugins/spice/vinagre-spice-tab.c
+++ b/plugins/spice/vinagre-spice-tab.c
@@ -379,9 +379,16 @@ create_spice_display (VinagreSpiceTab *spice_tab, int id)
                "grab-keyboard", TRUE,
                "grab-mouse", TRUE,
                "resize-guest", resize_guest,
-               "auto-clipboard", auto_clipboard,
                "scaling", scaling,
                NULL);
+
+#ifdef HAVE_SPICE_CLIENT_GTK_0_32
+  g_object_set (spice_gtk_session_get (spice_tab->priv->spice),
+#else
+  g_object_set (d->display,
+#endif
+               "auto-clipboard", auto_clipboard,
+               NULL);
   /* TODO: add view-only here when spice-gtk ready */
 
   g_object_get (spice_tab->priv->spice, "uri", &name, NULL); /* TODO: a better friendly name? */
@@ -735,7 +742,11 @@ vinagre_spice_tab_set_auto_clipboard (VinagreSpiceTab *tab, gboolean active)
 {
   g_return_if_fail (VINAGRE_IS_SPICE_TAB (tab));
 
+#ifdef HAVE_SPICE_CLIENT_GTK_0_32
+  g_object_set (spice_gtk_session_get (tab->priv->spice), "auto-clipboard", active, NULL);
+#else
   g_object_set (tab->priv->display, "auto-clipboard", active, NULL);
+#endif
 }
 
 gboolean
@@ -745,7 +756,11 @@ vinagre_spice_tab_get_auto_clipboard (VinagreSpiceTab *tab)
 
   g_return_val_if_fail (VINAGRE_IS_SPICE_TAB (tab), FALSE);
 
+#ifdef HAVE_SPICE_CLIENT_GTK_0_32
+  g_object_get (spice_gtk_session_get (tab->priv->spice), "auto-clipboard", &active, NULL);
+#else
   g_object_get (tab->priv->display, "auto-clipboard", &active, NULL);
+#endif
 
   return active;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]