[Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily

Victor Toso victortoso at redhat.com
Fri Dec 21 09:23:04 UTC 2018


Hi,

On Thu, Dec 20, 2018 at 06:36:02PM +0100, Christophe Fergeau wrote:
> Hey,
> 
> With this patch applied, I cannot seem to be able to copy from client to
> guest when using wayland.
> 
> Christophe

You are right... I thought I had tested it properly...

> On Wed, Dec 19, 2018 at 03:29:44PM +0100, Victor Toso wrote:
> > 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
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20181221/0d36f990/attachment.sig>


More information about the Spice-devel mailing list