From nobody Mon Feb 9 12:15:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615873138; cv=none; d=zohomail.com; s=zohoarc; b=P72Z1E+TbYiYsI/xmx6KYl7V4meWxKPwlKRXM0cvbSLV0E2h0NUn8zs8GrQOvC8m0PEJ1FTBumnq844vSVCxFH2NBcF0p/QZaFqXqzoyKcjBlsPuSgXamQZr84FgJtE8ZWKWC4yjeF6nNzqqr4wX2Mmf3G5R19W0FIF4TfG/CCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615873138; 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=Oqdpqg9I4PZSbZGu3CZuLugaZxHwMJD0Jpla0CqGCno=; b=JUjTOMJiP/IpWOjmD/ZsK5J+Y2uoQ55oWQMFLjQhMY4xWoGi9G3FpwFKw2FhPlih8Abqu5UZuhgVgiCmZe95sFczvQ6wqs509yRhVwARvAEuo9HVhaS2VNGlD/0aEt3jN1w6w9ikEkcELpHzMdHo85S/1myZUOFq12A5MEQPsBE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615873138985195.96858011849122; Mon, 15 Mar 2021 22:38:58 -0700 (PDT) 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-408-OzUoYiGMM4SoZlt7fTMDeg-1; Tue, 16 Mar 2021 01:38:55 -0400 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 0CB0A18460E9; Tue, 16 Mar 2021 05:38:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC1336F965; Tue, 16 Mar 2021 05:38:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A091857DC6; Tue, 16 Mar 2021 05:38:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12G5cTFI017085 for ; Tue, 16 Mar 2021 01:38:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 763EE18BBF; Tue, 16 Mar 2021 05:38:29 +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 F0D2A60C0F; Tue, 16 Mar 2021 05:38:22 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9C6541800843; Tue, 16 Mar 2021 06:38:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615873137; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Oqdpqg9I4PZSbZGu3CZuLugaZxHwMJD0Jpla0CqGCno=; b=PWwgZK+f6/agwMnBOqjNmqOh//dzPglI7ElKuTkOYdzt6gYQPk/Om9yNroF4ZB/FR5joI3 jMazBoEsR+mTZGYBXdnMYRXTMSJGIEawvYrFl0u9awT+kOfKiEacO2nruWeHxQRzsqQOZv oCBVLutSx2ZTrNGCkHrN8uQsu8+h5/w= X-MC-Unique: OzUoYiGMM4SoZlt7fTMDeg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 11/11] ui/cocoa: Comment about modifier key input quirks Date: Tue, 16 Mar 2021 06:38:13 +0100 Message-Id: <20210316053813.1719442-12-kraxel@redhat.com> In-Reply-To: <20210316053813.1719442-1-kraxel@redhat.com> References: <20210316053813.1719442-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Peter Maydell , Gerd Hoffmann , Akihiko Odaki X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki Based-on: <20210310042348.21931-1-akihiko.odaki@gmail.com> Signed-off-by: Akihiko Odaki Message-Id: <20210312133212.3131-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 9da0e884b712..37e1fb52eb4d 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -690,7 +690,43 @@ QemuCocoaView *cocoaView; NSPoint p =3D [self screenLocationOfEvent:event]; NSUInteger modifiers =3D [event modifierFlags]; =20 - // emulate caps lock keydown and keyup + /* + * Check -[NSEvent modifierFlags] here. + * + * There is a NSEventType for an event notifying the change of + * -[NSEvent modifierFlags], NSEventTypeFlagsChanged but these operati= ons + * are performed for any events because a modifier state may change wh= ile + * the application is inactive (i.e. no events fire) and we don't want= to + * wait for another modifier state change to detect such a change. + * + * NSEventModifierFlagCapsLock requires a special treatment. The other= flags + * are handled in similar manners. + * + * NSEventModifierFlagCapsLock + * --------------------------- + * + * If CapsLock state is changed, "up" and "down" events will be fired = in + * sequence, effectively updates CapsLock state on the guest. + * + * The other flags + * --------------- + * + * If a flag is not set, fire "up" events for all keys which correspon= d to + * the flag. Note that "down" events are not fired here because the fl= ags + * checked here do not tell what exact keys are down. + * + * If one of the keys corresponding to a flag is down, we rely on + * -[NSEvent keyCode] of an event whose -[NSEvent type] is + * NSEventTypeFlagsChanged to know the exact key which is down, which = has + * the following two downsides: + * - It does not work when the application is inactive as described ab= ove. + * - It malfactions *after* the modifier state is changed while the + * application is inactive. It is because -[NSEvent keyCode] does no= t tell + * if the key is up or down, and requires to infer the current state= from + * the previous state. It is still possible to fix such a malfanctio= n by + * completely leaving your hands from the keyboard, which hopefully = makes + * this implementation usable enough. + */ if (!!(modifiers & NSEventModifierFlagCapsLock) !=3D qkbd_state_modifier_get(kbd, QKBD_MOD_CAPSLOCK)) { qkbd_state_key_event(kbd, Q_KEY_CODE_CAPS_LOCK, true); --=20 2.29.2