Add misc upstream patches

They fix various bugs found in spice-gtk 0.20
This commit is contained in:
Christophe Fergeau 2013-09-13 14:02:24 +02:00
parent 59ec8b73bd
commit 902342efb0
7 changed files with 273 additions and 6 deletions

View File

@ -0,0 +1,45 @@
From 3bb15dd43daaed6b1d77e66c59432f228935322e Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@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

View File

@ -0,0 +1,130 @@
From 28ef25781f62d6e3d96dba57a7ec772899b83661 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@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@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);
}
/**

View File

@ -0,0 +1,53 @@
From 3010789e722f4a0fce62d7f172ad8134e1c5e866 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@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,

View File

@ -0,0 +1,27 @@
From f5dfea28a3b909e51bcb544c399b02bd3ff65df7 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@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@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);
}
}

View File

@ -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@redhat.com> 0.20-6
- Add misc upstream patches fixing various 0.20 bugs
* Wed Aug 28 2013 Alon Levy <alevy@redhat.com> - 0.20-5
- Fix wrong mono cursor local rendering (rhbz#998529)