From 60caec953f76b1c63ff526c84cc968b5f83eabdf Mon Sep 17 00:00:00 2001 From: Wang Chuan Date: Wed, 6 Oct 2021 00:08:28 +0800 Subject: [PATCH] macOS: Ensure cancelOperation is sent as regular key event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 9e1875483ceaf907226f84cd6a58ab59f7f16f80 the logic of sending QKeyEvent was changed to only happen when we explicitly decided to not treat input as complex text, or when a selector for a command was not found. This missed the case where we handle cancelOperation by falling back to sending a regular key event. We now set m_sendKeyEvent to true to trigger this logic. Fixes: QTBUG-97119 Pick-to: 6.2 Change-Id: Ibb72f4b068cce735db8d76e5e0a1882aae115207 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview_keys.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview_keys.mm b/src/plugins/platforms/cocoa/qnsview_keys.mm index d6e0c4b012d..2edbf67b6fd 100644 --- a/src/plugins/platforms/cocoa/qnsview_keys.mm +++ b/src/plugins/platforms/cocoa/qnsview_keys.mm @@ -165,8 +165,10 @@ // Handling the key event may recurse back here through interpretKeyEvents // (when IM is enabled), so we need to guard against that. - if (currentEvent == m_currentlyInterpretedKeyEvent) + if (currentEvent == m_currentlyInterpretedKeyEvent) { + m_sendKeyEvent = true; return; + } // Send Command+Key_Period and Escape as normal keypresses so that // the key sequence is delivered through Qt. That way clients can