Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Hi, On Thu, Jan 03, 2019 at 09:57:40AM +0100, Jakub Janku wrote: > Hi, > > > On Wed, Jan 2, 2019, 5:31 PM Victor Toso > > Hi, > > > > Thanks for taking a look! > > > > On Sun, Dec 30, 2018 at 10:23:02PM +0100, Jakub Janku wrote: > > > Hi, > > > > > > On Wed, Dec 19, 2018 at 3:30 PM Victor Toso > > wrote: > > > > > > > > From: Victor Toso > > > > > > > > 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. > > > > > > > > > I'm having a rather hard time understanding this commit message. > > > I read it the following way: > > > "spice-gtk should not request clipboard data from vdagent, while > > > spice-gtk holds the keyboard focus" > > > However, what the patch actually does is that it makes sure that > > > spice-gtk doesn't send clipboard grab to vdagent, while spice-gtk > > > holds the keyboard focus. > > > > > > These 2 things seem rather unrelated. What am I missing? > > > > Client request for grab will make agent to look into clipboard > > data in the guest which would lead to VD_AGENT_CLIPBOARD_REQUEST > > being sent from agent to client. > > Exactly! So it's the agent requesting the CLIENT's data. But in > the commit message, you state "do not request GUEST's clipboard > data unnecessarily". Or isn't it? Sorry, I got confused while replying earlier. I hope it is better on v2 https://lists.freedesktop.org/archives/spice-devel/2019-January/046857.html > > I can reproduce the client requesting guest's clipboard data on > > X11/KDE multiple times while the user is just copy-paste between > > applications in the guest. The idea of this patch was to avoid > > those requests till the keyboard focus is lost, which means that > > user is trying to paste guest's clipboard data into another > > application in the client's OS. > > > > Let me know if it isn't clear! > > > > Makes sense to me to try to avoid such requests. But why are > those requests causing the issues described? See: https://gitlab.freedesktop.org/spice/win32/vd_agent/issues/6#note_85246 Problem is the possible race in the state of grab. The situation that I see this happening is caused due too many requests to clipboard data of the guest. One fix is to avoid doing that; Another is to improve the checks on both, client and agent. As mentioned earlier, we should only allow a client->agent data request if another application in the client is asking for it. There is probably different ways to get into a bad state but this patch (well, v2) helps the use cases I've been trying. Cheers, > > > Cheers, > > > Jakub > > > > Thanks again, > > Victor > > > > > > > > > > > > Signed-off-by: Victor Toso > > > > 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@lists.freedesktop.org > > > > https://lists.freedesktop.org/mailman/listinfo/spice-devel > > signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Hi, On Wed, Jan 2, 2019, 5:31 PM Victor Toso Hi, > > Thanks for taking a look! > > On Sun, Dec 30, 2018 at 10:23:02PM +0100, Jakub Janku wrote: > > Hi, > > > > On Wed, Dec 19, 2018 at 3:30 PM Victor Toso > wrote: > > > > > > From: Victor Toso > > > > > > 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. > > > > > > I'm having a rather hard time understanding this commit message. > > I read it the following way: > > "spice-gtk should not request clipboard data from vdagent, while > > spice-gtk holds the keyboard focus" > > However, what the patch actually does is that it makes sure that > > spice-gtk doesn't send clipboard grab to vdagent, while spice-gtk > > holds the keyboard focus. > > > > These 2 things seem rather unrelated. What am I missing? > > Client request for grab will make agent to look into clipboard > data in the guest which would lead to VD_AGENT_CLIPBOARD_REQUEST > being sent from agent to client. > Exactly! So it's the agent requesting the CLIENT's data. But in the commit message, you state "do not request GUEST's clipboard data unnecessarily". Or isn't it? > > I tried to avoid the grab first; I can also delay the clipboard > data request to a later time (like when the keyboard is out of > focus, as I suggested in the patch and explained below) > > > > This is default behavior over wayland. > > > > I can confirm that on Wayland, this patch breaks copy > > from client to guest. > > According to the Wayland docs, the windows should receive the > > owner-change event before the focus-in event ( > > > https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-data-sharing > > have a look at Data devices.Selection: "This event is also generated > > on a client immediately before it receives keyboard focus."). > > But as it turns out, gtk+ delays the event so that the focus-in event > > comes first ( > https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/gdk/wayland/gdkdevice-wayland.c > > check out the keyboard_handle_enter() ). > > So this patch will unfortunately need some changes in order to > > work on Wayland. > > Yep! > > > > 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 > > > > Could you please elaborate a bit more on why this patch solves these > issues? > > I can reproduce the client requesting guest's clipboard data on > X11/KDE multiple times while the user is just copy-paste between > applications in the guest. The idea of this patch was to avoid > those requests till the keyboard focus is lost, which means that > user is trying to paste guest's clipboard data into another > application in the client's OS. > > Let me know if it isn't clear! > Makes sense to me to try to avoid such requests. But why are those requests causing the issues described? > > > Cheers, > > Jakub > > Thanks again, > Victor > > > > > > > > Signed-off-by: Victor Toso > > > 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@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/spice-devel > ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Hi, Thanks for taking a look! On Sun, Dec 30, 2018 at 10:23:02PM +0100, Jakub Janku wrote: > Hi, > > On Wed, Dec 19, 2018 at 3:30 PM Victor Toso wrote: > > > > From: Victor Toso > > > > 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. > > > I'm having a rather hard time understanding this commit message. > I read it the following way: > "spice-gtk should not request clipboard data from vdagent, while > spice-gtk holds the keyboard focus" > However, what the patch actually does is that it makes sure that > spice-gtk doesn't send clipboard grab to vdagent, while spice-gtk > holds the keyboard focus. > > These 2 things seem rather unrelated. What am I missing? Client request for grab will make agent to look into clipboard data in the guest which would lead to VD_AGENT_CLIPBOARD_REQUEST being sent from agent to client. I tried to avoid the grab first; I can also delay the clipboard data request to a later time (like when the keyboard is out of focus, as I suggested in the patch and explained below) > > This is default behavior over wayland. > > I can confirm that on Wayland, this patch breaks copy > from client to guest. > According to the Wayland docs, the windows should receive the > owner-change event before the focus-in event ( > https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-data-sharing > have a look at Data devices.Selection: "This event is also generated > on a client immediately before it receives keyboard focus."). > But as it turns out, gtk+ delays the event so that the focus-in event > comes first ( > https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/gdk/wayland/gdkdevice-wayland.c > check out the keyboard_handle_enter() ). > So this patch will unfortunately need some changes in order to > work on Wayland. Yep! > > 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 > > Could you please elaborate a bit more on why this patch solves these issues? I can reproduce the client requesting guest's clipboard data on X11/KDE multiple times while the user is just copy-paste between applications in the guest. The idea of this patch was to avoid those requests till the keyboard focus is lost, which means that user is trying to paste guest's clipboard data into another application in the client's OS. Let me know if it isn't clear! > Cheers, > Jakub Thanks again, Victor > > > > Signed-off-by: Victor Toso > > 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@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Hi, On Wed, Dec 19, 2018 at 3:30 PM Victor Toso wrote: > > From: Victor Toso > > 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. > I'm having a rather hard time understanding this commit message. I read it the following way: "spice-gtk should not request clipboard data from vdagent, while spice-gtk holds the keyboard focus" However, what the patch actually does is that it makes sure that spice-gtk doesn't send clipboard grab to vdagent, while spice-gtk holds the keyboard focus. These 2 things seem rather unrelated. What am I missing? > This is default behavior over wayland. I can confirm that on Wayland, this patch breaks copy from client to guest. According to the Wayland docs, the windows should receive the owner-change event before the focus-in event ( https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-data-sharing have a look at Data devices.Selection: "This event is also generated on a client immediately before it receives keyboard focus."). But as it turns out, gtk+ delays the event so that the focus-in event comes first ( https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/gdk/wayland/gdkdevice-wayland.c check out the keyboard_handle_enter() ). So this patch will unfortunately need some changes in order to work on 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 Could you please elaborate a bit more on why this patch solves these issues? Cheers, Jakub > > Signed-off-by: Victor Toso > 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@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
On Thu, Dec 20, 2018 at 04:41:48PM -0500, james harvey wrote: > On Thu, Dec 20, 2018 at 12:36 PM Christophe Fergeau > wrote: > > Hey, > > > > With this patch applied, I cannot seem to be able to copy from client to > > guest when using wayland. > > > > Christophe > > I admit I only have a vague understanding of what Wayland is. I'm > using Xorg & Plasma on Arch Linux. Some Wayland packages are > installed (kwayland, kwayland-integration, wayland, wayland-protocols, > xorg-server-xwayland) becuase they're dependencies for several things > like gtk3, mesa, and vulkan-radeon. If I understand correctly, that's > just the protocol and library. Weston isn't installed. So, I'm not > 100% positive if these few Wayland packages on my system are being > used in any way, or if they sit unused since I'm not using Weston. Yeah, at the moment you have Plasma running on top of Xorg, if you were using wayland, Plasma would have to be ported to wayland, which means turning it in a wayland compositor (this is what gnome-shell did), or making it run on top of a wayland compositor such a Weston. Christophe signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
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 > > > > 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 > > 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@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
On Thu, Dec 20, 2018 at 12:36 PM Christophe Fergeau wrote: > Hey, > > With this patch applied, I cannot seem to be able to copy from client to > guest when using wayland. > > Christophe I admit I only have a vague understanding of what Wayland is. I'm using Xorg & Plasma on Arch Linux. Some Wayland packages are installed (kwayland, kwayland-integration, wayland, wayland-protocols, xorg-server-xwayland) becuase they're dependencies for several things like gtk3, mesa, and vulkan-radeon. If I understand correctly, that's just the protocol and library. Weston isn't installed. So, I'm not 100% positive if these few Wayland packages on my system are being used in any way, or if they sit unused since I'm not using Weston. Only having myself setup XOrg and Plasma, I've been using this patch for 3-4 days without any copy/paste issues of any kind. There was a work in progress patch I tried from https://gitlab.freedesktop.org/spice/win32/vd_agent/issues/6 which fixed the bug, but had the side effect you're having of not being able to copy from client to guest. But the next patch Victor submitted, the one in this email, kept the bug fixed and took care of being able to copy from client to guest again. I double checked, and the patch in this email is definitely the "next patch" I'm referring to, not the work in progress one. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Hey, With this patch applied, I cannot seem to be able to copy from client to guest when using wayland. Christophe On Wed, Dec 19, 2018 at 03:29:44PM +0100, Victor Toso wrote: > From: Victor Toso > > 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 > 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@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
Hi, On Wed, Dec 19, 2018 at 03:29:44PM +0100, Victor Toso wrote: > From: Victor Toso > > 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 > 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; > > + ^ Not sure how I missed this. > 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)); Cheers, > break; > -- > 2.19.2 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [spice-gtk] gtk-session: do not request guest's clipboard data unnecessarily
From: Victor Toso 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 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@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel