From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466408; cv=none; d=zohomail.com; s=zohoarc; b=fCnMHn7ZRgBv2kYk6CrJYyMBHZG3XbTKZ1o95EtlPJJ3AD4ZChLLUvrGah3D8M/bkwh7TCZEcGk5RxjivFItdScl3EKzIE57SKEAn0pReJ74GphMeBDHyOvfcrtOY6O7YxKeZJ0o62a99V73hxtrnM8RDBcdL+vM+tn4fnuxq9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466408; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JihjGTtofNKogPSCm5rbbenl0j50JTKYUFKe3OPEnaw=; b=Zqx21rMtcU4eu/rfgqxzy+lHPRMCVAdKDzKDHcS7KY/yXUYURYtFvXAHFBVUmMvJonR2FIUuPKmXxu5jrsfkWnV+vG7G4r0nbMI4IdQLcDqD/mcm2lwuZkO/U4tdIS2fREPC+cd1pQtIFp3Yb5WOgd8vgs+Mx+G3dHFwWVgVYnw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615466408359605.3459477486764; Thu, 11 Mar 2021 04:40:08 -0800 (PST) Received: from localhost ([::1]:48076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKbn-000067-8m for importer@patchew.org; Thu, 11 Mar 2021 07:40:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKWD-0003fk-KH for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKW5-0006Uf-Kc for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:21 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-Y9Umt1kPOkOIner9GzapMw-1; Thu, 11 Mar 2021 07:34:07 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1683800D55; Thu, 11 Mar 2021 12:34:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C2945D9F0; Thu, 11 Mar 2021 12:34:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BAFED180090D; Thu, 11 Mar 2021 13:34:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JihjGTtofNKogPSCm5rbbenl0j50JTKYUFKe3OPEnaw=; b=QWIA/hVm6tyawbZjwDv9EXhaUtSvLqjCVuQdqPcr/VLwe1cWR1BPUUMqcUHbfnJJogCX6Y 9x+ixKF9l2WTheq/ZkKRvDbJNuwhbUiswWSsqQVlNBxN6YytBjPnRLzE7dlC3Jm1CsT+Ag Udgz+y4azofgz/rIpFi0prwl9JSD/t8= X-MC-Unique: Y9Umt1kPOkOIner9GzapMw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 1/8] ui/gtk: Remove NULL checks in gd_switch Date: Thu, 11 Mar 2021 13:33:54 +0100 Message-Id: <20210311123401.340122-2-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki c821a58ee7 ("ui/console: Pass placeholder surface to display") eliminated the possibility that NULL is passed as surface to dpy_gfx_switch and removed some NULL checks from gd_switch, but the removal was not thoroughly. Remaining NULL checks were confusing for Coverity and probably also for humans. This change removes those NULL checks. Reported-by: Coverity (CID 1448421) Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Message-Id: <20210308140713.17901-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 3edaf041defc..eb1c9658e24f 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -547,9 +547,7 @@ static void gd_switch(DisplayChangeListener *dcl, VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); bool resized =3D true; =20 - trace_gd_switch(vc->label, - surface ? surface_width(surface) : 0, - surface ? surface_height(surface) : 0); + trace_gd_switch(vc->label, surface_width(surface), surface_height(surf= ace)); =20 if (vc->gfx.surface) { cairo_surface_destroy(vc->gfx.surface); @@ -560,7 +558,7 @@ static void gd_switch(DisplayChangeListener *dcl, vc->gfx.convert =3D NULL; } =20 - if (vc->gfx.ds && surface && + if (vc->gfx.ds && surface_width(vc->gfx.ds) =3D=3D surface_width(surface) && surface_height(vc->gfx.ds) =3D=3D surface_height(surface)) { resized =3D false; --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466122; cv=none; d=zohomail.com; s=zohoarc; b=ISXwhyBu4jrIUj9aQB0JW/w8sTNQAE3x39uXlipCQ8cFny+IRK+i/+tW5zpHHOJ/f0QMILKSvSShW8SXt15GBQ7hZiKD+li1k1bjXkCylDSjMCPrEv9CgMuUsFyRmob6x1gTKIxz/yyX/D+8lMdBkTx0G/4In10fU+vMPb7kuu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466122; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P+L7YQbwy1gscmlWUFrU9vilK/s9kgxl3T1aBqYNfmY=; b=RFkgZPLZMLRsN+RvFywkbK3PTZaonQ+weRr7uf4qid0TyG7E8ptAGoZTQXQKxaqgr1uBx1Z9BcP6O337Mbu58RROir8LrJYFNyyYAi3ELWaHab7gmLHnAd+w6iXtXjY/WMLbaSKqvwbWKegdoYIKROkGiN1wh3PqDuIVw94010s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615466122665116.03705953095152; Thu, 11 Mar 2021 04:35:22 -0800 (PST) Received: from localhost ([::1]:39272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKXB-0004cA-Bg for importer@patchew.org; Thu, 11 Mar 2021 07:35:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKW8-0003eQ-I0 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKW2-0006T7-OC for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:16 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-xhV1UK0nOMeNADAJTZciLw-1; Thu, 11 Mar 2021 07:34:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC259100C619; Thu, 11 Mar 2021 12:34:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DCEC610A8; Thu, 11 Mar 2021 12:34:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C5631180090E; Thu, 11 Mar 2021 13:34:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P+L7YQbwy1gscmlWUFrU9vilK/s9kgxl3T1aBqYNfmY=; b=XFSju1ceiunTuJSI5YZdcvZrU2CHRi1VkDrztJ5K5Ar7IEmAOogjj5IdtQYZsPmR6Nevxk 9QzJumj6xlp8D0V7EtNAQKHFJHDoRrpVCG+iOYWgGJgxc+Ii9tOtE45u71QZr3u3KOcTKB ZCywNB1E+9FswRXJqTMfvCOmU2ArRfs= X-MC-Unique: xhV1UK0nOMeNADAJTZciLw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 2/8] ui/cocoa: Use kCGColorSpaceSRGB Date: Thu, 11 Mar 2021 13:33:55 +0100 Message-Id: <20210311123401.340122-3-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki kCGColorSpaceGenericRGB | Apple Developer Documentation https://developer.apple.com/documentation/coregraphics/kcgcolorspacegeneric= rgb > Deprecated > Use kCGColorSpaceSRGB instead. This change also removes the legacy color space specification for PowerPC. Signed-off-by: Akihiko Odaki Message-Id: <20210305121304.65096-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index f27beb30e6ef..3e1a7b7d5195 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -463,13 +463,8 @@ QemuCocoaView *cocoaView; DIV_ROUND_UP(bitsPerPixel, 8) * 2, //bitsPerComponent bitsPerPixel, //bitsPerPixel stride, //bytesPerRow -#ifdef __LITTLE_ENDIAN__ - CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorsp= ace for OS X >=3D 10.4 - kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, -#else - CGColorSpaceCreateDeviceRGB(), //colorspace for OS X < 10.4 (a= ctually ppc) - kCGImageAlphaNoneSkipFirst, //bitmapInfo -#endif + CGColorSpaceCreateWithName(kCGColorSpaceSRGB), //colorspace + kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, //bit= mapInfo dataProviderRef, //provider NULL, //decode 0, //interpolate --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466123; cv=none; d=zohomail.com; s=zohoarc; b=h4bVwOOu9GwIHrP+Jlp72DOgy0AYY3WAfS2G03zpF/PVT26F8+blA6L/IuV/vuNJOfkQ0S/vh6U5SytnWpVVDAWDdq6AuFDC3SymVWb3POCt1kdbKEijVHD6l8q948+6y7HDtlGPD5UHvFGVaMZG7DcXq/bHBLlBAjQaGSNcLvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466123; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fqWaTZpnIHATPc2r743MOt+DSl901yNVtjaflApgjio=; b=FaYr9HyhEAlY5uXkGFM6EsCk5HR6ysHKe5jTyydJsjdlJV2l/H27zF9bw8Z9H0qfIqbo7OixiUyt0N2Z8Ram2N8g8fkX6gvQ8yVoykKuJBg8XwO/cTbo6YBybCJoDbmdikwhdn/xTtv+Gs6khjZXKRU7CSIw0jzNMrPs0lI2U/o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161546612324075.5770554369251; Thu, 11 Mar 2021 04:35:23 -0800 (PST) Received: from localhost ([::1]:39318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKXC-0004dJ-4J for importer@patchew.org; Thu, 11 Mar 2021 07:35:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKW9-0003eZ-OF for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKW2-0006TN-Sw for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:17 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-191-9oc7zNCwPjipiFlOcfaMeQ-1; Thu, 11 Mar 2021 07:34:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AADEA107ACCA; Thu, 11 Mar 2021 12:34:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3730D610AE; Thu, 11 Mar 2021 12:34:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CF812180090F; Thu, 11 Mar 2021 13:34:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fqWaTZpnIHATPc2r743MOt+DSl901yNVtjaflApgjio=; b=NPXk+ytLBP1hzeCCSgunjszahp8axLgd78ng6MWjWHk9ff7AezA9oUkae98u1ua7G/cge6 m1N1jWXfmrx99udxdELiJr+adkz7nO6Q/d6jHFybnNPC/OAB8urYHpaVtNK36o/kVoNSIM JHg4NIjONKTth9zB4ZnkKjlGPifXbQ4= X-MC-Unique: 9oc7zNCwPjipiFlOcfaMeQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 3/8] docs: Fix removal text of -show-cursor Date: Thu, 11 Mar 2021 13:33:56 +0100 Message-Id: <20210311123401.340122-4-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Thomas Huth , Gerd Hoffmann , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Thomas Huth We should say now when it was removed, not when it was deprecated. Signed-off-by: Thomas Huth Reviewed-by: Markus Armbruster Message-Id: <20210310045821.1004396-1-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- docs/system/removed-features.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/system/removed-features.rst b/docs/system/removed-feature= s.rst index 4dcf4f924cf9..83148dcfda6a 100644 --- a/docs/system/removed-features.rst +++ b/docs/system/removed-features.rst @@ -26,8 +26,8 @@ The ``-no-kvm`` argument was a synonym for setting ``-mac= hine accel=3Dtcg``. The ``-realtime mlock=3Don|off`` argument has been replaced by the ``-overcommit mem-lock=3Don|off`` argument. =20 -``-show-cursor`` option (since 5.0) -''''''''''''''''''''''''''''''''''' +``-show-cursor`` option (removed in 6.0) +'''''''''''''''''''''''''''''''''''''''' =20 Use ``-display sdl,show-cursor=3Don``, ``-display gtk,show-cursor=3Don`` or ``-display default,show-cursor=3Don`` instead. --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466241; cv=none; d=zohomail.com; s=zohoarc; b=bqP/WwN9ZjyTrGL1f6SEUNYL6xG4OPz433J+BzoQuJUe7ynDkitrOy0Zwoqyu3Em0AcrovfiBaAh5uZQzhr9x/jbaUHzlW5nsd5WRhhgH8npKo20xJpEDSYZK3SNywHD4+e3gIMzW6pVXkTSLqSXTvkQnrsYxRzs7tayaSPzXuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466241; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FPCr3e1ARcmuTN0U2o/fY9E5DXoAaP5pJ5sp8U5Mm40=; b=LrApEvh95Tnehuei4Fx5hcf3GbuTmdJ8FLqoYxPpOdybfHbSLleNP9aW67EXNFWnSfFFS2RxeFvs0tscWtxrZ4Xwn5ae9ohaKq66bDN8EaXyOsy2z0v1zKcyG/nL9VDv4Xz9BL1S71+H+qBOiqxYJYiiwz7+Kfa/dIU3OKMRRoA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615466241151311.6954569956339; Thu, 11 Mar 2021 04:37:21 -0800 (PST) Received: from localhost ([::1]:43638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKZ6-0006bU-49 for importer@patchew.org; Thu, 11 Mar 2021 07:37:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKWB-0003f7-Ly for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKW5-0006Uc-Kn for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:19 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-528-h8d3TcsDPue9nUY34pgThA-1; Thu, 11 Mar 2021 07:34:09 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AEED83E745; Thu, 11 Mar 2021 12:34:08 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 430071002393; Thu, 11 Mar 2021 12:34:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA0DF1800910; Thu, 11 Mar 2021 13:34:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FPCr3e1ARcmuTN0U2o/fY9E5DXoAaP5pJ5sp8U5Mm40=; b=NRHYaIlErv/Qu5Q6VHTmbMCMKpfBMRf/PYmJM/yUV07N53ZRtEUak7BnPsHjbJJVnVfezw n9HxheDzQ7Hgv9kiGFLguPbZTyFdRg9xM3dVpuzK69Jant2eNkVrp1zPOGlUnWOpT8C5cL PNNggjSeipebXgSAyoxo/HXoqPFHSpk= X-MC-Unique: h8d3TcsDPue9nUY34pgThA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 4/8] ui/cocoa: Show QEMU icon in the about window Date: Thu, 11 Mar 2021 13:33:57 +0100 Message-Id: <20210311123401.340122-5-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Signed-off-by: Akihiko Odaki Message-Id: <20210309122226.23117-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 3e1a7b7d5195..e589534fa460 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -39,6 +39,7 @@ #include "qapi/qapi-commands-misc.h" #include "sysemu/blockdev.h" #include "qemu-version.h" +#include "qemu/cutils.h" #include "qemu/main-loop.h" #include "qemu/module.h" #include @@ -1385,18 +1386,13 @@ QemuCocoaView *cocoaView; y =3D about_height - picture_height - 10; NSRect picture_rect =3D NSMakeRect(x, y, picture_width, picture_height= ); =20 - /* Get the path to the QEMU binary */ - NSString *binary_name =3D [NSString stringWithCString: gArgv[0] - encoding: NSASCIIStringEncoding]; - binary_name =3D [binary_name lastPathComponent]; - NSString *program_path =3D [[NSString alloc] initWithFormat: @"%@/%@", - [[NSBundle mainBundle] bundlePath], binary_name]; - /* Make the picture of QEMU */ NSImageView *picture_view =3D [[NSImageView alloc] initWithFrame: picture_rect]; - NSImage *qemu_image =3D [[NSWorkspace sharedWorkspace] iconForFile: - program_path]; + char *qemu_image_path_c =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/h= icolor/512x512/apps/qemu.png"); + NSString *qemu_image_path =3D [NSString stringWithUTF8String:qemu_imag= e_path_c]; + g_free(qemu_image_path_c); + NSImage *qemu_image =3D [[NSImage alloc] initWithContentsOfFile:qemu_i= mage_path]; [picture_view setImage: qemu_image]; [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown]; [superView addSubview: picture_view]; --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466408; cv=none; d=zohomail.com; s=zohoarc; b=B9FVjKC+PeuFhN1OZmf8QyIUGmuDXXQhrtnvbg1/Hz/m+iYgqPrytRUeTMHdjd7CEz5brKw0t4wHEPwJOri/ieb3ZZSq2IvarTOWRH+yORgSG8As92W4TmAP3d3Iw4OqmCXj7BujPnynhqQFMCPmnXxMkX2G5sYIwqqUV7ojqKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466408; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hItlt2rz+ypHQJ0JcSDbJEMqcGZ5UqN4LOprhKfFsEU=; b=fDrNokiszg7/8Bb9KaTV/I2m++QnlNNEuJRozOuSZxI6XfpHZgydXFDXlqeDHlQOnVBwvDWor4qzbMluGMQxNIaB/7A+omGsDqQDpgC3NALxPpGgaiJX2mlYoKfZaKCacED7PHQfw1RAkm4Rbn19fiSMv3fUNLArFQJDLLWSrGY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615466408206712.7544603996594; Thu, 11 Mar 2021 04:40:08 -0800 (PST) Received: from localhost ([::1]:48036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKbm-00004x-UM for importer@patchew.org; Thu, 11 Mar 2021 07:40:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKWB-0003f1-JR for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60306) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKW5-0006Uh-KA for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-365-VVbw03LlNX2z1QBEgi8ftg-1; Thu, 11 Mar 2021 07:34:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 829E919253C6; Thu, 11 Mar 2021 12:34:08 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 498425DAA5; Thu, 11 Mar 2021 12:34:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E4A551800911; Thu, 11 Mar 2021 13:34:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hItlt2rz+ypHQJ0JcSDbJEMqcGZ5UqN4LOprhKfFsEU=; b=Hf9L3C7Xwyu/op96xMuKyLGLRg+5QmlVPZYpqNWVOFSY84NzgkLsKHeA/O8kMHiK63fbC8 EYTS0ffF9T6Yaiqm7Xwi63jK0aiMcyQKmaUMTgNiRutOAyiPC7Nzfw+LiUiYdt++B9LHif HA8WEvPBYoFZP9371oqu7F3cGDIjQ64= X-MC-Unique: VVbw03LlNX2z1QBEgi8ftg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 5/8] ui/cocoa: Do not rely on the first argument Date: Thu, 11 Mar 2021 13:33:58 +0100 Message-Id: <20210311123401.340122-6-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki The first argument of the executable was used to get its path, but it is not reliable because the executer can specify any arbitrary string. Use the interfaces provided by QEMU and the platform to get those paths. Signed-off-by: Akihiko Odaki Message-Id: <20210309122226.23117-2-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index e589534fa460..4753bb2f8800 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1398,20 +1398,21 @@ QemuCocoaView *cocoaView; [superView addSubview: picture_view]; =20 /* Make the name label */ - x =3D 0; - y =3D y - 25; - int name_width =3D about_width, name_height =3D 20; - NSRect name_rect =3D NSMakeRect(x, y, name_width, name_height); - NSTextField *name_label =3D [[NSTextField alloc] initWithFrame: name_r= ect]; - [name_label setEditable: NO]; - [name_label setBezeled: NO]; - [name_label setDrawsBackground: NO]; - [name_label setAlignment: NSTextAlignmentCenter]; - NSString *qemu_name =3D [[NSString alloc] initWithCString: gArgv[0] - encoding: NSASCIIStringEncodin= g]; - qemu_name =3D [qemu_name lastPathComponent]; - [name_label setStringValue: qemu_name]; - [superView addSubview: name_label]; + NSBundle *bundle =3D [NSBundle mainBundle]; + if (bundle) { + x =3D 0; + y =3D y - 25; + int name_width =3D about_width, name_height =3D 20; + NSRect name_rect =3D NSMakeRect(x, y, name_width, name_height); + NSTextField *name_label =3D [[NSTextField alloc] initWithFrame: na= me_rect]; + [name_label setEditable: NO]; + [name_label setBezeled: NO]; + [name_label setDrawsBackground: NO]; + [name_label setAlignment: NSTextAlignmentCenter]; + NSString *qemu_name =3D [[bundle executablePath] lastPathComponent= ]; + [name_label setStringValue: qemu_name]; + [superView addSubview: name_label]; + } =20 /* Set the version label's attributes */ x =3D 0; --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466921; cv=none; d=zohomail.com; s=zohoarc; b=NGokdVdWDCj8hbiTn9I1WbVmHgLSdMT+yj0sOUcCALEOh3MrORPUatXB+EhWq88MvJBqY6L11t9ENAj5+kwdEHb/vaGjXQhZALi2+A03hnuaFlraNVKv9R0KmN7OBAaYUUDM+85mDukf266MaBpsp95IRqNIgJ0EQjx5RBxHILo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466921; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SXyaJitTiRl72VJ+WQzLF6+6PYZN+obAQTsIl9RZ35w=; b=a0HBq4gt0PabKuh63Z1FhyEXKDG+ipy/MukNDIQQWzzfGpB6F0pYe26+WimVu8uk6L8aFSx2Gi7fLONUHSkHThkbHevKWrAUF/Zt54I3vSen6bPCjuAXBMfXyoBwiS0L+RzWeDeJ+anHQ8x79zpbqxkHbclSz5tjyZV5gVXrlaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615466921633891.024211428374; Thu, 11 Mar 2021 04:48:41 -0800 (PST) Received: from localhost ([::1]:35986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKk4-0008H0-D3 for importer@patchew.org; Thu, 11 Mar 2021 07:48:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKWJ-0003jz-K1 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKW9-0006W6-EF for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:27 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-WuW9XrkfNwKmIsMk1p-KNw-1; Thu, 11 Mar 2021 07:34:12 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6A1A19253C3; Thu, 11 Mar 2021 12:34:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C3FC18B5E; Thu, 11 Mar 2021 12:34:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F08D31800912; Thu, 11 Mar 2021 13:34:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SXyaJitTiRl72VJ+WQzLF6+6PYZN+obAQTsIl9RZ35w=; b=Gw2ONiBhGpBbm4O6BDBD15zU+pi8rOQJF+4fexaj4XEwr0uMuNHpUdhq+MpRGIm2+7gk3o XfAuGPKNErkcqwg7rS/dheLqeYqzOxS60Vrjbg+Lsc7PD9JTmRGGHtdxR/oYWMEOueNeah i56xMDMkM9Pore6Dz5m7yPzIWP9gcrI= X-MC-Unique: WuW9XrkfNwKmIsMk1p-KNw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 6/8] ui/cocoa: Clear modifiers whenever possible Date: Thu, 11 Mar 2021 13:33:59 +0100 Message-Id: <20210311123401.340122-7-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki ui/cocoa does not receive NSEventTypeFlagsChanged when it is not active, and the modifier state can be desynchronized in such a situation. [NSEvent -modifierFlags] tells whether a modifier is *not* pressed, so check it whenever receiving an event and clear the modifier if it is not pressed. Note that [NSEvent -modifierFlags] does not tell if a certain modifier *is* pressed because the documented mask for [NSEvent -modifierFlags] generalizes left shift and right shift, for example. CapsLock is the only exception. The pressed state is synchronized only with NSEventTypeFlagsChanged. This change also removes modifier keys from keycode map. If they are input with NSEventTypeKeyDown or NSEventTypeKeyUp, it leads to desynchronization. Although such a situation is not observed, they are removed just in case. Moreover, QKbdState is introduced for automatic key state tracking. Thanks to Konstantin Nazarov for testing and finding a bug in this change: https://gist.github.com/akihikodaki/87df4149e7ca87f18dc56807ec5a1bc5#gistco= mment-3659419 Signed-off-by: Akihiko Odaki Message-Id: <20210310144602.58528-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 150 +++++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 73 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 4753bb2f8800..f71c59711fa6 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -30,6 +30,7 @@ #include "qemu-common.h" #include "ui/console.h" #include "ui/input.h" +#include "ui/kbd-state.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" #include "sysemu/cpu-throttle.h" @@ -190,14 +191,6 @@ const int mac_to_qkeycode_map[] =3D { [kVK_ANSI_Comma] =3D Q_KEY_CODE_COMMA, [kVK_ANSI_Period] =3D Q_KEY_CODE_DOT, [kVK_ANSI_Slash] =3D Q_KEY_CODE_SLASH, - [kVK_Shift] =3D Q_KEY_CODE_SHIFT, - [kVK_RightShift] =3D Q_KEY_CODE_SHIFT_R, - [kVK_Control] =3D Q_KEY_CODE_CTRL, - [kVK_RightControl] =3D Q_KEY_CODE_CTRL_R, - [kVK_Option] =3D Q_KEY_CODE_ALT, - [kVK_RightOption] =3D Q_KEY_CODE_ALT_R, - [kVK_Command] =3D Q_KEY_CODE_META_L, - [0x36] =3D Q_KEY_CODE_META_R, /* There is no kVK_RightCommand */ [kVK_Space] =3D Q_KEY_CODE_SPC, =20 [kVK_ANSI_Keypad0] =3D Q_KEY_CODE_KP_0, @@ -307,7 +300,7 @@ static void handleAnyDeviceErrors(Error * err) NSWindow *fullScreenWindow; float cx,cy,cw,ch,cdx,cdy; pixman_image_t *pixman_image; - BOOL modifiers_state[256]; + QKbdState *kbd; BOOL isMouseGrabbed; BOOL isFullscreen; BOOL isAbsoluteEnabled; @@ -354,6 +347,7 @@ QemuCocoaView *cocoaView; =20 screen.width =3D frameRect.size.width; screen.height =3D frameRect.size.height; + kbd =3D qkbd_state_init(dcl.con); =20 } return self; @@ -367,6 +361,7 @@ QemuCocoaView *cocoaView; pixman_image_unref(pixman_image); } =20 + qkbd_state_free(kbd); [super dealloc]; } =20 @@ -604,19 +599,8 @@ QemuCocoaView *cocoaView; } } =20 -- (void) toggleModifier: (int)keycode { - // Toggle the stored state. - modifiers_state[keycode] =3D !modifiers_state[keycode]; - // Send a keyup or keydown depending on the state. - qemu_input_event_send_key_qcode(dcl.con, keycode, modifiers_state[keyc= ode]); -} - -- (void) toggleStatefulModifier: (int)keycode { - // Toggle the stored state. - modifiers_state[keycode] =3D !modifiers_state[keycode]; - // Generate keydown and keyup. - qemu_input_event_send_key_qcode(dcl.con, keycode, true); - qemu_input_event_send_key_qcode(dcl.con, keycode, false); +- (void) toggleKey: (int)keycode { + qkbd_state_key_event(kbd, keycode, !qkbd_state_key_get(kbd, keycode)); } =20 // Does the work of sending input to the monitor @@ -710,57 +694,86 @@ QemuCocoaView *cocoaView; static bool switched_to_fullscreen =3D false; // Location of event in virtual screen coordinates NSPoint p =3D [self screenLocationOfEvent:event]; + NSUInteger modifiers =3D [event modifierFlags]; + + // emulate caps lock keydown and keyup + if (!!(modifiers & NSEventModifierFlagCapsLock) !=3D + qkbd_state_modifier_get(kbd, QKBD_MOD_CAPSLOCK)) { + qkbd_state_key_event(kbd, Q_KEY_CODE_CAPS_LOCK, true); + qkbd_state_key_event(kbd, Q_KEY_CODE_CAPS_LOCK, false); + } + + if (!(modifiers & NSEventModifierFlagShift)) { + qkbd_state_key_event(kbd, Q_KEY_CODE_SHIFT, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_SHIFT_R, false); + } + if (!(modifiers & NSEventModifierFlagControl)) { + qkbd_state_key_event(kbd, Q_KEY_CODE_CTRL, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_CTRL_R, false); + } + if (!(modifiers & NSEventModifierFlagOption)) { + qkbd_state_key_event(kbd, Q_KEY_CODE_ALT, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_ALT_R, false); + } + if (!(modifiers & NSEventModifierFlagCommand)) { + qkbd_state_key_event(kbd, Q_KEY_CODE_META_L, false); + qkbd_state_key_event(kbd, Q_KEY_CODE_META_R, false); + } =20 switch ([event type]) { case NSEventTypeFlagsChanged: - if ([event keyCode] =3D=3D 0) { - // When the Cocoa keyCode is zero that means keys should be - // synthesized based on the values in in the eventModifiers - // bitmask. - - if (qemu_console_is_graphic(NULL)) { - NSUInteger modifiers =3D [event modifierFlags]; + switch ([event keyCode]) { + case kVK_Shift: + if (!!(modifiers & NSEventModifierFlagShift)) { + [self toggleKey:Q_KEY_CODE_SHIFT]; + } + break; =20 - if (!!(modifiers & NSEventModifierFlagCapsLock) !=3D != !modifiers_state[Q_KEY_CODE_CAPS_LOCK]) { - [self toggleStatefulModifier:Q_KEY_CODE_CAPS_LOCK]; + case kVK_RightShift: + if (!!(modifiers & NSEventModifierFlagShift)) { + [self toggleKey:Q_KEY_CODE_SHIFT_R]; } - if (!!(modifiers & NSEventModifierFlagShift) !=3D !!mo= difiers_state[Q_KEY_CODE_SHIFT]) { - [self toggleModifier:Q_KEY_CODE_SHIFT]; + break; + + case kVK_Control: + if (!!(modifiers & NSEventModifierFlagControl)) { + [self toggleKey:Q_KEY_CODE_CTRL]; } - if (!!(modifiers & NSEventModifierFlagControl) !=3D !!= modifiers_state[Q_KEY_CODE_CTRL]) { - [self toggleModifier:Q_KEY_CODE_CTRL]; + break; + + case kVK_RightControl: + if (!!(modifiers & NSEventModifierFlagControl)) { + [self toggleKey:Q_KEY_CODE_CTRL_R]; } - if (!!(modifiers & NSEventModifierFlagOption) !=3D !!m= odifiers_state[Q_KEY_CODE_ALT]) { - [self toggleModifier:Q_KEY_CODE_ALT]; + break; + + case kVK_Option: + if (!!(modifiers & NSEventModifierFlagOption)) { + [self toggleKey:Q_KEY_CODE_ALT]; } - if (!!(modifiers & NSEventModifierFlagCommand) !=3D !!= modifiers_state[Q_KEY_CODE_META_L]) { - [self toggleModifier:Q_KEY_CODE_META_L]; + break; + + case kVK_RightOption: + if (!!(modifiers & NSEventModifierFlagOption)) { + [self toggleKey:Q_KEY_CODE_ALT_R]; } - } - } else { - keycode =3D cocoa_keycode_to_qemu([event keyCode]); - } + break; =20 - if ((keycode =3D=3D Q_KEY_CODE_META_L || keycode =3D=3D Q_KEY_= CODE_META_R) - && !isMouseGrabbed) { - /* Don't pass command key changes to guest unless mouse is g= rabbed */ - keycode =3D 0; - } + /* Don't pass command key changes to guest unless mouse is= grabbed */ + case kVK_Command: + if (isMouseGrabbed && + !!(modifiers & NSEventModifierFlagCommand)) { + [self toggleKey:Q_KEY_CODE_META_L]; + } + break; =20 - if (keycode) { - // emulate caps lock and num lock keydown and keyup - if (keycode =3D=3D Q_KEY_CODE_CAPS_LOCK || - keycode =3D=3D Q_KEY_CODE_NUM_LOCK) { - [self toggleStatefulModifier:keycode]; - } else if (qemu_console_is_graphic(NULL)) { - if (switched_to_fullscreen) { - switched_to_fullscreen =3D false; - } else { - [self toggleModifier:keycode]; - } - } + case kVK_RightCommand: + if (isMouseGrabbed && + !!(modifiers & NSEventModifierFlagCommand)) { + [self toggleKey:Q_KEY_CODE_META_R]; + } + break; } - break; case NSEventTypeKeyDown: keycode =3D cocoa_keycode_to_qemu([event keyCode]); @@ -800,7 +813,7 @@ QemuCocoaView *cocoaView; } =20 if (qemu_console_is_graphic(NULL)) { - qemu_input_event_send_key_qcode(dcl.con, keycode, true); + qkbd_state_key_event(kbd, keycode, true); } else { [self handleMonitorInput: event]; } @@ -815,7 +828,7 @@ QemuCocoaView *cocoaView; } =20 if (qemu_console_is_graphic(NULL)) { - qemu_input_event_send_key_qcode(dcl.con, keycode, false); + qkbd_state_key_event(kbd, keycode, false); } break; case NSEventTypeMouseMoved: @@ -999,17 +1012,8 @@ QemuCocoaView *cocoaView; */ - (void) raiseAllKeys { - const int max_index =3D ARRAY_SIZE(modifiers_state); - with_iothread_lock(^{ - int index; - - for (index =3D 0; index < max_index; index++) { - if (modifiers_state[index]) { - modifiers_state[index] =3D 0; - qemu_input_event_send_key_qcode(dcl.con, index, false); - } - } + qkbd_state_lift_all_keys(kbd); }); } @end --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466555; cv=none; d=zohomail.com; s=zohoarc; b=C+D1EJf7RCDzkunayEpl/bjSxMjvoysE+ra55xoj8IgEAwft8tgGT3HfBAjnYQst1f3P9V3E1U4QvIYzzLd2V6Mld8BLE8oM/rLc5sUADXpVg9AVoeW8JHK9ufFD55zVKnGJ0HGUF/VXlqu57+d8bnHxIfTt8FaZG2L52Z0+lfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466555; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5G1omCn4ptjXrwk/awhGBOcQJU+c3/g3eaqF0LyzqjY=; b=AE15Khqtiaei3nEpm4RHClTNgmLrpN1Ah5tO8ivj7gyxH0+dnYp+zMk/joNRinTOzVB44y2XjCQbvjhzrN/6aNUj4UUBvC4O8tAGWdAhExxC7D52ByWSkEuw2kP+aOrfkMxP8yhTcVQLawz0gxck3dSDu88COPRqL3+YD98CQqI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16154665550831002.3752638251885; Thu, 11 Mar 2021 04:42:35 -0800 (PST) Received: from localhost ([::1]:55462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKe8-0003qn-IN for importer@patchew.org; Thu, 11 Mar 2021 07:42:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKWH-0003gN-10 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKWA-0006WG-6H for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:24 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-MxoYDDdaPZiiyy3YW04Raw-1; Thu, 11 Mar 2021 07:34:12 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2BFB8030A0; Thu, 11 Mar 2021 12:34:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4DD45196E3; Thu, 11 Mar 2021 12:34:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0764E1800913; Thu, 11 Mar 2021 13:34:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5G1omCn4ptjXrwk/awhGBOcQJU+c3/g3eaqF0LyzqjY=; b=aP23+JmW2XlqOiAtMjB16j4NN5fk9vKhEJZcjDZROeV27RheVwHzfrZH7xzeyO8a0zrpC6 OWEW5YdDVfBA05ooVtZQl/GXCwwvGi6aLVhc4oltBpDmHjxjQPmyppVaJ6mdYSJ9ytfZvp nTJqv2keeVQL1kxE5ldYT3YgWU4N3vE= X-MC-Unique: MxoYDDdaPZiiyy3YW04Raw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 7/8] ui/cocoa: Mark variables static Date: Thu, 11 Mar 2021 13:34:00 +0100 Message-Id: <20210311123401.340122-8-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Signed-off-by: Akihiko Odaki Message-Id: <20210225084202.39601-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index f71c59711fa6..3af167f0712f 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -82,7 +82,7 @@ static void cocoa_switch(DisplayChangeListener *dcl, =20 static void cocoa_refresh(DisplayChangeListener *dcl); =20 -NSWindow *normalWindow, *about_window; +static NSWindow *normalWindow, *about_window; static const DisplayChangeListenerOps dcl_ops =3D { .dpy_name =3D "cocoa", .dpy_gfx_update =3D cocoa_update, @@ -95,11 +95,11 @@ static DisplayChangeListener dcl =3D { static int last_buttons; static int cursor_hide =3D 1; =20 -int gArgc; -char **gArgv; -bool stretch_video; -NSTextField *pauseLabel; -NSArray * supportedImageFileTypes; +static int gArgc; +static char **gArgv; +static bool stretch_video; +static NSTextField *pauseLabel; +static NSArray * supportedImageFileTypes; =20 static QemuSemaphore display_init_sem; static QemuSemaphore app_started_sem; @@ -137,7 +137,7 @@ static bool bool_with_iothread_lock(BoolCodeBlock block) } =20 // Mac to QKeyCode conversion -const int mac_to_qkeycode_map[] =3D { +static const int mac_to_qkeycode_map[] =3D { [kVK_ANSI_A] =3D Q_KEY_CODE_A, [kVK_ANSI_B] =3D Q_KEY_CODE_B, [kVK_ANSI_C] =3D Q_KEY_CODE_C, --=20 2.29.2 From nobody Sun May 19 15:58:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615466742; cv=none; d=zohomail.com; s=zohoarc; b=R2b+MHWJC9p0iqj4URsi4arZPlhouiRafljHuZagFLIjXqU0rtjEYSk7MHBp1LwKWWyU6UWf3krfmfuL+4hRTB7vqhDqQLNtZMBwmZmA2lA9MbrnfoScuwQKgxDWNjx1arl6uqajvJrlW/l+kbApGJe8BLEb8Po5Ju86cERxM7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615466742; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=To8A17QUJLYh0uveAu5VbheglTSlu/oogbKxNVlHls4=; b=R8VBCtgfRSVGjcvW/yeOe4R8yKVGD451ySjpqHkHTHfKnc3g7b1nBt01cJ+KnT+barvPSP+urpHgE9r8T7566zpDjAVCctgOMHCFbH4senBlk48OH5VLW8Gg7Kum1iHAEjLnnW9ZyQA2SKS+NNwn653aPU0kj3fzSx8BtpfGoJk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615466742650350.0873025524845; Thu, 11 Mar 2021 04:45:42 -0800 (PST) Received: from localhost ([::1]:33300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKKhB-0006m9-Kl for importer@patchew.org; Thu, 11 Mar 2021 07:45:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKKWF-0003gC-IX for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lKKWA-0006WH-6P for qemu-devel@nongnu.org; Thu, 11 Mar 2021 07:34:23 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-117-T65FOOrCMn6kWe14KlaHnA-1; Thu, 11 Mar 2021 07:34:13 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CCBA1100C61A; Thu, 11 Mar 2021 12:34:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C68F60853; Thu, 11 Mar 2021 12:34:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1245C1800914; Thu, 11 Mar 2021 13:34:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615466057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=To8A17QUJLYh0uveAu5VbheglTSlu/oogbKxNVlHls4=; b=IIUREMwfkC0EGzOYzBvLLBFaGta+uc/vJl0h7I+Y2bIXIAwRayjUWhhIozGx73hJBWIeUT mTCDSYjBPy+32V62MZz866JptxiKq96Bbc3Z61slSufI/9bHqarR685rNWnpcnjcKQJ8hr AyP0qmao23XcnzNCHmN31NylIrcza2c= X-MC-Unique: T65FOOrCMn6kWe14KlaHnA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 8/8] ui/cocoa: Fix mouse association state Date: Thu, 11 Mar 2021 13:34:01 +0100 Message-Id: <20210311123401.340122-9-kraxel@redhat.com> In-Reply-To: <20210311123401.340122-1-kraxel@redhat.com> References: <20210311123401.340122-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Peter Maydell , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki ui/cocoa deassociates the mouse input and the mouse cursor position only when relative movement inputs are expected. Such inputs may let the mouse cursor leave the view and cause undesired side effects if they are associated. On the other hand, the problem does not occur when inputting absolute points, and the association allows seamless cursor movement across views. However, the synchronization of the association and the expected input type was only done when grabbing the mouse. In reality, the state whether the emulated input device expects absolute pointing inputs or relative movement inputs can vary dynamically due to USB device hot-plugging, for example. This change adds association state updates according to input type expectation changes. It also removes an internal flag representing the association state because the state can now be determined with the current input type expectation and it only adds the complexity of the state tracking. Signed-off-by: Akihiko Odaki Message-Id: <20210222150714.21766-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 3af167f0712f..a7848ae0a30e 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -304,7 +304,6 @@ static void handleAnyDeviceErrors(Error * err) BOOL isMouseGrabbed; BOOL isFullscreen; BOOL isAbsoluteEnabled; - BOOL isMouseDeassociated; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; @@ -321,14 +320,9 @@ static void handleAnyDeviceErrors(Error * err) * isMouseGrabbed tracks whether GUI events are directed to the guest; * it controls whether special keys like Cmd get sent to the guest, * and whether we capture the mouse when in non-absolute mode. - * isMouseDeassociated tracks whether we've told MacOSX to disassociate - * the mouse and mouse cursor position by calling - * CGAssociateMouseAndMouseCursorPosition(FALSE) - * (which basically happens if we grab in non-absolute mode). */ - (BOOL) isMouseGrabbed; - (BOOL) isAbsoluteEnabled; -- (BOOL) isMouseDeassociated; - (float) cdx; - (float) cdy; - (QEMUScreen) gscreen; @@ -972,10 +966,7 @@ QemuCocoaView *cocoaView; [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to relea= se Mouse)"]; } [self hideCursor]; - if (!isAbsoluteEnabled) { - isMouseDeassociated =3D TRUE; - CGAssociateMouseAndMouseCursorPosition(FALSE); - } + CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled); isMouseGrabbed =3D TRUE; // while isMouseGrabbed =3D TRUE, QemuCocoaAp= p sends all events to [cocoaView handleEvent:] } =20 @@ -990,17 +981,18 @@ QemuCocoaView *cocoaView; [normalWindow setTitle:@"QEMU"]; } [self unhideCursor]; - if (isMouseDeassociated) { - CGAssociateMouseAndMouseCursorPosition(TRUE); - isMouseDeassociated =3D FALSE; - } + CGAssociateMouseAndMouseCursorPosition(TRUE); isMouseGrabbed =3D FALSE; } =20 -- (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {isAbsoluteEnabled = =3D tIsAbsoluteEnabled;} +- (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled { + isAbsoluteEnabled =3D tIsAbsoluteEnabled; + if (isMouseGrabbed) { + CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled); + } +} - (BOOL) isMouseGrabbed {return isMouseGrabbed;} - (BOOL) isAbsoluteEnabled {return isAbsoluteEnabled;} -- (BOOL) isMouseDeassociated {return isMouseDeassociated;} - (float) cdx {return cdx;} - (float) cdy {return cdy;} - (QEMUScreen) gscreen {return screen;} --=20 2.29.2