From patchwork Tue Jun 4 09:36:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)\" via" X-Patchwork-Id: 10974515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 454F92D49 for ; Tue, 4 Jun 2019 09:38:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3224D20000 for ; Tue, 4 Jun 2019 09:38:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 224CB287CB; Tue, 4 Jun 2019 09:38:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C458020000 for ; Tue, 4 Jun 2019 09:38:13 +0000 (UTC) Received: from localhost ([127.0.0.1]:49405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hY5tV-0001lb-4m for patchwork-qemu-devel@patchwork.kernel.org; Tue, 04 Jun 2019 05:38:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hY5sE-0000qP-Sr for qemu-devel@nongnu.org; Tue, 04 Jun 2019 05:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hY5sC-0004kc-Vw for qemu-devel@nongnu.org; Tue, 04 Jun 2019 05:36:53 -0400 Received: from pv50p00im-ztdg10021901.me.com ([17.58.6.55]:42933) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hY5sC-0004hh-Ec for qemu-devel@nongnu.org; Tue, 04 Jun 2019 05:36:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1559641010; bh=qDQqvEUK1Ku+l8atD8lNJCpwoCM1Zj4XsvaD6ib62mY=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To; b=zj156XFD8rsQG1Z+eewq9CR9VACWCS15MTcJj5B1tCAwG09fF0JJCJFPkK3x8ONGB YYyIaZYWta6+5hwPu6LVIZacDwabzxoDY5W6yfeKeH1M5OiiFIQL7Krs+7GUcfQV8b u4u9R4qq+rPTk1xfjObTqqXXATaGJlo+yzKmXMIc1shwqsAEiH3r+5Rln9Slb2ndI/ 2UhHFNBzNFsLHUD1RsYUT8/9B6AEx5j4OelLwRwibezPEvNoCsEo4EG4Sls9cJnXPP s0ZraHikpedOPMSSyfHbuT/tA83pgR1iYjnMxGHp+A9ZSQ/deV2T7xhXSku2TPXBLR jG2sGzIPX5zpg== Received: from [172.18.2.102] (unknown [36.106.167.139]) by pv50p00im-ztdg10021901.me.com (Postfix) with ESMTPSA id 62E2A880A96; Tue, 4 Jun 2019 09:36:49 +0000 (UTC) Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: Date: Tue, 4 Jun 2019 17:36:48 +0800 Message-Id: <2D2F1191-E82F-4B54-A6E7-73FFB953DE93@me.com> References: To: Gerd Hoffmann , Peter Maydell X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-04_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=634 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1812120000 definitions=main-1906040064 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.6.55 Subject: [Qemu-devel] [PATCH 2/2] 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: , X-Patchwork-Original-From: Chen Zhang via Qemu-devel From: "Zhijian Li (Fujitsu)\" via" Reply-To: Chen Zhang Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In fullscreen mode, the window property of cocoaView may not be the key window, and the current implementation would not re-grab cursor by left click in fullscreen mode after ungrabbed in fullscreen mode with hot-key ctrl-opt-g. This patch used value of isFullscreen as a short-cirtuit condition for relative input device grabbing. 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 474d44cb9f..aa7cf07368 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -901,7 +901,12 @@ QemuCocoaView *cocoaView; case NSEventTypeLeftMouseUp: mouse_event = 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 virtual + * screen alone will be sufficient. + */ + if(isFullscreen || [[self window] isKeyWindow]) { [self grabMouse]; } }