diff --git a/honoka/libhonoka/honokapluginbase.h b/honoka/libhonoka/honokapluginbase.h index 473058d..f44ee88 100644 --- a/honoka/libhonoka/honokapluginbase.h +++ b/honoka/libhonoka/honokapluginbase.h @@ -28,7 +28,7 @@ #include #define Uses_SCIM_CONFIG_BASE -#define HONOKA_PLUGIN_VERSION 8 +#define HONOKA_PLUGIN_VERSION 9 using namespace std; using namespace scim; diff --git a/honoka/libhonoka/preeditor.cpp b/honoka/libhonoka/preeditor.cpp index d6e37aa..810d29a 100644 --- a/honoka/libhonoka/preeditor.cpp +++ b/honoka/libhonoka/preeditor.cpp @@ -387,36 +387,36 @@ /*! - \fn Honoka::PreEditor::getCommitString() + \fn PreEditor::getCommitString() */ -const WideString Honoka::PreEditor::getCommitString() +const WideString PreEditor::getCommitString() { return commitString; } /*! - \fn Honoka::PreEditor::setCommitString(const WideString &t) + \fn PreEditor::setCommitString(const WideString &t) */ -void Honoka::PreEditor::setCommitString(const WideString &t) +void PreEditor::setCommitString(const WideString &t) { commitString = t; } /*! - \fn Honoka::PreEditor::resetCommitString() + \fn PreEditor::resetCommitString() */ -void Honoka::PreEditor::resetCommitString() +void PreEditor::resetCommitString() { commitString.clear(); } /*! - \fn Honoka::PreEditor::isPrintable(const KeyEvent &key) + \fn PreEditor::isPrintable(const KeyEvent &key) */ -bool Honoka::PreEditor::isPrintable(const KeyEvent &key) +bool PreEditor::isPrintable(const KeyEvent &key) { if ((key.code == SCIM_KEY_Return) || (key.code == SCIM_KEY_Linefeed) || @@ -426,4 +426,29 @@ return false; } +/*! + \fn PreEditor::isThrough(const KeyEvent &key) + */ +bool PreEditor::isThrough(const KeyEvent &key) +{ + // 喰っておくべきもの。 + if ((key.code == SCIM_KEY_Shift_L) || + (key.code == SCIM_KEY_Shift_R) || + (key.code == SCIM_KEY_Control_L) || + (key.code == SCIM_KEY_Control_R) || + (key.code == SCIM_KEY_Alt_L) || + (key.code == SCIM_KEY_Alt_R) || + (key.code == SCIM_KEY_Super_L) || + (key.code == SCIM_KEY_Super_R) || + (key.code == SCIM_KEY_Hyper_L) || + (key.code == SCIM_KEY_Hyper_R) || + (key.code == SCIM_KEY_Meta_L) || + (key.code == SCIM_KEY_Meta_R) || + (key.code == SCIM_KEY_Num_Lock) || + (key.code == SCIM_KEY_Caps_Lock) || + (key.code == SCIM_KEY_Shift_Lock) || + (key.code == SCIM_KEY_Mode_switch) || + (key.code == SCIM_KEY_ISO_Next_Group)) return true; + return false; +} diff --git a/honoka/libhonoka/preeditor.h b/honoka/libhonoka/preeditor.h index daa6fb8..549c3f9 100644 --- a/honoka/libhonoka/preeditor.h +++ b/honoka/libhonoka/preeditor.h @@ -92,6 +92,7 @@ static const WideString getCommitString(); static void resetCommitString(); static bool isPrintable(const KeyEvent &key); + static bool isThrough(const KeyEvent &key); protected: static WideString text; diff --git a/honoka/plugins/asciiinput.cpp b/honoka/plugins/asciiinput.cpp index 1ee11a2..16cdf3b 100644 --- a/honoka/plugins/asciiinput.cpp +++ b/honoka/plugins/asciiinput.cpp @@ -233,19 +233,7 @@ */ bool AsciiInput::keyEvent(const KeyEvent &key) { - // 喰っておくべきもの。 - if ((key.code == SCIM_KEY_Shift_L) || - (key.code == SCIM_KEY_Shift_R) || - (key.code == SCIM_KEY_Control_L) || - (key.code == SCIM_KEY_Control_R) || - (key.code == SCIM_KEY_Alt_L) || - (key.code == SCIM_KEY_Alt_R) || - (key.code == SCIM_KEY_Super_L) || - (key.code == SCIM_KEY_Super_R) || - (key.code == SCIM_KEY_Hyper_L) || - (key.code == SCIM_KEY_Hyper_R)|| - (key.code == SCIM_KEY_Mode_switch) || - (key.code == SCIM_KEY_ISO_Next_Group)) return true; + if (PreEditor::isThrough(key)) return true; if ((compose)) { if (composeKey1.code == 0) { diff --git a/honoka/plugins/kanainput.cpp b/honoka/plugins/kanainput.cpp index 1d81d4d..ac5080f 100644 --- a/honoka/plugins/kanainput.cpp +++ b/honoka/plugins/kanainput.cpp @@ -188,18 +188,7 @@ bool KanaInput::inputEvent(const KeyEvent &key) { // 喰っておくべきもの。 - if ((key.code == SCIM_KEY_Shift_L) || - (key.code == SCIM_KEY_Shift_R) || - (key.code == SCIM_KEY_Control_L) || - (key.code == SCIM_KEY_Control_R) || - (key.code == SCIM_KEY_Alt_L) || - (key.code == SCIM_KEY_Alt_R) || - (key.code == SCIM_KEY_Super_L) || - (key.code == SCIM_KEY_Super_R) || - (key.code == SCIM_KEY_Hyper_L) || - (key.code == SCIM_KEY_Hyper_R) || - (key.code == SCIM_KEY_Mode_switch) || - (key.code == SCIM_KEY_ISO_Next_Group)) return true; + if (PreEditor::isThrough(key)) return true; for(unsigned int i = 0;HonokaKanaInputTable[i].code != 0;++ i) { diff --git a/honoka/plugins/nicolainput.cpp b/honoka/plugins/nicolainput.cpp index 1cd016c..2eb5da7 100644 --- a/honoka/plugins/nicolainput.cpp +++ b/honoka/plugins/nicolainput.cpp @@ -257,19 +257,7 @@ */ bool NicolaInput::inputEvent(const KeyEvent &key) { - // 喰っておくべきもの。 - if ((key.code == SCIM_KEY_Shift_L) || - (key.code == SCIM_KEY_Shift_R) || - (key.code == SCIM_KEY_Control_L) || - (key.code == SCIM_KEY_Control_R) || - (key.code == SCIM_KEY_Alt_L) || - (key.code == SCIM_KEY_Alt_R) || - (key.code == SCIM_KEY_Super_L) || - (key.code == SCIM_KEY_Super_R) || - (key.code == SCIM_KEY_Hyper_L) || - (key.code == SCIM_KEY_Hyper_R) || - (key.code == SCIM_KEY_Mode_switch) || - (key.code == SCIM_KEY_ISO_Next_Group)) return true; + if (PreEditor::isThrough(key)) return true; map::iterator it = keymap.find(key); diff --git a/honoka/plugins/romkan.cpp b/honoka/plugins/romkan.cpp index 2853bdf..5d2d3f6 100644 --- a/honoka/plugins/romkan.cpp +++ b/honoka/plugins/romkan.cpp @@ -652,19 +652,7 @@ */ bool Romkan::inputEvent(const KeyEvent &key) { - // 喰っておくべきもの。 - if ((key.code == SCIM_KEY_Shift_L) || - (key.code == SCIM_KEY_Shift_R) || - (key.code == SCIM_KEY_Control_L) || - (key.code == SCIM_KEY_Control_R) || - (key.code == SCIM_KEY_Alt_L) || - (key.code == SCIM_KEY_Alt_R) || - (key.code == SCIM_KEY_Super_L) || - (key.code == SCIM_KEY_Super_R) || - (key.code == SCIM_KEY_Hyper_L) || - (key.code == SCIM_KEY_Hyper_R) || - (key.code == SCIM_KEY_Mode_switch) || - (key.code == SCIM_KEY_ISO_Next_Group)) return true; + if (PreEditor::isThrough(key)) return true; if (key_a2k.comp(key)) { asciiToKana(); diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index 4c1fb69..a651385 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -1075,18 +1075,7 @@ // 変換時のキーイベント処理。 // 喰う!。 if (key.is_key_release()) return true; - if ((key.code == SCIM_KEY_Shift_L) || - (key.code == SCIM_KEY_Shift_R) || - (key.code == SCIM_KEY_Control_L) || - (key.code == SCIM_KEY_Control_R) || - (key.code == SCIM_KEY_Alt_L) || - (key.code == SCIM_KEY_Alt_R) || - (key.code == SCIM_KEY_Super_L) || - (key.code == SCIM_KEY_Super_R) || - (key.code == SCIM_KEY_Hyper_L) || - (key.code == SCIM_KEY_Hyper_R) || - (key.code == SCIM_KEY_Mode_switch) || - (key.code == SCIM_KEY_ISO_Next_Group)) return true; + if (PreEditor::isThrough(key)) return true; // 自動候補ポップアップのカウント計算。 if ((alp <= alp_count) && (alp != 0)) {