From nobody Sun May 19 01:43:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155315282997137.228094939412586; Thu, 21 Mar 2019 00:20:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:60696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6rzx-0000gI-Na for importer@patchew.org; Thu, 21 Mar 2019 03:20:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ryb-0008OJ-2D for qemu-devel@nongnu.org; Thu, 21 Mar 2019 03:18:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6rqF-0007ZM-2j for qemu-devel@nongnu.org; Thu, 21 Mar 2019 03:10:21 -0400 Received: from pv50p00im-hyfv10011601.me.com ([17.58.6.43]:44904) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6rqE-0007Fv-QD for qemu-devel@nongnu.org; Thu, 21 Mar 2019 03:10:19 -0400 Received: from [172.18.2.102] (unknown [36.106.167.8]) by pv50p00im-hyfv10011601.me.com (Postfix) with ESMTPSA id B95A63802B1; Thu, 21 Mar 2019 07:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1553152213; bh=a1qu7ebzTnspeMTRLUDcFjG19gNhl03gUx9nrXCxNSM=; h=From:Content-Type:Mime-Version:Subject:Message-Id:Date:To; b=U74KefokEhsY96f/kDN+iCIbvf/rM4Wr9qMJeNcSvs9QbGX1tfAM0EW22feE4XQZd Ar1iJdtDT/Kp4jTzNzdHUUsvwyxOYHzuOMIgS2hLlsV0MAfwbMmTiUSevruqeQxbju IF1XLujGFTavoWeiUSy6SNh85gD4ipJ2kRV34tYjUZqtwxHvKy+jXtkLY1mxHcWpOO uFuFnKYWWcj0CibnGPNcdIKKiOcUh2IXzUA58mH5F5DwBkZNvh2H1+lHG2Zg+DWhC2 7Alqn5kYrl5j6Nf/ElSXAeeAkQj8CZuHe+6PolN7YgCzpT3JTHsX+SFWNF/LpTUk5y GxTKHfbWFXmxw== Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Message-Id: <176E53D9-50B8-405C-82FF-5247342264C1@me.com> Date: Thu, 21 Mar 2019 15:10:05 +0800 To: qemu-devel@nongnu.org X-Mailer: Apple Mail (2.3445.102.3) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-21_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=771 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1812120000 definitions=main-1903210052 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.6.43 Subject: [Qemu-devel] [PATCH] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chen Zhang via Qemu-devel Reply-To: Chen Zhang Cc: Peter Maydell , Gerd Hoffmann 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" In fullscreen mode, the window property of cocoaView may not be the key window, and the current implementation would not grab mouse in fullscreen mode after left clicks on relative input devices. This patch used isFullscreen value as a short-cirtuit condition for relative input device grabbing. Note that this patch should be tested after applying a previous patch which fixed event location conversion for relative input devices. Signed-off-by: Chen Zhang --- ui/cocoa.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 420b2411c1..51463bb931 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -862,7 +862,12 @@ QemuCocoaView *cocoaView; case NSEventTypeLeftMouseUp: mouse_event =3D true; if (!isMouseGrabbed && [self screenContainsPoint:p]) { - if([[self window] isKeyWindow]) { + /* + * In fullscreen mode, the window of cocoaView may not be = the + * key window, therefore the position relative to the virt= ual + * screen alone will be sufficient. + */ + if(isFullscreen || [[self window] isKeyWindow]) { [self grabMouse]; } } --=20 2.19.2