From 80bef8f28cab48f7104ca885a88186126d73ba34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=85=E6=88=8E=E6=B0=8F?= Date: Thu, 26 Jan 2023 01:35:41 +0800 Subject: [PATCH] fix: skip key combos with super modifier closes #458 --- src/rime/gear/editor.cc | 2 +- src/rime/gear/punctuator.cc | 3 ++- src/rime/gear/recognizer.cc | 3 ++- src/rime/gear/shape.cc | 3 ++- src/rime/gear/speller.cc | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/rime/gear/editor.cc b/src/rime/gear/editor.cc index f37b6d19a3..38b4a724ce 100644 --- a/src/rime/gear/editor.cc +++ b/src/rime/gear/editor.cc @@ -58,7 +58,7 @@ ProcessResult Editor::ProcessKeyEvent(const KeyEvent& key_event) { } } if (char_handler_ && - !key_event.ctrl() && !key_event.alt() && + !key_event.ctrl() && !key_event.alt() && !key_event.super() && ch > 0x20 && ch < 0x7f) { DLOG(INFO) << "input char: '" << (char)ch << "', " << ch << ", '" << key_event.repr() << "'"; diff --git a/src/rime/gear/punctuator.cc b/src/rime/gear/punctuator.cc index 555b0930db..8a01eda024 100644 --- a/src/rime/gear/punctuator.cc +++ b/src/rime/gear/punctuator.cc @@ -59,7 +59,8 @@ static bool punctuation_is_translated(Context* ctx) { } ProcessResult Punctuator::ProcessKeyEvent(const KeyEvent& key_event) { - if (key_event.release() || key_event.ctrl() || key_event.alt()) + if (key_event.release() || + key_event.ctrl() || key_event.alt() || key_event.super()) return kNoop; int ch = key_event.keycode(); if (ch < 0x20 || ch >= 0x7f) diff --git a/src/rime/gear/recognizer.cc b/src/rime/gear/recognizer.cc index 33a0a73ca8..0582379efd 100644 --- a/src/rime/gear/recognizer.cc +++ b/src/rime/gear/recognizer.cc @@ -80,7 +80,8 @@ Recognizer::Recognizer(const Ticket& ticket) : Processor(ticket) { ProcessResult Recognizer::ProcessKeyEvent(const KeyEvent& key_event) { if (patterns_.empty() || - key_event.ctrl() || key_event.alt() || key_event.release()) { + key_event.ctrl() || key_event.alt() || key_event.super() || + key_event.release()) { return kNoop; } int ch = key_event.keycode(); diff --git a/src/rime/gear/shape.cc b/src/rime/gear/shape.cc index bea1e611be..937346c488 100644 --- a/src/rime/gear/shape.cc +++ b/src/rime/gear/shape.cc @@ -41,7 +41,8 @@ ProcessResult ShapeProcessor::ProcessKeyEvent(const KeyEvent& key_event) { if (!engine_->context()->get_option("full_shape")) { return kNoop; } - if (key_event.ctrl() || key_event.alt() || key_event.release()) { + if (key_event.ctrl() || key_event.alt() || key_event.super() || + key_event.release()) { return kNoop; } int ch = key_event.keycode(); diff --git a/src/rime/gear/speller.cc b/src/rime/gear/speller.cc index 714a45279c..ff1457f62f 100644 --- a/src/rime/gear/speller.cc +++ b/src/rime/gear/speller.cc @@ -90,7 +90,8 @@ Speller::Speller(const Ticket& ticket) : Processor(ticket), } ProcessResult Speller::ProcessKeyEvent(const KeyEvent& key_event) { - if (key_event.release() || key_event.ctrl() || key_event.alt()) + if (key_event.release() || + key_event.ctrl() || key_event.alt() || key_event.super()) return kNoop; int ch = key_event.keycode(); if (ch < 0x20 || ch >= 0x7f) // not a valid key for spelling