├── .gitignore ├── example.gif ├── src ├── ilo-sitelen.conf ├── ilo-sitelen-addon.conf.in ├── CMakeLists.txt ├── ilo-sitelen.h └── ilo-sitelen.cpp ├── CMakeLists.txt ├── LICENSE ├── README-EN.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .cache/ 2 | build/ 3 | 4 | -------------------------------------------------------------------------------- /example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0x182d4454fb211940/ilo-sitelen/HEAD/example.gif -------------------------------------------------------------------------------- /src/ilo-sitelen.conf: -------------------------------------------------------------------------------- 1 | [InputMethod] 2 | Name=ilo sitelen 3 | Icon=fcitx-ilo-sitelen 4 | Label=ilo sitelen 5 | LangCode=tok 6 | Addon=ilo-sitelen 7 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.21) 2 | project(fcitx-ilo-sitelen) 3 | 4 | find_package(Fcitx5Core REQUIRED COMPONENTS) 5 | include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake") 6 | 7 | add_subdirectory(src) 8 | -------------------------------------------------------------------------------- /src/ilo-sitelen-addon.conf.in: -------------------------------------------------------------------------------- 1 | [Addon] 2 | Name=ilo sitelen 3 | Category=InputMethod 4 | Version=@PROJECT_VERSION@ 5 | Library=ilo-sitelen 6 | Type=SharedLibrary 7 | OnDemand=True 8 | Configurable=True 9 | 10 | [Addon/Dependencies] 11 | 12 | [Addon/OptionalDependencies] -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(ilo-sitelen SHARED ilo-sitelen.cpp) 2 | target_link_libraries(ilo-sitelen PRIVATE Fcitx5::Core) 3 | set_target_properties(ilo-sitelen PROPERTIES PREFIX "") 4 | install(TARGETS ilo-sitelen DESTINATION "${FCITX_INSTALL_LIBDIR}/fcitx5") 5 | 6 | configure_file(ilo-sitelen-addon.conf.in ilo-sitelen-addon.conf) 7 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ilo-sitelen-addon.conf" RENAME ilo-sitelen.conf DESTINATION "${FCITX_INSTALL_PKGDATADIR}/addon") 8 | 9 | install(FILES "ilo-sitelen.conf" DESTINATION "${FCITX_INSTALL_PKGDATADIR}/inputmethod") 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 Ian Wood (ianwoodformal@gmail.com) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /src/ilo-sitelen.h: -------------------------------------------------------------------------------- 1 | #ifndef _FCITX5_SP_H_ 2 | #define _FCITX5_SP_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | class IloSitelenState : public fcitx::InputContextProperty { 13 | public: 14 | void keyEvent(fcitx::InputContext *ic, fcitx::KeyEvent &keyEvent); 15 | 16 | void reset(fcitx::InputContext *ic); 17 | 18 | private: 19 | void updateUi(fcitx::InputContext *ic); 20 | 21 | fcitx::InputBuffer buffer_{{ 22 | fcitx::InputBufferOption::AsciiOnly, 23 | }}; 24 | }; 25 | 26 | class IloSitelenEngine : public fcitx::InputMethodEngineV3 { 27 | public: 28 | IloSitelenEngine(); 29 | 30 | void keyEvent(const fcitx::InputMethodEntry &entry, 31 | fcitx::KeyEvent &keyEvent) override; 32 | 33 | void reset(const fcitx::InputMethodEntry &entry, 34 | fcitx::InputContextEvent &keyEvent) override; 35 | 36 | private: 37 | fcitx::FactoryFor factory_; 38 | 39 | friend class IloSitelenEngineFactory; 40 | }; 41 | 42 | class IloSitelenEngineFactory : public fcitx::AddonFactory { 43 | fcitx::AddonInstance *create(fcitx::AddonManager *manager) override; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /README-EN.md: -------------------------------------------------------------------------------- 1 | # ilo sitelen 2 | 3 | To read in toki pona, see [`README.md`](https://github.com/0x182d4454fb211940/ilo-sitelen/blob/master/README.md). 4 | 5 | This is an IME for typing sitelen pona characters using FCITX. 6 | 7 | The following example uses [linja nanpa](https://github.com/ETBCOR/nasin-nanpa) as a font: 8 | 9 | ![Example input](https://raw.githubusercontent.com/0x182d4454fb211940/ilo-sitelen/master/example.gif) 10 | 11 | ## Usage 12 | 13 | Use `\[` and `\]` for cartouches. (Alternatively, use `=` for the combining cartouche extension) 14 | 15 | Use `(` and `)` after a compatible glyph to extend it to the right. (Alternatively, use `_` for the combining glyph extension) 16 | 17 | Use `{` and `}` before a compatible glyph to extend it to the left. 18 | 19 | Use `-` for a zero-width joiner, `+` for a scaling joiner and `*` for a stacking joiner 20 | 21 | Use `.` to type a middle dot and `:` for a fullwidth colon. 22 | 23 | Use `/` and `\` for alternate glyphs. 24 | 25 | ## Installation 26 | 27 | ### Arch 28 | 29 | An [AUR](https://wiki.archlinux.org/title/Arch_User_Repository) package exists: [https://aur.archlinux.org/packages/ilo-sitelen-git](https://aur.archlinux.org/packages/ilo-sitelen-git). 30 | 31 | ### Other Linux 32 | 33 | Build and install with CMake: 34 | 35 | ```bash 36 | $ git clone https://github.com/0x182d4454fb211940/ilo-sitelen.git 37 | $ cd ilo-sitelen 38 | $ cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release 39 | $ cmake --build build 40 | $ sudo cmake --install build 41 | ``` 42 | 43 | 44 | ## TODO 45 | 46 | - User preferences 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ilo sitelen 2 | 3 | sina wile lukin e ni kepeken toki Inli la, o lukin e [`README-EN.md`](https://github.com/0x182d4454fb211940/ilo-sitelen/blob/master/README-EN.md). 4 | 5 | ilo ni la sina ken sitelen e sitelen pona kepeken sitelen Lasin. ona li kepeken ilo FCITX. 6 | 7 | ni li kepeken sitelen pi [linja nanpa](https://github.com/ETBCOR/nasin-nanpa) 8 | 9 | ![kepeken pi pana sona](https://raw.githubusercontent.com/0x182d4454fb211940/ilo-sitelen/master/example.gif) 10 | 11 | ## nasin kepeken 12 | 13 | sitelen e poki nimi kepeken `[` en `]`. anu la, sitelen e sitelen wan pi poki nimi kepeken `=`. 14 | 15 | sitelen e sitelen pi linja anpa kepeken `(` en `)` lon sitelen sinpin. anu la, sitelen e sitelen wan pi linja anpa kepeken `_` 16 | 17 | sitelen e sitelen pi linja anpa pi poka pilin kepeken `{` en `}` lon sitelen monsi. 18 | 19 | wan e sitelen kepeken `-`. anu la, wan insa e sitelen kepeken `+`. anu la, wan sewi e sitelen kepeken `*`. 20 | 21 | sitelen e sike pimeja kekepen `.`, e sike pimeja tu kepeken `:`. 22 | 23 | ante e sitelen kepeken `/` anu `\` 24 | 25 | 26 | ## sina kama jo kepeken ni: 27 | 28 | ### ilo Arch 29 | 30 | poki [AUR](https://wiki.archlinux.org/title/Arch_User_Repository) li lon ni: [https://aur.archlinux.org/packages/ilo-sitelen-git](https://aur.archlinux.org/packages/ilo-sitelen-git). 31 | 32 | ### ilo Linux ante 33 | 34 | o pali li kama jo kepeken ilo CMake. 35 | 36 | ```bash 37 | $ git clone https://github.com/0x182d4454fb211940/ilo-sitelen.git 38 | $ cd ilo-sitelen 39 | $ cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release 40 | $ cmake --build build 41 | $ sudo cmake --install build 42 | ``` 43 | 44 | ## pali ala 45 | 46 | - wile pi jan kepeken 47 | -------------------------------------------------------------------------------- /src/ilo-sitelen.cpp: -------------------------------------------------------------------------------- 1 | #include "ilo-sitelen.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | // todo: replace with a map 10 | // todo: allow customization 11 | std::vector> words{ 12 | {"kijetesantakalu", "\U000F1980"}, 13 | {"kokosila", "\U000F1984"}, 14 | {"misikeke", "\U000F1987"}, 15 | {"kepeken", "\U000F1919"}, 16 | {"monsuta", "\U000F197D"}, 17 | {"sitelen", "\U000F1960"}, 18 | {"jasima", "\U000F197F"}, 19 | {"kalama", "\U000F1915"}, 20 | {"kipisi", "\U000F197B"}, 21 | {"kulupu", "\U000F191F"}, 22 | {"lanpan", "\U000F1985"}, 23 | {"namako", "\U000F1978"}, 24 | {"pakala", "\U000F1948"}, 25 | {"palisa", "\U000F194A"}, 26 | {"pimeja", "\U000F194F"}, 27 | {"sijelo", "\U000F195B"}, 28 | {"sinpin", "\U000F195F"}, 29 | {"soweli", "\U000F1962"}, 30 | {"akesi", "\U000F1901"}, 31 | {"alasa", "\U000F1903"}, 32 | {"epiku", "\U000F1983"}, 33 | {"kiwen", "\U000F191B"}, 34 | {"linja", "\U000F1929"}, 35 | {"lukin", "\U000F192E"}, 36 | {"monsi", "\U000F1938"}, 37 | {"nanpa", "\U000F193D"}, 38 | {"nasin", "\U000F193F"}, 39 | {"pilin", "\U000F194E"}, 40 | {"tenpo", "\U000F196B"}, 41 | {"tonsi", "\U000F197E"}, 42 | {"utala", "\U000F1971"}, 43 | {"anpa", "\U000F1905"}, 44 | {"ante", "\U000F1906"}, 45 | {"awen", "\U000F1908"}, 46 | {"esun", "\U000F190B"}, 47 | {"insa", "\U000F190F"}, 48 | {"jaki", "\U000F1910"}, 49 | {"jelo", "\U000F1912"}, 50 | {"kala", "\U000F1914"}, 51 | {"kama", "\U000F1916"}, 52 | {"kasi", "\U000F1917"}, 53 | {"kili", "\U000F191A"}, 54 | {"kule", "\U000F191E"}, 55 | {"kute", "\U000F1920"}, 56 | {"lape", "\U000F1922"}, 57 | {"laso", "\U000F1923"}, 58 | {"lawa", "\U000F1924"}, 59 | {"leko", "\U000F197C"}, 60 | {"lete", "\U000F1926"}, 61 | {"lili", "\U000F1928"}, 62 | {"lipu", "\U000F192A"}, 63 | {"loje", "\U000F192B"}, 64 | {"luka", "\U000F192D"}, 65 | {"lupa", "\U000F192F"}, 66 | {"mama", "\U000F1931"}, 67 | {"mani", "\U000F1932"}, 68 | {"meli", "\U000F1933"}, 69 | {"meso", "\U000F1982"}, 70 | {"mije", "\U000F1935"}, 71 | {"moku", "\U000F1936"}, 72 | {"moli", "\U000F1937"}, 73 | {"musi", "\U000F193B"}, 74 | {"mute", "\U000F193C"}, 75 | {"nasa", "\U000F193E"}, 76 | {"nena", "\U000F1940"}, 77 | {"nimi", "\U000F1942"}, 78 | {"noka", "\U000F1943"}, 79 | {"olin", "\U000F1945"}, 80 | {"open", "\U000F1947"}, 81 | {"pali", "\U000F1949"}, 82 | {"pana", "\U000F194C"}, 83 | {"pini", "\U000F1950"}, 84 | {"pipi", "\U000F1951"}, 85 | {"poka", "\U000F1952"}, 86 | {"poki", "\U000F1953"}, 87 | {"pona", "\U000F1954"}, 88 | {"sama", "\U000F1956"}, 89 | {"seli", "\U000F1957"}, 90 | {"selo", "\U000F1958"}, 91 | {"seme", "\U000F1959"}, 92 | {"sewi", "\U000F195A"}, 93 | {"sike", "\U000F195C"}, 94 | {"sina", "\U000F195E"}, 95 | {"soko", "\U000F1981"}, 96 | {"sona", "\U000F1961"}, 97 | {"suli", "\U000F1963"}, 98 | {"suno", "\U000F1964"}, 99 | {"supa", "\U000F1965"}, 100 | {"suwi", "\U000F1966"}, 101 | {"taso", "\U000F1968"}, 102 | {"tawa", "\U000F1969"}, 103 | {"telo", "\U000F196A"}, 104 | {"toki", "\U000F196C"}, 105 | {"tomo", "\U000F196D"}, 106 | {"unpa", "\U000F196F"}, 107 | {"walo", "\U000F1972"}, 108 | {"waso", "\U000F1974"}, 109 | {"wawa", "\U000F1975"}, 110 | {"weka", "\U000F1976"}, 111 | {"wile", "\U000F1977"}, 112 | {"ala", "\U000F1902"}, 113 | {"ale", "\U000F1904"}, 114 | {"anu", "\U000F1907"}, 115 | {"ijo", "\U000F190C"}, 116 | {"ike", "\U000F190D"}, 117 | {"ilo", "\U000F190E"}, 118 | {"jan", "\U000F1911"}, 119 | {"ken", "\U000F1918"}, 120 | {"kin", "\U000F1979"}, 121 | {"kon", "\U000F191D"}, 122 | {"len", "\U000F1925"}, 123 | {"lon", "\U000F192C"}, 124 | {"mun", "\U000F193A"}, 125 | {"oko", "\U000F197A"}, 126 | {"ona", "\U000F1946"}, 127 | {"pan", "\U000F194B"}, 128 | {"sin", "\U000F195D"}, 129 | {"tan", "\U000F1967"}, 130 | {"uta", "\U000F1970"}, 131 | {"wan", "\U000F1973"}, 132 | {"en", "\U000F190A"}, 133 | {"jo", "\U000F1913"}, 134 | {"ko", "\U000F191C"}, 135 | {"ku", "\U000F1988"}, 136 | {"la", "\U000F1921"}, 137 | {"li", "\U000F1927"}, 138 | {"ma", "\U000F1930"}, 139 | {"mi", "\U000F1934"}, 140 | {"mu", "\U000F1939"}, 141 | {"ni", "\U000F1941"}, 142 | {"pi", "\U000F194D"}, 143 | {"pu", "\U000F1955"}, 144 | {"tu", "\U000F196E"}, 145 | {"e", "\U000F1909"}, 146 | {"n", "\U000F1986"}, 147 | {"o", "\U000F1944"}, 148 | {"a", "\U000F1900"}, 149 | {"pake", "\U000F19A0"}, 150 | {"apeja", "\U000F19A1"}, 151 | {"majuna", "\U000F19A2"}, 152 | {"powe", "\U000f19a3"}, 153 | }; 154 | 155 | // todo: customizable 156 | std::unordered_map punctuation = { 157 | {' ', " "}, {':', "\U000F199D"}, {'.', "\U000F199C"}, {'!', "\U0000FF01"}, 158 | {'"', "\""}, {'$', "$"}, {'%', "%"}, {'^', "^"}, 159 | {'&', "&"}, {'*', "\U000F1995"}, {'(', "\U000F1997"}, {')', "\U000F1998"}, 160 | {'-', "\U0000200D"}, {'=', "\U000F1992"}, {'_', "\U000f1999"}, {'+', "\U000F1996"}, 161 | {'[', "\U000F1990"}, {']', "\U000F1991"}, {'{', "\U000F199A"}, {'}', "\U000F199B"}, 162 | {';', ";"}, {'\'', "\'"}, {'#', "#"}, {'@', "@"}, 163 | {'~', "~"}, {',', ","}, {'<', "\U0000300C"}, {'>', "\U0000300D"}, 164 | {'/', "\U0000FE00"}, {'?', "\U0000FF1F"}, {'\\', "\U0000FE01"}, {'|', "|"}, 165 | }; 166 | 167 | std::pair toki_pona_to_sitelen_pona(const std::string &x, 168 | size_t cursor) { 169 | std::string out; 170 | bool just_found_word = false; 171 | size_t out_cursor = cursor; 172 | for (size_t i = 0; i < x.length();) { 173 | bool found_word = false, found_end = false; 174 | // todo: filter by word length 175 | FCITX_INFO() << " i=" << i << " oc=" << out_cursor; 176 | for (auto it : words) { 177 | if (x.size() - i > it.first.size()) { 178 | if (0 == x.compare(i, it.first.size(), it.first) && 179 | punctuation.count(x[i + it.first.size()])) { 180 | // if the cursor is before the start of this word, we replace and the 181 | // cursor stays where it is if the cursor is within this word, we do 182 | // not replace and the cursor stays where it is if the cursor is after 183 | // this word, we replace and the cursor is moved by how much we 184 | // replaced 185 | 186 | FCITX_INFO() << " i=" << i << " c=" << cursor; 187 | if (i + it.first.size() - 1 < cursor) { 188 | out_cursor -= it.first.size() - it.second.length(); 189 | } else if (i <= cursor) { 190 | break; 191 | } 192 | 193 | // remove gaps between words 194 | // SAFETY: just_found_word should never be true when i = 0 195 | if (just_found_word && x[i - 1] == ' ') { 196 | out.pop_back(); 197 | // if the cursor is after this word, account for loss of space 198 | if (i < cursor) 199 | out_cursor--; 200 | } 201 | 202 | i += it.first.size(); 203 | out.append(it.second); 204 | found_word = true; 205 | break; 206 | } 207 | } else if (x.size() - i == it.first.size()) { 208 | if (0 == x.compare(i, it.first.size(), it.first)) { 209 | // same logic as above 210 | if (i + it.first.size() - 1 < cursor) { 211 | out_cursor -= it.first.size() - it.second.length(); 212 | } else if (i <= cursor) { 213 | // cursor is within word, don't replace word 214 | break; 215 | } 216 | 217 | // remove gaps between words 218 | // SAFETY: just_found_word should never be true when i = 0 219 | if (just_found_word && x[i - 1] == ' ') { 220 | out.pop_back(); 221 | // if the cursor is after this word, account for loss of space 222 | if (i < cursor) 223 | out_cursor--; 224 | } 225 | 226 | found_end = true; 227 | out.append(it.second); 228 | break; 229 | } 230 | } 231 | } 232 | if (found_end) 233 | break; 234 | 235 | just_found_word = found_word; 236 | 237 | // skip to past end of word 238 | while (!punctuation.count(x[i]) && i < x.length()) 239 | out.push_back(x[i++]); 240 | 241 | // feed all punctuation 242 | std::unordered_map::iterator it; 243 | while ((it = punctuation.find(x[i])) != punctuation.end() && 244 | i < x.length()) { 245 | out.append(it->second); 246 | if (i < cursor) { 247 | // if the punctuation is now multiple bytes long, move the cursor 248 | // accordingly 249 | out_cursor += it->second.length() - 1; 250 | } 251 | i++; 252 | } 253 | } 254 | FCITX_INFO() << "converted \"" << x << "\" -> \"" << out << "\" i=" << cursor 255 | << " -> " << out_cursor; 256 | return {out, out_cursor}; 257 | } 258 | 259 | void IloSitelenState::keyEvent(fcitx::InputContext *ic, 260 | fcitx::KeyEvent &keyEvent) { 261 | // int in_letters = letters.count(keyEvent.key().sym()); 262 | int in_letters = keyEvent.key().isSimple(); 263 | 264 | FCITX_INFO() << keyEvent.key() << " isRelease=" << keyEvent.isRelease(); 265 | 266 | if (buffer_.empty()) { 267 | if (in_letters) { 268 | buffer_.type(keyEvent.key().sym()); 269 | updateUi(ic); 270 | return keyEvent.filterAndAccept(); 271 | } 272 | } else { 273 | if (keyEvent.key().check(FcitxKey_BackSpace)) 274 | buffer_.backspace(); 275 | 276 | if (keyEvent.key().check(FcitxKey_Escape)) 277 | buffer_.clear(); 278 | 279 | if (keyEvent.key().check(FcitxKey_Return)) { 280 | ic->commitString( 281 | toki_pona_to_sitelen_pona(buffer_.userInput(), buffer_.size()).first); 282 | buffer_.clear(); 283 | } 284 | 285 | if (keyEvent.key().check(FcitxKey_Left)) { 286 | size_t cursor = buffer_.cursor(); 287 | if (cursor != 0) 288 | buffer_.setCursor(cursor - 1); 289 | } 290 | if (keyEvent.key().check(FcitxKey_Right)) { 291 | size_t cursor = buffer_.cursor(); 292 | if (cursor != buffer_.size()) 293 | buffer_.setCursor(cursor + 1); 294 | } 295 | 296 | FCITX_INFO() << buffer_.cursor() << " " << keyEvent.key().sym(); 297 | 298 | if (in_letters) 299 | buffer_.type(keyEvent.key().sym()); 300 | 301 | updateUi(ic); 302 | return keyEvent.filterAndAccept(); 303 | } 304 | } 305 | 306 | void IloSitelenState::reset(fcitx::InputContext *ic) { 307 | buffer_.clear(); 308 | updateUi(ic); 309 | } 310 | 311 | void IloSitelenState::updateUi(fcitx::InputContext *ic) { 312 | auto &ip = ic->inputPanel(); 313 | ip.reset(); 314 | 315 | auto predit_text = 316 | toki_pona_to_sitelen_pona(buffer_.userInput(), buffer_.cursor()); 317 | if (ic->capabilityFlags().test(fcitx::CapabilityFlag::Preedit)) { 318 | fcitx::Text preedit(predit_text.first, fcitx::TextFormatFlag::Underline); 319 | preedit.setCursor(predit_text.second); 320 | ip.setClientPreedit(preedit); 321 | } else { 322 | fcitx::Text preedit(predit_text.first); 323 | ip.setPreedit(preedit); 324 | } 325 | 326 | ic->updateUserInterface(fcitx::UserInterfaceComponent::InputPanel); 327 | ic->updatePreedit(); 328 | } 329 | 330 | IloSitelenEngine::IloSitelenEngine() 331 | : factory_([](fcitx::InputContext &ic) { 332 | FCITX_UNUSED(ic); 333 | return new IloSitelenState; 334 | }) {} 335 | 336 | void IloSitelenEngine::keyEvent(const fcitx::InputMethodEntry &entry, 337 | fcitx::KeyEvent &keyEvent) { 338 | FCITX_UNUSED(entry); 339 | if (keyEvent.isRelease() || keyEvent.key().states()) 340 | return; 341 | auto *ic = keyEvent.inputContext(); 342 | auto *state = ic->propertyFor(&this->factory_); 343 | state->keyEvent(ic, keyEvent); 344 | } 345 | 346 | void IloSitelenEngine::reset(const fcitx::InputMethodEntry &entry, 347 | fcitx::InputContextEvent &keyEvent) { 348 | FCITX_UNUSED(entry); 349 | auto *state = keyEvent.inputContext()->propertyFor(&this->factory_); 350 | state->reset(keyEvent.inputContext()); 351 | } 352 | 353 | FCITX_ADDON_FACTORY(IloSitelenEngineFactory); 354 | 355 | fcitx::AddonInstance * 356 | IloSitelenEngineFactory::create(fcitx::AddonManager *manager) { 357 | auto engine = new IloSitelenEngine(); 358 | manager->instance()->inputContextManager().registerProperty( 359 | "ijo-pona", &engine->factory_); 360 | return engine; 361 | } 362 | --------------------------------------------------------------------------------