[spice-gtk] Add misc upstream patches

Christophe Fergeau teuf at fedoraproject.org
Fri Sep 13 12:21:32 UTC 2013


commit 8dc5ba9f897bbd79e27c4e9109cf8c0821b07d46
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Sep 13 14:02:24 2013 +0200

    Add misc upstream patches
    
    They fix various bugs found in spice-gtk 0.20

 ...ard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch |   45 +++++++
 ...n-Convert-text-line-endings-if-necessary-.patch |  130 ++++++++++++++++++++
 0004-usb-widget-fix-gtk2-Python-bindings.patch     |   53 ++++++++
 ...-g_slist_free_full-pass-the-right-ptr-to-.patch |   27 ++++
 ...-cursor.c-add-cursor_type_to_string-for-d.patch |    0
 ...annel-cursor-copy-spicec-hack-RHBZ-998529.patch |    0
 spice-gtk.spec                                     |   24 +++-
 7 files changed, 273 insertions(+), 6 deletions(-)
---
diff --git a/0002-smartcard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch b/0002-smartcard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch
new file mode 100644
index 0000000..4f24e85
--- /dev/null
+++ b/0002-smartcard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch
@@ -0,0 +1,45 @@
+From 3bb15dd43daaed6b1d77e66c59432f228935322e Mon Sep 17 00:00:00 2001
+From: Christophe Fergeau <cfergeau at redhat.com>
+Date: Thu, 11 Jul 2013 15:18:33 +0200
+Subject: [spice-gtk] smartcard: Handle VCARD_EMUL_INIT_ALREADY_INITED
+
+When initializing a software smartcard, vcard_emul_init() can
+report success, error, or indicate that initialization has already
+been done. In this last case, we would assume that an error occurred
+instead of behaving as if the initialization succeeded.
+
+vcard_emul_init() can end up being called multiple time if the
+smartcard channel gets destroyed and recreated during the lifetime
+of the application
+
+Fixes rhbz#815639
+---
+ gtk/smartcard-manager.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/gtk/smartcard-manager.c b/gtk/smartcard-manager.c
+index 4b1efe2..2a0e397 100644
+--- a/gtk/smartcard-manager.c
++++ b/gtk/smartcard-manager.c
+@@ -408,6 +408,7 @@ static gboolean smartcard_manager_init(SpiceSession *session,
+ {
+     gchar *emul_args = NULL;
+     VCardEmulOptions *options = NULL;
++    VCardEmulError emul_init_status;
+     gchar *dbname = NULL;
+     GStrv certificates = NULL;
+     gboolean retval = FALSE;
+@@ -448,7 +449,9 @@ static gboolean smartcard_manager_init(SpiceSession *session,
+ 
+ init:
+     SPICE_DEBUG("vcard_emul_init");
+-    if (vcard_emul_init(options) != VCARD_EMUL_OK) {
++    emul_init_status = vcard_emul_init(options);
++    if ((emul_init_status != VCARD_EMUL_OK)
++            && (emul_init_status != VCARD_EMUL_INIT_ALREADY_INITED)) {
+         *err = g_error_new(SPICE_CLIENT_ERROR,
+                            SPICE_CLIENT_ERROR_FAILED,
+                            "Failed to initialize smartcard");
+-- 
+1.8.3.1
+
diff --git a/0003-channel-main-Convert-text-line-endings-if-necessary-.patch b/0003-channel-main-Convert-text-line-endings-if-necessary-.patch
new file mode 100644
index 0000000..788d21a
--- /dev/null
+++ b/0003-channel-main-Convert-text-line-endings-if-necessary-.patch
@@ -0,0 +1,130 @@
+From 28ef25781f62d6e3d96dba57a7ec772899b83661 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Mon, 24 Jun 2013 14:30:43 +0200
+Subject: [PATCH] channel-main: Convert text line-endings if necessary
+ (rhbz#752350)
+
+This implements line-ending conversion following the specification in the
+commit message of spice-protocol commit 7be0e88e7e03a956b364cc847aad11b96ed4 :
+vd_agent: Add caps for the agent to signal the guest line-ending (rhbz#752350)
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+(cherry picked from commit e45a446a9981ad4adaeff9c885962a8c6140333e)
+---
+ gtk/channel-main.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 69 insertions(+), 4 deletions(-)
+
+diff --git a/gtk/channel-main.c b/gtk/channel-main.c
+index b58af52..b9e0da2 100644
+--- a/gtk/channel-main.c
++++ b/gtk/channel-main.c
+@@ -1181,6 +1181,24 @@ static void agent_announce_caps(SpiceMainChannel *channel)
+ #define HAS_CLIPBOARD_SELECTION(c) \
+     VD_AGENT_HAS_CAPABILITY((c)->agent_caps, G_N_ELEMENTS((c)->agent_caps), VD_AGENT_CAP_CLIPBOARD_SELECTION)
+ 
++#define GUEST_LINEEND_LF(c) \
++    VD_AGENT_HAS_CAPABILITY((c)->agent_caps, G_N_ELEMENTS((c)->agent_caps), VD_AGENT_CAP_GUEST_LINEEND_LF)
++
++#define GUEST_LINEEND_CRLF(c) \
++    VD_AGENT_HAS_CAPABILITY((c)->agent_caps, G_N_ELEMENTS((c)->agent_caps), VD_AGENT_CAP_GUEST_LINEEND_CRLF)
++
++#ifdef G_OS_UNIX
++#define CLIENT_LINEEND_LF 1
++#else
++#define CLIENT_LINEEND_LF 0
++#endif
++
++#ifdef G_OS_WIN32
++#define CLIENT_LINEEND_CRLF 1
++#else
++#define CLIENT_LINEEND_CRLF 0
++#endif
++
+ /* any context: the message is not flushed immediately,
+    you can wakeup() the channel coroutine or send_msg_queue() */
+ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
+@@ -1751,6 +1769,29 @@ static void file_xfer_handle_status(SpiceMainChannel *channel,
+     file_xfer_completed(task, error);
+ }
+ 
++/* any context */
++static guchar *convert_lineend(const guchar *in, gsize *size,
++                               const gchar *from, const gchar *to)
++{
++    gchar *nul_terminated, **split, *out;
++
++    /* Nul-terminate */
++    nul_terminated = g_malloc(*size + 1);
++    memcpy(nul_terminated, in, *size);
++    nul_terminated[*size] = 0;
++
++    /* Convert */
++    split = g_strsplit(nul_terminated, from, -1);
++    out = g_strjoinv(to, split);
++    *size = strlen(out);
++
++    /* Clean-up */
++    g_strfreev(split);
++    g_free(nul_terminated);
++
++    return (guchar *)out;
++}
++
+ /* coroutine context */
+ static void main_agent_handle_msg(SpiceChannel *channel,
+                                   VDAgentMessage *msg, gpointer payload)
+@@ -1809,12 +1850,22 @@ static void main_agent_handle_msg(SpiceChannel *channel,
+     case VD_AGENT_CLIPBOARD:
+     {
+         VDAgentClipboard *cb = payload;
++        guchar *data = cb->data;
++        gsize size = msg->size - sizeof(VDAgentClipboard);
++        if (cb->type == VD_AGENT_CLIPBOARD_UTF8_TEXT) {
++            if (GUEST_LINEEND_LF(c) && CLIENT_LINEEND_CRLF)
++                data = convert_lineend(data, &size, "\n", "\r\n");
++            if (GUEST_LINEEND_CRLF(c) && CLIENT_LINEEND_LF)
++                data = convert_lineend(data, &size, "\r\n", "\n");
++        }
+         emit_main_context(channel, SPICE_MAIN_CLIPBOARD_SELECTION, selection,
+-                          cb->type, cb->data, msg->size - sizeof(VDAgentClipboard));
++                          cb->type, data, size);
+ 
+-       if (selection == VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD)
++        if (selection == VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD)
+             emit_main_context(channel, SPICE_MAIN_CLIPBOARD,
+-                              cb->type, cb->data, msg->size - sizeof(VDAgentClipboard));
++                              cb->type, data, size);
++        if (data != cb->data)
++            g_free(data);
+         break;
+     }
+     case VD_AGENT_CLIPBOARD_GRAB:
+@@ -2554,13 +2605,27 @@ void spice_main_clipboard_notify(SpiceMainChannel *channel,
+  * Since: 0.6
+  **/
+ void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint selection,
+-                                           guint32 type, const guchar *data, size_t size)
++                                           guint32 type, const guchar *_data, size_t _size)
+ {
++    const guchar *data = _data;
++    gsize size = _size;
++
+     g_return_if_fail(channel != NULL);
+     g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
+ 
++    SpiceMainChannelPrivate *c = channel->priv;
++
++    if (type == VD_AGENT_CLIPBOARD_UTF8_TEXT) {
++        if (CLIENT_LINEEND_CRLF && GUEST_LINEEND_LF(c))
++            data = convert_lineend(data, &size, "\r\n", "\n");
++        if (CLIENT_LINEEND_LF && GUEST_LINEEND_CRLF(c))
++            data = convert_lineend(data, &size, "\n", "\r\n");
++    }
+     agent_clipboard_notify(channel, selection, type, data, size);
+     spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
++
++    if (data != _data)
++        g_free((guchar *)data);
+ }
+ 
+ /**
diff --git a/0004-usb-widget-fix-gtk2-Python-bindings.patch b/0004-usb-widget-fix-gtk2-Python-bindings.patch
new file mode 100644
index 0000000..c627229
--- /dev/null
+++ b/0004-usb-widget-fix-gtk2-Python-bindings.patch
@@ -0,0 +1,53 @@
+From 3010789e722f4a0fce62d7f172ad8134e1c5e866 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at redhat.com>
+Date: Tue, 6 Aug 2013 12:09:18 +0200
+Subject: [spice-gtk] usb-widget: fix gtk2 Python bindings
+
+The Python bindings generator failed to bind the USB widget, because of
+the object/class declaration. The declaration was circumventing the
+deprecated errors when compiling with GTK_DISABLE_DEPRECATED. We used
+to need that because of broken gtk+ headers, but it is no longer
+necessary since 15bd7ceba1434b5d710bfd16078044f30693467b.
+
+(cherry picked from commit a7565265532f6abec0fd3c6d843683b58eee070a)
+---
+ gtk/usb-device-widget.h | 12 ++----------
+ 1 file changed, 2 insertions(+), 10 deletions(-)
+
+diff --git a/gtk/usb-device-widget.h b/gtk/usb-device-widget.h
+index 3920990..b68cc6b 100644
+--- a/gtk/usb-device-widget.h
++++ b/gtk/usb-device-widget.h
+@@ -37,14 +37,6 @@ typedef struct _SpiceUsbDeviceWidget SpiceUsbDeviceWidget;
+ typedef struct _SpiceUsbDeviceWidgetClass SpiceUsbDeviceWidgetClass;
+ typedef struct _SpiceUsbDeviceWidgetPrivate SpiceUsbDeviceWidgetPrivate;
+ 
+-#if GTK_CHECK_VERSION(3,0,0)
+-typedef struct _GtkBox _SpiceGtkBox;
+-typedef struct _GtkBoxClass _SpiceGtkBoxClass;
+-#else
+-typedef struct _GtkVBox _SpiceGtkBox;
+-typedef struct _GtkVBoxClass _SpiceGtkBoxClass;
+-#endif
+-
+ /**
+  * SpiceUsbDeviceWidget:
+  *
+@@ -52,7 +44,7 @@ typedef struct _GtkVBoxClass _SpiceGtkBoxClass;
+  */
+ struct _SpiceUsbDeviceWidget
+ {
+-    _SpiceGtkBox parent;
++    GtkVBox parent;
+ 
+     /*< private >*/
+     SpiceUsbDeviceWidgetPrivate *priv;
+@@ -67,7 +59,7 @@ struct _SpiceUsbDeviceWidget
+  */
+ struct _SpiceUsbDeviceWidgetClass
+ {
+-    _SpiceGtkBoxClass parent_class;
++    GtkVBoxClass parent_class;
+ 
+     /* signals */
+     void (*connect_failed) (SpiceUsbDeviceWidget *widget,
diff --git a/0005-glib-compat-g_slist_free_full-pass-the-right-ptr-to-.patch b/0005-glib-compat-g_slist_free_full-pass-the-right-ptr-to-.patch
new file mode 100644
index 0000000..2db36a8
--- /dev/null
+++ b/0005-glib-compat-g_slist_free_full-pass-the-right-ptr-to-.patch
@@ -0,0 +1,27 @@
+From f5dfea28a3b909e51bcb544c399b02bd3ff65df7 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Mon, 19 Aug 2013 16:51:58 +0200
+Subject: [PATCH spice-gtk] glib-compat: g_slist_free_full: pass the right ptr
+ to destroy (rhbz#997893)
+
+The destroy function passed to g_slist_free_full should be passed the elements
+data pointer, not the element itself.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ gtk/glib-compat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c
+index 21be1f6..c3bb8e6 100644
+--- a/gtk/glib-compat.c
++++ b/gtk/glib-compat.c
+@@ -88,7 +88,7 @@ g_slist_free_full(GSList         *list,
+ 
+     if (free_func) {
+         for (el = list; el ; el = g_slist_next(el)) {
+-            free_func(el);
++            free_func(el->data);
+         }
+     }
+ 
diff --git a/0002-gtk-channel-cursor.c-add-cursor_type_to_string-for-d.patch b/0006-gtk-channel-cursor.c-add-cursor_type_to_string-for-d.patch
similarity index 100%
rename from 0002-gtk-channel-cursor.c-add-cursor_type_to_string-for-d.patch
rename to 0006-gtk-channel-cursor.c-add-cursor_type_to_string-for-d.patch
diff --git a/0003-gtk-channel-cursor-copy-spicec-hack-RHBZ-998529.patch b/0007-gtk-channel-cursor-copy-spicec-hack-RHBZ-998529.patch
similarity index 100%
rename from 0003-gtk-channel-cursor-copy-spicec-hack-RHBZ-998529.patch
rename to 0007-gtk-channel-cursor-copy-spicec-hack-RHBZ-998529.patch
diff --git a/spice-gtk.spec b/spice-gtk.spec
index 00dc42f..e81f18e 100644
--- a/spice-gtk.spec
+++ b/spice-gtk.spec
@@ -13,7 +13,7 @@
 
 Name:           spice-gtk
 Version:        0.20
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        A GTK+ widget for SPICE clients
 
 Group:          System Environment/Libraries
@@ -22,8 +22,12 @@ URL:            http://spice-space.org/page/Spice-Gtk
 #VCS:           git:git://anongit.freedesktop.org/spice/spice-gtk
 Source0:        http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2
 Patch1:         0001-Add-spice_channel_string_to_type-to-map-files.patch
-Patch2:         0002-gtk-channel-cursor.c-add-cursor_type_to_string-for-d.patch
-Patch3:         0003-gtk-channel-cursor-copy-spicec-hack-RHBZ-998529.patch
+Patch2:         0002-smartcard-Handle-VCARD_EMUL_INIT_ALREADY_INITED.patch
+Patch3:         0003-channel-main-Convert-text-line-endings-if-necessary-.patch
+Patch4:         0004-usb-widget-fix-gtk2-Python-bindings.patch
+Patch5:         0005-glib-compat-g_slist_free_full-pass-the-right-ptr-to-.patch
+Patch6:         0006-gtk-channel-cursor.c-add-cursor_type_to_string-for-d.patch
+Patch7:         0007-gtk-channel-cursor-copy-spicec-hack-RHBZ-998529.patch
 
 BuildRequires: intltool
 BuildRequires: gtk2-devel >= 2.14
@@ -150,9 +154,14 @@ if [ -n '%{?_version_suffix}' ]; then
 fi
 
 pushd spice-gtk-%{version}
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
+%patch0001 -p1
+%patch0002 -p1
+%patch0003 -p1
+%patch0004 -p1
+%patch0005 -p1
+%patch0006 -p1
+%patch0007 -p1
+find . -name '*.stamp' | xargs touch
 popd
 
 %if %{with_gtk3}
@@ -273,6 +282,9 @@ rm -rf %{buildroot}%{_datadir}/pkgconfig/spice-protocol.pc
 %{_bindir}/spicy-stats
 
 %changelog
+* Fri Sep 13 2013 Christophe Fergeau <cfergeau at redhat.com> 0.20-6
+- Add misc upstream patches fixing various 0.20 bugs
+
 * Wed Aug 28 2013 Alon Levy <alevy at redhat.com> - 0.20-5
 - Fix wrong mono cursor local rendering (rhbz#998529)
 


More information about the scm-commits mailing list