From 3e144307bd32e45383fe9e72da570982ff176aa2 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Mon, 27 May 2024 08:41:45 -0700 Subject: [PATCH] Relax the compose modifier key check. This allows compose key to be handled by pinyin/table if compose sequence has shift. --- im/pinyin/pinyin.cpp | 4 +++- im/table/state.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/im/pinyin/pinyin.cpp b/im/pinyin/pinyin.cpp index af40463..b5260bc 100644 --- a/im/pinyin/pinyin.cpp +++ b/im/pinyin/pinyin.cpp @@ -1813,7 +1813,9 @@ bool PinyinEngine::handlePunc(KeyEvent &event) { bool PinyinEngine::handleCompose(KeyEvent &event) { auto *inputContext = event.inputContext(); auto *state = inputContext->propertyFor(&factory_); - if (event.key().hasModifier() || state->mode_ != PinyinMode::Normal) { + if (event.key().states().testAny( + KeyStates{KeyState::Ctrl, KeyState::Super}) || + state->mode_ != PinyinMode::Normal) { return false; } auto candidateList = inputContext->inputPanel().candidateList(); diff --git a/im/table/state.cpp b/im/table/state.cpp index 62598e9..4296227 100644 --- a/im/table/state.cpp +++ b/im/table/state.cpp @@ -866,7 +866,8 @@ void TableState::keyEvent(const InputMethodEntry &entry, KeyEvent &event) { } if ((mode_ == TableMode::Normal || mode_ == TableMode::Pinyin) && - !event.key().hasModifier()) { + !event.key().states().testAny( + KeyStates{KeyState::Ctrl, KeyState::Super})) { auto compose = engine_->instance()->processComposeString( inputContext, event.key().sym()); if (!compose) {