[Spice-devel] [spice-gtk] clipboard: don't request targets without owner on X11

Victor Toso victortoso at redhat.com
Mon Jan 28 10:20:33 UTC 2019


Hi,

On Sun, Jan 27, 2019 at 06:14:20PM +0100, Jakub Janků wrote:
> On X11, if the owner in GdkEventOwnerChange is set to NULL,
> it means there's no data in the clipboard, so it's pointless to
> request targets as the request will fail anyway.
> 
> On Wayland, owner is always NULL, so don't do anything there.

Patch seems fine. I did similar but using the focus; Marc-André
did similar but for all instead of targeting x11 on NULL owner.

CC'ing Marc-André.

> Signed-off-by: Jakub Janků <jjanku at redhat.com>
> ---
>  src/spice-gtk-session.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 1a19bca..b48f92a 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -674,6 +674,14 @@ static void clipboard_owner_change(GtkClipboard        *clipboard,
>      }
>  
>      s->clipboard_by_guest[selection] = FALSE;
> +
> +#ifdef GDK_WINDOWING_X11
> +    if (!event->owner && GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
> +        s->clip_hasdata[selection] = FALSE;
> +        return;
> +    }
> +#endif
> +
>      s->clip_hasdata[selection] = TRUE;
>      if (s->auto_clipboard_enable && !read_only(self))
>          gtk_clipboard_request_targets(clipboard, clipboard_get_targets,
> -- 
> 2.20.1
> 
> _______________________________________________
> 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/20190128/735f06c6/attachment.sig>


More information about the Spice-devel mailing list