From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25083C433DB for ; Wed, 24 Mar 2021 10:27:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4406C619C0 for ; Wed, 24 Mar 2021 10:27:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4406C619C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lP0jh-0006iv-2H for qemu-devel@archiver.kernel.org; Wed, 24 Mar 2021 06:27:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lP0ia-0006Eh-O3 for qemu-devel@nongnu.org; Wed, 24 Mar 2021 06:26:28 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:34558) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lP0iW-0006bU-0e for qemu-devel@nongnu.org; Wed, 24 Mar 2021 06:26:28 -0400 Received: by mail-ej1-x635.google.com with SMTP id b7so31964871ejv.1 for ; Wed, 24 Mar 2021 03:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UKKn27vZ14/A55czGc82jsfliWNOiR+sbXhUIfwQcjI=; b=MhTQPY8sz4NCRWsEJRyN7dPtljc5RKr27REWuNp4+OqFm3+oQ3CIYi5B+S+zu0riQo Hsm7xCMMmGX0VfkFOxat67DodGGpHc+uDfi6UHUlBRRwsKJh6OqTJe5jZWdBiJ2qe7OU TdcOBE48enPEW815zCjz+v0SEyF6+kjjIYynY4gJzDjdr9cc29DVja8JMG+JEWgs1vbo XAzA+CacBSKjORFPBHZtl6gseebZOTPjcOWNUqYVi+edh9uhxYyqi3xR+TlRaO78C9UC 2x8UN3oyi/YYGlt2AbpDokNAGRYxaUEElnhxLGJHUWznGfyqjdzCYdNXqTddtejaRzkK GW9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UKKn27vZ14/A55czGc82jsfliWNOiR+sbXhUIfwQcjI=; b=IMGiRBJ/x8d/zvNFsiEt0RCbx2PMZNDUt2SqaB1OcR93NptW/lxbhjFg1VQbi2r+CY uAda1fmvaEtv6mmqTAR6lKj1riWZeWthQCzmQOYGCWmobt5ljj+0XrArnngVFI5G/flc LjX+zFypwKXK3PdCLZQRyGgcxkz/Wx9r3Wv1Eh5ahshVrZ3vRHVkfA8/G3VaLcxvSi+1 dYt3D05d0izkIi/weCanbUrxr5aqoDu4AVSVW/oFau2GdB5aBQ53lJ6AzNu86m5M+TFA CMIFeX+YUkQbkvxY6dT8skBatQzw2ldSbtErb39bDO04ah9Xue2z9efFCxdSTTAyDvt3 haPw== X-Gm-Message-State: AOAM533htZ/6+Fhu/rhu3iHB2nv1Rjmv4seX+DsoeGrdPL/yzF+q6OUX S+r2v0BlqgHXWah4jh5SG53OBhvqEVGbOiaIsQI= X-Google-Smtp-Source: ABdhPJzQZZHiOg/HzoDQZbNFnEeISC5stcOhH7t5W6p4VMgB88FwZRIF/EmyMv4G2xWdObVuYOg/TKyV/TijYqaI7hk= X-Received: by 2002:a17:906:4e99:: with SMTP id v25mr2855728eju.532.1616581581855; Wed, 24 Mar 2021 03:26:21 -0700 (PDT) MIME-Version: 1.0 References: <20210318091647.3233178-1-kraxel@redhat.com> <20210318091647.3233178-8-kraxel@redhat.com> <20210324101650.irnpfnklksfnejic@sirius.home.kraxel.org> In-Reply-To: <20210324101650.irnpfnklksfnejic@sirius.home.kraxel.org> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Wed, 24 Mar 2021 14:26:10 +0400 Message-ID: Subject: Re: [PATCH v2 7/7] ui/gtk: add clipboard support To: Gerd Hoffmann Content-Type: multipart/alternative; boundary="000000000000efe08d05be45baed" Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=marcandre.lureau@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , QEMU , Markus Armbruster Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000efe08d05be45baed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Wed, Mar 24, 2021 at 2:16 PM Gerd Hoffmann wrote: > Hi, > > > > + if (gd->cbowner[s]) { > > > + /* ignore notifications about our own grabs */ > > > + return; > > > + } > > > + > > > + > > > + switch (event->owner_change.reason) { > > > + case GDK_SETTING_ACTION_NEW: > > > + info =3D qemu_clipboard_info_new(&gd->cbpeer, s); > > > + if (gtk_clipboard_wait_is_text_available(clipboard)) { > > > + info->types[QEMU_CLIPBOARD_TYPE_TEXT].available =3D true= ; > > > + } > > > > > > > Same comment as v1: > > So after gtk_clipboard_set_text() the client side is actually taking > > the ownership away from the guest clipboard I presume. That might have > some > > weird interaction issues. Hopefully the other side isn't playing the sa= me > > game... > > The cbowner check above should avoid that ... > I fail to see how that works, imagine the other end is the same code (qemu in the guest), it will take clipboard ownership and it is in a endless loop, isn't it? > > > > + gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD] =3D > > > + gtk_clipboard_get(gdk_atom_intern("CLIPBOARD", FALSE)); > > > > Why not use GDK_SELECTION_* ? > > So I don't have to worry about converting GDK_SELECTION_* to > QEMU_CLIPBOARD_SELECTION_* ? > > GDK_SELECTION* is gdk_atom_intern(*, FALSE)) afaik --=20 Marc-Andr=C3=A9 Lureau --000000000000efe08d05be45baed Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Wed, Mar 24, 2021 at 2:16 PM Ger= d Hoffmann <kraxel@redhat.com&g= t; wrote:
=C2=A0= Hi,

> > +=C2=A0 =C2=A0 if (gd->cbowner[s]) {
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* ignore notifications about our ow= n grabs */
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
> > +=C2=A0 =C2=A0 }
> > +
> > +
> > +=C2=A0 =C2=A0 switch (event->owner_change.reason) {
> > +=C2=A0 =C2=A0 case GDK_SETTING_ACTION_NEW:
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 info =3D qemu_clipboard_info_new(&am= p;gd->cbpeer, s);
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (gtk_clipboard_wait_is_text_avail= able(clipboard)) {
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 info->types[QEMU_CL= IPBOARD_TYPE_TEXT].available =3D true;
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> >
>
> Same comment as v1:
> So after gtk_clipboard_set_text() the client side is actually taking > the ownership away from the guest clipboard I presume. That might have= some
> weird interaction issues. Hopefully the other side isn't playing t= he same
> game...

The cbowner check above should avoid that ...

I fail to see how that works, imagine the other end is the same code= (qemu in the guest), it will take clipboard ownership and it is in a endle= ss loop, isn't it?

> > +=C2=A0 =C2=A0 gd->gtkcb[QEMU_CLIPBOARD_SELECTION_CLIPBOARD] = =3D
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 gtk_clipboard_get(gdk_atom_intern(&q= uot;CLIPBOARD", FALSE));
>
> Why not use GDK_SELECTION_* ?

So I don't have to worry about converting GDK_SELECTION_* to
QEMU_CLIPBOARD_SELECTION_* ?


GDK_SELECTION* is gdk_atom_intern(*, FALSE)= ) afaik

--
Marc= -Andr=C3=A9 Lureau
--000000000000efe08d05be45baed--