Skip to content

Commit

Permalink
Relax the compose modifier key check.
Browse files Browse the repository at this point in the history
This allows compose key to be handled by pinyin/table if compose
sequence has shift.
  • Loading branch information
wengxt committed May 27, 2024
1 parent 5dd323b commit 3e14430
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion im/pinyin/pinyin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion im/table/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3e14430

Please sign in to comment.