From patchwork Tue Mar 7 23:47:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 659894 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp38053wrb; Tue, 7 Mar 2023 15:50:35 -0800 (PST) X-Google-Smtp-Source: AK7set9bpxVnZ7dnDESRZmaFDtFI93Zizw/yjOdqBHm8pMnoWWTDqhUL/kEKCX1+3afAsJMFvu/y X-Received: by 2002:ac8:584d:0:b0:3bf:e129:8563 with SMTP id h13-20020ac8584d000000b003bfe1298563mr27094675qth.46.1678233034948; Tue, 07 Mar 2023 15:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678233034; cv=none; d=google.com; s=arc-20160816; b=H6mV2HNkqTNHVjjYth1CHKGuBm7MSOidhX8B1str9pBBu2zyg0pWKN4nmDiRQc5PAU +t2b9Lp1qt6kk+Vr0Zx10yxa9R3dV1e1oYQXEvEH9b9uO8bvaYSs8LGwmGsZz11rUC3R zzJS3GEEa0J9e6+3hA03YCibVUCupqf0RkqpKHki27j0hx2Cq2pDaYu/IusRL78qb9n9 BvsS7Wj1vi9eohjJnIDxgnrTiEEMfApAkcy9IisfbvIp4A1mKehPpcBreP8G562Ws91l mm3f/N0/6mv9ankEne68jQyRct0R2dZ0x2P6yoqz0M/AtKprc3Pod0N/bjNBn+veBnGD N/MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NiawUsU8t9iSDPAS2ynsYcKvAPuboz/5nBfIXoe6khg=; b=FunKWQhtWXVPaHf+2JC8je+OzYUX19kri3U+DmoQx75sOsRHd9tMP37fxsAs6UbHXH WsJWVXG/gKhaVpATfEuaqMX8LYRFiGZeuoSkO4pji4zDm3mxAPtBooU3gGPXvbu7q4zu yFi7xpJSTGXZP+PBica3UZo4MLM+qfo9j84GB4P8JAoO3ZJQ+KihfVuiBp0eJnbxYt1P VGrdOFPabIrTRv/GfL4T+AtTpdzZvQjMhk+imh1DXJpZmJu7GNUkVqrLXDC6gxUa/vYf +v9Nj3m2Bo6M8tuFFPjun+ArLEBMpV1+lp8jmG0I2sY3foJKmzCblAosIhJEIG6O5tNa o40A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ngJ7LoAn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h22-20020a05620a401600b0073b4c66f1cfsi12285635qko.668.2023.03.07.15.50.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Mar 2023 15:50:34 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ngJ7LoAn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZh3a-0005pI-1d; Tue, 07 Mar 2023 18:49:22 -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 1pZh3H-0005TE-NY for qemu-devel@nongnu.org; Tue, 07 Mar 2023 18:49:09 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZh3F-0002tI-Uk for qemu-devel@nongnu.org; Tue, 07 Mar 2023 18:49:03 -0500 Received: by mail-wm1-x335.google.com with SMTP id j19-20020a05600c1c1300b003e9b564fae9so177721wms.2 for ; Tue, 07 Mar 2023 15:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678232940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NiawUsU8t9iSDPAS2ynsYcKvAPuboz/5nBfIXoe6khg=; b=ngJ7LoAniqn69ZUzCIh7UJjhEzokAG3f6buBP17pRCv/xvcOtkHpRRonnrIWbg92c8 KTMBNjlcBlkxtB717aLR+CMmEOXg0id1s1FAWY4VpTOPFkafo+D8wABZBsSVXSxF/pcG gvYBX9KJZZqxUOfVl/uNrsBfAjo+YKunHqWIC80uHXfLlsegp7FjKy6+y6/CD5AfHePt 0BUoO74+LoBn4fdk1jPxvZrKnWDlvD7phN5ROV8eLxFVfe3bUgoHNwbOq0fYQeUMrv+m Rp5uv1CF7XuIT+LVcx5TzmDTXg5t6xbuVFQV4MGPZfQh1H+qj6gz4mKdJJgYV+bH9OhM PDwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678232940; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NiawUsU8t9iSDPAS2ynsYcKvAPuboz/5nBfIXoe6khg=; b=m0hBi6236xH+MMTPYnxoIM8j2NgEmgzQI6iSaj0EPiKBopHNSA5lCtKp2ipmMUhvMH TWL6KxhINjvyTAuP4nlD1RHCPwaFWOZokWD4Fh/B9G5pcWXBAhiXfBGSE607boMvNSJd q55G4njA1W4yzEJO24onx0wpA8ZTXldV8UYdY7NDY/CPI4nNmsqWMT9wZ938wFogvT7y NmwztaWBYw7CrpAaj2O0LbSg7AqncTjGwlI+qKgff2ehgycRiYJyGtVjJB3iq+zpGmSB ovpaXJQJjug+EXHEA+hecJ8pYAifnisn9CJkGuuzXlx/9e3byz3Pw023JMjy4pempuIK WV6w== X-Gm-Message-State: AO0yUKXB95a3CRYCBf4PSXcatNXLyomRzqaQv1SjbQC4PvCeEDmN/7+F u0VR40Hrv5M8g4xXJzImkNH/nJuOWJ/5rAh5Xq0= X-Received: by 2002:a05:600c:474f:b0:3df:deb5:6ff5 with SMTP id w15-20020a05600c474f00b003dfdeb56ff5mr14674737wmo.24.1678232940806; Tue, 07 Mar 2023 15:49:00 -0800 (PST) Received: from localhost.localdomain (57.red-88-29-179.dynamicip.rima-tde.net. [88.29.179.57]) by smtp.gmail.com with ESMTPSA id m13-20020a056000008d00b002c54c92e125sm13988751wrx.46.2023.03.07.15.48.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Mar 2023 15:49:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Akihiko Odaki , Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PULL 18/20] ui/cocoa: Override windowDidResignKey Date: Wed, 8 Mar 2023 00:47:09 +0100 Message-Id: <20230307234711.55375-19-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230307234711.55375-1-philmd@linaro.org> References: <20230307234711.55375-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki 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/e906a80147b1dc6d4f31b6a08064ef9871a2b76c Signed-off-by: Akihiko Odaki Message-Id: <20230228070946.12370-1-akihiko.odaki@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 289a2b193e..985a0f5069 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1330,10 +1330,15 @@ - (BOOL)windowShouldClose:(id)sender return NO; } -/* 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]; }