pax_global_header00006660000000000000000000000064145674221420014521gustar00rootroot0000000000000052 comment=2d830133a26508ed0b14419f9c4d12b8392cb965 fcitx5-keyman-master/000077500000000000000000000000001456742214200150425ustar00rootroot00000000000000fcitx5-keyman-master/.gitignore000066400000000000000000000001651456742214200170340ustar00rootroot00000000000000build*/ .* !.git* .git/ *.tar.* *.kdev4 *.kate-swp *.orig tags astyle.sh cscope.* *.part XF86keysym.h keysymdef.h *~ fcitx5-keyman-master/CMakeLists.txt000066400000000000000000000016361456742214200176100ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.4.0) project(fcitx5-keyman VERSION 1.0.7) include(FeatureSummary) include(GNUInstallDirs) find_package(Gettext REQUIRED) find_package(Fcitx5Core 5.0.10 REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(Keyman REQUIRED IMPORTED_TARGET "keyman_core") pkg_check_modules(JsonC REQUIRED IMPORTED_TARGET "json-c") add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-keyman\") fcitx5_add_i18n_definition() include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake") add_subdirectory(po) add_subdirectory(src) fcitx5_translate_desktop_file(org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml XML) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml" DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) fcitx5-keyman-master/LICENSES/000077500000000000000000000000001456742214200162475ustar00rootroot00000000000000fcitx5-keyman-master/LICENSES/GPL-2.0-or-later.txt000066400000000000000000000423261456742214200214610ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. fcitx5-keyman-master/Messages.sh000077500000000000000000000000741456742214200171510ustar00rootroot00000000000000#!/bin/bash gen_pot cxx:appdata:desktop fcitx5-keyman po . fcitx5-keyman-master/README.md000066400000000000000000000003041456742214200163160ustar00rootroot00000000000000Keyman (https://keyman.com/linux/) for Fcitx 5 ============================================================================== Require keyman 15 to work properly, but you may use it with keyman 13 fcitx5-keyman-master/org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in000066400000000000000000000017221456742214200253070ustar00rootroot00000000000000 org.fcitx.Fcitx5.Addon.Keyman org.fcitx.Fcitx5 CC0-1.0 GPL-2.0+ Keyman support for Fcitx 5 Type in your language with Keyman for Linux https://fcitx-im.org https://github.com/fcitx/fcitx5-keyman/issues Fcitx fcitx5-keyman-master/po/000077500000000000000000000000001456742214200154605ustar00rootroot00000000000000fcitx5-keyman-master/po/CMakeLists.txt000066400000000000000000000000521456742214200202150ustar00rootroot00000000000000fcitx5_install_translation(fcitx5-keyman) fcitx5-keyman-master/po/LINGUAS000066400000000000000000000000371456742214200165050ustar00rootroot00000000000000 de fr ja ko ru tr zh_CN zh_TW fcitx5-keyman-master/po/de.po000066400000000000000000000023061456742214200164110ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # Ettore Atalan , 2022 # mar well , 2022 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2022-12-06 20:25+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: mar well , 2022\n" "Language-Team: German (https://www.transifex.com/fcitx/teams/12005/de/)\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: src/engine.h:36 msgid "Configuration" msgstr "Konfiguration" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "Keyman-Unterstützung for Fcitx5" #: src/engine.cpp:642 msgid "Not available" msgstr "Nicht verfügbar" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "" fcitx5-keyman-master/po/fcitx5-keyman.pot000066400000000000000000000017021456742214200206700ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2021-03-26 18:53-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: LANG\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #: src/engine.h:50 msgid "Configuration" msgstr "" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "" #: src/keyman.conf.in.in:4 org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 msgid "Keyman support for Fcitx 5" msgstr "" #: src/engine.cpp:618 msgid "Not available" msgstr "" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "" fcitx5-keyman-master/po/fr.po000066400000000000000000000023571456742214200164360ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # roxfr , 2022 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2022-05-28 20:24+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: roxfr , 2022\n" "Language-Team: French (https://www.transifex.com/fcitx/teams/12005/fr/)\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % " "1000000 == 0 ? 1 : 2;\n" #: src/engine.h:36 msgid "Configuration" msgstr "Configuration" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "Prise en charge de Keyman pour Fcitx 5" #: src/engine.cpp:632 msgid "Not available" msgstr "Indisponible" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "Saisir votre langue avec Keyman pour Linux" fcitx5-keyman-master/po/ja.po000066400000000000000000000023131456742214200164110ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # Takuro Onoue , 2021 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2021-11-18 20:05+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: Takuro Onoue , 2021\n" "Language-Team: Japanese (https://www.transifex.com/fcitx/teams/12005/ja/)\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: src/engine.h:36 msgid "Configuration" msgstr "設定" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr " Fcitx 5 用の Keyman サポート" #: src/engine.cpp:632 msgid "Not available" msgstr "利用不可" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "Keyman for Linux で言語を入力する" fcitx5-keyman-master/po/ko.po000066400000000000000000000022731456742214200164350ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # Junghee Lee , 2022 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2022-04-09 20:25+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: Junghee Lee , 2022\n" "Language-Team: Korean (https://www.transifex.com/fcitx/teams/12005/ko/)\n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: src/engine.h:36 msgid "Configuration" msgstr "구성" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "FCitx 5용 Keyman 지원" #: src/engine.cpp:632 msgid "Not available" msgstr "사용할 수 없음" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "Linux용 Keyman으로 사용자의 언어 입력" fcitx5-keyman-master/po/ru.po000066400000000000000000000026001456742214200164440ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # Dmitry , 2022 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2022-06-02 20:26+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: Dmitry , 2022\n" "Language-Team: Russian (https://www.transifex.com/fcitx/teams/12005/ru/)\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " "(n%100>=11 && n%100<=14)? 2 : 3);\n" #: src/engine.h:36 msgid "Configuration" msgstr "Конфигурация" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "Поддержка Keyman для Fcitx 5" #: src/engine.cpp:632 msgid "Not available" msgstr "Недоступно" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "Введите свой язык с Keyman для Linux" fcitx5-keyman-master/po/tr.po000066400000000000000000000022751456742214200164530ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # abc Def , 2021 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2021-11-18 20:05+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: abc Def , 2021\n" "Language-Team: Turkish (https://www.transifex.com/fcitx/teams/12005/tr/)\n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: src/engine.h:36 msgid "Configuration" msgstr "Yapılandırma" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "Fcitx 5 için Keyman desteği" #: src/engine.cpp:632 msgid "Not available" msgstr "Müsait değil" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "Linux İçin Keyman ile dilinizde yazın" fcitx5-keyman-master/po/zh_CN.po000066400000000000000000000022661456742214200170270ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # csslayer , 2021 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2021-11-18 20:05+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: csslayer , 2021\n" "Language-Team: Chinese (China) (https://www.transifex.com/fcitx/teams/12005/" "zh_CN/)\n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: src/engine.h:36 msgid "Configuration" msgstr "配置" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "Fcitx 5 的 Keyman 支持" #: src/engine.cpp:632 msgid "Not available" msgstr "不可用" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "使用 Keyman 在 Linux 下输入您的语言" fcitx5-keyman-master/po/zh_TW.po000066400000000000000000000023421456742214200170540ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the fcitx5-keyman package. # # Translators: # fhoshino , 2021 # 黃柏諺 , 2021 # msgid "" msgstr "" "Project-Id-Version: fcitx5-keyman\n" "Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n" "POT-Creation-Date: 2021-11-18 20:05+0000\n" "PO-Revision-Date: 2021-11-01 14:47+0000\n" "Last-Translator: 黃柏諺 , 2021\n" "Language-Team: Chinese (Taiwan) (https://www.transifex.com/fcitx/teams/12005/" "zh_TW/)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: src/engine.h:36 msgid "Configuration" msgstr "設定" #: src/keyman.conf.in.in:3 msgid "Keyman" msgstr "Keyman" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:7 src/keyman.conf.in.in:4 msgid "Keyman support for Fcitx 5" msgstr "Fcitx 5 的 Keyman 支援" #: src/engine.cpp:632 msgid "Not available" msgstr "無法使用" #: org.fcitx.Fcitx5.Addon.Keyman.metainfo.xml.in:8 msgid "Type in your language with Keyman for Linux" msgstr "使用 Linux 下的 Keyman 輸入您的語言" fcitx5-keyman-master/src/000077500000000000000000000000001456742214200156315ustar00rootroot00000000000000fcitx5-keyman-master/src/CMakeLists.txt000066400000000000000000000010621456742214200203700ustar00rootroot00000000000000set(KEYMAN_SOURCES engine.cpp kmpmetadata.cpp ) add_library(keyman MODULE ${KEYMAN_SOURCES}) target_link_libraries(keyman Fcitx5::Core Fcitx5::Config PkgConfig::Keyman PkgConfig::JsonC) set_target_properties(keyman PROPERTIES PREFIX "") install(TARGETS keyman DESTINATION "${CMAKE_INSTALL_LIBDIR}/fcitx5") configure_file(keyman.conf.in.in keyman.conf.in) fcitx5_translate_desktop_file("${CMAKE_CURRENT_BINARY_DIR}/keyman.conf.in" keyman.conf) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/keyman.conf" DESTINATION "${CMAKE_INSTALL_DATADIR}/fcitx5/addon") fcitx5-keyman-master/src/engine.cpp000066400000000000000000000441241456742214200176070ustar00rootroot00000000000000/* * SPDX-FileCopyrightText: 2018 SIL International * SPDX-FileCopyrightText: 2021~2021 Google LLC * * SPDX-License-Identifier: GPL-2.0-or-later * */ #include "engine.h" #include #include #include #include #include #include #include #include "kmpdata.h" #include "kmpmetadata.h" #define MAXCONTEXT_ITEMS 128 #define KEYMAN_BACKSPACE 14 #define KEYMAN_BACKSPACE_KEYSYM 0xff08 #define KEYMAN_LCTRL 29 #define KEYMAN_LALT 56 #define KEYMAN_RCTRL 97 #define KEYMAN_RALT 100 FCITX_DEFINE_LOG_CATEGORY(keyman, "keyman"); #define FCITX_KEYMAN_DEBUG() FCITX_LOGC(::keyman, Debug) #define FCITX_KEYMAN_ERROR() FCITX_LOGC(::keyman, Error) namespace fcitx { namespace { std::vector utf8ToUTF16(std::string_view str) { if (!utf8::validate(str)) { return {}; } std::vector result; for (const auto ucs4 : utf8::MakeUTF8CharRange(str)) { if (ucs4 < 0x10000) { result.push_back(static_cast(ucs4)); } else if (ucs4 < 0x110000) { result.push_back(0xD800 | (((ucs4 - 0x10000) >> 10) & 0x3ff)); result.push_back(0xDC00 | (ucs4 & 0x3ff)); } else { return {}; } } result.push_back(0); return result; } template std::string utf16ToUTF8(Iter start, Iter end) { std::string result; while (start != end) { uint32_t ucs4 = 0; if (*start < 0xD800 || *start > 0xDFFF) { ucs4 = *start; start = std::next(start); } else if (0xD800 <= *start && *start <= 0xDBFF) { if (std::next(start) == end) { return {}; } auto cur = *start; auto next = std::next(start); if (0xDC00 <= *next && *next <= 0xDFFF) { /* We have a valid surrogate pair. */ ucs4 = (((cur & 0x3FF) << 10) | (*next & 0x3FF)) + (1 << 16); } else { return {}; } start = std::next(next); } else if (0xDC00 <= *start && *start <= 0xDFFF) { return {}; } result.append(utf8::UCS4ToUTF8(ucs4)); } return result; } std::string get_current_context_text_debug(km_core_state *state) { km_core_cp *buf = km_core_state_context_debug(state, KM_CORE_DEBUG_CONTEXT_CACHED); std::string result; if (buf) { size_t n = 0; while (buf[n]) { n++; } result = utf16ToUTF8(buf, buf + n); km_core_cp_dispose(buf); } return result; } std::set listKeymapDirs() { // Locate all directory under $XDG_DATA/keyman std::set keymapDirs; StandardPath::global().scanFiles( StandardPath::Type::Data, "keyman", [&keymapDirs](const std::string &path, const std::string &dir, bool) { if (fs::isdir(stringutils::joinPath(dir, path))) { keymapDirs.insert(path); } return true; }); return keymapDirs; } } // namespace class KeymanState : public InputContextProperty { public: KeymanState(KeymanKeyboardData *keyboard, InputContext *ic) : keyboard_(keyboard), ic_(ic) { std::vector keyboard_opts; keyboard_opts.emplace_back(); keyboard_opts.back().scope = KM_CORE_OPT_ENVIRONMENT; const auto platform = utf8ToUTF16("platform"); keyboard_opts.back().key = platform.data(); const auto platformValue = utf8ToUTF16("linux desktop hardware native"); keyboard_opts.back().value = platformValue.data(); keyboard_opts.emplace_back(); keyboard_opts.back().scope = KM_CORE_OPT_ENVIRONMENT; const auto baseLayout = utf8ToUTF16("baseLayout"); keyboard_opts.back().key = baseLayout.data(); const auto baseLayoutValue = utf8ToUTF16("kbdus.dll"); keyboard_opts.back().value = baseLayoutValue.data(); keyboard_opts.emplace_back(); keyboard_opts.back().scope = KM_CORE_OPT_ENVIRONMENT; const auto baseLayoutAlt = utf8ToUTF16("baseLayoutAlt"); keyboard_opts.back().key = baseLayoutAlt.data(); const auto baseLayoutAltValue = utf8ToUTF16("en-US"); keyboard_opts.back().value = baseLayoutAltValue.data(); keyboard_opts.emplace_back(); keyboard_opts.back().scope = 0; keyboard_opts.back().key = nullptr; keyboard_opts.back().value = nullptr; km_core_status status_state = km_core_state_create( keyboard_->kbpKeyboard(), keyboard_opts.data(), &state); if (status_state != KM_CORE_STATUS_OK) { FCITX_KEYMAN_ERROR() << "problem creating km_core_state for " << keyboard_->metadata().id; return; }; updateContext(); } // Update context from surrounding if possible. void updateContext() { if (ic_->capabilityFlags().test(CapabilityFlag::SurroundingText) && ic_->surroundingText().isValid()) { auto text = ic_->surroundingText().text(); auto context_pos = std::min(ic_->surroundingText().anchor(), ic_->surroundingText().cursor()); auto context_start = context_pos > MAXCONTEXT_ITEMS ? context_pos - MAXCONTEXT_ITEMS : 0; auto startIter = utf8::nextNChar(text.begin(), context_start); auto endIter = utf8::nextNChar(startIter, context_pos - context_start); std::string new_context(startIter, endIter); auto utf16Context = utf8ToUTF16(new_context); km_core_state_context_set_if_needed( state, reinterpret_cast(utf16Context.data())); FCITX_KEYMAN_DEBUG() << "Set context from application: " << new_context; } } void clearContext() { FCITX_KEYMAN_DEBUG() << "Clear context"; km_core_state_context_clear(state); } void reset() { lctrl_pressed = false; rctrl_pressed = false; lalt_pressed = false; ralt_pressed = false; } auto *keyboard() { return keyboard_; } km_core_state *state = nullptr; bool lctrl_pressed = false; bool rctrl_pressed = false; bool lalt_pressed = false; bool ralt_pressed = false; private: KeymanKeyboardData *keyboard_; InputContext *ic_; }; KeymanEngine::KeymanEngine(Instance *instance) : instance_(instance) { updateHandler_ = instance_->watchEvent( EventType::CheckUpdate, EventWatcherPhase::Default, [this](Event &event) { auto &update = static_cast(event); // Locate all directory under $XDG_DATA/keyman std::set keymapDirs = listKeymapDirs(); FCITX_KEYMAN_DEBUG() << "Keyman directories: " << keymapDirs; std::unordered_map> keyboards; for (const auto &keymapDir : keymapDirs) { auto kmpJsonFiles = StandardPath::global().locateAll( StandardPath::Type::Data, stringutils::joinPath("keyman", keymapDir, "kmp.json")); for (const auto &kmpJsonFile : kmpJsonFiles) { if (timestamp_ < fs::modifiedTime(kmpJsonFile)) { update.setHasUpdate(); return; } } } }); } std::vector KeymanEngine::listInputMethods() { // Locate all directory under $XDG_DATA/keyman std::set keymapDirs = listKeymapDirs(); FCITX_KEYMAN_DEBUG() << "Keyman directories: " << keymapDirs; std::unordered_map> keyboards; for (const auto &keymapDir : keymapDirs) { auto kmpJsonFiles = StandardPath::global().openAll( StandardPath::Type::Data, stringutils::joinPath("keyman", keymapDir, "kmp.json"), O_RDONLY); for (const auto &kmpJsonFile : kmpJsonFiles) { try { timestamp_ = std::max(timestamp_, fs::modifiedTime(kmpJsonFile.path())); KmpMetadata metadata(kmpJsonFile.fd()); for (const auto &[id, keyboard] : metadata.keyboards()) { if (auto iter = keyboards.find(id); iter != keyboards.end() && iter->second->version < keyboard.version) { continue; } keyboards[id] = std::make_unique( instance_, keyboard, metadata, fs::dirName(kmpJsonFile.path())); } } catch (...) { } } } std::vector result; for (auto &[id, keyboard] : keyboards) { std::string icon = "km-config"; // Check if icon file exists, otherwise fallback to keyman's icon. for (auto *suffix : {".bmp.png", ".icon.png"}) { auto path = stringutils::joinPath(keyboard->baseDir, stringutils::concat(id, suffix)); if (fs::isreg(path)) { icon = std::move(path); break; } } result.emplace_back(stringutils::concat("keyman:", id), stringutils::concat(keyboard->name, " (Keyman)"), keyboard->language, "keyman"); result.back().setIcon(icon).setConfigurable(true).setUserData( std::move(keyboard)); } return result; } FCITX_ADDON_FACTORY(fcitx::KeymanEngineFactory); } // namespace fcitx void fcitx::KeymanKeyboardData::load() { if (loaded_) { return; } loaded_ = true; auto kmxPath = stringutils::joinPath( metadata_.baseDir, stringutils::concat(metadata_.id, ".kmx")); auto ldmlFile = stringutils::joinPath( metadata_.baseDir, stringutils::concat(metadata_.id, ".ldml")); if (!fs::isreg(ldmlFile)) { ldmlFile.clear(); } ldmlFile_ = ldmlFile; if (!fs::isreg(kmxPath)) { FCITX_KEYMAN_ERROR() << "Failed to find kmx file. " << metadata_.id; return; } km_core_status status_keyboard = km_core_keyboard_load(kmxPath.data(), &keyboard_); if (status_keyboard != KM_CORE_STATUS_OK) { FCITX_KEYMAN_ERROR() << "problem creating km_core_keyboard" << metadata_.id; return; } instance_->inputContextManager().registerProperty( stringutils::concat("keymanState", metadata_.id), &factory_); config_ = RawConfig(); readAsIni(config_, stringutils::concat("keyman/", metadata_.id, ".conf")); FCITX_KEYMAN_DEBUG() << config_; } void fcitx::KeymanKeyboardData::setOption(const km_core_cp *key, const km_core_cp *value) { auto keyEnd = key; while (*keyEnd) { ++keyEnd; } auto valueEnd = value; while (*valueEnd) { ++valueEnd; } auto utf8Key = utf16ToUTF8(key, keyEnd); auto utf8Value = utf16ToUTF8(value, valueEnd); if (!utf8Key.empty()) { config_.setValueByPath(utf8Key, utf8Value); safeSaveAsIni(config_, stringutils::concat("keyman/", metadata_.id, ".conf")); } } fcitx::KeymanKeyboardData::KeymanKeyboardData( Instance *instance, const fcitx::KeymanKeyboard &metadata) : instance_(instance), metadata_(metadata), factory_( [this](InputContext &ic) { return new KeymanState(this, &ic); }) {} fcitx::KeymanKeyboardData::~KeymanKeyboardData() { factory_.unregister(); } void fcitx::KeymanEngine::activate(const fcitx::InputMethodEntry &entry, fcitx::InputContextEvent &event) { auto data = static_cast(entry.userData()); data->load(); auto keyman = state(entry, *event.inputContext()); if (!keyman) { return; } keyman->updateContext(); } void fcitx::KeymanEngine::keyEvent(const fcitx::InputMethodEntry &entry, fcitx::KeyEvent &keyEvent) { auto ic = keyEvent.inputContext(); auto keyman = state(entry, *ic); if (!keyman) { return; } auto keycode = keyEvent.key().code() - 8; auto state = keyEvent.rawKey().states(); switch (keycode) { case KEYMAN_LCTRL: keyman->lctrl_pressed = !keyEvent.isRelease(); break; case KEYMAN_RCTRL: keyman->rctrl_pressed = !keyEvent.isRelease(); break; case KEYMAN_LALT: keyman->lalt_pressed = !keyEvent.isRelease(); break; case KEYMAN_RALT: keyman->ralt_pressed = !keyEvent.isRelease(); break; default: break; } if (keycode < 0 || keycode > 255) { return; } if (keycode_to_vk[keycode] == 0) { // key that we don't handles if (keyEvent.key().isCursorMove()) { km_core_state_context_clear(keyman->state); keyman->updateContext(); } return; } // keyman modifiers are different from X11 uint16_t km_mod_state = 0; if (state.test(KeyState::Shift)) { km_mod_state |= KM_CORE_MODIFIER_SHIFT; } if (state.test(KeyState::Mod5)) { km_mod_state |= KM_CORE_MODIFIER_RALT; FCITX_KEYMAN_DEBUG() << "modstate KM_CORE_MODIFIER_RALT from Mod5"; } if (state.test(KeyState::Mod1)) { if (keyman->ralt_pressed) { km_mod_state |= KM_CORE_MODIFIER_RALT; FCITX_KEYMAN_DEBUG() << "modstate KM_CORE_MODIFIER_RALT from ralt_pressed"; } if (keyman->lalt_pressed) { km_mod_state |= KM_CORE_MODIFIER_LALT; FCITX_KEYMAN_DEBUG() << "modstate KM_CORE_MODIFIER_LALT from lalt_pressed"; } } if (state.test(KeyState::Ctrl)) { if (keyman->rctrl_pressed) { km_mod_state |= KM_CORE_MODIFIER_RCTRL; FCITX_KEYMAN_DEBUG() << "modstate KM_CORE_MODIFIER_RCTRL from rctrl_pressed"; } if (keyman->lctrl_pressed) { km_mod_state |= KM_CORE_MODIFIER_LCTRL; FCITX_KEYMAN_DEBUG() << "modstate KM_CORE_MODIFIER_LCTRL from lctrl_pressed"; } } if (ic->capabilityFlags().test(CapabilityFlag::SurroundingText) && ic->surroundingText().isValid()) { keyman->updateContext(); } FCITX_KEYMAN_DEBUG() << "before process key event context: " << get_current_context_text_debug(keyman->state); FCITX_KEYMAN_DEBUG() << "km_mod_state=" << km_mod_state; km_core_process_event(keyman->state, keycode_to_vk[keycode], km_mod_state, !keyEvent.isRelease(), 0); FCITX_KEYMAN_DEBUG() << "after process key event context : " << get_current_context_text_debug(keyman->state); km_core_actions const *actions = km_core_state_get_actions(keyman->state); auto numOfDelete = actions->code_points_to_delete; FCITX_KEYMAN_DEBUG() << "BACK action " << numOfDelete; if (numOfDelete > 0) { if (numOfDelete == 1 && keyEvent.key().check(FcitxKey_BackSpace)) { emit_keystroke = true; } else if (ic->capabilityFlags().test( CapabilityFlag::SurroundingText)) { ic->deleteSurroundingText(-numOfDelete, numOfDelete); FCITX_KEYMAN_DEBUG() << "deleting surrounding text " << numOfDelete << " char(s)"; } else { FCITX_KEYMAN_DEBUG() << "forwarding backspace with reset context"; while (numOfDelete) { ic->forwardKey(Key(FcitxKey_BackSpace)); numOfDelete -= 1; } } } std::string output; if (actions->output) { for (size_t n = 0; actions->output[n]; n++) { output.append(utf8::UCS4ToUTF8(actions->output[n])); } } if (actions->do_alert) { FCITX_KEYMAN_DEBUG() << "ALERT action"; } if (!output.empty()) { ic->commitString(output); } if (actions->emit_keystroke || emit_keystroke) { FCITX_KEYMAN_DEBUG() << "EMIT_KEYSTROKE action"; emit_keystroke = false; } else { keyEvent.filterAndAccept(); } FCITX_KEYMAN_DEBUG() << "PERSIST_OPT action"; for (size_t i = 0; actions->persist_options[i].scope; i++) { if (actions->persist_options[i].key && actions->persist_options[i].value) { // Put the keyboard option into config FCITX_KEYMAN_DEBUG() << "Saving keyboard option to Config"; // Load the current keyboard options from DConf keyman->keyboard()->setOption(actions->persist_options[i].key, actions->persist_options[i].value); } } // TODO: set capslock if actions->new_caps_lock_state != // KM_CORE_CAPS_UNCHANGED FCITX_KEYMAN_DEBUG() << "after processing all actions"; } void fcitx::KeymanEngine::reset(const fcitx::InputMethodEntry &entry, fcitx::InputContextEvent &event) { auto ic = event.inputContext(); auto keyman = state(entry, *ic); if (!keyman) { return; } keyman->clearContext(); keyman->reset(); } fcitx::KeymanState * fcitx::KeymanEngine::state(const fcitx::InputMethodEntry &entry, fcitx::InputContext &ic) { auto userData = static_cast(entry.userData()); auto &data = userData->data(); // Check if data is ready. if (!data.kbpKeyboard() || !data.factory().registered()) { return nullptr; } auto keyman = ic.propertyFor(&data.factory()); if (!keyman->state) { return nullptr; } return keyman; } std::string fcitx::KeymanEngine::subMode(const fcitx::InputMethodEntry &entry, fcitx::InputContext &ic) { auto keyman = state(entry, ic); if (!keyman) { return _("Not available"); } return ""; } fcitx5-keyman-master/src/engine.h000066400000000000000000000074351456742214200172600ustar00rootroot00000000000000/* * SPDX-FileCopyrightText: 2021~2021 Google LLC * * SPDX-License-Identifier: GPL-2.0-or-later * */ #ifndef _FCITX5_KEYMAN_ENGINE_H_ #define _FCITX5_KEYMAN_ENGINE_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kmpmetadata.h" namespace fcitx { class KeymanState; class KeymanKeyboard; FCITX_CONFIGURATION(KeymanConfig, ExternalOption config{this, "Configuration", _("Configuration"), "km-config"};); class KeymanKeyboardData { public: KeymanKeyboardData(Instance *instance, const KeymanKeyboard &metadata); ~KeymanKeyboardData(); void load(); const auto &metadata() const { return metadata_; } auto *kbpKeyboard() const { return keyboard_; } const auto &factory() const { return factory_; } void setOption(const km_core_cp *key, const km_core_cp *value); private: Instance *instance_; bool loaded_ = false; std::string ldmlFile_; const KeymanKeyboard &metadata_; km_core_keyboard *keyboard_ = nullptr; FactoryFor factory_; RawConfig config_; }; class KeymanKeyboard : public InputMethodEntryUserData { public: KeymanKeyboard(Instance *instance, const KmpKeyboardMetadata &keyboard, const KmpMetadata &metadata, const std::string &dir) : id(keyboard.id), version(keyboard.version), baseDir(dir), name(keyboard.name), language(keyboard.languages.empty() ? "" : keyboard.languages[0].first), readme(metadata.readmeFile()), graphic(metadata.graphicFile()), data_(instance, *this) {} const std::string id; const std::string version; const std::string baseDir; const std::string name; const std::string language; const std::string readme; const std::string graphic; void load() const { data_.load(); } KeymanKeyboardData &data() const { return data_; } private: mutable KeymanKeyboardData data_; }; class KeymanEngine final : public InputMethodEngineV2 { public: KeymanEngine(Instance *instance); Instance *instance() { return instance_; } void activate(const fcitx::InputMethodEntry &, fcitx::InputContextEvent &) override; void keyEvent(const InputMethodEntry &entry, KeyEvent &keyEvent) override; std::vector listInputMethods() override; void reset(const fcitx::InputMethodEntry &, fcitx::InputContextEvent &) override; const fcitx::Configuration *getConfig() const override { return &config_; } std::string subMode(const fcitx::InputMethodEntry &, fcitx::InputContext &) override; private: FCITX_ADDON_DEPENDENCY_LOADER(dbus, instance_->addonManager()); KeymanState *state(const fcitx::InputMethodEntry &entry, fcitx::InputContext &ic); Instance *instance_; KeymanConfig config_; std::unique_ptr> updateHandler_; int64_t timestamp_ = 0; bool emit_keystroke = false; }; class KeymanEngineFactory : public AddonFactory { public: AddonInstance *create(AddonManager *manager) override { registerDomain("fcitx5-keyman", FCITX_INSTALL_LOCALEDIR); return new KeymanEngine(manager->instance()); } }; } // namespace fcitx #endif // _FCITX5_KEYMAN_ENGINE_H_ fcitx5-keyman-master/src/keyman.conf.in.in000066400000000000000000000002751456742214200210020ustar00rootroot00000000000000[Addon] Name=Keyman Comment=Keyman support for Fcitx 5 Category=InputMethod Version=@PROJECT_VERSION@ Library=keyman Type=SharedLibrary Configurable=True [Addon/Dependencies] 0=core:5.0.6 fcitx5-keyman-master/src/kmpdata.h000066400000000000000000000164011456742214200174250ustar00rootroot00000000000000/* * SPDX-FileCopyrightText: 2009~2020 SIL International * SPDX-FileCopyrightText: 2021~2021 Google LLC * * SPDX-License-Identifier: GPL-2.0-or-later * */ #ifndef _FCITX5_KEYMAN_KMPDATA_H_ #define _FCITX5_KEYMAN_KMPDATA_H_ #include #include // from // android/KMEA/app/src/main/java/com/tavultesoft/kmea/KMHardwareKeyboardInterpreter.java // uses kernel keycodes which are X11 keycode - 8 // private static final // int scanCodeMap[] = { static km_kpb_virtual_key const keycode_to_vk[256] = { KM_CORE_VKEY__00, // padding = 0x00; KM_CORE_VKEY_ESC, // public static final int KEY_ESC = 0x01; KM_CORE_VKEY_1, // public static final int KEY_1 = 0x02; KM_CORE_VKEY_2, // public static final int KEY_2 = 0x03; KM_CORE_VKEY_3, // public static final int KEY_3 = 0x04; KM_CORE_VKEY_4, // public static final int KEY_4 = 0x05; KM_CORE_VKEY_5, // public static final int KEY_5 = 0x06; KM_CORE_VKEY_6, // public static final int KEY_6 = 0x07; KM_CORE_VKEY_7, // public static final int KEY_7 = 0x08; KM_CORE_VKEY_8, // public static final int KEY_8 = 0x09; KM_CORE_VKEY_9, // public static final int KEY_9 = 0x0A; KM_CORE_VKEY_0, // public static final int KEY_0 = 0x0B; KM_CORE_VKEY_HYPHEN, // public static final int KEY_MINUS = 0x0C; KM_CORE_VKEY_EQUAL, // public static final int KEY_EQUALS = 0x0D; KM_CORE_VKEY_BKSP, // public static final int KEY_BACKSPACE = 0x0E; KM_CORE_VKEY_TAB, // public static final int KEY_TAB = 0x0F; KM_CORE_VKEY_Q, // public static final int KEY_Q = 0x10; KM_CORE_VKEY_W, // public static final int KEY_W = 0x11; KM_CORE_VKEY_E, // public static final int KEY_E = 0x12; KM_CORE_VKEY_R, // public static final int KEY_R = 0x13; KM_CORE_VKEY_T, // public static final int KEY_T = 0x14; KM_CORE_VKEY_Y, // public static final int KEY_Y = 0x15; KM_CORE_VKEY_U, // public static final int KEY_U = 0x16; KM_CORE_VKEY_I, // public static final int KEY_I = 0x17; KM_CORE_VKEY_O, // public static final int KEY_O = 0x18; KM_CORE_VKEY_P, // public static final int KEY_P = 0x19; KM_CORE_VKEY_LBRKT, // public static final int KEY_LEFTBRACE = 0x1A; KM_CORE_VKEY_RBRKT, // public static final int KEY_RIGHTBRACE = 0x1B; KM_CORE_VKEY_ENTER, // public static final int KEY_ENTER = 0x1C; KM_CORE_VKEY__00, // public static final int KEY_LEFTCTRL = 0x1D; KM_CORE_VKEY_A, // public static final int KEY_A = 0x1E; KM_CORE_VKEY_S, // public static final int KEY_S = 0x1F; KM_CORE_VKEY_D, // public static final int KEY_D = 0x20; KM_CORE_VKEY_F, // public static final int KEY_F = 0x21; KM_CORE_VKEY_G, // public static final int KEY_G = 0x22; KM_CORE_VKEY_H, // public static final int KEY_H = 0x23; KM_CORE_VKEY_J, // public static final int KEY_J = 0x24; KM_CORE_VKEY_K, // public static final int KEY_K = 0x25; KM_CORE_VKEY_L, // public static final int KEY_L = 0x26; KM_CORE_VKEY_COLON, // public static final int KEY_SEMICOLON = 0x27; KM_CORE_VKEY_QUOTE, // public static final int KEY_APOSTROPHE = 0x28; KM_CORE_VKEY_BKQUOTE, // public static final int KEY_GRAVE = 0x29; KM_CORE_VKEY__00, // public static final int KEY_LEFTSHIFT = 0x2A; KM_CORE_VKEY_BKSLASH, // public static final int KEY_BACKSLASH = // 0x2B; KM_CORE_VKEY_Z, // public static final int KEY_Z = 0x2C; KM_CORE_VKEY_X, // public static final int KEY_X = 0x2D; KM_CORE_VKEY_C, // public static final int KEY_C = 0x2E; KM_CORE_VKEY_V, // public static final int KEY_V = 0x2F; KM_CORE_VKEY_B, // public static final int KEY_B = 0x30; KM_CORE_VKEY_N, // public static final int KEY_N = 0x31; KM_CORE_VKEY_M, // public static final int KEY_M = 0x32; KM_CORE_VKEY_COMMA, // public static final int KEY_COMMA = 0x33; KM_CORE_VKEY_PERIOD, // public static final int KEY_DOT = 0x34; KM_CORE_VKEY_SLASH, // public static final int KEY_SLASH = 0x35; KM_CORE_VKEY__00, // public static final int KEY_RIGHTSHIFT = 0x36; KM_CORE_VKEY_NPSTAR, // public static final int KEY_KPASTERISK = // 0x37; KM_CORE_VKEY__00, // public static final int KEY_LEFTALT = 0x38; KM_CORE_VKEY_SPACE, // public static final int KEY_SPACE = 0x39; KM_CORE_VKEY__00, // public static final int KEY_CAPSLOCK = 0x3A; KM_CORE_VKEY_F1, // public static final int KEY_F1 = 0x3B; KM_CORE_VKEY_F2, // public static final int KEY_F2 = 0x3C; KM_CORE_VKEY_F3, // public static final int KEY_F3 = 0x3D; KM_CORE_VKEY_F4, // public static final int KEY_F4 = 0x3E; KM_CORE_VKEY_F5, // public static final int KEY_F5 = 0x3F; KM_CORE_VKEY_F6, // public static final int KEY_F6 = 0x40; KM_CORE_VKEY_F7, // public static final int KEY_F7 = 0x41; KM_CORE_VKEY_F8, // public static final int KEY_F8 = 0x42; KM_CORE_VKEY_F9, // public static final int KEY_F9 = 0x43; KM_CORE_VKEY_F10, // public static final int KEY_F10 = 0x44; KM_CORE_VKEY__00, // public static final int KEY_NUMLOCK = 0x45; KM_CORE_VKEY__00, // public static final int KEY_SCROLLLOCK = 0x46; KM_CORE_VKEY_NP7, // public static final int KEY_KP7 = 0x47; KM_CORE_VKEY_NP8, // public static final int KEY_KP8 = 0x48; KM_CORE_VKEY_NP9, // public static final int KEY_KP9 = 0x49; KM_CORE_VKEY_NPMINUS, // public static final int KEY_KPMINUS = 0x4A; KM_CORE_VKEY_NP4, // public static final int KEY_KP4 = 0x4B; KM_CORE_VKEY_NP5, // public static final int KEY_KP5 = 0x4C; KM_CORE_VKEY_NP6, // public static final int KEY_KP6 = 0x4D; KM_CORE_VKEY_NPPLUS, // public static final int KEY_KPPLUS = 0x4E; KM_CORE_VKEY_NP1, // public static final int KEY_KP1 = 0x4F; KM_CORE_VKEY_NP2, // public static final int KEY_KP2 = 0x50; KM_CORE_VKEY_NP3, // public static final int KEY_KP3 = 0x51; KM_CORE_VKEY_NP0, // public static final int KEY_KP0 = 0x52; KM_CORE_VKEY_NPDOT, // public static final int KEY_KPDOT = 0x53; KM_CORE_VKEY__00, // padding 0x54; KM_CORE_VKEY__00, // public static final int KEY_ZENKAKUHANKAKU = // 0x55; KM_CORE_VKEY_oE2, // public static final int KEY_102ND = 0x56; // additional on linux KM_CORE_VKEY_F11, // public static final int KEY_F11 = 0x57; KM_CORE_VKEY_F12 // public static final int KEY_F12 = 0x58; // Many more KEYS currently not used by KMW... }; #endif // _FCITX5_KEYMAN_KMPDATA_H_ fcitx5-keyman-master/src/kmpmetadata.cpp000066400000000000000000000111651456742214200206310ustar00rootroot00000000000000/* * SPDX-FileCopyrightText: 2021~2021 Google LLC * * SPDX-License-Identifier: GPL-2.0-or-later * */ #include "kmpmetadata.h" #include #include #include #include #include namespace fcitx { std::string readStringValue(json_object *object, const char *field, std::string_view defaultValue = "") { if (auto subObject = json_object_object_get(object, field); subObject && json_object_get_type(subObject) == json_type_string) { return json_object_get_string(subObject); } return std::string{defaultValue}; } std::string readDescriptionValue(json_object *object, const char *field, std::string_view defaultValue = "") { if (auto subObject = json_object_object_get(object, field); subObject && json_object_get_type(subObject) == json_type_object) { return readStringValue(subObject, "description", defaultValue); } return std::string{defaultValue}; } KmpMetadata::KmpMetadata(int fd) { UniqueCPtr obj(json_object_from_fd(fd)); if (!obj) { throw std::runtime_error("Failed to parse kmp.json"); } if (auto kmpSystem = json_object_object_get(obj.get(), "system"); kmpSystem && json_object_get_type(kmpSystem) == json_type_object) { keymanDeveloperVersion_ = readStringValue(kmpSystem, "keymanDeveloperVersion"); fileVersion_ = readStringValue(kmpSystem, "fileVersion"); } if (auto kmpInfo = json_object_object_get(obj.get(), "info"); kmpInfo && json_object_get_type(kmpInfo) == json_type_object) { name_ = readDescriptionValue(kmpInfo, "name"); version_ = readDescriptionValue(kmpInfo, "version"); copyright_ = readDescriptionValue(kmpInfo, "copyright"); author_ = readDescriptionValue(kmpInfo, "author"); website_ = readDescriptionValue(kmpInfo, "website"); } if (auto kmpFiles = json_object_object_get(obj.get(), "files"); kmpFiles && json_object_get_type(kmpFiles) == json_type_array) { for (size_t i = 0, e = json_object_array_length(kmpFiles); i < e; i++) { auto file = json_object_array_get_idx(kmpFiles, i); auto name = readStringValue(file, "name"); auto description = readStringValue(file, "description"); if (!name.empty()) { files_[name] = description; } } } if (auto kmpOptions = json_object_object_get(obj.get(), "options"); kmpOptions && json_object_get_type(kmpOptions) == json_type_object) { readmeFile_ = readStringValue(kmpOptions, "readmeFile"); graphicFile_ = readStringValue(kmpOptions, "graphicFile"); if (!files_.count(readmeFile_)) { readmeFile_ = std::string(); } if (!files_.count(graphicFile_)) { graphicFile_ = std::string(); } } if (auto kmpKeyboards = json_object_object_get(obj.get(), "keyboards"); kmpKeyboards && json_object_get_type(kmpKeyboards) == json_type_array) { for (size_t i = 0, e = json_object_array_length(kmpKeyboards); i < e; i++) { auto file = json_object_array_get_idx(kmpKeyboards, i); KmpKeyboardMetadata keyboard; keyboard.id = readStringValue(file, "id"); if (keyboard.id.empty()) { continue; } keyboard.name = readStringValue(file, "name"); if (keyboard.name.empty()) { keyboard.name = keyboard.id; } keyboard.version = readStringValue(file, "version"); if (auto kmpLanguages = json_object_object_get(file, "languages"); kmpLanguages && json_object_get_type(kmpLanguages) == json_type_array) { for (size_t i = 0, e = json_object_array_length(kmpLanguages); i < e; i++) { auto language = json_object_array_get_idx(kmpLanguages, i); auto languageName = readStringValue(language, "name"); auto languageId = readStringValue(language, "id"); if (languageId.empty()) { continue; } keyboard.languages.emplace_back(languageId, languageName); } } auto kmxFile = stringutils::concat(keyboard.id, ".kmx"); if (!files_.count(kmxFile)) { continue; } keyboards_[keyboard.id] = std::move(keyboard); } } } } // namespace fcitx fcitx5-keyman-master/src/kmpmetadata.h000066400000000000000000000033361456742214200202770ustar00rootroot00000000000000/* * SPDX-FileCopyrightText: 2021~2021 Google LLC * * SPDX-License-Identifier: GPL-2.0-or-later * */ #ifndef _FCITX5_KEYMAN_KMPMETADATA_H_ #define _FCITX5_KEYMAN_KMPMETADATA_H_ #include #include #include #include namespace fcitx { struct KmpKeyboardMetadata { std::string id; std::string name; std::string version; // The order matters here, because fcitx support only one language code. std::vector> languages; }; inline LogMessageBuilder &operator<<(LogMessageBuilder &builder, const KmpKeyboardMetadata &keyboard) { builder << "KmpKeyboardMetadata(id=" << keyboard.id << ",name=" << keyboard.name << ",version=" << keyboard.version << ",languages=" << keyboard.languages << ")"; return builder; } // Lots of property is not used within Fcitx, but we just try to save them all // anyway. class KmpMetadata { public: KmpMetadata(int fd); const auto &keyboards() const { return keyboards_; } const auto &readmeFile() const { return readmeFile_; } const auto &graphicFile() const { return graphicFile_; } private: // System std::string keymanDeveloperVersion_; std::string fileVersion_; // info std::string name_; std::string version_; std::string copyright_; std::string author_; std::string website_; // Option std::string readmeFile_; std::string graphicFile_; // Files // file name to description; std::unordered_map files_; std::unordered_map keyboards_; }; } // namespace fcitx #endif // _FCITX5_KEYMAN_KMPMETADATA_H_