[Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Victor Toso
victortoso at redhat.com
Wed Dec 19 14:29:44 UTC 2018
From: Victor Toso <me at victortoso.com>
If SpiceGtkSession is holding the keyboard, that's huge indication
that we should not be requesting clipboard data yet. The proper time
to request it is when another application in the client machine is
asking for it, which means the user would switch to another
application to paste the guest's clipboard data.
This is default behavior over wayland.
Related: https://gitlab.freedesktop.org/spice/win32/vd_agent/issues/6
Related: https://gitlab.freedesktop.org/spice/linux/vd_agent/issues/9
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1594876
Signed-off-by: Victor Toso <victortoso at redhat.com>
Tested-by: James Harvey @jamespharvey20
---
src/spice-gtk-session.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 1ccae07..0d3438c 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -645,9 +645,11 @@ static void clipboard_owner_change(GtkClipboard *clipboard,
if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(self))
break;
+
s->clipboard_by_guest[selection] = FALSE;
s->clip_hasdata[selection] = TRUE;
- if (s->auto_clipboard_enable && !read_only(self))
+ if (s->auto_clipboard_enable && !read_only(self) &&
+ !spice_gtk_session_get_keyboard_has_focus(self))
gtk_clipboard_request_targets(clipboard, clipboard_get_targets,
get_weak_ref(self));
break;
--
2.19.2
More information about the Spice-devel
mailing list