Update to release v0.38

This commit is contained in:
Victor Toso 2020-03-16 13:58:20 +01:00
parent 2379d13954
commit 4bef931bd5
13 changed files with 13 additions and 655 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/spice-gtk-*.tar.bz2 /spice-gtk-*.tar.bz2
/spice-gtk-0.37.tar.bz2.sig /spice-gtk-0.37.tar.bz2.sig
/victortoso-E37A484F.keyring /victortoso-E37A484F.keyring
/spice-gtk-0.38.tar.xz
/spice-gtk-0.38.tar.xz.sig

View File

@ -1,44 +0,0 @@
From 308df96bef921c8acc61b645a1744b65e2104e6e Mon Sep 17 00:00:00 2001
From: Victor Toso <me@victortoso.com>
Date: Thu, 6 Feb 2020 14:21:10 +0100
Subject: [PATCH spice-gtk] build: egl: remove libdrm/drm_fourcc.h
Same result but removing the single directly usage of libdrm include
which is not being checked. The header epoxy/egl_generated.h contains
the macro EGL_LINUX_DRM_FOURCC_EXT that we use in spice-widget-egl.c
and that is included in epoxy/egl.h already.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
---
meson.build | 1 +
src/spice-widget-egl.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 171a3f6..e7df9c4 100644
--- a/meson.build
+++ b/meson.build
@@ -63,6 +63,7 @@ foreach header : headers
endif
endforeach
+# FIXME: Add a config option to validate spice-widget-egl being built or not
spice_gtk_has_egl = compiler.has_header('epoxy/egl.h')
if spice_gtk_has_egl
spice_gtk_config_data.set('HAVE_EPOXY_EGL_H', '1')
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index f5e24a0..06af97a 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -26,7 +26,6 @@
#include "spice-widget.h"
#include "spice-widget-priv.h"
#include "spice-gtk-session-priv.h"
-#include <libdrm/drm_fourcc.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
--
2.25.0.rc2.1.g09a9a1a997

View File

@ -1,77 +0,0 @@
From 16b41429618985e4ab8c597fbd0c5cca5cf7b3e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Thu, 21 Mar 2019 13:21:33 +0100
Subject: [PATCH 1/6] clipboard: do not release between client grabs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On the client side, whenever the grab owner changes (and the clipboard
was previously grabbed), spice-gtk sends a clipboard release followed
immediately by a new grab. But some clipboard managers on the remote
side react to clipboard release events by taking a clipboard grab,
presumably to avoid empty clipboards.
The two grabs, coming from the client and from the remote sides, will
race in both directions, which may confuse the client & remote side,
as both believe the other side is the current grab owner, and thus
further clipboard data requests are likely to fail.
Let's avoid sending a release event when re-grabing.
The race described above may still happen in other rare circunstances,
and will require a protocol change. To avoid the conflict, a discussed
solution could use a clipboard serial number.
Tested with current linux & windows vdagent. Looking at earlier
version of the code, it doesn't seem like subsequent grabs will be
treated as an error.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/spice-gtk-session.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 60399d0..cb00fa5 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -577,8 +577,7 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
g_return_if_fail(selection != -1);
if (s->clip_grabbed[selection]) {
- SPICE_DEBUG("Clipboard is already grabbed, ignoring %d atoms", n_atoms);
- return;
+ SPICE_DEBUG("Clipboard is already grabbed, re-grab: %d atoms", n_atoms);
}
/* Set all Atoms that matches our current protocol implementation */
@@ -660,18 +659,14 @@ static void clipboard_owner_change(GtkClipboard *clipboard,
return;
}
- /* In case we sent a grab to the agent, we need to release it now as
- * previous clipboard data should not be reachable anymore */
- if (s->clip_grabbed[selection]) {
- s->clip_grabbed[selection] = FALSE;
- if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) {
- spice_main_channel_clipboard_selection_release(s->main, selection);
- }
- }
-
- /* We are mostly interested when owner has changed in which case
- * we would like to let agent know about new clipboard data. */
if (event->reason != GDK_OWNER_CHANGE_NEW_OWNER) {
+ if (s->clip_grabbed[selection]) {
+ /* grab was sent to the agent, so release it */
+ s->clip_grabbed[selection] = FALSE;
+ if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) {
+ spice_main_channel_clipboard_selection_release(s->main, selection);
+ }
+ }
s->clip_hasdata[selection] = FALSE;
return;
}
--
2.23.0

View File

@ -1,29 +0,0 @@
From fc4400033ea6b8d0731b29d12d66441da70f4e4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Thu, 30 Jan 2020 12:07:07 -0300
Subject: [PATCH spice-gtk] meson: link with -lm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 8c6288f..ff7c773 100644
--- a/meson.build
+++ b/meson.build
@@ -111,7 +111,7 @@ foreach dep : deps
spice_glib_deps += dependency(dep)
endforeach
-deps = []
+deps = ['m']
if host_machine.system() == 'windows'
deps += ['libws2_32', 'libgdi32']
endif
--
2.25.0.rc2.1.g09a9a1a997

View File

@ -1,57 +0,0 @@
From c188c382afcad1a054541f8b101fa1044e2289cf Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <fziglio@redhat.com>
Date: Sun, 2 Jun 2019 19:02:25 +0100
Subject: [PATCH spice-gtk] vmcstream: Fix buffer overflow sending data to task
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The "count" variable is used to store the full length of the
initial buffer set using spice_vmc_input_stream_read_all_async or
spice_vmc_input_stream_read_async.
However on spice_vmc_input_stream_co_data the "buffer" variable is
increased by the amount read into it.
On potential next loop "count" is still used to compute the bytes to
read but now "buffer + count" points past the original buffer.
So we need to take into account the position written in order to
compute the right limit.
Tested with WebDAV.
https://bugzilla.redhat.com/show_bug.cgi?id=1720532
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/vmcstream.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/vmcstream.c b/src/vmcstream.c
index 0634bce..86c949a 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -142,17 +142,16 @@ spice_vmc_input_stream_co_data(SpiceVmcInputStream *self,
g_return_if_fail(self->task != NULL);
- gsize min = MIN(self->count, size);
- memcpy(self->buffer, data, min);
+ gsize min = MIN(self->count - self->pos, size);
+ memcpy(self->buffer + self->pos, data, min);
size -= min;
data += min;
- SPICE_DEBUG("spicevmc co_data complete: %" G_GSIZE_FORMAT
- "/%" G_GSIZE_FORMAT, min, self->count);
-
self->pos += min;
- self->buffer += min;
+
+ SPICE_DEBUG("spicevmc co_data complete: %" G_GSIZE_FORMAT
+ "/%" G_GSIZE_FORMAT, self->pos, self->count);
if (self->all && min > 0 && self->pos != self->count)
continue;
--
2.22.0.rc2.384.g1a9a72ea1d

View File

@ -1,167 +0,0 @@
From 271656ae32e756eacfcc522d1aaab9d7102b0ce7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Thu, 21 Mar 2019 13:21:34 +0100
Subject: [PATCH 2/6] clipboard: do not release between remote grabs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Delay the release events for 0.5 sec. If no further grab comes in,
then release the grab. Otherwise, let's skip the release. This avoids
some races with clipboard managers.
Related to:
https://gitlab.freedesktop.org/spice/spice-gtk/issues/82
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/spice-gtk-session.c | 80 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 72 insertions(+), 8 deletions(-)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index cb00fa5..79385a4 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -59,6 +59,7 @@ struct _SpiceGtkSessionPrivate {
gboolean clip_hasdata[CLIPBOARD_LAST];
gboolean clip_grabbed[CLIPBOARD_LAST];
gboolean clipboard_by_guest[CLIPBOARD_LAST];
+ guint clipboard_release_delay[CLIPBOARD_LAST];
/* auto-usbredir related */
gboolean auto_usbredir_enable;
int auto_usbredir_reqs;
@@ -95,6 +96,7 @@ struct _SpiceGtkSessionPrivate {
/* ------------------------------------------------------------------ */
/* Prototypes for private functions */
+static void clipboard_release(SpiceGtkSession *self, guint selection);
static void clipboard_owner_change(GtkClipboard *clipboard,
GdkEventOwnerChange *event,
gpointer user_data);
@@ -255,6 +257,23 @@ static void spice_gtk_session_dispose(GObject *gobject)
G_OBJECT_CLASS(spice_gtk_session_parent_class)->dispose(gobject);
}
+static void clipboard_release_delay_remove(SpiceGtkSession *self, guint selection,
+ gboolean release_if_delayed)
+{
+ SpiceGtkSessionPrivate *s = self->priv;
+
+ if (!s->clipboard_release_delay[selection])
+ return;
+
+ if (release_if_delayed) {
+ SPICE_DEBUG("delayed clipboard release, sel:%u", selection);
+ clipboard_release(self, selection);
+ }
+
+ g_source_remove(s->clipboard_release_delay[selection]);
+ s->clipboard_release_delay[selection] = 0;
+}
+
static void spice_gtk_session_finalize(GObject *gobject)
{
SpiceGtkSession *self = SPICE_GTK_SESSION(gobject);
@@ -264,6 +283,7 @@ static void spice_gtk_session_finalize(GObject *gobject)
/* release stuff */
for (i = 0; i < CLIPBOARD_LAST; ++i) {
g_clear_pointer(&s->clip_targets[i], g_free);
+ clipboard_release_delay_remove(self, i, true);
}
/* Chain up to the parent class */
@@ -823,6 +843,8 @@ static gboolean clipboard_grab(SpiceMainChannel *main, guint selection,
int m, n;
int num_targets = 0;
+ clipboard_release_delay_remove(self, selection, false);
+
cb = get_clipboard_from_selection(s, selection);
g_return_val_if_fail(cb != NULL, FALSE);
@@ -1052,17 +1074,12 @@ static gboolean clipboard_request(SpiceMainChannel *main, guint selection,
return TRUE;
}
-static void clipboard_release(SpiceMainChannel *main, guint selection,
- gpointer user_data)
+static void clipboard_release(SpiceGtkSession *self, guint selection)
{
- g_return_if_fail(SPICE_IS_GTK_SESSION(user_data));
-
- SpiceGtkSession *self = user_data;
SpiceGtkSessionPrivate *s = self->priv;
GtkClipboard* clipboard = get_clipboard_from_selection(s, selection);
- if (!clipboard)
- return;
+ g_return_if_fail(clipboard != NULL);
s->nclip_targets[selection] = 0;
@@ -1072,6 +1089,53 @@ static void clipboard_release(SpiceMainChannel *main, guint selection,
s->clipboard_by_guest[selection] = FALSE;
}
+typedef struct SpiceGtkClipboardRelease {
+ SpiceGtkSession *self;
+ guint selection;
+} SpiceGtkClipboardRelease;
+
+static gboolean clipboard_release_timeout(gpointer user_data)
+{
+ SpiceGtkClipboardRelease *rel = user_data;
+
+ clipboard_release_delay_remove(rel->self, rel->selection, true);
+
+ return G_SOURCE_REMOVE;
+}
+
+/*
+ * The agents send release between two grabs. This may trigger
+ * clipboard managers trying to grab the clipboard. We end up with two
+ * sides, client and remote, racing for the clipboard grab, and
+ * believing each other is the owner.
+ *
+ * Workaround this problem by delaying the release event by 0.5 sec.
+ * FIXME: protocol change to solve the conflict and set client priority.
+ */
+#define CLIPBOARD_RELEASE_DELAY 500 /* ms */
+
+static void clipboard_release_delay(SpiceMainChannel *main, guint selection,
+ gpointer user_data)
+{
+ SpiceGtkSession *self = SPICE_GTK_SESSION(user_data);
+ SpiceGtkSessionPrivate *s = self->priv;
+ GtkClipboard* clipboard = get_clipboard_from_selection(s, selection);
+ SpiceGtkClipboardRelease *rel;
+
+ if (!clipboard)
+ return;
+
+ clipboard_release_delay_remove(self, selection, true);
+
+ rel = g_new0(SpiceGtkClipboardRelease, 1);
+ rel->self = self;
+ rel->selection = selection;
+ s->clipboard_release_delay[selection] =
+ g_timeout_add_full(G_PRIORITY_DEFAULT, CLIPBOARD_RELEASE_DELAY,
+ clipboard_release_timeout, rel, g_free);
+
+}
+
static void channel_new(SpiceSession *session, SpiceChannel *channel,
gpointer user_data)
{
@@ -1088,7 +1152,7 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel,
g_signal_connect(channel, "main-clipboard-selection-request",
G_CALLBACK(clipboard_request), self);
g_signal_connect(channel, "main-clipboard-selection-release",
- G_CALLBACK(clipboard_release), self);
+ G_CALLBACK(clipboard_release_delay), self);
}
if (SPICE_IS_INPUTS_CHANNEL(channel)) {
spice_g_signal_connect_object(channel, "inputs-modifiers",
--
2.23.0

View File

@ -1,32 +0,0 @@
From c771229a978c69323869d4063228306dc41e15b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Jank=C5=AF?= <jjanku@redhat.com>
Date: Mon, 30 Sep 2019 18:44:05 +0200
Subject: [PATCH 3/6] fixup! clipboard: do not release between remote grabs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jakub Janků <jjanku@redhat.com>
---
src/spice-gtk-session.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 79385a4..cbfe3bf 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -782,6 +782,11 @@ static void clipboard_get(GtkClipboard *clipboard,
g_return_if_fail(info < SPICE_N_ELEMENTS(atom2agent));
g_return_if_fail(s->main != NULL);
+ if (s->clipboard_release_delay[selection]) {
+ SPICE_DEBUG("not requesting data from guest during delayed release");
+ return;
+ }
+
ri.selection_data = selection_data;
ri.info = info;
ri.loop = g_main_loop_new(NULL, FALSE);
--
2.23.0

View File

@ -1,65 +0,0 @@
From 31a44bfd0acc3ae18682ae19ff1c8a8101bc96f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Fri, 22 Mar 2019 15:20:12 +0100
Subject: [PATCH 4/6] clipboard: do not delay release if agent has "no release
on regrab"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/channel-main.c | 2 ++
src/spice-gtk-session.c | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/channel-main.c b/src/channel-main.c
index 4305dcd..adf6bab 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -222,6 +222,7 @@ static const char *agent_caps[] = {
[ VD_AGENT_CAP_AUDIO_VOLUME_SYNC ] = "volume-sync",
[ VD_AGENT_CAP_MONITORS_CONFIG_POSITION ] = "monitors config position",
[ VD_AGENT_CAP_FILE_XFER_DISABLED ] = "file transfer disabled",
+ [ VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB ] = "no release on re-grab",
};
#define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) ? (_a[(_i)] ?: "?") : "?")
@@ -1333,6 +1334,7 @@ static void agent_announce_caps(SpiceMainChannel *channel)
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION);
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_MONITORS_CONFIG_POSITION);
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS);
+ VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB);
agent_msg_queue(channel, VD_AGENT_ANNOUNCE_CAPABILITIES, size, caps);
g_free(caps);
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index cbfe3bf..34ae4a1 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -1114,7 +1114,8 @@ static gboolean clipboard_release_timeout(gpointer user_data)
* sides, client and remote, racing for the clipboard grab, and
* believing each other is the owner.
*
- * Workaround this problem by delaying the release event by 0.5 sec.
+ * Workaround this problem by delaying the release event by 0.5 sec,
+ * unless the no-release-on-regrab capability is present.
* FIXME: protocol change to solve the conflict and set client priority.
*/
#define CLIPBOARD_RELEASE_DELAY 500 /* ms */
@@ -1132,6 +1133,12 @@ static void clipboard_release_delay(SpiceMainChannel *main, guint selection,
clipboard_release_delay_remove(self, selection, true);
+ if (spice_main_channel_agent_test_capability(s->main,
+ VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB)) {
+ clipboard_release(self, selection);
+ return;
+ }
+
rel = g_new0(SpiceGtkClipboardRelease, 1);
rel->self = self;
rel->selection = selection;
--
2.23.0

View File

@ -1,33 +0,0 @@
From 7bbf04e5484129037d29018352ab6d3333fddf05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Fri, 22 Mar 2019 15:20:13 +0100
Subject: [PATCH 5/6] clipboard: pre-condition on selection value < 256
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The protocol uses a u8 for the selection value. Make sure the given
argument value fits there, or throw a critical.
The other places seem to use u8 variables already.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/channel-main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/channel-main.c b/src/channel-main.c
index adf6bab..8574ae6 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1354,6 +1354,7 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
if (!c->agent_connected)
return;
+ g_return_if_fail(selection < 256);
g_return_if_fail(test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND));
size = sizeof(VDAgentClipboardGrab) + sizeof(uint32_t) * ntypes;
--
2.23.0

View File

@ -1,121 +0,0 @@
From 48e516347587f6f9e21f3ba9616079521296888d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Fri, 22 Mar 2019 15:20:14 +0100
Subject: [PATCH 6/6] clipboard: implement CAP_CLIPBOARD_GRAB_SERIAL
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/channel-main.c | 32 +++++++++++++++++++++++++++++++-
src/spice-gtk-session.c | 1 -
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/channel-main.c b/src/channel-main.c
index 8574ae6..0062593 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -111,6 +111,7 @@ struct _SpiceMainChannelPrivate {
guint migrate_delayed_id;
spice_migrate *migrate_data;
int max_clipboard;
+ uint32_t clipboard_serial[256];
gboolean agent_volume_playback_sync;
gboolean agent_volume_record_sync;
@@ -223,6 +224,7 @@ static const char *agent_caps[] = {
[ VD_AGENT_CAP_MONITORS_CONFIG_POSITION ] = "monitors config position",
[ VD_AGENT_CAP_FILE_XFER_DISABLED ] = "file transfer disabled",
[ VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB ] = "no release on re-grab",
+ [ VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL ] = "clipboard grab serial",
};
#define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) ? (_a[(_i)] ?: "?") : "?")
@@ -412,6 +414,7 @@ static void spice_main_channel_reset_agent(SpiceMainChannel *channel)
spice_main_channel_reset_all_xfer_operations(channel);
file_xfer_flushed(channel, FALSE);
+ memset(c->clipboard_serial, 0, sizeof(c->clipboard_serial));
}
/* main or coroutine context */
@@ -1335,6 +1338,7 @@ static void agent_announce_caps(SpiceMainChannel *channel)
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_MONITORS_CONFIG_POSITION);
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS);
VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB);
+ VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL);
agent_msg_queue(channel, VD_AGENT_ANNOUNCE_CAPABILITIES, size, caps);
g_free(caps);
@@ -1365,6 +1369,10 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
return;
}
+ if (test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) {
+ size += sizeof(uint32_t);
+ }
+
msg = g_alloca(size);
memset(msg, 0, size);
@@ -1372,7 +1380,13 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
if (test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_SELECTION)) {
msg[0] = selection;
- grab = (VDAgentClipboardGrab *)(msg + 4);
+ grab = (void *)grab + 4;
+ }
+
+ if (test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) {
+ guint32 *serial = (guint32 *)grab;
+ *serial = GUINT32_TO_LE(c->clipboard_serial[selection]++);
+ grab = (void *)grab + sizeof(uint32_t);
}
for (i = 0; i < ntypes; i++) {
@@ -1974,6 +1988,7 @@ static void main_agent_handle_msg(SpiceChannel *channel,
SpiceMainChannel *self = SPICE_MAIN_CHANNEL(channel);
SpiceMainChannelPrivate *c = self->priv;
guint8 selection = VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD;
+ guint32 serial;
g_return_if_fail(msg->protocol == VD_AGENT_PROTOCOL);
@@ -2045,6 +2060,21 @@ static void main_agent_handle_msg(SpiceChannel *channel,
case VD_AGENT_CLIPBOARD_GRAB:
{
gboolean ret;
+
+ if (test_agent_cap(self, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) {
+ serial = GUINT32_FROM_LE(*((guint32 *)payload));
+ payload = ((guint8*)payload) + sizeof(uint32_t);
+ msg->size -= sizeof(uint32_t);
+
+ if (serial == c->clipboard_serial[selection]) {
+ c->clipboard_serial[selection]++;
+ } else {
+ CHANNEL_DEBUG(channel, "grab discard, serial:%u != c->serial:%u",
+ serial, c->clipboard_serial[selection]);
+ break;
+ }
+ }
+
g_coroutine_signal_emit(self, signals[SPICE_MAIN_CLIPBOARD_SELECTION_GRAB], 0, selection,
(guint8*)payload, msg->size / sizeof(uint32_t), &ret);
if (selection == VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 34ae4a1..439199b 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -1116,7 +1116,6 @@ static gboolean clipboard_release_timeout(gpointer user_data)
*
* Workaround this problem by delaying the release event by 0.5 sec,
* unless the no-release-on-regrab capability is present.
- * FIXME: protocol change to solve the conflict and set client priority.
*/
#define CLIPBOARD_RELEASE_DELAY 500 /* ms */
--
2.23.0

View File

@ -1,3 +1,3 @@
SHA512 (spice-gtk-0.37.tar.bz2) = a0a20bc6f25337d86e57fe1fc9586c4cc84457fc8c38cdcc5a728990a69018da0fca3ab5aa63349786b5a7508c82b716c94803eefb3495cffb7df4526db2d029 SHA512 (spice-gtk-0.38.tar.xz) = 27b44ac9f0cee2737ce03bb3f47c62fc0ee2402c291c49fc56cffc4ccb63e2cab001a68ba865a6375d82cb38444408d59c68469783ee4279fa818d8682e902f3
SHA512 (spice-gtk-0.37.tar.bz2.sig) = 2d9cecac89b1e0413ea390dae5c9e7e96cfbd4f00a941aa9df98502ff40aee90692fc86d5bf18ef4dd806b5f65618a5118cf2aa6dfe3b6ffda84cf40b33e80c9 SHA512 (spice-gtk-0.38.tar.xz.sig) = fd04d339a3e70b04494b58809c1b196bf17c1b7daaa25712ecca4a24afaaea1fe240d1b6d53f28ad961b1179ed7b9279426540704bdc2e807635816b5d9d25ca
SHA512 (victortoso-E37A484F.keyring) = 091755da8a358c8c8ebd3b5443b4b5eb3c260afed943454c085d48c973de6a42763547c321c64e4da5c1b2983ad0c5146aaeddeb1d54ef414f7e6a530a3bf14a SHA512 (victortoso-E37A484F.keyring) = 091755da8a358c8c8ebd3b5443b4b5eb3c260afed943454c085d48c973de6a42763547c321c64e4da5c1b2983ad0c5146aaeddeb1d54ef414f7e6a530a3bf14a

Binary file not shown.

View File

@ -1,44 +1,22 @@
#define _version_suffix #define _version_suffix
Name: spice-gtk Name: spice-gtk
Version: 0.37 Version: 0.38
Release: 6%{?dist} Release: 1%{?dist}
Summary: A GTK+ widget for SPICE clients Summary: A GTK+ widget for SPICE clients
License: LGPLv2+ License: LGPLv2+
URL: https://www.spice-space.org/spice-gtk.html URL: https://www.spice-space.org/spice-gtk.html
#VCS: git:git://anongit.freedesktop.org/spice/spice-gtk #VCS: git:git://anongit.freedesktop.org/spice/spice-gtk
Source0: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2 Source0: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.xz
Source1: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2.sig Source1: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.xz.sig
Source2: victortoso-E37A484F.keyring Source2: victortoso-E37A484F.keyring
Patch0001: 0001-vmcstream-Fix-buffer-overflow-sending-data-to-task.patch
# clipboard-race patches: together with patches for spice-protocol
# and spice-gtk these fix problems interacting with mutter's new
# clipboard manager
# https://bugzilla.redhat.com/show_bug.cgi?id=1755038
# all rebased by Jakub Janků:
# https://github.com/jjanku/spice-gtk/tree/clipboard-race
# https://patchwork.freedesktop.org/series/58353/
Patch0002: 0001-clipboard-do-not-release-between-client-grabs.patch
Patch0003: 0002-clipboard-do-not-release-between-remote-grabs.patch
# ???
Patch0004: 0003-fixup-clipboard-do-not-release-between-remote-grabs.patch
# https://patchwork.freedesktop.org/series/58418/#rev1
# edited to not require protocol version 0.14.1 as we didn't bump
# the version in spice-protocol when backporting the patches there
Patch0005: 0004-clipboard-do-not-delay-release-if-agent-has-no-relea.patch
Patch0006: 0005-clipboard-pre-condition-on-selection-value-256.patch
Patch0007: 0006-clipboard-implement-CAP_CLIPBOARD_GRAB_SERIAL.patch
Patch0008: 0001-build-egl-remove-libdrm-drm_fourcc.h.patch
Patch0009: 0001-meson-link-with-lm.patch
BuildRequires: git-core BuildRequires: git-core
BuildRequires: meson BuildRequires: meson
BuildRequires: intltool BuildRequires: intltool
BuildRequires: usbredir-devel >= 0.7.1 BuildRequires: usbredir-devel >= 0.7.1
BuildRequires: libusb1-devel >= 1.0.16 BuildRequires: libusb1-devel >= 1.0.21
BuildRequires: pixman-devel libjpeg-turbo-devel BuildRequires: pixman-devel libjpeg-turbo-devel
BuildRequires: opus-devel BuildRequires: opus-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
@ -57,7 +35,7 @@ BuildRequires: libphodav-devel
BuildRequires: lz4-devel BuildRequires: lz4-devel
BuildRequires: gtk3-devel BuildRequires: gtk3-devel
BuildRequires: json-glib-devel BuildRequires: json-glib-devel
BuildRequires: spice-protocol >= 0.12.15 BuildRequires: spice-protocol >= 0.14.1
BuildRequires: gstreamer1-devel >= 1.10 gstreamer1-plugins-base-devel >= 1.10 BuildRequires: gstreamer1-devel >= 1.10 gstreamer1-plugins-base-devel >= 1.10
BuildRequires: python3-six BuildRequires: python3-six
BuildRequires: python3-pyparsing BuildRequires: python3-pyparsing
@ -214,6 +192,9 @@ gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0}
%{_bindir}/spicy-stats %{_bindir}/spicy-stats
%changelog %changelog
* Mon Mar 16 2020 Victor Toso <victortoso@redhat.com> - 0.38-1
- Update to v0.38
* Tue Feb 25 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.37-6 * Tue Feb 25 2020 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.37-6
- Fix FTBFS https://bugzilla.redhat.com/show_bug.cgi?id=1800106 - Fix FTBFS https://bugzilla.redhat.com/show_bug.cgi?id=1800106