From nobody Sun May 5 23:28:51 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=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 1677572740048783.284727574185; Tue, 28 Feb 2023 00:25:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWvIU-0003Db-VI; Tue, 28 Feb 2023 03:25:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWvIU-0003DO-1a for qemu-devel@nongnu.org; Tue, 28 Feb 2023 03:25:18 -0500 Received: from [157.82.194.14] (helo=aki-MacBook-Air.local) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWvIS-0006IC-Go for qemu-devel@nongnu.org; Tue, 28 Feb 2023 03:25:17 -0500 Received: by aki-MacBook-Air.local (Postfix, from userid 501) id 6B7B871026A; Tue, 28 Feb 2023 17:25:11 +0900 (JST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Gustavo Noronha Silva , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Akihiko Odaki Subject: [PATCH] ui/cocoa: Override windowDidResignKey Date: Tue, 28 Feb 2023 17:24:32 +0900 Message-Id: <20230228082432.872-1-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 157.82.194.14 (failed) 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=157.82.194.14; envelope-from=person@aki-MacBook-Air.local; helo=aki-MacBook-Air.local X-Spam_score_int: 25 X-Spam_score: 2.5 X-Spam_bar: ++ X-Spam_report: (2.5 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NO_DNS_FOR_FROM=0.001, RCVD_IN_SBL_CSS=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1677572741985100002 Content-Type: text/plain; charset="utf-8" This fixes pressed keys being stuck when the deck is clicked and the window loses focus. In the past, Gustavo Noronha Silva also had a patch to fix this issue though it only ungrabs mouse and does not release keys, and depends on another out-of-tree patch: https://github.com/akihikodaki/qemu/pull/3/commits/e906a80147b1dc6d4f31b6a0= 8064ef9871a2b76c Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 52e750f8a29..ac1cee09cd0 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1330,10 +1330,15 @@ - (BOOL)windowShouldClose:(id)sender return NO; } =20 -/* Called when QEMU goes into the background */ -- (void) applicationWillResignActive: (NSNotification *)aNotification +/* + * Called when QEMU goes into the background. Note that + * [-NSWindowDelegate windowDidResignKey:] is used here instead of + * [-NSApplicationDelegate applicationWillResignActive:] because it cannot + * detect that the window loses focus when the deck is clicked on macOS 13= .2.1. + */ +- (void) windowDidResignKey: (NSNotification *)aNotification { - COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n"); + COCOA_DEBUG("%s\n", __func__); [cocoaView ungrabMouse]; [cocoaView raiseAllKeys]; } --=20 2.37.1 (Apple Git-137.1)