pax_global_header00006660000000000000000000000064142036336770014525gustar00rootroot0000000000000052 comment=4faef1e0a04b54eefbd2245abeea197a702e2086 libtsm-4.0.2/000077500000000000000000000000001420363367700130225ustar00rootroot00000000000000libtsm-4.0.2/.clang-format000066400000000000000000000066401420363367700154030ustar00rootroot00000000000000--- Language: Cpp BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Right AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: true BinPackArguments: true BinPackParameters: true BraceWrapping: AfterClass: false AfterControlStatement: false AfterEnum: false AfterFunction: true AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false AfterUnion: false AfterExternBlock: false BeforeCatch: false BeforeElse: false IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Custom BreakBeforeInheritanceComma: false BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: true BreakConstructorInitializers: BeforeComma BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true ColumnLimit: 110 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - Q_FOREVER - BOOST_FOREACH IncludeBlocks: Regroup IncludeCategories: - Regex: 'tensorflow_headers\.h' Priority: -1 - Regex: '^"' Priority: 3 - Regex: '^(<|")(tensorflow|third_party)/' Priority: 5 - Regex: '^ David Herrmann Ran Benita = Copyright Notice = This software is licensed under the terms of the MIT license. Please see each source file for the related copyright notice and license. If a file does not contain a copright notice, the following license shall apply: Copyright (c) 2017-2018 Aetf Copyright (c) 2011-2013 David Herrmann 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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. == Third-Party Source == The hash-table implementation in src/shared/shl-htable.* uses internally the htable from CCAN, see LICENSE_htable. The wcwidth() implementation in ./external/wcwidth is from Copyright (C) Fredrik Fornwall 2016. Distributed under the MIT License. Implementation of wcwidth(3) as a C port of: https://github.com/jquast/wcwidth Report issues at: https://github.com/termux/wcwidth UCS-4 to UTF-8 encoding is copied from "terminology": Copyright (C) 2012-2012 Carsten Haitzler and various contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The "solarized" color palettes in tsm_vte.c are from: Copyright (c) 2011 Ethan Schoonover 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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. libtsm-4.0.2/LICENSE_htable000066400000000000000000000636371420363367700153650ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, 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. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library. 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 Library or any portion of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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. If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be 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. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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. 9. 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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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 with this License. 11. 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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library. 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. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. 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 library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libtsm-4.0.2/NEWS000066400000000000000000000000611420363367700135160ustar00rootroot00000000000000= libtsm Release News = CHANGES WITH 1: * TODO libtsm-4.0.2/README000066400000000000000000000042471420363367700137110ustar00rootroot00000000000000= TSM - Terminal Emulator State Machine = TSM is a state machine for DEC VT100-VT520 compatible terminal emulators. It tries to support all common standards while keeping compatibility to existing emulators like xterm, gnome-terminal, konsole, .. TSM itself does not provide any rendering nor window management. It is a simple plain state machine without any external dependencies. It can be used to implement terminal emulators, but also to implement other applications that need to interpret terminal escape sequences. This library is very similar to libvte of the gnome project. However, libvte is highly bound to GTK+, which makes it unsuitable for non-graphics projects that need to parse escape sequences. Instead, TSM tries to restrict its API to terminal emulation only. Furthermore, TSM does not try to establish a new terminal emulation standard, but instead keeps compatibility as close to xterm as possible. This is why the TERM variable can be set to xterm-color256 with any TSM based terminal emulator. Website: http://www.freedesktop.org/wiki/Software/libtsm == Requirements == libtsm has no runtime requirements other than a ISO-C compatible C library. For keyboard key-symbols, the headers of libxkbcommon are needed during compile-time only. libtsm ships a copy of these headers if they are not available at compile-time. == Download == Released tarballs can be found at: http://www.freedesktop.org/software/kmscon/releases == Install == To compile libtsm, run the standard autotools commands: $ test -f ./configure || NOCONFIGURE=1 ./autogen.sh $ ./configure $ make $ make install To compile the test applications, run: $ make check == Documentation == There is currently no API documentation available. You can have a look at the example terminal-emulator "wlterm" available at: http://www.freedesktop.org/wiki/Software/kmscon/wlterm == License == This software is licensed under the terms of an MIT-like license. Please see ./COPYING for further information. == Contact == This software is maintained by: David Herrmann If you have any questions, do not hesitate to contact one of the maintainers. libtsm-4.0.2/README.md000066400000000000000000000036701420363367700143070ustar00rootroot00000000000000# TSM - Terminal Emulator State Machine [![Build Status](https://travis-ci.com/Aetf/libtsm.svg?branch=master)](https://travis-ci.com/Aetf/libtsm) TSM is a state machine for DEC VT100-VT520 compatible terminal emulators. It tries to support all common standards while keeping compatibility to existing emulators like xterm, gnome-terminal, konsole, ... This is a personal modified version. For more information, please refer to its original [README](README). ## Added feature + More color palettes: * soft-black * [base16](https://github.com/chriskempson/base16-default-schemes){-light,-dark} * solarized{,-black,-white} * custom: set via API + Support underline/italic rendering (with [a patched version of kmscon](https://github.com/Aetf/kmscon)) + Support 24-bit true color + Support Ctrl + Arrow keys + Support custom title using OSC + Bug fixes: * [Repsonse to 'CSI c' contains random bytes][91335] * [Fix invalid cpr values](https://github.com/Aetf/libtsm/pull/2) [91335]: https://bugs.freedesktop.org/show_bug.cgi?id=91335 ## Build ```bash mkdir build && cd build cmake .. make make install ``` ### Build options Options may be supplied when configuring cmake: ```bash cmake -DOPTION1=VALUE1 -DOPTION2=VALUE2 .. ``` The following options are available: |Name | Description | Default | |:---:|:---|:---:| | BUILD_SHARED_LIBS | Whether to build as a shared library | ON | | BUILD_TESTING | Whether to build test suits | OFF | | ENABLE_EXTRA_DEBUG | Whether to enable several non-standard debug options. | OFF | | BUILD_GTKTSM | Whether to build the gtktsm example. This is linux-only as it uses epoll and friends. Therefore is disabled by default. | OFF | ### Dependencies - [cmake](https://cmake.org) >= 3.5 - `xkbcommon-keysyms.h` from xkbcommon (Optional. Will use private copy if not found.) The test suits needs: - [check](https://libcheck.github.io/check/) >= 0.9.10 The gtktsm example needs: - gtk3 - cairo - pango - xkbcommon libtsm-4.0.2/ci.ctest000066400000000000000000000034401420363367700144620ustar00rootroot00000000000000set(CTEST_PROJECT_NAME libtsm) set(CTEST_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) set(CTEST_BINARY_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/build/ctest") set(CTEST_CMAKE_GENERATOR "Unix Makefiles") set(ENV{CK_FORK} "no") find_program(VALGRIND valgrind) if(NOT VALGRIND) message(FATAL_ERROR "valgrind is required for memcheck") endif() set(CTEST_MEMORYCHECK_COMMAND "${VALGRIND}") string(CONCAT CTEST_MEMORYCHECK_COMMAND_OPTIONS " --tool=memcheck" " --leak-check=yes" " --show-reachable=yes" " --leak-resolution=high" " --error-exitcode=1" ) set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "${CTEST_SOURCE_DIRECTORY}/etc/test.supp") function(print_section name) message(STATUS "********************") message(STATUS "${name}") message(STATUS "********************") endfunction() # # Start the tests # ctest_start("Continuous") print_section("Configuring project") ctest_configure(OPTIONS "-DBUILD_TESTING=ON;-DBUILD_GTKTSM=ON" RETURN_VALUE ret) if(NOT ${ret} EQUAL 0) message(FATAL_ERROR "Configure step failed with ${ret}") endif() print_section("Building project") ctest_build(RETURN_VALUE ret) if(NOT ${ret} EQUAL 0) message(FATAL_ERROR "Build step failed with ${ret}") endif() print_section("Running tests") ctest_test(RETURN_VALUE ret) if(NOT ${ret} EQUAL 0) message(FATAL_ERROR "Tests step failed with ${ret}") endif() # First make sure valgrind works print_section("Making sure valgrind works") ctest_memcheck(INCLUDE_LABEL "memcheck-xfail" RETURN_VALUE ret) if(${ret} EQUAL 0) message(FATAL_ERROR "Valgrind may not work correctly. Expected failed test got passed.") endif() print_section("Running memcheck") ctest_memcheck(EXCLUDE_LABEL "memcheck-xfail" RETURN_VALUE ret) if(NOT ${ret} EQUAL 0) message(FATAL_ERROR "Memcheck step failed with ${ret}") endif() libtsm-4.0.2/cmake/000077500000000000000000000000001420363367700141025ustar00rootroot00000000000000libtsm-4.0.2/cmake/BuildTypes.cmake000066400000000000000000000051731420363367700171760ustar00rootroot00000000000000# Add new build types for sanitizer and profiler # Address sanitizer and undefined beheavior sanitizer set(CMAKE_CXX_FLAGS_ASAN "-g -O1 -fno-omit-frame-pointer -fsanitize=address" CACHE STRING "Flags used by the C++ compiler during ASan builds." FORCE) set(CMAKE_C_FLAGS_ASAN "${CMAKE_CXX_FLAGS_ASAN}" CACHE STRING "Flags used by the C compiler during ASan builds." FORCE) set(CMAKE_EXE_LINKER_FLAGS_ASAN "-fsanitize=address" CACHE STRING "Flags used for linking binaries during ASan builds." FORCE) set(CMAKE_SHARED_LINKER_FLAGS_ASAN "-fsanitize=address" CACHE STRING "Flags used by the shared libraries linker during ASan builds." FORCE) # Thread sanitizer set(CMAKE_CXX_FLAGS_TSAN "-DNDEBUG -g -O0 -fno-omit-frame-pointer -fsanitize=thread" CACHE STRING "Flags used by the C++ compiler during TSan builds." FORCE) set(CMAKE_C_FLAGS_TSAN "${CMAKE_CXX_FLAGS_TSAN}" CACHE STRING "Flags used by the C compiler during TSan builds." FORCE) set(CMAKE_EXE_LINKER_FLAGS_TSAN "-fsanitize=thread" CACHE STRING "Flags used for linking binaries during TSan builds." FORCE) set(CMAKE_SHARED_LINKER_FLAGS_TSAN "-fsanitize=thread" CACHE STRING "Flags used by the shared libraries linker during TSan builds." FORCE) # Memory sanitizer set(CMAKE_CXX_FLAGS_MSAN "-DNDEBUG -g -O1 -fno-omit-frame-pointer -fsanitize=memory" CACHE STRING "Flags used by the C++ compiler during MSan builds." FORCE) set(CMAKE_C_FLAGS_MSAN "${CMAKE_CXX_FLAGS_MSAN}" CACHE STRING "Flags used by the C compiler during MSan builds." FORCE) set(CMAKE_EXE_LINKER_FLAGS_MSAN "-fsanitize=memory" CACHE STRING "Flags used for linking binaries during MSan builds." FORCE) set(CMAKE_SHARED_LINKER_FLAGS_MSAN "-fsanitize=memory" CACHE STRING "Flags used by the shared libraries linker during MSan builds." FORCE) set(KNOWN_BUILD_TYPES "") foreach(build IN ITEMS ASan TSan MSan) string(TOUPPER ${build} build_upper) mark_as_advanced( CMAKE_CXX_FLAGS_${build_upper} CMAKE_C_FLAGS_${build_upper} CMAKE_EXE_LINKER_FLAGS_${build_upper} CMAKE_SHARED_LINKER_FLAGS_${build_upper} ) list(APPEND KNOWN_BUILD_TYPES ${build}) endforeach() list(APPEND KNOWN_BUILD_TYPES Debug Release RelWithDebInfo MinSizeRel) if (NOT CMAKE_BUILD_TYPE IN_LIST KNOWN_BUILD_TYPES) message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}. Choices are ${KNOWN_BUILD_TYPES}") endif() # Update the documentation string of CMAKE_BUILD_TYPE for GUIs set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Choose the type of build, options are: None;${KNOWN_BUILD_TYPES}." FORCE) message(STATUS "Using build type: ${CMAKE_BUILD_TYPE}") libtsm-4.0.2/cmake/CompileOptions.cmake000066400000000000000000000062141420363367700200530ustar00rootroot00000000000000# Set compiler flags set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) # analogous to AC_USE_SYSTEM_EXTENSIONS in configure.ac add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE) # copied from Autoconf's AC_SYS_LARGEFILE if(NOT WIN32) add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE) endif(NOT WIN32) # Set compiler flags for warnings if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # using Clang or AppleClang # reasonable and standard add_compile_options_with_check(-Weverything) add_compile_options_with_check(-Werror) add_compile_options_with_check(-Wfatal-errors) add_compile_options_with_check(-Wold-style-cast) # helps catch hard to track down memory errors add_compile_options_with_check(-Wnon-virtual-dtor) # warn for potential performance problem casts add_compile_options_with_check(-Wcast-align) # warn if you overload (not override) a virtual function add_compile_options_with_check(-Woverloaded-virtual) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # using GCC # reasonable and standard add_compile_options_with_check(-Wall) add_compile_options_with_check(-Wextra) add_compile_options_with_check(-pedantic) add_compile_options_with_check(-Werror) #add_compile_options_with_check(-Wfatal-errors) add_compile_options_with_check(-Wold-style-cast) # helps catch hard to track down memory errors add_compile_options_with_check(-Wnon-virtual-dtor) # warn for potential performance problem casts add_compile_options_with_check(-Wcast-align) # warn if you overload (not override) a virtual function add_compile_options_with_check(-Woverloaded-virtual) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # using Intel C++ message(WARNING "Using of Intel C++ is not supported, you are on your own.") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # using Visual Studio C++ # all reasonable warnings add_compile_options_with_check(/W4) # treat warnings as errors add_compile_options_with_check(/Wx) # enable warning on thread un-safe static member initialization add_compile_options_with_check(/W44640) endif() # Other flags are not added directly globally, but using a function # so later when defining targets, it can be set per target function(add_libtsm_compile_options target) # Make all files include "config.h" by default. This shouldn't cause any # problems and we cannot forget to include it anymore. target_compile_options(${target} PRIVATE -include ${CMAKE_BINARY_DIR}/config.h -pipe -fno-common -ffast-math -fno-strict-aliasing -ffunction-sections -fdata-sections ) # Linker flags ## Make the linker discard all unused symbols. if(APPLE) set(LDFLAGS "-Wl,-dead_strip -Wl,-dead_strip_dylibs -Wl,-bind_at_load") elseif(UNIX) set(LDFLAGS "-Wl,--as-needed -Wl,--gc-sections -Wl,-z,relro -Wl,-z,now") else() message("Unsupported platform, you are on your own.") endif() set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${LDFLAGS}") endfunction() libtsm-4.0.2/cmake/Utilities.cmake000066400000000000000000000277571420363367700171010ustar00rootroot00000000000000include(CheckCCompilerFlag) # # Check compiler flag support with cached support. # Shadows the internal check_c_compiler_flag # macro(libtsm_check_c_compiler_flag flag retvar) string(REPLACE "-" "_" cache_name "COMPILER_SUPPORT_${flag}") check_c_compiler_flag(${flag} ${cache_name}) set(${retvar} ${cache_name}) endmacro() # Add a global default compile option function(add_compile_options_with_check flag) libtsm_check_c_compiler_flag(${flag} ret) if(${ret}) add_compile_options(${flag}) endif() endfunction() # Add a new private compile option to a target function(target_compile_options_with_check target flag) libtsm_check_c_compiler_flag(${flag} ret) if(${ret}) target_compile_options(${target} PRIVATE ${flag}) endif() endfunction() # Add compile option to a build type with check function(build_type_add_compile_option_with_check buildtype flag) libtsm_check_c_compiler_flag(${flag} ret) if(${ret}) set(CMAKE_CXX_FLAGS_${buildtype} "${CMAKE_CXX_FLAGS_${buildtype}}" ${flag}) endif() endfunction() # Print all properties for a target # From https://stackoverflow.com/questions/32183975/how-to-print-all-the-properties-of-a-target-in-cmake # # Get all propreties that cmake supports execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) # Convert command output into a CMake list string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST) function(print_properties) message ("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}") endfunction(print_properties) function(print_target_properties tgt) if(NOT TARGET ${tgt}) message("There is no target named '${tgt}'") return() endif() foreach (prop ${CMAKE_PROPERTY_LIST}) string(REPLACE "" "${CMAKE_BUILD_TYPE}" prop ${prop}) # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i if(prop STREQUAL "LOCATION" OR prop MATCHES "^LOCATION_" OR prop MATCHES "_LOCATION$") continue() endif() # message ("Checking ${prop}") get_property(propval TARGET ${tgt} PROPERTY ${prop} SET) if (propval) get_target_property(propval ${tgt} ${prop}) message ("${tgt} ${prop} = ${propval}") endif() endforeach(prop) endfunction(print_target_properties) # A simpler version to parse package components # Copied from extra-cmake-modules macro(find_package_parse_components module_name) set(fppc_options) set(fppc_oneValueArgs RESULT_VAR) set(fppc_multiValueArgs KNOWN_COMPONENTS DEFAULT_COMPONENTS) cmake_parse_arguments(FPPC "${fppc_options}" "${fppc_oneValueArgs}" "${fppc_multiValueArgs}" ${ARGN}) if(FPPC_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unexpected arguments to find_package_parse_components: ${FPPC_UNPARSED_ARGUMENTS}") endif() if(NOT FPPC_RESULT_VAR) message(FATAL_ERROR "Missing RESULT_VAR argument to find_package_parse_components") endif() if(NOT FPPC_KNOWN_COMPONENTS) message(FATAL_ERROR "Missing KNOWN_COMPONENTS argument to find_package_parse_components") endif() if(NOT FPPC_DEFAULT_COMPONENTS) set(FPPC_DEFAULT_COMPONENTS ${FPPC_KNOWN_COMPONENTS}) endif() if(${module_name}_FIND_COMPONENTS) set(fppc_requestedComps ${${module_name}_FIND_COMPONENTS}) list(REMOVE_DUPLICATES fppc_requestedComps) # This makes sure components are listed in the same order as # KNOWN_COMPONENTS (potentially important for inter-dependencies) set(${FPPC_RESULT_VAR}) foreach(fppc_comp ${FPPC_KNOWN_COMPONENTS}) list(FIND fppc_requestedComps "${fppc_comp}" fppc_index) if(NOT "${fppc_index}" STREQUAL "-1") list(APPEND ${FPPC_RESULT_VAR} "${fppc_comp}") list(REMOVE_AT fppc_requestedComps ${fppc_index}) endif() endforeach() # if there are any left, they are unknown components if(fppc_requestedComps) set(fppc_msgType STATUS) if(${module_name}_FIND_REQUIRED) set(fppc_msgType FATAL_ERROR) endif() if(NOT ${module_name}_FIND_QUIETLY) message(${fppc_msgType} "${module_name}: requested unknown components ${fppc_requestedComps}") endif() return() endif() else() set(${FPPC_RESULT_VAR} ${FPPC_DEFAULT_COMPONENTS}) endif() endmacro() # # Creates an imported library target for each component. See ECM's documentation for usage. # # This version addtionally treats empty __lib variable as an indication for interface only library # # The following additionall keyword arguments are accepted: # NAMESPACE - The namespace to use for the imported target, default to # macro(find_package_handle_library_components module_name) set(fphlc_options SKIP_PKG_CONFIG SKIP_DEPENDENCY_HANDLING) set(fphlc_oneValueArgs NAMESPACE) set(fphlc_multiValueArgs COMPONENTS) cmake_parse_arguments(FPHLC "${fphlc_options}" "${fphlc_oneValueArgs}" "${fphlc_multiValueArgs}" ${ARGN}) if(FPHLC_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unexpected arguments to find_package_handle_components: ${FPHLC_UNPARSED_ARGUMENTS}") endif() if(NOT FPHLC_COMPONENTS) message(FATAL_ERROR "Missing COMPONENTS argument to find_package_handle_components") endif() if(NOT FPHLC_NAMESPACE) set(FPHLC_NAMESPACE ${module_name}) endif() include(FindPackageHandleStandardArgs) find_package(PkgConfig QUIET) foreach(fphlc_comp ${FPHLC_COMPONENTS}) set(fphlc_dep_vars) set(fphlc_dep_targets) if(NOT SKIP_DEPENDENCY_HANDLING) foreach(fphlc_dep ${${module_name}_${fphlc_comp}_component_deps}) list(APPEND fphlc_dep_vars "${module_name}_${fphlc_dep}_FOUND") list(APPEND fphlc_dep_targets "${FPHLC_NAMESPACE}::${fphlc_dep}") endforeach() endif() if(NOT FPHLC_SKIP_PKG_CONFIG AND ${module_name}_${fphlc_comp}_pkg_config) pkg_check_modules(PKG_${module_name}_${fphlc_comp} QUIET ${${module_name}_${fphlc_comp}_pkg_config}) endif() if("${${module_name}_${fphlc_comp}_lib}" STREQUAL "") set(fphlc_library_type INTERFACE) set(fphlc_required_vars "${module_name}_${fphlc_comp}_INCLUDE_DIR") else() set(fphlc_library_type UNKNOWN) set(fphlc_required_vars "${module_name}_${fphlc_comp}_LIBRARY;${module_name}_${fphlc_comp}_INCLUDE_DIR") endif() find_path(${module_name}_${fphlc_comp}_INCLUDE_DIR NAMES ${${module_name}_${fphlc_comp}_header} HINTS ${PKG_${module_name}_${fphlc_comp}_INCLUDE_DIRS} PATH_SUFFIXES ${${module_name}_${fphlc_comp}_header_subdir} ) find_library(${module_name}_${fphlc_comp}_LIBRARY NAMES ${${module_name}_${fphlc_comp}_lib} HINTS ${PKG_${module_name}_${fphlc_comp}_LIBRARY_DIRS} ) set(${module_name}_${fphlc_comp}_VERSION "${PKG_${module_name}_${fphlc_comp}_VERSION}") if(NOT ${module_name}_VERSION) set(${module_name}_VERSION ${${module_name}_${fphlc_comp}_VERSION}) endif() find_package_handle_standard_args(${module_name}_${fphlc_comp} FOUND_VAR ${module_name}_${fphlc_comp}_FOUND REQUIRED_VARS ${fphlc_required_vars} ${fphlc_dep_vars} VERSION_VAR ${module_name}_${fphlc_comp}_VERSION ) mark_as_advanced( ${module_name}_${fphlc_comp}_LIBRARY ${module_name}_${fphlc_comp}_INCLUDE_DIR ) if(${module_name}_${fphlc_comp}_FOUND) if("${fphlc_library_type}" STREQUAL "UNKNOWN") list(APPEND ${module_name}_LIBRARIES "${${module_name}_${fphlc_comp}_LIBRARY}") endif() list(APPEND ${module_name}_INCLUDE_DIRS "${${module_name}_${fphlc_comp}_INCLUDE_DIR}") set(${module_name}_DEFINITIONS ${${module_name}_DEFINITIONS} ${PKG_${module_name}_${fphlc_comp}_DEFINITIONS}) if(NOT TARGET ${FPHLC_NAMESPACE}::${fphlc_comp}) add_library(${FPHLC_NAMESPACE}::${fphlc_comp} ${fphlc_library_type} IMPORTED) set_target_properties(${FPHLC_NAMESPACE}::${fphlc_comp} PROPERTIES INTERFACE_COMPILE_OPTIONS "${PKG_${module_name}_${fphlc_comp}_DEFINITIONS}" INTERFACE_INCLUDE_DIRECTORIES "${${module_name}_${fphlc_comp}_INCLUDE_DIR}" INTERFACE_LINK_LIBRARIES "${fphlc_dep_targets}" ) if("${fphlc_library_type}" STREQUAL "UNKNOWN") set_target_properties(${FPHLC_NAMESPACE}::${fphlc_comp} PROPERTIES IMPORTED_LOCATION "${${module_name}_${fphlc_comp}_LIBRARY}" ) endif() endif() list(APPEND ${module_name}_TARGETS "${FPHLC_NAMESPACE}::${fphlc_comp}") endif() endforeach() if(${module_name}_LIBRARIES) list(REMOVE_DUPLICATES ${module_name}_LIBRARIES) endif() if(${module_name}_INCLUDE_DIRS) list(REMOVE_DUPLICATES ${module_name}_INCLUDE_DIRS) endif() if(${module_name}_DEFINITIONS) list(REMOVE_DUPLICATES ${module_name}_DEFINITIONS) endif() if(${module_name}_TARGETS) list(REMOVE_DUPLICATES ${module_name}_TARGETS) endif() endmacro() # # Helper to link to an object library. # # The advantage of using this over target_link_library directly # is that when used privately, it will not pollute target exports, # See: https://gitlab.kitware.com/cmake/cmake/issues/17357 # # This is done by not involving target_link_libraries but directly set # properties. # function(target_link_object_libraries target) set(tlol_options) set(tlol_oneValueArgs) set(tlol_multiValueArgs PRIVATE INTERFACE PUBLIC) cmake_parse_arguments(TLOL "${tlol_options}" "${tlol_oneValueArgs}" "${tlol_multiValueArgs}" ${ARGN}) if(TLOL_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unexpected arguments to target_link_object_libraries: ${TLOL_UNPARSED_ARGUMENTS}") endif() if(NOT TLOL_PRIVATE AND NOT TLOL_INTERFACE AND NOT TLOL_PUBLIC) message(FATAL_ERROR "Missing PRIVATE|INTERFACE|PUBLIC argument to target_link_object_libraries") endif() foreach(lib IN LISTS TLOL_PRIVATE) target_sources(${target} PRIVATE $ $) target_include_directories(${target} PRIVATE $) target_compile_options(${target} PRIVATE $) # This is not supported, as it will make exporting ${target} also needs exporting ${lib} even in PRIVATE mode #target_link_libraries(${target} PRIVATE $) endforeach() foreach(lib IN LISTS TLOL_INTERFACE) target_sources(${target} INTERFACE $ $) target_include_directories(${target} INTERFACE $) target_compile_options(${target} INTERFACE $) target_link_libraries(${target} INTERFACE $) endforeach() foreach(lib IN LISTS TLOL_PUBLIC) target_sources(${target} PUBLIC $ $) target_include_directories(${target} PUBLIC $) target_compile_options(${target} PUBLIC $) endforeach() endfunction() libtsm-4.0.2/cmake/modules/000077500000000000000000000000001420363367700155525ustar00rootroot00000000000000libtsm-4.0.2/cmake/modules/FindCairo.cmake000066400000000000000000000001721420363367700204120ustar00rootroot00000000000000find_package(PkgConfig QUIET) pkg_check_modules(Cairo ${Cairo_FIND_REQUIRED} ${Cairo_FIND_QUITELY} cairo IMPORTED_TARGET) libtsm-4.0.2/cmake/modules/FindCheck.cmake000066400000000000000000000071541420363367700204010ustar00rootroot00000000000000# Try to find libcheck # # This will define: # # Check_FOUND - True if libcheck is available # Check_LIBRARIES - Found libraries for libcheck # Check_INCLUDE_DIRS - Include directory for libcheck # Check_CFLAGS - Other compiler flags for using libcheck # Check_VERSION - Version of the found libcheck # # Additionally, the following imported targets will be defined: # # check::check # include(FindPackageHandleStandardArgs) set(module_name Check) # We rely on pkg-config to provide dependency info. find_package(PkgConfig REQUIRED QUIET) pkg_check_modules(PKG_${module_name} QUIET check) find_path(${module_name}_INCLUDE_DIR NAMES check.h HINTS ${PKG_${module_name}_INCLUDE_DIRS} ) find_library(${module_name}_LIBRARY NAMES check_pic check HINTS ${PKG_${module_name}_LIBRARY_DIRS} ) set(${module_name}_VERSION "${PKG_${module_name}_VERSION}") if(NOT ${module_name}_VERSION) set(${module_name}_VERSION ${${module_name}_VERSION}) if(${module_name}_INCLUDE_DIR) file(STRINGS "${${module_name}_INCLUDE_DIR}/check.h" ${module_name}_MAJOR_VERSION REGEX "^#define CHECK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define CHECK_MAJOR_VERSION \\(?([0-9]+)\\)?" "\\1" ${module_name}_MAJOR_VERSION "${${module_name}_MAJOR_VERSION}") file(STRINGS "${${module_name}_INCLUDE_DIR}/check.h" ${module_name}_MINOR_VERSION REGEX "^#define CHECK_MINOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define CHECK_MINOR_VERSION \\(?([0-9]+)\\)?" "\\1" ${module_name}_MINOR_VERSION "${${module_name}_MINOR_VERSION}") file(STRINGS "${${module_name}_INCLUDE_DIR}/check.h" ${module_name}_MICRO_VERSION REGEX "^#define CHECK_MICRO_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define CHECK_MICRO_VERSION \\(?([0-9]+)\\)?" "\\1" ${module_name}_MICRO_VERSION "${${module_name}_MICRO_VERSION}") set(${module_name}_VERSION "${${module_name}_MAJOR_VERSION}.${${module_name}_MINOR_VERSION}.${${module_name}_MICRO_VERSION}") unset(${module_name}_MAJOR_VERSION) unset(${module_name}_MINOR_VERSION) unset(${module_name}_MICRO_VERSION) endif() endif() find_package_handle_standard_args(${module_name} FOUND_VAR ${module_name}_FOUND REQUIRED_VARS ${module_name}_LIBRARY ${module_name}_INCLUDE_DIR VERSION_VAR ${module_name}_VERSION ) mark_as_advanced( ${module_name}_LIBRARY ${module_name}_INCLUDE_DIR ) if(${module_name}_FOUND) list(APPEND ${module_name}_LIBRARIES "${PKG_${module_name}_LIBRARIES}") list(APPEND ${module_name}_CFLAGS "${PKG_${module_name}_CFLAGS_OTHER}") list(APPEND ${module_name}_LDFLAGS "${PKG_${module_name}_LDFLAGS_OTHER}") message("PKG_${module_name}_LDFLAGS_OTHER = ${PKG_${module_name}_LDFLAGS_OTHER}") if("-pthread" IN_LIST ${module_name}_LDFLAGS) include(CMakeFindDependencyMacro) find_dependency(Threads REQUIRED) list(APPEND ${module_name}_LIBRARIES Threads::Threads) endif() list(APPEND ${module_name}_INCLUDE_DIRS "${${module_name}_INCLUDE_DIR}") if(NOT TARGET check::check) add_library(check::check INTERFACE IMPORTED) set_target_properties(check::check PROPERTIES INTERFACE_COMPILE_OPTIONS "${${module_name}_CFLAGS}" INTERFACE_INCLUDE_DIRECTORIES "${${module_name}_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${${module_name}_LIBRARIES}" ) endif() endif() include(FeatureSummary) set_package_properties(${module_name} PROPERTIES URL "https://libcheck.github.io/check/" DESCRIPTION "A unit testing framework for C" ) unset(module_name) libtsm-4.0.2/cmake/modules/FindGTK3.cmake000066400000000000000000000001721420363367700200650ustar00rootroot00000000000000find_package(PkgConfig QUIET) pkg_check_modules(GTK3 ${GTK3_FIND_REQUIRED} ${GTK3_FIND_QUIETLY} gtk+-3.0 IMPORTED_TARGET) libtsm-4.0.2/cmake/modules/FindPango.cmake000066400000000000000000000001721420363367700204210ustar00rootroot00000000000000find_package(PkgConfig QUIET) pkg_check_modules(Pango ${Pango_FIND_REQUIRED} ${Pango_FIND_QUIETLY} pango IMPORTED_TARGET) libtsm-4.0.2/cmake/modules/FindPangoCairo.cmake000066400000000000000000000003111420363367700213720ustar00rootroot00000000000000# FindPangoCairo.cmake # # CMake support for PangoCairo. # find_package(PkgConfig QUIET) pkg_check_modules(PangoCairo ${PangoCairo_FIND_REQUIRED} ${PangoCairo_FIND_QUIETLY} pangocairo IMPORTED_TARGET) libtsm-4.0.2/cmake/modules/FindXKBCommon.cmake000066400000000000000000000040121420363367700211470ustar00rootroot00000000000000# Try to find xkbcommon # # Available components: # XKBCommon - The whole xkbcommon library # KeySyms - The interface library containing only xkbcommon-keysyms.h # # This will define: # # XKBCommon_FOUND - True if xkbcommon is available # XKBCommon_LIBRARIES - Found libraries for xkbcommon # XKBCommon_INCLUDE_DIRS - Include directory for xkbcommon # XKBCommon_DEFINITIONS - Compiler flags for using xkbcommon # # Additionally, the following imported targets will be defined: # # XKB::XKBCommon # XKB::KeySyms # include(FindPackageHandleStandardArgs) # Note that this list needs to be ordered such that any component appears after its dependencies set(XKBCommon_known_components XKBCommon KeySyms ) set(XKBCommon_XKBCommon_component_deps) set(XKBCommon_XKBCommon_pkg_config "xkbcommon") set(XKBCommon_XKBCommon_lib "xkbcommon") set(XKBCommon_XKBCommon_header "xkbcommon/xkbcommon.h") set(XKBCommon_KeySyms_component_deps) set(XKBCommon_KeySyms_pkg_config "xkbcommon") set(XKBCommon_KeySyms_lib) set(XKBCommon_KeySyms_header "xkbcommon/xkbcommon-keysyms.h") # Parse components find_package_parse_components(XKBCommon RESULT_VAR XKBCommon_components KNOWN_COMPONENTS ${XKBCommon_known_components} ) # Find each component # use our private version of find_package_handle_library_components # that also handles interface library find_package_handle_library_components(XKBCommon NAMESPACE XKB COMPONENTS ${XKBCommon_components} ) set(XKBCommon_component_FOUND_VARS) foreach(comp ${XKBCommon_components}) list(APPEND XKBCommon_component_FOUND_VARS "XKBCommon_${comp}_FOUND") endforeach(comp) find_package_handle_standard_args(XKBCommon FOUND_VAR XKBCommon_FOUND REQUIRED_VARS ${XKBCommon_component_FOUND_VARS} VERSION_VAR XKBCommon_VERSION HANDLE_COMPONENTS ) unset(XKBCommon_component_FOUND_VARS) include(FeatureSummary) set_package_properties(XKBCommon PROPERTIES URL "http://xkbcommon.org" DESCRIPTION "Keyboard handling library using XKB data" ) libtsm-4.0.2/etc/000077500000000000000000000000001420363367700135755ustar00rootroot00000000000000libtsm-4.0.2/etc/libtsm-config.cmake.in000066400000000000000000000003151420363367700177400ustar00rootroot00000000000000# # libtsm # ------ # # The following imported targets are created: # libtsm::libtsm # @PACKAGE_INIT@ if(NOT TARGET libtsm::tsm) include("${CMAKE_CURRENT_LIST_DIR}/libtsm-targets.cmake") endif() libtsm-4.0.2/etc/libtsm.pc.in000066400000000000000000000004611420363367700160210ustar00rootroot00000000000000prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ Name: @PROJECT_NAME@ Description: @PROJECT_DESCRIPTION@ URL: @PROJECT_HOMEPAGE_URL@ Version: @PROJECT_VERSION@ Libs: -L${libdir} -ltsm Cflags: -I${includedir} libtsm-4.0.2/etc/test.supp000066400000000000000000000004771420363367700154750ustar00rootroot00000000000000# # Some suppression rules for our test-suite to work correctly. # libcheck has some weird errors, so lets ignore them. # { libcheck timer_create warnings Memcheck:Param timer_create(evp) fun:timer_create obj:/usr/lib/libcheck.so.0.0.0 obj:/usr/lib/libcheck.so.0.0.0 fun:srunner_run fun:main } libtsm-4.0.2/external/000077500000000000000000000000001420363367700146445ustar00rootroot00000000000000libtsm-4.0.2/external/CMakeLists.txt000066400000000000000000000006521420363367700174070ustar00rootroot00000000000000# # External vendorized code # build everything into a object library for ease of use internally # add_library(external OBJECT wcwidth/wcwidth.c ) target_include_directories(external PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/wcwidth ) set_target_properties(external PROPERTIES C_VISIBILITY_PRESET hidden POSITION_INDEPENDENT_CODE ON ) add_libtsm_compile_options(external) libtsm-4.0.2/external/wcwidth/000077500000000000000000000000001420363367700163155ustar00rootroot00000000000000libtsm-4.0.2/external/wcwidth/.gitignore000066400000000000000000000000151420363367700203010ustar00rootroot00000000000000test_wcwidth libtsm-4.0.2/external/wcwidth/.travis.yml000066400000000000000000000001341420363367700204240ustar00rootroot00000000000000sudo: false language: c compiler: - clang - gcc os: - linux - osx script: make test libtsm-4.0.2/external/wcwidth/LICENSE.txt000066400000000000000000000045001420363367700201370ustar00rootroot00000000000000This project is licensed for use as follows: """ The MIT License (MIT) Copyright (c) 2016 Fredrik Fornwall 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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. """ This license applies to parts originating from the https://github.com/jquast/wcwidth repository: """ The MIT License (MIT) Copyright (c) 2014 Jeff Quast 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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. """ libtsm-4.0.2/external/wcwidth/README.md000066400000000000000000000007421420363367700175770ustar00rootroot00000000000000A wcwidth implementation in C ============================= [![Travis build status](https://travis-ci.org/termux/wcwidth.svg?branch=master)](https://travis-ci.org/termux/wcwidth) A simple implementation of [wcwidth(3)](http://pubs.opengroup.org/onlinepubs/009695399/functions/wcwidth.html) in C as a port of [wcwidth.py](https://github.com/jquast/wcwidth/blob/master/wcwidth/wcwidth.py). Used in [Termux](https://termux.com) as part of the `libandroid-support.so` shared library. libtsm-4.0.2/external/wcwidth/test_wcwidth.c000066400000000000000000000020231420363367700211660ustar00rootroot00000000000000#include #include #include #include "wcwidth.h" static int tests_run; static int test_failures; void assertWidthIs(int expected_width, wchar_t c) { tests_run++; int actual_width = wcwidth(c); if (actual_width != expected_width) { fprintf(stderr, "ERROR: wcwidth(U+%04x) returned %d, expected %d\n", c, actual_width, expected_width); test_failures++; } } int main() { assertWidthIs(1, 'a'); assertWidthIs(1, L'ö'); // Some wide: assertWidthIs(2, L'A'); assertWidthIs(2, L'ï¼¢'); assertWidthIs(2, L'ï¼£'); assertWidthIs(2, L'中'); assertWidthIs(2, L'æ–‡'); assertWidthIs(2, 0x679C); assertWidthIs(2, 0x679D); assertWidthIs(2, 0x2070E); assertWidthIs(2, 0x20731); assertWidthIs(1, 0x11A3); assertWidthIs(2, 0x1F428); // Koala emoji. assertWidthIs(2, 0x231a); // Watch emoji. if (test_failures > 0) printf("%d tests FAILED, ", test_failures); printf("%d tests OK\n", tests_run); return (test_failures == 0) ? 0 : 1; } libtsm-4.0.2/external/wcwidth/wcwidth.c000066400000000000000000000762241420363367700201450ustar00rootroot00000000000000/* * Copyright (C) Fredrik Fornwall 2016. * Distributed under the MIT License. * * Implementation of wcwidth(3) as a C port of: * https://github.com/jquast/wcwidth * * Report issues at: * https://github.com/termux/wcwidth */ #include #include struct width_interval { int start; int end; }; // From https://github.com/jquast/wcwidth/blob/master/wcwidth/table_zero.py // at commit 0d7de112202cc8b2ebe9232ff4a5c954f19d561a (2016-07-02): static struct width_interval ZERO_WIDTH[] = { {0x0300, 0x036f}, // Combining Grave Accent ..Combining Latin Small Le {0x0483, 0x0489}, // Combining Cyrillic Titlo..Combining Cyrillic Milli {0x0591, 0x05bd}, // Hebrew Accent Etnahta ..Hebrew Point Meteg {0x05bf, 0x05bf}, // Hebrew Point Rafe ..Hebrew Point Rafe {0x05c1, 0x05c2}, // Hebrew Point Shin Dot ..Hebrew Point Sin Dot {0x05c4, 0x05c5}, // Hebrew Mark Upper Dot ..Hebrew Mark Lower Dot {0x05c7, 0x05c7}, // Hebrew Point Qamats Qata..Hebrew Point Qamats Qata {0x0610, 0x061a}, // Arabic Sign Sallallahou ..Arabic Small Kasra {0x064b, 0x065f}, // Arabic Fathatan ..Arabic Wavy Hamza Below {0x0670, 0x0670}, // Arabic Letter Superscrip..Arabic Letter Superscrip {0x06d6, 0x06dc}, // Arabic Small High Ligatu..Arabic Small High Seen {0x06df, 0x06e4}, // Arabic Small High Rounde..Arabic Small High Madda {0x06e7, 0x06e8}, // Arabic Small High Yeh ..Arabic Small High Noon {0x06ea, 0x06ed}, // Arabic Empty Centre Low ..Arabic Small Low Meem {0x0711, 0x0711}, // Syriac Letter Superscrip..Syriac Letter Superscrip {0x0730, 0x074a}, // Syriac Pthaha Above ..Syriac Barrekh {0x07a6, 0x07b0}, // Thaana Abafili ..Thaana Sukun {0x07eb, 0x07f3}, // Nko Combining Sh||t High..Nko Combining Double Dot {0x0816, 0x0819}, // Samaritan Mark In ..Samaritan Mark Dagesh {0x081b, 0x0823}, // Samaritan Mark Epentheti..Samaritan Vowel Sign A {0x0825, 0x0827}, // Samaritan Vowel Sign Sho..Samaritan Vowel Sign U {0x0829, 0x082d}, // Samaritan Vowel Sign Lon..Samaritan Mark Nequdaa {0x0859, 0x085b}, // Mandaic Affrication Mark..Mandaic Gemination Mark {0x08d4, 0x08e1}, // (nil) .. {0x08e3, 0x0902}, // Arabic Turned Damma Belo..Devanagari Sign Anusvara {0x093a, 0x093a}, // Devanagari Vowel Sign Oe..Devanagari Vowel Sign Oe {0x093c, 0x093c}, // Devanagari Sign Nukta ..Devanagari Sign Nukta {0x0941, 0x0948}, // Devanagari Vowel Sign U ..Devanagari Vowel Sign Ai {0x094d, 0x094d}, // Devanagari Sign Virama ..Devanagari Sign Virama {0x0951, 0x0957}, // Devanagari Stress Sign U..Devanagari Vowel Sign Uu {0x0962, 0x0963}, // Devanagari Vowel Sign Vo..Devanagari Vowel Sign Vo {0x0981, 0x0981}, // Bengali Sign Candrabindu..Bengali Sign Candrabindu {0x09bc, 0x09bc}, // Bengali Sign Nukta ..Bengali Sign Nukta {0x09c1, 0x09c4}, // Bengali Vowel Sign U ..Bengali Vowel Sign Vocal {0x09cd, 0x09cd}, // Bengali Sign Virama ..Bengali Sign Virama {0x09e2, 0x09e3}, // Bengali Vowel Sign Vocal..Bengali Vowel Sign Vocal {0x0a01, 0x0a02}, // Gurmukhi Sign Adak Bindi..Gurmukhi Sign Bindi {0x0a3c, 0x0a3c}, // Gurmukhi Sign Nukta ..Gurmukhi Sign Nukta {0x0a41, 0x0a42}, // Gurmukhi Vowel Sign U ..Gurmukhi Vowel Sign Uu {0x0a47, 0x0a48}, // Gurmukhi Vowel Sign Ee ..Gurmukhi Vowel Sign Ai {0x0a4b, 0x0a4d}, // Gurmukhi Vowel Sign Oo ..Gurmukhi Sign Virama {0x0a51, 0x0a51}, // Gurmukhi Sign Udaat ..Gurmukhi Sign Udaat {0x0a70, 0x0a71}, // Gurmukhi Tippi ..Gurmukhi Addak {0x0a75, 0x0a75}, // Gurmukhi Sign Yakash ..Gurmukhi Sign Yakash {0x0a81, 0x0a82}, // Gujarati Sign Candrabind..Gujarati Sign Anusvara {0x0abc, 0x0abc}, // Gujarati Sign Nukta ..Gujarati Sign Nukta {0x0ac1, 0x0ac5}, // Gujarati Vowel Sign U ..Gujarati Vowel Sign Cand {0x0ac7, 0x0ac8}, // Gujarati Vowel Sign E ..Gujarati Vowel Sign Ai {0x0acd, 0x0acd}, // Gujarati Sign Virama ..Gujarati Sign Virama {0x0ae2, 0x0ae3}, // Gujarati Vowel Sign Voca..Gujarati Vowel Sign Voca {0x0b01, 0x0b01}, // ||iya Sign Candrabindu ..||iya Sign Candrabindu {0x0b3c, 0x0b3c}, // ||iya Sign Nukta ..||iya Sign Nukta {0x0b3f, 0x0b3f}, // ||iya Vowel Sign I ..||iya Vowel Sign I {0x0b41, 0x0b44}, // ||iya Vowel Sign U ..||iya Vowel Sign Vocalic {0x0b4d, 0x0b4d}, // ||iya Sign Virama ..||iya Sign Virama {0x0b56, 0x0b56}, // ||iya Ai Length Mark ..||iya Ai Length Mark {0x0b62, 0x0b63}, // ||iya Vowel Sign Vocalic..||iya Vowel Sign Vocalic {0x0b82, 0x0b82}, // Tamil Sign Anusvara ..Tamil Sign Anusvara {0x0bc0, 0x0bc0}, // Tamil Vowel Sign Ii ..Tamil Vowel Sign Ii {0x0bcd, 0x0bcd}, // Tamil Sign Virama ..Tamil Sign Virama {0x0c00, 0x0c00}, // Telugu Sign Combining Ca..Telugu Sign Combining Ca {0x0c3e, 0x0c40}, // Telugu Vowel Sign Aa ..Telugu Vowel Sign Ii {0x0c46, 0x0c48}, // Telugu Vowel Sign E ..Telugu Vowel Sign Ai {0x0c4a, 0x0c4d}, // Telugu Vowel Sign O ..Telugu Sign Virama {0x0c55, 0x0c56}, // Telugu Length Mark ..Telugu Ai Length Mark {0x0c62, 0x0c63}, // Telugu Vowel Sign Vocali..Telugu Vowel Sign Vocali {0x0c81, 0x0c81}, // Kannada Sign Candrabindu..Kannada Sign Candrabindu {0x0cbc, 0x0cbc}, // Kannada Sign Nukta ..Kannada Sign Nukta {0x0cbf, 0x0cbf}, // Kannada Vowel Sign I ..Kannada Vowel Sign I {0x0cc6, 0x0cc6}, // Kannada Vowel Sign E ..Kannada Vowel Sign E {0x0ccc, 0x0ccd}, // Kannada Vowel Sign Au ..Kannada Sign Virama {0x0ce2, 0x0ce3}, // Kannada Vowel Sign Vocal..Kannada Vowel Sign Vocal {0x0d01, 0x0d01}, // Malayalam Sign Candrabin..Malayalam Sign Candrabin {0x0d41, 0x0d44}, // Malayalam Vowel Sign U ..Malayalam Vowel Sign Voc {0x0d4d, 0x0d4d}, // Malayalam Sign Virama ..Malayalam Sign Virama {0x0d62, 0x0d63}, // Malayalam Vowel Sign Voc..Malayalam Vowel Sign Voc {0x0dca, 0x0dca}, // Sinhala Sign Al-lakuna ..Sinhala Sign Al-lakuna {0x0dd2, 0x0dd4}, // Sinhala Vowel Sign Ketti..Sinhala Vowel Sign Ketti {0x0dd6, 0x0dd6}, // Sinhala Vowel Sign Diga ..Sinhala Vowel Sign Diga {0x0e31, 0x0e31}, // Thai Character Mai Han-a..Thai Character Mai Han-a {0x0e34, 0x0e3a}, // Thai Character Sara I ..Thai Character Phinthu {0x0e47, 0x0e4e}, // Thai Character Maitaikhu..Thai Character Yamakkan {0x0eb1, 0x0eb1}, // Lao Vowel Sign Mai Kan ..Lao Vowel Sign Mai Kan {0x0eb4, 0x0eb9}, // Lao Vowel Sign I ..Lao Vowel Sign Uu {0x0ebb, 0x0ebc}, // Lao Vowel Sign Mai Kon ..Lao Semivowel Sign Lo {0x0ec8, 0x0ecd}, // Lao Tone Mai Ek ..Lao Niggahita {0x0f18, 0x0f19}, // Tibetan Astrological Sig..Tibetan Astrological Sig {0x0f35, 0x0f35}, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung {0x0f37, 0x0f37}, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung {0x0f39, 0x0f39}, // Tibetan Mark Tsa -phru ..Tibetan Mark Tsa -phru {0x0f71, 0x0f7e}, // Tibetan Vowel Sign Aa ..Tibetan Sign Rjes Su Nga {0x0f80, 0x0f84}, // Tibetan Vowel Sign Rever..Tibetan Mark Halanta {0x0f86, 0x0f87}, // Tibetan Sign Lci Rtags ..Tibetan Sign Yang Rtags {0x0f8d, 0x0f97}, // Tibetan Subjoined Sign L..Tibetan Subjoined Letter {0x0f99, 0x0fbc}, // Tibetan Subjoined Letter..Tibetan Subjoined Letter {0x0fc6, 0x0fc6}, // Tibetan Symbol Padma Gda..Tibetan Symbol Padma Gda {0x102d, 0x1030}, // Myanmar Vowel Sign I ..Myanmar Vowel Sign Uu {0x1032, 0x1037}, // Myanmar Vowel Sign Ai ..Myanmar Sign Dot Below {0x1039, 0x103a}, // Myanmar Sign Virama ..Myanmar Sign Asat {0x103d, 0x103e}, // Myanmar Consonant Sign M..Myanmar Consonant Sign M {0x1058, 0x1059}, // Myanmar Vowel Sign Vocal..Myanmar Vowel Sign Vocal {0x105e, 0x1060}, // Myanmar Consonant Sign M..Myanmar Consonant Sign M {0x1071, 0x1074}, // Myanmar Vowel Sign Geba ..Myanmar Vowel Sign Kayah {0x1082, 0x1082}, // Myanmar Consonant Sign S..Myanmar Consonant Sign S {0x1085, 0x1086}, // Myanmar Vowel Sign Shan ..Myanmar Vowel Sign Shan {0x108d, 0x108d}, // Myanmar Sign Shan Counci..Myanmar Sign Shan Counci {0x109d, 0x109d}, // Myanmar Vowel Sign Aiton..Myanmar Vowel Sign Aiton {0x135d, 0x135f}, // Ethiopic Combining Gemin..Ethiopic Combining Gemin {0x1712, 0x1714}, // Tagalog Vowel Sign I ..Tagalog Sign Virama {0x1732, 0x1734}, // Hanunoo Vowel Sign I ..Hanunoo Sign Pamudpod {0x1752, 0x1753}, // Buhid Vowel Sign I ..Buhid Vowel Sign U {0x1772, 0x1773}, // Tagbanwa Vowel Sign I ..Tagbanwa Vowel Sign U {0x17b4, 0x17b5}, // Khmer Vowel Inherent Aq ..Khmer Vowel Inherent Aa {0x17b7, 0x17bd}, // Khmer Vowel Sign I ..Khmer Vowel Sign Ua {0x17c6, 0x17c6}, // Khmer Sign Nikahit ..Khmer Sign Nikahit {0x17c9, 0x17d3}, // Khmer Sign Muusikatoan ..Khmer Sign Bathamasat {0x17dd, 0x17dd}, // Khmer Sign Atthacan ..Khmer Sign Atthacan {0x180b, 0x180d}, // Mongolian Free Variation..Mongolian Free Variation {0x1885, 0x1886}, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal {0x18a9, 0x18a9}, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal {0x1920, 0x1922}, // Limbu Vowel Sign A ..Limbu Vowel Sign U {0x1927, 0x1928}, // Limbu Vowel Sign E ..Limbu Vowel Sign O {0x1932, 0x1932}, // Limbu Small Letter Anusv..Limbu Small Letter Anusv {0x1939, 0x193b}, // Limbu Sign Mukphreng ..Limbu Sign Sa-i {0x1a17, 0x1a18}, // Buginese Vowel Sign I ..Buginese Vowel Sign U {0x1a1b, 0x1a1b}, // Buginese Vowel Sign Ae ..Buginese Vowel Sign Ae {0x1a56, 0x1a56}, // Tai Tham Consonant Sign ..Tai Tham Consonant Sign {0x1a58, 0x1a5e}, // Tai Tham Sign Mai Kang L..Tai Tham Consonant Sign {0x1a60, 0x1a60}, // Tai Tham Sign Sakot ..Tai Tham Sign Sakot {0x1a62, 0x1a62}, // Tai Tham Vowel Sign Mai ..Tai Tham Vowel Sign Mai {0x1a65, 0x1a6c}, // Tai Tham Vowel Sign I ..Tai Tham Vowel Sign Oa B {0x1a73, 0x1a7c}, // Tai Tham Vowel Sign Oa A..Tai Tham Sign Khuen-lue {0x1a7f, 0x1a7f}, // Tai Tham Combining Crypt..Tai Tham Combining Crypt {0x1ab0, 0x1abe}, // Combining Doubled Circum..Combining Parentheses Ov {0x1b00, 0x1b03}, // Balinese Sign Ulu Ricem ..Balinese Sign Surang {0x1b34, 0x1b34}, // Balinese Sign Rerekan ..Balinese Sign Rerekan {0x1b36, 0x1b3a}, // Balinese Vowel Sign Ulu ..Balinese Vowel Sign Ra R {0x1b3c, 0x1b3c}, // Balinese Vowel Sign La L..Balinese Vowel Sign La L {0x1b42, 0x1b42}, // Balinese Vowel Sign Pepe..Balinese Vowel Sign Pepe {0x1b6b, 0x1b73}, // Balinese Musical Symbol ..Balinese Musical Symbol {0x1b80, 0x1b81}, // Sundanese Sign Panyecek ..Sundanese Sign Panglayar {0x1ba2, 0x1ba5}, // Sundanese Consonant Sign..Sundanese Vowel Sign Pan {0x1ba8, 0x1ba9}, // Sundanese Vowel Sign Pam..Sundanese Vowel Sign Pan {0x1bab, 0x1bad}, // Sundanese Sign Virama ..Sundanese Consonant Sign {0x1be6, 0x1be6}, // Batak Sign Tompi ..Batak Sign Tompi {0x1be8, 0x1be9}, // Batak Vowel Sign Pakpak ..Batak Vowel Sign Ee {0x1bed, 0x1bed}, // Batak Vowel Sign Karo O ..Batak Vowel Sign Karo O {0x1bef, 0x1bf1}, // Batak Vowel Sign U F|| S..Batak Consonant Sign H {0x1c2c, 0x1c33}, // Lepcha Vowel Sign E ..Lepcha Consonant Sign T {0x1c36, 0x1c37}, // Lepcha Sign Ran ..Lepcha Sign Nukta {0x1cd0, 0x1cd2}, // Vedic Tone Karshana ..Vedic Tone Prenkha {0x1cd4, 0x1ce0}, // Vedic Sign Yajurvedic Mi..Vedic Tone Rigvedic Kash {0x1ce2, 0x1ce8}, // Vedic Sign Visarga Svari..Vedic Sign Visarga Anuda {0x1ced, 0x1ced}, // Vedic Sign Tiryak ..Vedic Sign Tiryak {0x1cf4, 0x1cf4}, // Vedic Tone Candra Above ..Vedic Tone Candra Above {0x1cf8, 0x1cf9}, // Vedic Tone Ring Above ..Vedic Tone Double Ring A {0x1dc0, 0x1df5}, // Combining Dotted Grave A..Combining Up Tack Above {0x1dfb, 0x1dff}, // (nil) ..Combining Right Arrowhea {0x20d0, 0x20f0}, // Combining Left Harpoon A..Combining Asterisk Above {0x2cef, 0x2cf1}, // Coptic Combining Ni Abov..Coptic Combining Spiritu {0x2d7f, 0x2d7f}, // Tifinagh Consonant Joine..Tifinagh Consonant Joine {0x2de0, 0x2dff}, // Combining Cyrillic Lette..Combining Cyrillic Lette {0x302a, 0x302d}, // Ideographic Level Tone M..Ideographic Entering Ton {0x3099, 0x309a}, // Combining Katakana-hirag..Combining Katakana-hirag {0xa66f, 0xa672}, // Combining Cyrillic Vzmet..Combining Cyrillic Thous {0xa674, 0xa67d}, // Combining Cyrillic Lette..Combining Cyrillic Payer {0xa69e, 0xa69f}, // Combining Cyrillic Lette..Combining Cyrillic Lette {0xa6f0, 0xa6f1}, // Bamum Combining Mark Koq..Bamum Combining Mark Tuk {0xa802, 0xa802}, // Syloti Nagri Sign Dvisva..Syloti Nagri Sign Dvisva {0xa806, 0xa806}, // Syloti Nagri Sign Hasant..Syloti Nagri Sign Hasant {0xa80b, 0xa80b}, // Syloti Nagri Sign Anusva..Syloti Nagri Sign Anusva {0xa825, 0xa826}, // Syloti Nagri Vowel Sign ..Syloti Nagri Vowel Sign {0xa8c4, 0xa8c5}, // Saurashtra Sign Virama .. {0xa8e0, 0xa8f1}, // Combining Devanagari Dig..Combining Devanagari Sig {0xa926, 0xa92d}, // Kayah Li Vowel Ue ..Kayah Li Tone Calya Plop {0xa947, 0xa951}, // Rejang Vowel Sign I ..Rejang Consonant Sign R {0xa980, 0xa982}, // Javanese Sign Panyangga ..Javanese Sign Layar {0xa9b3, 0xa9b3}, // Javanese Sign Cecak Telu..Javanese Sign Cecak Telu {0xa9b6, 0xa9b9}, // Javanese Vowel Sign Wulu..Javanese Vowel Sign Suku {0xa9bc, 0xa9bc}, // Javanese Vowel Sign Pepe..Javanese Vowel Sign Pepe {0xa9e5, 0xa9e5}, // Myanmar Sign Shan Saw ..Myanmar Sign Shan Saw {0xaa29, 0xaa2e}, // Cham Vowel Sign Aa ..Cham Vowel Sign Oe {0xaa31, 0xaa32}, // Cham Vowel Sign Au ..Cham Vowel Sign Ue {0xaa35, 0xaa36}, // Cham Consonant Sign La ..Cham Consonant Sign Wa {0xaa43, 0xaa43}, // Cham Consonant Sign Fina..Cham Consonant Sign Fina {0xaa4c, 0xaa4c}, // Cham Consonant Sign Fina..Cham Consonant Sign Fina {0xaa7c, 0xaa7c}, // Myanmar Sign Tai Laing T..Myanmar Sign Tai Laing T {0xaab0, 0xaab0}, // Tai Viet Mai Kang ..Tai Viet Mai Kang {0xaab2, 0xaab4}, // Tai Viet Vowel I ..Tai Viet Vowel U {0xaab7, 0xaab8}, // Tai Viet Mai Khit ..Tai Viet Vowel Ia {0xaabe, 0xaabf}, // Tai Viet Vowel Am ..Tai Viet Tone Mai Ek {0xaac1, 0xaac1}, // Tai Viet Tone Mai Tho ..Tai Viet Tone Mai Tho {0xaaec, 0xaaed}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign {0xaaf6, 0xaaf6}, // Meetei Mayek Virama ..Meetei Mayek Virama {0xabe5, 0xabe5}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign {0xabe8, 0xabe8}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign {0xabed, 0xabed}, // Meetei Mayek Apun Iyek ..Meetei Mayek Apun Iyek {0xfb1e, 0xfb1e}, // Hebrew Point Judeo-spani..Hebrew Point Judeo-spani {0xfe00, 0xfe0f}, // Variation Select||-1 ..Variation Select||-16 {0xfe20, 0xfe2f}, // Combining Ligature Left ..Combining Cyrillic Titlo {0x101fd, 0x101fd}, // Phaistos Disc Sign Combi..Phaistos Disc Sign Combi {0x102e0, 0x102e0}, // Coptic Epact Thousands M..Coptic Epact Thousands M {0x10376, 0x1037a}, // Combining Old Permic Let..Combining Old Permic Let {0x10a01, 0x10a03}, // Kharoshthi Vowel Sign I ..Kharoshthi Vowel Sign Vo {0x10a05, 0x10a06}, // Kharoshthi Vowel Sign E ..Kharoshthi Vowel Sign O {0x10a0c, 0x10a0f}, // Kharoshthi Vowel Length ..Kharoshthi Sign Visarga {0x10a38, 0x10a3a}, // Kharoshthi Sign Bar Abov..Kharoshthi Sign Dot Belo {0x10a3f, 0x10a3f}, // Kharoshthi Virama ..Kharoshthi Virama {0x10ae5, 0x10ae6}, // Manichaean Abbreviation ..Manichaean Abbreviation {0x11001, 0x11001}, // Brahmi Sign Anusvara ..Brahmi Sign Anusvara {0x11038, 0x11046}, // Brahmi Vowel Sign Aa ..Brahmi Virama {0x1107f, 0x11081}, // Brahmi Number Joiner ..Kaithi Sign Anusvara {0x110b3, 0x110b6}, // Kaithi Vowel Sign U ..Kaithi Vowel Sign Ai {0x110b9, 0x110ba}, // Kaithi Sign Virama ..Kaithi Sign Nukta {0x11100, 0x11102}, // Chakma Sign Candrabindu ..Chakma Sign Visarga {0x11127, 0x1112b}, // Chakma Vowel Sign A ..Chakma Vowel Sign Uu {0x1112d, 0x11134}, // Chakma Vowel Sign Ai ..Chakma Maayyaa {0x11173, 0x11173}, // Mahajani Sign Nukta ..Mahajani Sign Nukta {0x11180, 0x11181}, // Sharada Sign Candrabindu..Sharada Sign Anusvara {0x111b6, 0x111be}, // Sharada Vowel Sign U ..Sharada Vowel Sign O {0x111ca, 0x111cc}, // Sharada Sign Nukta ..Sharada Extra Sh||t Vowe {0x1122f, 0x11231}, // Khojki Vowel Sign U ..Khojki Vowel Sign Ai {0x11234, 0x11234}, // Khojki Sign Anusvara ..Khojki Sign Anusvara {0x11236, 0x11237}, // Khojki Sign Nukta ..Khojki Sign Shadda {0x1123e, 0x1123e}, // (nil) .. {0x112df, 0x112df}, // Khudawadi Sign Anusvara ..Khudawadi Sign Anusvara {0x112e3, 0x112ea}, // Khudawadi Vowel Sign U ..Khudawadi Sign Virama {0x11300, 0x11301}, // Grantha Sign Combining A..Grantha Sign Candrabindu {0x1133c, 0x1133c}, // Grantha Sign Nukta ..Grantha Sign Nukta {0x11340, 0x11340}, // Grantha Vowel Sign Ii ..Grantha Vowel Sign Ii {0x11366, 0x1136c}, // Combining Grantha Digit ..Combining Grantha Digit {0x11370, 0x11374}, // Combining Grantha Letter..Combining Grantha Letter {0x11438, 0x1143f}, // (nil) .. {0x11442, 0x11444}, // (nil) .. {0x11446, 0x11446}, // (nil) .. {0x114b3, 0x114b8}, // Tirhuta Vowel Sign U ..Tirhuta Vowel Sign Vocal {0x114ba, 0x114ba}, // Tirhuta Vowel Sign Sh||t..Tirhuta Vowel Sign Sh||t {0x114bf, 0x114c0}, // Tirhuta Sign Candrabindu..Tirhuta Sign Anusvara {0x114c2, 0x114c3}, // Tirhuta Sign Virama ..Tirhuta Sign Nukta {0x115b2, 0x115b5}, // Siddham Vowel Sign U ..Siddham Vowel Sign Vocal {0x115bc, 0x115bd}, // Siddham Sign Candrabindu..Siddham Sign Anusvara {0x115bf, 0x115c0}, // Siddham Sign Virama ..Siddham Sign Nukta {0x115dc, 0x115dd}, // Siddham Vowel Sign Alter..Siddham Vowel Sign Alter {0x11633, 0x1163a}, // Modi Vowel Sign U ..Modi Vowel Sign Ai {0x1163d, 0x1163d}, // Modi Sign Anusvara ..Modi Sign Anusvara {0x1163f, 0x11640}, // Modi Sign Virama ..Modi Sign Ardhacandra {0x116ab, 0x116ab}, // Takri Sign Anusvara ..Takri Sign Anusvara {0x116ad, 0x116ad}, // Takri Vowel Sign Aa ..Takri Vowel Sign Aa {0x116b0, 0x116b5}, // Takri Vowel Sign U ..Takri Vowel Sign Au {0x116b7, 0x116b7}, // Takri Sign Nukta ..Takri Sign Nukta {0x1171d, 0x1171f}, // Ahom Consonant Sign Medi..Ahom Consonant Sign Medi {0x11722, 0x11725}, // Ahom Vowel Sign I ..Ahom Vowel Sign Uu {0x11727, 0x1172b}, // Ahom Vowel Sign Aw ..Ahom Sign Killer {0x11c30, 0x11c36}, // (nil) .. {0x11c38, 0x11c3d}, // (nil) .. {0x11c3f, 0x11c3f}, // (nil) .. {0x11c92, 0x11ca7}, // (nil) .. {0x11caa, 0x11cb0}, // (nil) .. {0x11cb2, 0x11cb3}, // (nil) .. {0x11cb5, 0x11cb6}, // (nil) .. {0x16af0, 0x16af4}, // Bassa Vah Combining High..Bassa Vah Combining High {0x16b30, 0x16b36}, // Pahawh Hmong Mark Cim Tu..Pahawh Hmong Mark Cim Ta {0x16f8f, 0x16f92}, // Miao Tone Right ..Miao Tone Below {0x1bc9d, 0x1bc9e}, // Duployan Thick Letter Se..Duployan Double Mark {0x1d167, 0x1d169}, // Musical Symbol Combining..Musical Symbol Combining {0x1d17b, 0x1d182}, // Musical Symbol Combining..Musical Symbol Combining {0x1d185, 0x1d18b}, // Musical Symbol Combining..Musical Symbol Combining {0x1d1aa, 0x1d1ad}, // Musical Symbol Combining..Musical Symbol Combining {0x1d242, 0x1d244}, // Combining Greek Musical ..Combining Greek Musical {0x1da00, 0x1da36}, // Signwriting Head Rim ..Signwriting Air Sucking {0x1da3b, 0x1da6c}, // Signwriting Mouth Closed..Signwriting Excitement {0x1da75, 0x1da75}, // Signwriting Upper Body T..Signwriting Upper Body T {0x1da84, 0x1da84}, // Signwriting Location Hea..Signwriting Location Hea {0x1da9b, 0x1da9f}, // Signwriting Fill Modifie..Signwriting Fill Modifie {0x1daa1, 0x1daaf}, // Signwriting Rotation Mod..Signwriting Rotation Mod {0x1e000, 0x1e006}, // (nil) .. {0x1e008, 0x1e018}, // (nil) .. {0x1e01b, 0x1e021}, // (nil) .. {0x1e023, 0x1e024}, // (nil) .. {0x1e026, 0x1e02a}, // (nil) .. {0x1e8d0, 0x1e8d6}, // Mende Kikakui Combining ..Mende Kikakui Combining {0x1e944, 0x1e94a}, // (nil) .. {0xe0100, 0xe01ef}, // Variation Select||-17 ..Variation Select||-256 }; // https://github.com/jquast/wcwidth/blob/master/wcwidth/table_wide.py // at commit 0d7de112202cc8b2ebe9232ff4a5c954f19d561a (2016-07-02): static struct width_interval WIDE_EASTASIAN[] = { {0x1100, 0x115f}, // Hangul Choseong Kiyeok ..Hangul Choseong Filler {0x231a, 0x231b}, // Watch ..Hourglass {0x2329, 0x232a}, // Left-pointing Angle Brac..Right-pointing Angle Bra {0x23e9, 0x23ec}, // Black Right-pointing Dou..Black Down-pointing Doub {0x23f0, 0x23f0}, // Alarm Clock ..Alarm Clock {0x23f3, 0x23f3}, // Hourglass With Flowing S..Hourglass With Flowing S {0x25fd, 0x25fe}, // White Medium Small Squar..Black Medium Small Squar {0x2614, 0x2615}, // Umbrella With Rain Drops..Hot Beverage {0x2648, 0x2653}, // Aries ..Pisces {0x267f, 0x267f}, // Wheelchair Symbol ..Wheelchair Symbol {0x2693, 0x2693}, // Anch|| ..Anch|| {0x26a1, 0x26a1}, // High Voltage Sign ..High Voltage Sign {0x26aa, 0x26ab}, // Medium White Circle ..Medium Black Circle {0x26bd, 0x26be}, // Soccer Ball ..Baseball {0x26c4, 0x26c5}, // Snowman Without Snow ..Sun Behind Cloud {0x26ce, 0x26ce}, // Ophiuchus ..Ophiuchus {0x26d4, 0x26d4}, // No Entry ..No Entry {0x26ea, 0x26ea}, // Church ..Church {0x26f2, 0x26f3}, // Fountain ..Flag In Hole {0x26f5, 0x26f5}, // Sailboat ..Sailboat {0x26fa, 0x26fa}, // Tent ..Tent {0x26fd, 0x26fd}, // Fuel Pump ..Fuel Pump {0x2705, 0x2705}, // White Heavy Check Mark ..White Heavy Check Mark {0x270a, 0x270b}, // Raised Fist ..Raised Hand {0x2728, 0x2728}, // Sparkles ..Sparkles {0x274c, 0x274c}, // Cross Mark ..Cross Mark {0x274e, 0x274e}, // Negative Squared Cross M..Negative Squared Cross M {0x2753, 0x2755}, // Black Question Mark ||na..White Exclamation Mark O {0x2757, 0x2757}, // Heavy Exclamation Mark S..Heavy Exclamation Mark S {0x2795, 0x2797}, // Heavy Plus Sign ..Heavy Division Sign {0x27b0, 0x27b0}, // Curly Loop ..Curly Loop {0x27bf, 0x27bf}, // Double Curly Loop ..Double Curly Loop {0x2b1b, 0x2b1c}, // Black Large Square ..White Large Square {0x2b50, 0x2b50}, // White Medium Star ..White Medium Star {0x2b55, 0x2b55}, // Heavy Large Circle ..Heavy Large Circle {0x2e80, 0x2e99}, // Cjk Radical Repeat ..Cjk Radical Rap {0x2e9b, 0x2ef3}, // Cjk Radical Choke ..Cjk Radical C-simplified {0x2f00, 0x2fd5}, // Kangxi Radical One ..Kangxi Radical Flute {0x2ff0, 0x2ffb}, // Ideographic Description ..Ideographic Description {0x3000, 0x303e}, // Ideographic Space ..Ideographic Variation In {0x3041, 0x3096}, // Hiragana Letter Small A ..Hiragana Letter Small Ke {0x3099, 0x30ff}, // Combining Katakana-hirag..Katakana Digraph Koto {0x3105, 0x312d}, // Bopomofo Letter B ..Bopomofo Letter Ih {0x3131, 0x318e}, // Hangul Letter Kiyeok ..Hangul Letter Araeae {0x3190, 0x31ba}, // Ideographic Annotation L..Bopomofo Letter Zy {0x31c0, 0x31e3}, // Cjk Stroke T ..Cjk Stroke Q {0x31f0, 0x321e}, // Katakana Letter Small Ku..Parenthesized K||ean Cha {0x3220, 0x3247}, // Parenthesized Ideograph ..Circled Ideograph Koto {0x3250, 0x32fe}, // Partnership Sign ..Circled Katakana Wo {0x3300, 0x4dbf}, // Square Apaato .. {0x4e00, 0xa48c}, // Cjk Unified Ideograph-4e..Yi Syllable Yyr {0xa490, 0xa4c6}, // Yi Radical Qot ..Yi Radical Ke {0xa960, 0xa97c}, // Hangul Choseong Tikeut-m..Hangul Choseong Ssangyeo {0xac00, 0xd7a3}, // Hangul Syllable Ga ..Hangul Syllable Hih {0xf900, 0xfaff}, // Cjk Compatibility Ideogr.. {0xfe10, 0xfe19}, // Presentation F||m F|| Ve..Presentation F||m F|| Ve {0xfe30, 0xfe52}, // Presentation F||m F|| Ve..Small Full Stop {0xfe54, 0xfe66}, // Small Semicolon ..Small Equals Sign {0xfe68, 0xfe6b}, // Small Reverse Solidus ..Small Commercial At {0xff01, 0xff60}, // Fullwidth Exclamation Ma..Fullwidth Right White Pa {0xffe0, 0xffe6}, // Fullwidth Cent Sign ..Fullwidth Won Sign {0x16fe0, 0x16fe0}, // (nil) .. {0x17000, 0x187ec}, // (nil) .. {0x18800, 0x18af2}, // (nil) .. {0x1b000, 0x1b001}, // Katakana Letter Archaic ..Hiragana Letter Archaic {0x1f004, 0x1f004}, // Mahjong Tile Red Dragon ..Mahjong Tile Red Dragon {0x1f0cf, 0x1f0cf}, // Playing Card Black Joker..Playing Card Black Joker {0x1f18e, 0x1f18e}, // Negative Squared Ab ..Negative Squared Ab {0x1f191, 0x1f19a}, // Squared Cl ..Squared Vs {0x1f200, 0x1f202}, // Square Hiragana Hoka ..Squared Katakana Sa {0x1f210, 0x1f23b}, // Squared Cjk Unified Ideo.. {0x1f240, 0x1f248}, // T||toise Shell Bracketed..T||toise Shell Bracketed {0x1f250, 0x1f251}, // Circled Ideograph Advant..Circled Ideograph Accept {0x1f300, 0x1f320}, // Cyclone ..Shooting Star {0x1f32d, 0x1f335}, // Hot Dog ..Cactus {0x1f337, 0x1f37c}, // Tulip ..Baby Bottle {0x1f37e, 0x1f393}, // Bottle With Popping C||k..Graduation Cap {0x1f3a0, 0x1f3ca}, // Carousel H||se ..Swimmer {0x1f3cf, 0x1f3d3}, // Cricket Bat And Ball ..Table Tennis Paddle And {0x1f3e0, 0x1f3f0}, // House Building ..European Castle {0x1f3f4, 0x1f3f4}, // Waving Black Flag ..Waving Black Flag {0x1f3f8, 0x1f43e}, // Badminton Racquet And Sh..Paw Prints {0x1f440, 0x1f440}, // Eyes ..Eyes {0x1f442, 0x1f4fc}, // Ear ..Videocassette {0x1f4ff, 0x1f53d}, // Prayer Beads ..Down-pointing Small Red {0x1f54b, 0x1f54e}, // Kaaba ..Men||ah With Nine Branch {0x1f550, 0x1f567}, // Clock Face One Oclock ..Clock Face Twelve-thirty {0x1f57a, 0x1f57a}, // (nil) .. {0x1f595, 0x1f596}, // Reversed Hand With Middl..Raised Hand With Part Be {0x1f5a4, 0x1f5a4}, // (nil) .. {0x1f5fb, 0x1f64f}, // Mount Fuji ..Person With Folded Hands {0x1f680, 0x1f6c5}, // Rocket ..Left Luggage {0x1f6cc, 0x1f6cc}, // Sleeping Accommodation ..Sleeping Accommodation {0x1f6d0, 0x1f6d2}, // Place Of W||ship .. {0x1f6eb, 0x1f6ec}, // Airplane Departure ..Airplane Arriving {0x1f6f4, 0x1f6f6}, // (nil) .. {0x1f910, 0x1f91e}, // Zipper-mouth Face .. {0x1f920, 0x1f927}, // (nil) .. {0x1f930, 0x1f930}, // (nil) .. {0x1f933, 0x1f93e}, // (nil) .. {0x1f940, 0x1f94b}, // (nil) .. {0x1f950, 0x1f95e}, // (nil) .. {0x1f980, 0x1f991}, // Crab .. {0x1f9c0, 0x1f9c0}, // Cheese Wedge ..Cheese Wedge {0x20000, 0x2fffd}, // Cjk Unified Ideograph-20.. {0x30000, 0x3fffd}, // (nil) .. }; static bool intable(struct width_interval* table, int table_length, int c) { // First quick check for Latin1 etc. characters. if (c < table[0].start) return false; // Binary search in table. int bot = 0; int top = table_length - 1; while (top >= bot) { int mid = (bot + top) / 2; if (table[mid].end < c) { bot = mid + 1; } else if (table[mid].start > c) { top = mid - 1; } else { return true; } } return false; } int wcwidth(wchar_t ucs) { // NOTE: created by hand, there isn't anything identifiable other than // general Cf category code to identify these, and some characters in Cf // category code are of non-zero width. if (ucs == 0 || ucs == 0x034F || (0x200B <= ucs && ucs <= 0x200F) || ucs == 0x2028 || ucs == 0x2029 || (0x202A <= ucs && ucs <= 0x202E) || (0x2060 <= ucs && ucs <= 0x2063)) { return 0; } // C0/C1 control characters. if (ucs < 32 || (0x07F <= ucs && ucs < 0x0A0)) return -1; // Combining characters with zero width. if (intable(ZERO_WIDTH, sizeof(ZERO_WIDTH)/sizeof(struct width_interval), ucs)) return 0; return intable(WIDE_EASTASIAN, sizeof(WIDE_EASTASIAN)/sizeof(struct width_interval), ucs) ? 2 : 1; } libtsm-4.0.2/external/wcwidth/wcwidth.h000066400000000000000000000002641420363367700201410ustar00rootroot00000000000000#ifndef WCWIDTH_H_INCLUDED #define WCWIDTH_H_INCLUDED #include #ifdef __cplusplus extern "C" { #endif int wcwidth(wchar_t ucs); #ifdef __cplusplus } #endif #endif libtsm-4.0.2/external/xkbcommon/000077500000000000000000000000001420363367700166415ustar00rootroot00000000000000libtsm-4.0.2/external/xkbcommon/xkbcommon-keysyms.h000066400000000000000000006366431420363367700225330ustar00rootroot00000000000000#ifndef _XKBCOMMON_KEYSYMS_H #define _XKBCOMMON_KEYSYMS_H /* This file is autogenerated; please do not commit directly. */ #define XKB_KEY_NoSymbol 0x000000 /* Special KeySym */ /*********************************************************** Copyright 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * The "X11 Window System Protocol" standard defines in Appendix A the * keysym codes. These 29-bit integer values identify characters or * functions associated with each key (e.g., via the visible * engraving) of a keyboard layout. This file assigns mnemonic macro * names for these keysyms. * * This file is also compiled (by src/util/makekeys.c in libX11) into * hash tables that can be accessed with X11 library functions such as * XStringToKeysym() and XKeysymToString(). * * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode * character, this is noted in a comment that provides both the U+xxxx * Unicode position, as well as the official Unicode name of the * character. * * Where the correspondence is either not one-to-one or semantically * unclear, the Unicode position and name are enclosed in * parentheses. Such legacy keysyms should be considered deprecated * and are not recommended for use in future keyboard mappings. * * For any future extension of the keysyms with characters already * found in ISO 10646 / Unicode, the following algorithm shall be * used. The new keysym code position will simply be the character's * Unicode number plus 0x01000000. The keysym values in the range * 0x01000100 to 0x0110ffff are reserved to represent Unicode * characters in the range U+0100 to U+10FFFF. * * While most newer Unicode-based X11 clients do already accept * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it * will remain necessary for clients -- in the interest of * compatibility with existing servers -- to also understand the * existing legacy keysym values in the range 0x0100 to 0x20ff. * * Where several mnemonic names are defined for the same keysym in this * file, all but the first one listed should be considered deprecated. * * Mnemonic names for keysyms are defined in this file with lines * that match one of these Perl regular expressions: * * /^\#define XKB_KEY_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/ * /^\#define XKB_KEY_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ * /^\#define XKB_KEY_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ * * Before adding new keysyms, please do consider the following: In * addition to the keysym names defined in this file, the * XStringToKeysym() and XKeysymToString() functions will also handle * any keysym string of the form "U0020" to "U007E" and "U00A0" to * "U10FFFF" for all possible Unicode characters. In other words, * every possible Unicode character has already a keysym string * defined algorithmically, even if it is not listed here. Therefore, * defining an additional keysym macro is only necessary where a * non-hexadecimal mnemonic name is needed, or where the new keysym * does not represent any existing Unicode character. * * When adding new keysyms to this file, do not forget to also update the * following as needed: * * - the mappings in src/KeyBind.c in the repo * git://anongit.freedesktop.org/xorg/lib/libX11.git * * - the protocol specification in specs/keysyms.xml * in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git * */ #define XKB_KEY_VoidSymbol 0xffffff /* Void symbol */ /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code). */ #define XKB_KEY_BackSpace 0xff08 /* Back space, back char */ #define XKB_KEY_Tab 0xff09 #define XKB_KEY_Linefeed 0xff0a /* Linefeed, LF */ #define XKB_KEY_Clear 0xff0b #define XKB_KEY_Return 0xff0d /* Return, enter */ #define XKB_KEY_Pause 0xff13 /* Pause, hold */ #define XKB_KEY_Scroll_Lock 0xff14 #define XKB_KEY_Sys_Req 0xff15 #define XKB_KEY_Escape 0xff1b #define XKB_KEY_Delete 0xffff /* Delete, rubout */ /* International & multi-key character composition */ #define XKB_KEY_Multi_key 0xff20 /* Multi-key character compose */ #define XKB_KEY_Codeinput 0xff37 #define XKB_KEY_SingleCandidate 0xff3c #define XKB_KEY_MultipleCandidate 0xff3d #define XKB_KEY_PreviousCandidate 0xff3e /* Japanese keyboard support */ #define XKB_KEY_Kanji 0xff21 /* Kanji, Kanji convert */ #define XKB_KEY_Muhenkan 0xff22 /* Cancel Conversion */ #define XKB_KEY_Henkan_Mode 0xff23 /* Start/Stop Conversion */ #define XKB_KEY_Henkan 0xff23 /* Alias for Henkan_Mode */ #define XKB_KEY_Romaji 0xff24 /* to Romaji */ #define XKB_KEY_Hiragana 0xff25 /* to Hiragana */ #define XKB_KEY_Katakana 0xff26 /* to Katakana */ #define XKB_KEY_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */ #define XKB_KEY_Zenkaku 0xff28 /* to Zenkaku */ #define XKB_KEY_Hankaku 0xff29 /* to Hankaku */ #define XKB_KEY_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */ #define XKB_KEY_Touroku 0xff2b /* Add to Dictionary */ #define XKB_KEY_Massyo 0xff2c /* Delete from Dictionary */ #define XKB_KEY_Kana_Lock 0xff2d /* Kana Lock */ #define XKB_KEY_Kana_Shift 0xff2e /* Kana Shift */ #define XKB_KEY_Eisu_Shift 0xff2f /* Alphanumeric Shift */ #define XKB_KEY_Eisu_toggle 0xff30 /* Alphanumeric toggle */ #define XKB_KEY_Kanji_Bangou 0xff37 /* Codeinput */ #define XKB_KEY_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */ #define XKB_KEY_Mae_Koho 0xff3e /* Previous Candidate */ /* 0xff31 thru 0xff3f are under XK_KOREAN */ /* Cursor control & motion */ #define XKB_KEY_Home 0xff50 #define XKB_KEY_Left 0xff51 /* Move left, left arrow */ #define XKB_KEY_Up 0xff52 /* Move up, up arrow */ #define XKB_KEY_Right 0xff53 /* Move right, right arrow */ #define XKB_KEY_Down 0xff54 /* Move down, down arrow */ #define XKB_KEY_Prior 0xff55 /* Prior, previous */ #define XKB_KEY_Page_Up 0xff55 #define XKB_KEY_Next 0xff56 /* Next */ #define XKB_KEY_Page_Down 0xff56 #define XKB_KEY_End 0xff57 /* EOL */ #define XKB_KEY_Begin 0xff58 /* BOL */ /* Misc functions */ #define XKB_KEY_Select 0xff60 /* Select, mark */ #define XKB_KEY_Print 0xff61 #define XKB_KEY_Execute 0xff62 /* Execute, run, do */ #define XKB_KEY_Insert 0xff63 /* Insert, insert here */ #define XKB_KEY_Undo 0xff65 #define XKB_KEY_Redo 0xff66 /* Redo, again */ #define XKB_KEY_Menu 0xff67 #define XKB_KEY_Find 0xff68 /* Find, search */ #define XKB_KEY_Cancel 0xff69 /* Cancel, stop, abort, exit */ #define XKB_KEY_Help 0xff6a /* Help */ #define XKB_KEY_Break 0xff6b #define XKB_KEY_Mode_switch 0xff7e /* Character set switch */ #define XKB_KEY_script_switch 0xff7e /* Alias for mode_switch */ #define XKB_KEY_Num_Lock 0xff7f /* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ #define XKB_KEY_KP_Space 0xff80 /* Space */ #define XKB_KEY_KP_Tab 0xff89 #define XKB_KEY_KP_Enter 0xff8d /* Enter */ #define XKB_KEY_KP_F1 0xff91 /* PF1, KP_A, ... */ #define XKB_KEY_KP_F2 0xff92 #define XKB_KEY_KP_F3 0xff93 #define XKB_KEY_KP_F4 0xff94 #define XKB_KEY_KP_Home 0xff95 #define XKB_KEY_KP_Left 0xff96 #define XKB_KEY_KP_Up 0xff97 #define XKB_KEY_KP_Right 0xff98 #define XKB_KEY_KP_Down 0xff99 #define XKB_KEY_KP_Prior 0xff9a #define XKB_KEY_KP_Page_Up 0xff9a #define XKB_KEY_KP_Next 0xff9b #define XKB_KEY_KP_Page_Down 0xff9b #define XKB_KEY_KP_End 0xff9c #define XKB_KEY_KP_Begin 0xff9d #define XKB_KEY_KP_Insert 0xff9e #define XKB_KEY_KP_Delete 0xff9f #define XKB_KEY_KP_Equal 0xffbd /* Equals */ #define XKB_KEY_KP_Multiply 0xffaa #define XKB_KEY_KP_Add 0xffab #define XKB_KEY_KP_Separator 0xffac /* Separator, often comma */ #define XKB_KEY_KP_Subtract 0xffad #define XKB_KEY_KP_Decimal 0xffae #define XKB_KEY_KP_Divide 0xffaf #define XKB_KEY_KP_0 0xffb0 #define XKB_KEY_KP_1 0xffb1 #define XKB_KEY_KP_2 0xffb2 #define XKB_KEY_KP_3 0xffb3 #define XKB_KEY_KP_4 0xffb4 #define XKB_KEY_KP_5 0xffb5 #define XKB_KEY_KP_6 0xffb6 #define XKB_KEY_KP_7 0xffb7 #define XKB_KEY_KP_8 0xffb8 #define XKB_KEY_KP_9 0xffb9 /* * Auxiliary functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ #define XKB_KEY_F1 0xffbe #define XKB_KEY_F2 0xffbf #define XKB_KEY_F3 0xffc0 #define XKB_KEY_F4 0xffc1 #define XKB_KEY_F5 0xffc2 #define XKB_KEY_F6 0xffc3 #define XKB_KEY_F7 0xffc4 #define XKB_KEY_F8 0xffc5 #define XKB_KEY_F9 0xffc6 #define XKB_KEY_F10 0xffc7 #define XKB_KEY_F11 0xffc8 #define XKB_KEY_L1 0xffc8 #define XKB_KEY_F12 0xffc9 #define XKB_KEY_L2 0xffc9 #define XKB_KEY_F13 0xffca #define XKB_KEY_L3 0xffca #define XKB_KEY_F14 0xffcb #define XKB_KEY_L4 0xffcb #define XKB_KEY_F15 0xffcc #define XKB_KEY_L5 0xffcc #define XKB_KEY_F16 0xffcd #define XKB_KEY_L6 0xffcd #define XKB_KEY_F17 0xffce #define XKB_KEY_L7 0xffce #define XKB_KEY_F18 0xffcf #define XKB_KEY_L8 0xffcf #define XKB_KEY_F19 0xffd0 #define XKB_KEY_L9 0xffd0 #define XKB_KEY_F20 0xffd1 #define XKB_KEY_L10 0xffd1 #define XKB_KEY_F21 0xffd2 #define XKB_KEY_R1 0xffd2 #define XKB_KEY_F22 0xffd3 #define XKB_KEY_R2 0xffd3 #define XKB_KEY_F23 0xffd4 #define XKB_KEY_R3 0xffd4 #define XKB_KEY_F24 0xffd5 #define XKB_KEY_R4 0xffd5 #define XKB_KEY_F25 0xffd6 #define XKB_KEY_R5 0xffd6 #define XKB_KEY_F26 0xffd7 #define XKB_KEY_R6 0xffd7 #define XKB_KEY_F27 0xffd8 #define XKB_KEY_R7 0xffd8 #define XKB_KEY_F28 0xffd9 #define XKB_KEY_R8 0xffd9 #define XKB_KEY_F29 0xffda #define XKB_KEY_R9 0xffda #define XKB_KEY_F30 0xffdb #define XKB_KEY_R10 0xffdb #define XKB_KEY_F31 0xffdc #define XKB_KEY_R11 0xffdc #define XKB_KEY_F32 0xffdd #define XKB_KEY_R12 0xffdd #define XKB_KEY_F33 0xffde #define XKB_KEY_R13 0xffde #define XKB_KEY_F34 0xffdf #define XKB_KEY_R14 0xffdf #define XKB_KEY_F35 0xffe0 #define XKB_KEY_R15 0xffe0 /* Modifiers */ #define XKB_KEY_Shift_L 0xffe1 /* Left shift */ #define XKB_KEY_Shift_R 0xffe2 /* Right shift */ #define XKB_KEY_Control_L 0xffe3 /* Left control */ #define XKB_KEY_Control_R 0xffe4 /* Right control */ #define XKB_KEY_Caps_Lock 0xffe5 /* Caps lock */ #define XKB_KEY_Shift_Lock 0xffe6 /* Shift lock */ #define XKB_KEY_Meta_L 0xffe7 /* Left meta */ #define XKB_KEY_Meta_R 0xffe8 /* Right meta */ #define XKB_KEY_Alt_L 0xffe9 /* Left alt */ #define XKB_KEY_Alt_R 0xffea /* Right alt */ #define XKB_KEY_Super_L 0xffeb /* Left super */ #define XKB_KEY_Super_R 0xffec /* Right super */ #define XKB_KEY_Hyper_L 0xffed /* Left hyper */ #define XKB_KEY_Hyper_R 0xffee /* Right hyper */ /* * Keyboard (XKB) Extension function and modifier keys * (from Appendix C of "The X Keyboard Extension: Protocol Specification") * Byte 3 = 0xfe */ #define XKB_KEY_ISO_Lock 0xfe01 #define XKB_KEY_ISO_Level2_Latch 0xfe02 #define XKB_KEY_ISO_Level3_Shift 0xfe03 #define XKB_KEY_ISO_Level3_Latch 0xfe04 #define XKB_KEY_ISO_Level3_Lock 0xfe05 #define XKB_KEY_ISO_Level5_Shift 0xfe11 #define XKB_KEY_ISO_Level5_Latch 0xfe12 #define XKB_KEY_ISO_Level5_Lock 0xfe13 #define XKB_KEY_ISO_Group_Shift 0xff7e /* Alias for mode_switch */ #define XKB_KEY_ISO_Group_Latch 0xfe06 #define XKB_KEY_ISO_Group_Lock 0xfe07 #define XKB_KEY_ISO_Next_Group 0xfe08 #define XKB_KEY_ISO_Next_Group_Lock 0xfe09 #define XKB_KEY_ISO_Prev_Group 0xfe0a #define XKB_KEY_ISO_Prev_Group_Lock 0xfe0b #define XKB_KEY_ISO_First_Group 0xfe0c #define XKB_KEY_ISO_First_Group_Lock 0xfe0d #define XKB_KEY_ISO_Last_Group 0xfe0e #define XKB_KEY_ISO_Last_Group_Lock 0xfe0f #define XKB_KEY_ISO_Left_Tab 0xfe20 #define XKB_KEY_ISO_Move_Line_Up 0xfe21 #define XKB_KEY_ISO_Move_Line_Down 0xfe22 #define XKB_KEY_ISO_Partial_Line_Up 0xfe23 #define XKB_KEY_ISO_Partial_Line_Down 0xfe24 #define XKB_KEY_ISO_Partial_Space_Left 0xfe25 #define XKB_KEY_ISO_Partial_Space_Right 0xfe26 #define XKB_KEY_ISO_Set_Margin_Left 0xfe27 #define XKB_KEY_ISO_Set_Margin_Right 0xfe28 #define XKB_KEY_ISO_Release_Margin_Left 0xfe29 #define XKB_KEY_ISO_Release_Margin_Right 0xfe2a #define XKB_KEY_ISO_Release_Both_Margins 0xfe2b #define XKB_KEY_ISO_Fast_Cursor_Left 0xfe2c #define XKB_KEY_ISO_Fast_Cursor_Right 0xfe2d #define XKB_KEY_ISO_Fast_Cursor_Up 0xfe2e #define XKB_KEY_ISO_Fast_Cursor_Down 0xfe2f #define XKB_KEY_ISO_Continuous_Underline 0xfe30 #define XKB_KEY_ISO_Discontinuous_Underline 0xfe31 #define XKB_KEY_ISO_Emphasize 0xfe32 #define XKB_KEY_ISO_Center_Object 0xfe33 #define XKB_KEY_ISO_Enter 0xfe34 #define XKB_KEY_dead_grave 0xfe50 #define XKB_KEY_dead_acute 0xfe51 #define XKB_KEY_dead_circumflex 0xfe52 #define XKB_KEY_dead_tilde 0xfe53 #define XKB_KEY_dead_perispomeni 0xfe53 /* alias for dead_tilde */ #define XKB_KEY_dead_macron 0xfe54 #define XKB_KEY_dead_breve 0xfe55 #define XKB_KEY_dead_abovedot 0xfe56 #define XKB_KEY_dead_diaeresis 0xfe57 #define XKB_KEY_dead_abovering 0xfe58 #define XKB_KEY_dead_doubleacute 0xfe59 #define XKB_KEY_dead_caron 0xfe5a #define XKB_KEY_dead_cedilla 0xfe5b #define XKB_KEY_dead_ogonek 0xfe5c #define XKB_KEY_dead_iota 0xfe5d #define XKB_KEY_dead_voiced_sound 0xfe5e #define XKB_KEY_dead_semivoiced_sound 0xfe5f #define XKB_KEY_dead_belowdot 0xfe60 #define XKB_KEY_dead_hook 0xfe61 #define XKB_KEY_dead_horn 0xfe62 #define XKB_KEY_dead_stroke 0xfe63 #define XKB_KEY_dead_abovecomma 0xfe64 #define XKB_KEY_dead_psili 0xfe64 /* alias for dead_abovecomma */ #define XKB_KEY_dead_abovereversedcomma 0xfe65 #define XKB_KEY_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */ #define XKB_KEY_dead_doublegrave 0xfe66 #define XKB_KEY_dead_belowring 0xfe67 #define XKB_KEY_dead_belowmacron 0xfe68 #define XKB_KEY_dead_belowcircumflex 0xfe69 #define XKB_KEY_dead_belowtilde 0xfe6a #define XKB_KEY_dead_belowbreve 0xfe6b #define XKB_KEY_dead_belowdiaeresis 0xfe6c #define XKB_KEY_dead_invertedbreve 0xfe6d #define XKB_KEY_dead_belowcomma 0xfe6e #define XKB_KEY_dead_currency 0xfe6f /* extra dead elements for German T3 layout */ #define XKB_KEY_dead_lowline 0xfe90 #define XKB_KEY_dead_aboveverticalline 0xfe91 #define XKB_KEY_dead_belowverticalline 0xfe92 #define XKB_KEY_dead_longsolidusoverlay 0xfe93 /* dead vowels for universal syllable entry */ #define XKB_KEY_dead_a 0xfe80 #define XKB_KEY_dead_A 0xfe81 #define XKB_KEY_dead_e 0xfe82 #define XKB_KEY_dead_E 0xfe83 #define XKB_KEY_dead_i 0xfe84 #define XKB_KEY_dead_I 0xfe85 #define XKB_KEY_dead_o 0xfe86 #define XKB_KEY_dead_O 0xfe87 #define XKB_KEY_dead_u 0xfe88 #define XKB_KEY_dead_U 0xfe89 #define XKB_KEY_dead_small_schwa 0xfe8a #define XKB_KEY_dead_capital_schwa 0xfe8b #define XKB_KEY_dead_greek 0xfe8c #define XKB_KEY_First_Virtual_Screen 0xfed0 #define XKB_KEY_Prev_Virtual_Screen 0xfed1 #define XKB_KEY_Next_Virtual_Screen 0xfed2 #define XKB_KEY_Last_Virtual_Screen 0xfed4 #define XKB_KEY_Terminate_Server 0xfed5 #define XKB_KEY_AccessX_Enable 0xfe70 #define XKB_KEY_AccessX_Feedback_Enable 0xfe71 #define XKB_KEY_RepeatKeys_Enable 0xfe72 #define XKB_KEY_SlowKeys_Enable 0xfe73 #define XKB_KEY_BounceKeys_Enable 0xfe74 #define XKB_KEY_StickyKeys_Enable 0xfe75 #define XKB_KEY_MouseKeys_Enable 0xfe76 #define XKB_KEY_MouseKeys_Accel_Enable 0xfe77 #define XKB_KEY_Overlay1_Enable 0xfe78 #define XKB_KEY_Overlay2_Enable 0xfe79 #define XKB_KEY_AudibleBell_Enable 0xfe7a #define XKB_KEY_Pointer_Left 0xfee0 #define XKB_KEY_Pointer_Right 0xfee1 #define XKB_KEY_Pointer_Up 0xfee2 #define XKB_KEY_Pointer_Down 0xfee3 #define XKB_KEY_Pointer_UpLeft 0xfee4 #define XKB_KEY_Pointer_UpRight 0xfee5 #define XKB_KEY_Pointer_DownLeft 0xfee6 #define XKB_KEY_Pointer_DownRight 0xfee7 #define XKB_KEY_Pointer_Button_Dflt 0xfee8 #define XKB_KEY_Pointer_Button1 0xfee9 #define XKB_KEY_Pointer_Button2 0xfeea #define XKB_KEY_Pointer_Button3 0xfeeb #define XKB_KEY_Pointer_Button4 0xfeec #define XKB_KEY_Pointer_Button5 0xfeed #define XKB_KEY_Pointer_DblClick_Dflt 0xfeee #define XKB_KEY_Pointer_DblClick1 0xfeef #define XKB_KEY_Pointer_DblClick2 0xfef0 #define XKB_KEY_Pointer_DblClick3 0xfef1 #define XKB_KEY_Pointer_DblClick4 0xfef2 #define XKB_KEY_Pointer_DblClick5 0xfef3 #define XKB_KEY_Pointer_Drag_Dflt 0xfef4 #define XKB_KEY_Pointer_Drag1 0xfef5 #define XKB_KEY_Pointer_Drag2 0xfef6 #define XKB_KEY_Pointer_Drag3 0xfef7 #define XKB_KEY_Pointer_Drag4 0xfef8 #define XKB_KEY_Pointer_Drag5 0xfefd #define XKB_KEY_Pointer_EnableKeys 0xfef9 #define XKB_KEY_Pointer_Accelerate 0xfefa #define XKB_KEY_Pointer_DfltBtnNext 0xfefb #define XKB_KEY_Pointer_DfltBtnPrev 0xfefc /* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */ #define XKB_KEY_ch 0xfea0 #define XKB_KEY_Ch 0xfea1 #define XKB_KEY_CH 0xfea2 #define XKB_KEY_c_h 0xfea3 #define XKB_KEY_C_h 0xfea4 #define XKB_KEY_C_H 0xfea5 /* * 3270 Terminal Keys * Byte 3 = 0xfd */ #define XKB_KEY_3270_Duplicate 0xfd01 #define XKB_KEY_3270_FieldMark 0xfd02 #define XKB_KEY_3270_Right2 0xfd03 #define XKB_KEY_3270_Left2 0xfd04 #define XKB_KEY_3270_BackTab 0xfd05 #define XKB_KEY_3270_EraseEOF 0xfd06 #define XKB_KEY_3270_EraseInput 0xfd07 #define XKB_KEY_3270_Reset 0xfd08 #define XKB_KEY_3270_Quit 0xfd09 #define XKB_KEY_3270_PA1 0xfd0a #define XKB_KEY_3270_PA2 0xfd0b #define XKB_KEY_3270_PA3 0xfd0c #define XKB_KEY_3270_Test 0xfd0d #define XKB_KEY_3270_Attn 0xfd0e #define XKB_KEY_3270_CursorBlink 0xfd0f #define XKB_KEY_3270_AltCursor 0xfd10 #define XKB_KEY_3270_KeyClick 0xfd11 #define XKB_KEY_3270_Jump 0xfd12 #define XKB_KEY_3270_Ident 0xfd13 #define XKB_KEY_3270_Rule 0xfd14 #define XKB_KEY_3270_Copy 0xfd15 #define XKB_KEY_3270_Play 0xfd16 #define XKB_KEY_3270_Setup 0xfd17 #define XKB_KEY_3270_Record 0xfd18 #define XKB_KEY_3270_ChangeScreen 0xfd19 #define XKB_KEY_3270_DeleteWord 0xfd1a #define XKB_KEY_3270_ExSelect 0xfd1b #define XKB_KEY_3270_CursorSelect 0xfd1c #define XKB_KEY_3270_PrintScreen 0xfd1d #define XKB_KEY_3270_Enter 0xfd1e /* * Latin 1 * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF) * Byte 3 = 0 */ #define XKB_KEY_space 0x0020 /* U+0020 SPACE */ #define XKB_KEY_exclam 0x0021 /* U+0021 EXCLAMATION MARK */ #define XKB_KEY_quotedbl 0x0022 /* U+0022 QUOTATION MARK */ #define XKB_KEY_numbersign 0x0023 /* U+0023 NUMBER SIGN */ #define XKB_KEY_dollar 0x0024 /* U+0024 DOLLAR SIGN */ #define XKB_KEY_percent 0x0025 /* U+0025 PERCENT SIGN */ #define XKB_KEY_ampersand 0x0026 /* U+0026 AMPERSAND */ #define XKB_KEY_apostrophe 0x0027 /* U+0027 APOSTROPHE */ #define XKB_KEY_quoteright 0x0027 /* deprecated */ #define XKB_KEY_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */ #define XKB_KEY_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */ #define XKB_KEY_asterisk 0x002a /* U+002A ASTERISK */ #define XKB_KEY_plus 0x002b /* U+002B PLUS SIGN */ #define XKB_KEY_comma 0x002c /* U+002C COMMA */ #define XKB_KEY_minus 0x002d /* U+002D HYPHEN-MINUS */ #define XKB_KEY_period 0x002e /* U+002E FULL STOP */ #define XKB_KEY_slash 0x002f /* U+002F SOLIDUS */ #define XKB_KEY_0 0x0030 /* U+0030 DIGIT ZERO */ #define XKB_KEY_1 0x0031 /* U+0031 DIGIT ONE */ #define XKB_KEY_2 0x0032 /* U+0032 DIGIT TWO */ #define XKB_KEY_3 0x0033 /* U+0033 DIGIT THREE */ #define XKB_KEY_4 0x0034 /* U+0034 DIGIT FOUR */ #define XKB_KEY_5 0x0035 /* U+0035 DIGIT FIVE */ #define XKB_KEY_6 0x0036 /* U+0036 DIGIT SIX */ #define XKB_KEY_7 0x0037 /* U+0037 DIGIT SEVEN */ #define XKB_KEY_8 0x0038 /* U+0038 DIGIT EIGHT */ #define XKB_KEY_9 0x0039 /* U+0039 DIGIT NINE */ #define XKB_KEY_colon 0x003a /* U+003A COLON */ #define XKB_KEY_semicolon 0x003b /* U+003B SEMICOLON */ #define XKB_KEY_less 0x003c /* U+003C LESS-THAN SIGN */ #define XKB_KEY_equal 0x003d /* U+003D EQUALS SIGN */ #define XKB_KEY_greater 0x003e /* U+003E GREATER-THAN SIGN */ #define XKB_KEY_question 0x003f /* U+003F QUESTION MARK */ #define XKB_KEY_at 0x0040 /* U+0040 COMMERCIAL AT */ #define XKB_KEY_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */ #define XKB_KEY_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */ #define XKB_KEY_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */ #define XKB_KEY_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */ #define XKB_KEY_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */ #define XKB_KEY_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */ #define XKB_KEY_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */ #define XKB_KEY_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */ #define XKB_KEY_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */ #define XKB_KEY_J 0x004a /* U+004A LATIN CAPITAL LETTER J */ #define XKB_KEY_K 0x004b /* U+004B LATIN CAPITAL LETTER K */ #define XKB_KEY_L 0x004c /* U+004C LATIN CAPITAL LETTER L */ #define XKB_KEY_M 0x004d /* U+004D LATIN CAPITAL LETTER M */ #define XKB_KEY_N 0x004e /* U+004E LATIN CAPITAL LETTER N */ #define XKB_KEY_O 0x004f /* U+004F LATIN CAPITAL LETTER O */ #define XKB_KEY_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */ #define XKB_KEY_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */ #define XKB_KEY_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */ #define XKB_KEY_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */ #define XKB_KEY_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */ #define XKB_KEY_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */ #define XKB_KEY_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */ #define XKB_KEY_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */ #define XKB_KEY_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */ #define XKB_KEY_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */ #define XKB_KEY_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */ #define XKB_KEY_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */ #define XKB_KEY_backslash 0x005c /* U+005C REVERSE SOLIDUS */ #define XKB_KEY_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */ #define XKB_KEY_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */ #define XKB_KEY_underscore 0x005f /* U+005F LOW LINE */ #define XKB_KEY_grave 0x0060 /* U+0060 GRAVE ACCENT */ #define XKB_KEY_quoteleft 0x0060 /* deprecated */ #define XKB_KEY_a 0x0061 /* U+0061 LATIN SMALL LETTER A */ #define XKB_KEY_b 0x0062 /* U+0062 LATIN SMALL LETTER B */ #define XKB_KEY_c 0x0063 /* U+0063 LATIN SMALL LETTER C */ #define XKB_KEY_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ #define XKB_KEY_e 0x0065 /* U+0065 LATIN SMALL LETTER E */ #define XKB_KEY_f 0x0066 /* U+0066 LATIN SMALL LETTER F */ #define XKB_KEY_g 0x0067 /* U+0067 LATIN SMALL LETTER G */ #define XKB_KEY_h 0x0068 /* U+0068 LATIN SMALL LETTER H */ #define XKB_KEY_i 0x0069 /* U+0069 LATIN SMALL LETTER I */ #define XKB_KEY_j 0x006a /* U+006A LATIN SMALL LETTER J */ #define XKB_KEY_k 0x006b /* U+006B LATIN SMALL LETTER K */ #define XKB_KEY_l 0x006c /* U+006C LATIN SMALL LETTER L */ #define XKB_KEY_m 0x006d /* U+006D LATIN SMALL LETTER M */ #define XKB_KEY_n 0x006e /* U+006E LATIN SMALL LETTER N */ #define XKB_KEY_o 0x006f /* U+006F LATIN SMALL LETTER O */ #define XKB_KEY_p 0x0070 /* U+0070 LATIN SMALL LETTER P */ #define XKB_KEY_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */ #define XKB_KEY_r 0x0072 /* U+0072 LATIN SMALL LETTER R */ #define XKB_KEY_s 0x0073 /* U+0073 LATIN SMALL LETTER S */ #define XKB_KEY_t 0x0074 /* U+0074 LATIN SMALL LETTER T */ #define XKB_KEY_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ #define XKB_KEY_v 0x0076 /* U+0076 LATIN SMALL LETTER V */ #define XKB_KEY_w 0x0077 /* U+0077 LATIN SMALL LETTER W */ #define XKB_KEY_x 0x0078 /* U+0078 LATIN SMALL LETTER X */ #define XKB_KEY_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */ #define XKB_KEY_z 0x007a /* U+007A LATIN SMALL LETTER Z */ #define XKB_KEY_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */ #define XKB_KEY_bar 0x007c /* U+007C VERTICAL LINE */ #define XKB_KEY_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */ #define XKB_KEY_asciitilde 0x007e /* U+007E TILDE */ #define XKB_KEY_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */ #define XKB_KEY_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */ #define XKB_KEY_cent 0x00a2 /* U+00A2 CENT SIGN */ #define XKB_KEY_sterling 0x00a3 /* U+00A3 POUND SIGN */ #define XKB_KEY_currency 0x00a4 /* U+00A4 CURRENCY SIGN */ #define XKB_KEY_yen 0x00a5 /* U+00A5 YEN SIGN */ #define XKB_KEY_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */ #define XKB_KEY_section 0x00a7 /* U+00A7 SECTION SIGN */ #define XKB_KEY_diaeresis 0x00a8 /* U+00A8 DIAERESIS */ #define XKB_KEY_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */ #define XKB_KEY_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ #define XKB_KEY_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XKB_KEY_notsign 0x00ac /* U+00AC NOT SIGN */ #define XKB_KEY_hyphen 0x00ad /* U+00AD SOFT HYPHEN */ #define XKB_KEY_registered 0x00ae /* U+00AE REGISTERED SIGN */ #define XKB_KEY_macron 0x00af /* U+00AF MACRON */ #define XKB_KEY_degree 0x00b0 /* U+00B0 DEGREE SIGN */ #define XKB_KEY_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */ #define XKB_KEY_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */ #define XKB_KEY_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */ #define XKB_KEY_acute 0x00b4 /* U+00B4 ACUTE ACCENT */ #define XKB_KEY_mu 0x00b5 /* U+00B5 MICRO SIGN */ #define XKB_KEY_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */ #define XKB_KEY_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */ #define XKB_KEY_cedilla 0x00b8 /* U+00B8 CEDILLA */ #define XKB_KEY_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */ #define XKB_KEY_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */ #define XKB_KEY_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XKB_KEY_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */ #define XKB_KEY_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */ #define XKB_KEY_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */ #define XKB_KEY_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */ #define XKB_KEY_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ #define XKB_KEY_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ #define XKB_KEY_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ #define XKB_KEY_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */ #define XKB_KEY_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */ #define XKB_KEY_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */ #define XKB_KEY_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */ #define XKB_KEY_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */ #define XKB_KEY_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */ #define XKB_KEY_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ #define XKB_KEY_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ #define XKB_KEY_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */ #define XKB_KEY_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */ #define XKB_KEY_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */ #define XKB_KEY_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ #define XKB_KEY_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */ #define XKB_KEY_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */ #define XKB_KEY_Eth 0x00d0 /* deprecated */ #define XKB_KEY_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */ #define XKB_KEY_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ #define XKB_KEY_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ #define XKB_KEY_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ #define XKB_KEY_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ #define XKB_KEY_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ #define XKB_KEY_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ #define XKB_KEY_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XKB_KEY_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XKB_KEY_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ #define XKB_KEY_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ #define XKB_KEY_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ #define XKB_KEY_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ #define XKB_KEY_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ #define XKB_KEY_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */ #define XKB_KEY_Thorn 0x00de /* deprecated */ #define XKB_KEY_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */ #define XKB_KEY_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */ #define XKB_KEY_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */ #define XKB_KEY_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */ #define XKB_KEY_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */ #define XKB_KEY_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */ #define XKB_KEY_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */ #define XKB_KEY_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */ #define XKB_KEY_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */ #define XKB_KEY_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */ #define XKB_KEY_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ #define XKB_KEY_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */ #define XKB_KEY_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */ #define XKB_KEY_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */ #define XKB_KEY_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */ #define XKB_KEY_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */ #define XKB_KEY_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */ #define XKB_KEY_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */ #define XKB_KEY_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */ #define XKB_KEY_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ #define XKB_KEY_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ #define XKB_KEY_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ #define XKB_KEY_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ #define XKB_KEY_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ #define XKB_KEY_division 0x00f7 /* U+00F7 DIVISION SIGN */ #define XKB_KEY_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XKB_KEY_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XKB_KEY_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ #define XKB_KEY_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ #define XKB_KEY_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ #define XKB_KEY_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ #define XKB_KEY_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ #define XKB_KEY_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */ #define XKB_KEY_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ /* * Latin 2 * Byte 3 = 1 */ #define XKB_KEY_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */ #define XKB_KEY_breve 0x01a2 /* U+02D8 BREVE */ #define XKB_KEY_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ #define XKB_KEY_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */ #define XKB_KEY_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */ #define XKB_KEY_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */ #define XKB_KEY_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */ #define XKB_KEY_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */ #define XKB_KEY_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */ #define XKB_KEY_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */ #define XKB_KEY_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */ #define XKB_KEY_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */ #define XKB_KEY_ogonek 0x01b2 /* U+02DB OGONEK */ #define XKB_KEY_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */ #define XKB_KEY_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */ #define XKB_KEY_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */ #define XKB_KEY_caron 0x01b7 /* U+02C7 CARON */ #define XKB_KEY_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */ #define XKB_KEY_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */ #define XKB_KEY_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */ #define XKB_KEY_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */ #define XKB_KEY_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */ #define XKB_KEY_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */ #define XKB_KEY_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */ #define XKB_KEY_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */ #define XKB_KEY_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */ #define XKB_KEY_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */ #define XKB_KEY_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */ #define XKB_KEY_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */ #define XKB_KEY_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */ #define XKB_KEY_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */ #define XKB_KEY_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */ #define XKB_KEY_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */ #define XKB_KEY_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */ #define XKB_KEY_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */ #define XKB_KEY_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ #define XKB_KEY_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */ #define XKB_KEY_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */ #define XKB_KEY_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ #define XKB_KEY_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */ #define XKB_KEY_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */ #define XKB_KEY_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */ #define XKB_KEY_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */ #define XKB_KEY_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */ #define XKB_KEY_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */ #define XKB_KEY_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */ #define XKB_KEY_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */ #define XKB_KEY_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */ #define XKB_KEY_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */ #define XKB_KEY_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */ #define XKB_KEY_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */ #define XKB_KEY_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */ #define XKB_KEY_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */ #define XKB_KEY_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */ #define XKB_KEY_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */ #define XKB_KEY_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */ #define XKB_KEY_abovedot 0x01ff /* U+02D9 DOT ABOVE */ /* * Latin 3 * Byte 3 = 2 */ #define XKB_KEY_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */ #define XKB_KEY_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ #define XKB_KEY_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */ #define XKB_KEY_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */ #define XKB_KEY_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ #define XKB_KEY_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */ #define XKB_KEY_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */ #define XKB_KEY_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */ #define XKB_KEY_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */ #define XKB_KEY_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */ #define XKB_KEY_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */ #define XKB_KEY_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ #define XKB_KEY_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */ #define XKB_KEY_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ #define XKB_KEY_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */ #define XKB_KEY_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ #define XKB_KEY_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */ #define XKB_KEY_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */ #define XKB_KEY_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */ #define XKB_KEY_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */ #define XKB_KEY_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */ #define XKB_KEY_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */ /* * Latin 4 * Byte 3 = 3 */ #define XKB_KEY_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */ #define XKB_KEY_kappa 0x03a2 /* deprecated */ #define XKB_KEY_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */ #define XKB_KEY_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */ #define XKB_KEY_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */ #define XKB_KEY_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */ #define XKB_KEY_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */ #define XKB_KEY_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */ #define XKB_KEY_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */ #define XKB_KEY_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */ #define XKB_KEY_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */ #define XKB_KEY_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */ #define XKB_KEY_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */ #define XKB_KEY_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */ #define XKB_KEY_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */ #define XKB_KEY_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */ #define XKB_KEY_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */ #define XKB_KEY_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */ #define XKB_KEY_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */ #define XKB_KEY_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */ #define XKB_KEY_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */ #define XKB_KEY_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */ #define XKB_KEY_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */ #define XKB_KEY_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */ #define XKB_KEY_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */ #define XKB_KEY_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */ #define XKB_KEY_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */ #define XKB_KEY_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */ #define XKB_KEY_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */ #define XKB_KEY_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */ #define XKB_KEY_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */ #define XKB_KEY_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XKB_KEY_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XKB_KEY_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XKB_KEY_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XKB_KEY_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ /* * Latin 8 */ #define XKB_KEY_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ #define XKB_KEY_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */ #define XKB_KEY_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ #define XKB_KEY_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */ #define XKB_KEY_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */ #define XKB_KEY_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */ #define XKB_KEY_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */ #define XKB_KEY_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */ #define XKB_KEY_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */ #define XKB_KEY_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */ #define XKB_KEY_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */ #define XKB_KEY_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */ #define XKB_KEY_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */ #define XKB_KEY_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */ #define XKB_KEY_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */ #define XKB_KEY_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */ #define XKB_KEY_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */ #define XKB_KEY_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */ #define XKB_KEY_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */ #define XKB_KEY_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */ #define XKB_KEY_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */ #define XKB_KEY_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */ #define XKB_KEY_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */ #define XKB_KEY_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */ #define XKB_KEY_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */ #define XKB_KEY_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */ /* * Latin 9 * Byte 3 = 0x13 */ #define XKB_KEY_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ #define XKB_KEY_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */ #define XKB_KEY_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */ /* * Katakana * Byte 3 = 4 */ #define XKB_KEY_overline 0x047e /* U+203E OVERLINE */ #define XKB_KEY_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */ #define XKB_KEY_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */ #define XKB_KEY_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */ #define XKB_KEY_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */ #define XKB_KEY_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */ #define XKB_KEY_kana_middledot 0x04a5 /* deprecated */ #define XKB_KEY_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */ #define XKB_KEY_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */ #define XKB_KEY_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */ #define XKB_KEY_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */ #define XKB_KEY_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */ #define XKB_KEY_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */ #define XKB_KEY_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */ #define XKB_KEY_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */ #define XKB_KEY_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */ #define XKB_KEY_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */ #define XKB_KEY_kana_tu 0x04af /* deprecated */ #define XKB_KEY_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */ #define XKB_KEY_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */ #define XKB_KEY_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */ #define XKB_KEY_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */ #define XKB_KEY_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */ #define XKB_KEY_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */ #define XKB_KEY_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */ #define XKB_KEY_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */ #define XKB_KEY_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */ #define XKB_KEY_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */ #define XKB_KEY_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */ #define XKB_KEY_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */ #define XKB_KEY_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */ #define XKB_KEY_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */ #define XKB_KEY_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */ #define XKB_KEY_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */ #define XKB_KEY_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */ #define XKB_KEY_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */ #define XKB_KEY_kana_TI 0x04c1 /* deprecated */ #define XKB_KEY_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */ #define XKB_KEY_kana_TU 0x04c2 /* deprecated */ #define XKB_KEY_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */ #define XKB_KEY_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */ #define XKB_KEY_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */ #define XKB_KEY_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */ #define XKB_KEY_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */ #define XKB_KEY_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */ #define XKB_KEY_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */ #define XKB_KEY_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */ #define XKB_KEY_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */ #define XKB_KEY_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */ #define XKB_KEY_kana_HU 0x04cc /* deprecated */ #define XKB_KEY_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */ #define XKB_KEY_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */ #define XKB_KEY_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */ #define XKB_KEY_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */ #define XKB_KEY_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */ #define XKB_KEY_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */ #define XKB_KEY_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */ #define XKB_KEY_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */ #define XKB_KEY_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */ #define XKB_KEY_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */ #define XKB_KEY_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */ #define XKB_KEY_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */ #define XKB_KEY_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */ #define XKB_KEY_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */ #define XKB_KEY_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */ #define XKB_KEY_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */ #define XKB_KEY_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */ #define XKB_KEY_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ #define XKB_KEY_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ #define XKB_KEY_kana_switch 0xff7e /* Alias for mode_switch */ /* * Arabic * Byte 3 = 5 */ #define XKB_KEY_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */ #define XKB_KEY_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */ #define XKB_KEY_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */ #define XKB_KEY_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */ #define XKB_KEY_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */ #define XKB_KEY_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */ #define XKB_KEY_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */ #define XKB_KEY_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */ #define XKB_KEY_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */ #define XKB_KEY_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */ #define XKB_KEY_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */ #define XKB_KEY_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */ #define XKB_KEY_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */ #define XKB_KEY_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */ #define XKB_KEY_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */ #define XKB_KEY_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */ #define XKB_KEY_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */ #define XKB_KEY_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */ #define XKB_KEY_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */ #define XKB_KEY_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */ #define XKB_KEY_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */ #define XKB_KEY_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */ #define XKB_KEY_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */ #define XKB_KEY_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */ #define XKB_KEY_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */ #define XKB_KEY_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */ #define XKB_KEY_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */ #define XKB_KEY_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */ #define XKB_KEY_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */ #define XKB_KEY_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */ #define XKB_KEY_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */ #define XKB_KEY_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ #define XKB_KEY_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ #define XKB_KEY_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ #define XKB_KEY_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ #define XKB_KEY_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ #define XKB_KEY_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */ #define XKB_KEY_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */ #define XKB_KEY_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */ #define XKB_KEY_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */ #define XKB_KEY_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */ #define XKB_KEY_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */ #define XKB_KEY_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */ #define XKB_KEY_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */ #define XKB_KEY_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */ #define XKB_KEY_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */ #define XKB_KEY_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */ #define XKB_KEY_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */ #define XKB_KEY_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */ #define XKB_KEY_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */ #define XKB_KEY_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */ #define XKB_KEY_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */ #define XKB_KEY_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */ #define XKB_KEY_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */ #define XKB_KEY_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */ #define XKB_KEY_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */ #define XKB_KEY_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */ #define XKB_KEY_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */ #define XKB_KEY_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */ #define XKB_KEY_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */ #define XKB_KEY_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */ #define XKB_KEY_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */ #define XKB_KEY_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */ #define XKB_KEY_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */ #define XKB_KEY_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */ #define XKB_KEY_Arabic_heh 0x05e7 /* deprecated */ #define XKB_KEY_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */ #define XKB_KEY_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */ #define XKB_KEY_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */ #define XKB_KEY_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */ #define XKB_KEY_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XKB_KEY_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XKB_KEY_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XKB_KEY_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XKB_KEY_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XKB_KEY_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XKB_KEY_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ #define XKB_KEY_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */ #define XKB_KEY_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */ #define XKB_KEY_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */ #define XKB_KEY_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */ #define XKB_KEY_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ #define XKB_KEY_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ #define XKB_KEY_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */ #define XKB_KEY_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ #define XKB_KEY_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ #define XKB_KEY_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XKB_KEY_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XKB_KEY_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */ #define XKB_KEY_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */ #define XKB_KEY_Arabic_switch 0xff7e /* Alias for mode_switch */ /* * Cyrillic * Byte 3 = 6 */ #define XKB_KEY_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */ #define XKB_KEY_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */ #define XKB_KEY_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */ #define XKB_KEY_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */ #define XKB_KEY_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */ #define XKB_KEY_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */ #define XKB_KEY_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */ #define XKB_KEY_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */ #define XKB_KEY_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */ #define XKB_KEY_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */ #define XKB_KEY_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */ #define XKB_KEY_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */ #define XKB_KEY_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */ #define XKB_KEY_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */ #define XKB_KEY_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */ #define XKB_KEY_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */ #define XKB_KEY_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */ #define XKB_KEY_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */ #define XKB_KEY_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */ #define XKB_KEY_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */ #define XKB_KEY_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */ #define XKB_KEY_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */ #define XKB_KEY_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */ #define XKB_KEY_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */ #define XKB_KEY_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */ #define XKB_KEY_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */ #define XKB_KEY_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */ #define XKB_KEY_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */ #define XKB_KEY_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */ #define XKB_KEY_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */ #define XKB_KEY_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ #define XKB_KEY_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ #define XKB_KEY_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ #define XKB_KEY_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ #define XKB_KEY_Ukranian_je 0x06a4 /* deprecated */ #define XKB_KEY_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ #define XKB_KEY_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ #define XKB_KEY_Ukranian_i 0x06a6 /* deprecated */ #define XKB_KEY_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */ #define XKB_KEY_Ukranian_yi 0x06a7 /* deprecated */ #define XKB_KEY_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */ #define XKB_KEY_Serbian_je 0x06a8 /* deprecated */ #define XKB_KEY_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */ #define XKB_KEY_Serbian_lje 0x06a9 /* deprecated */ #define XKB_KEY_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */ #define XKB_KEY_Serbian_nje 0x06aa /* deprecated */ #define XKB_KEY_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */ #define XKB_KEY_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */ #define XKB_KEY_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */ #define XKB_KEY_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */ #define XKB_KEY_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */ #define XKB_KEY_Serbian_dze 0x06af /* deprecated */ #define XKB_KEY_numerosign 0x06b0 /* U+2116 NUMERO SIGN */ #define XKB_KEY_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */ #define XKB_KEY_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */ #define XKB_KEY_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */ #define XKB_KEY_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ #define XKB_KEY_Ukranian_JE 0x06b4 /* deprecated */ #define XKB_KEY_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */ #define XKB_KEY_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ #define XKB_KEY_Ukranian_I 0x06b6 /* deprecated */ #define XKB_KEY_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */ #define XKB_KEY_Ukranian_YI 0x06b7 /* deprecated */ #define XKB_KEY_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */ #define XKB_KEY_Serbian_JE 0x06b8 /* deprecated */ #define XKB_KEY_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */ #define XKB_KEY_Serbian_LJE 0x06b9 /* deprecated */ #define XKB_KEY_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */ #define XKB_KEY_Serbian_NJE 0x06ba /* deprecated */ #define XKB_KEY_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */ #define XKB_KEY_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */ #define XKB_KEY_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ #define XKB_KEY_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */ #define XKB_KEY_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */ #define XKB_KEY_Serbian_DZE 0x06bf /* deprecated */ #define XKB_KEY_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */ #define XKB_KEY_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */ #define XKB_KEY_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */ #define XKB_KEY_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */ #define XKB_KEY_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */ #define XKB_KEY_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */ #define XKB_KEY_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */ #define XKB_KEY_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */ #define XKB_KEY_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */ #define XKB_KEY_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */ #define XKB_KEY_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */ #define XKB_KEY_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */ #define XKB_KEY_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */ #define XKB_KEY_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */ #define XKB_KEY_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */ #define XKB_KEY_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */ #define XKB_KEY_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */ #define XKB_KEY_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */ #define XKB_KEY_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */ #define XKB_KEY_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */ #define XKB_KEY_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */ #define XKB_KEY_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */ #define XKB_KEY_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */ #define XKB_KEY_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */ #define XKB_KEY_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */ #define XKB_KEY_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */ #define XKB_KEY_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */ #define XKB_KEY_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */ #define XKB_KEY_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */ #define XKB_KEY_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */ #define XKB_KEY_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */ #define XKB_KEY_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */ #define XKB_KEY_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */ #define XKB_KEY_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */ #define XKB_KEY_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */ #define XKB_KEY_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */ #define XKB_KEY_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */ #define XKB_KEY_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */ #define XKB_KEY_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */ #define XKB_KEY_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */ #define XKB_KEY_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */ #define XKB_KEY_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */ #define XKB_KEY_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */ #define XKB_KEY_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */ #define XKB_KEY_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */ #define XKB_KEY_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */ #define XKB_KEY_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */ #define XKB_KEY_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */ #define XKB_KEY_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */ #define XKB_KEY_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */ #define XKB_KEY_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */ #define XKB_KEY_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */ #define XKB_KEY_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */ #define XKB_KEY_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */ #define XKB_KEY_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */ #define XKB_KEY_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */ #define XKB_KEY_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */ #define XKB_KEY_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */ #define XKB_KEY_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */ #define XKB_KEY_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */ #define XKB_KEY_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */ #define XKB_KEY_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ #define XKB_KEY_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */ #define XKB_KEY_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */ /* * Greek * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7) * Byte 3 = 7 */ #define XKB_KEY_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ #define XKB_KEY_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ #define XKB_KEY_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ #define XKB_KEY_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ #define XKB_KEY_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ #define XKB_KEY_Greek_IOTAdiaeresis 0x07a5 /* old typo */ #define XKB_KEY_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ #define XKB_KEY_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ #define XKB_KEY_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ #define XKB_KEY_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ #define XKB_KEY_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */ #define XKB_KEY_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */ #define XKB_KEY_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ #define XKB_KEY_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */ #define XKB_KEY_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */ #define XKB_KEY_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */ #define XKB_KEY_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */ #define XKB_KEY_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ #define XKB_KEY_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */ #define XKB_KEY_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */ #define XKB_KEY_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ #define XKB_KEY_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ #define XKB_KEY_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */ #define XKB_KEY_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */ #define XKB_KEY_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */ #define XKB_KEY_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */ #define XKB_KEY_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */ #define XKB_KEY_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ #define XKB_KEY_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ #define XKB_KEY_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ #define XKB_KEY_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ #define XKB_KEY_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ #define XKB_KEY_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ #define XKB_KEY_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XKB_KEY_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XKB_KEY_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */ #define XKB_KEY_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */ #define XKB_KEY_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */ #define XKB_KEY_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */ #define XKB_KEY_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */ #define XKB_KEY_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */ #define XKB_KEY_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */ #define XKB_KEY_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */ #define XKB_KEY_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */ #define XKB_KEY_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */ #define XKB_KEY_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */ #define XKB_KEY_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */ #define XKB_KEY_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */ #define XKB_KEY_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */ #define XKB_KEY_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */ #define XKB_KEY_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */ #define XKB_KEY_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */ #define XKB_KEY_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ #define XKB_KEY_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ #define XKB_KEY_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ #define XKB_KEY_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ #define XKB_KEY_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ #define XKB_KEY_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ #define XKB_KEY_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XKB_KEY_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XKB_KEY_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */ #define XKB_KEY_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */ #define XKB_KEY_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */ #define XKB_KEY_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */ #define XKB_KEY_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */ #define XKB_KEY_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */ #define XKB_KEY_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */ #define XKB_KEY_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ #define XKB_KEY_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */ #define XKB_KEY_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */ #define XKB_KEY_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */ #define XKB_KEY_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */ #define XKB_KEY_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */ #define XKB_KEY_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */ #define XKB_KEY_Greek_switch 0xff7e /* Alias for mode_switch */ /* * Technical * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) * Byte 3 = 8 */ #define XKB_KEY_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */ #define XKB_KEY_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/ #define XKB_KEY_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/ #define XKB_KEY_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */ #define XKB_KEY_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */ #define XKB_KEY_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/ #define XKB_KEY_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */ #define XKB_KEY_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */ #define XKB_KEY_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */ #define XKB_KEY_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */ #define XKB_KEY_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */ #define XKB_KEY_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */ #define XKB_KEY_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */ #define XKB_KEY_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */ #define XKB_KEY_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */ #define XKB_KEY_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */ #define XKB_KEY_topleftsummation 0x08b1 #define XKB_KEY_botleftsummation 0x08b2 #define XKB_KEY_topvertsummationconnector 0x08b3 #define XKB_KEY_botvertsummationconnector 0x08b4 #define XKB_KEY_toprightsummation 0x08b5 #define XKB_KEY_botrightsummation 0x08b6 #define XKB_KEY_rightmiddlesummation 0x08b7 #define XKB_KEY_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */ #define XKB_KEY_notequal 0x08bd /* U+2260 NOT EQUAL TO */ #define XKB_KEY_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */ #define XKB_KEY_integral 0x08bf /* U+222B INTEGRAL */ #define XKB_KEY_therefore 0x08c0 /* U+2234 THEREFORE */ #define XKB_KEY_variation 0x08c1 /* U+221D PROPORTIONAL TO */ #define XKB_KEY_infinity 0x08c2 /* U+221E INFINITY */ #define XKB_KEY_nabla 0x08c5 /* U+2207 NABLA */ #define XKB_KEY_approximate 0x08c8 /* U+223C TILDE OPERATOR */ #define XKB_KEY_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */ #define XKB_KEY_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */ #define XKB_KEY_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */ #define XKB_KEY_identical 0x08cf /* U+2261 IDENTICAL TO */ #define XKB_KEY_radical 0x08d6 /* U+221A SQUARE ROOT */ #define XKB_KEY_includedin 0x08da /* U+2282 SUBSET OF */ #define XKB_KEY_includes 0x08db /* U+2283 SUPERSET OF */ #define XKB_KEY_intersection 0x08dc /* U+2229 INTERSECTION */ #define XKB_KEY_union 0x08dd /* U+222A UNION */ #define XKB_KEY_logicaland 0x08de /* U+2227 LOGICAL AND */ #define XKB_KEY_logicalor 0x08df /* U+2228 LOGICAL OR */ #define XKB_KEY_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */ #define XKB_KEY_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */ #define XKB_KEY_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */ #define XKB_KEY_uparrow 0x08fc /* U+2191 UPWARDS ARROW */ #define XKB_KEY_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */ #define XKB_KEY_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */ /* * Special * (from the DEC VT100 Special Graphics Character Set) * Byte 3 = 9 */ #define XKB_KEY_blank 0x09df #define XKB_KEY_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */ #define XKB_KEY_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */ #define XKB_KEY_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */ #define XKB_KEY_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */ #define XKB_KEY_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */ #define XKB_KEY_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */ #define XKB_KEY_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */ #define XKB_KEY_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */ #define XKB_KEY_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */ #define XKB_KEY_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */ #define XKB_KEY_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */ #define XKB_KEY_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */ #define XKB_KEY_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ #define XKB_KEY_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */ #define XKB_KEY_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */ #define XKB_KEY_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */ #define XKB_KEY_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */ #define XKB_KEY_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */ #define XKB_KEY_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ #define XKB_KEY_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */ #define XKB_KEY_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */ #define XKB_KEY_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ #define XKB_KEY_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ /* * Publishing * (these are probably from a long forgotten DEC Publishing * font that once shipped with DECwrite) * Byte 3 = 0x0a */ #define XKB_KEY_emspace 0x0aa1 /* U+2003 EM SPACE */ #define XKB_KEY_enspace 0x0aa2 /* U+2002 EN SPACE */ #define XKB_KEY_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */ #define XKB_KEY_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */ #define XKB_KEY_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */ #define XKB_KEY_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */ #define XKB_KEY_thinspace 0x0aa7 /* U+2009 THIN SPACE */ #define XKB_KEY_hairspace 0x0aa8 /* U+200A HAIR SPACE */ #define XKB_KEY_emdash 0x0aa9 /* U+2014 EM DASH */ #define XKB_KEY_endash 0x0aaa /* U+2013 EN DASH */ #define XKB_KEY_signifblank 0x0aac /*(U+2423 OPEN BOX)*/ #define XKB_KEY_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */ #define XKB_KEY_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */ #define XKB_KEY_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */ #define XKB_KEY_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */ #define XKB_KEY_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */ #define XKB_KEY_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ #define XKB_KEY_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ #define XKB_KEY_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ #define XKB_KEY_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ #define XKB_KEY_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ #define XKB_KEY_careof 0x0ab8 /* U+2105 CARE OF */ #define XKB_KEY_figdash 0x0abb /* U+2012 FIGURE DASH */ #define XKB_KEY_leftanglebracket 0x0abc /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/ #define XKB_KEY_decimalpoint 0x0abd /*(U+002E FULL STOP)*/ #define XKB_KEY_rightanglebracket 0x0abe /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/ #define XKB_KEY_marker 0x0abf #define XKB_KEY_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */ #define XKB_KEY_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */ #define XKB_KEY_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */ #define XKB_KEY_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ #define XKB_KEY_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */ #define XKB_KEY_signaturemark 0x0aca /*(U+2613 SALTIRE)*/ #define XKB_KEY_trademarkincircle 0x0acb #define XKB_KEY_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/ #define XKB_KEY_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/ #define XKB_KEY_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/ #define XKB_KEY_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/ #define XKB_KEY_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */ #define XKB_KEY_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */ #define XKB_KEY_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */ #define XKB_KEY_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */ #define XKB_KEY_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */ #define XKB_KEY_permille 0x0ad5 /* U+2030 PER MILLE SIGN */ #define XKB_KEY_minutes 0x0ad6 /* U+2032 PRIME */ #define XKB_KEY_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */ #define XKB_KEY_latincross 0x0ad9 /* U+271D LATIN CROSS */ #define XKB_KEY_hexagram 0x0ada #define XKB_KEY_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/ #define XKB_KEY_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/ #define XKB_KEY_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/ #define XKB_KEY_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/ #define XKB_KEY_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/ #define XKB_KEY_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/ #define XKB_KEY_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/ #define XKB_KEY_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/ #define XKB_KEY_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/ #define XKB_KEY_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/ #define XKB_KEY_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/ #define XKB_KEY_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/ #define XKB_KEY_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/ #define XKB_KEY_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/ #define XKB_KEY_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/ #define XKB_KEY_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/ #define XKB_KEY_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/ #define XKB_KEY_club 0x0aec /* U+2663 BLACK CLUB SUIT */ #define XKB_KEY_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */ #define XKB_KEY_heart 0x0aee /* U+2665 BLACK HEART SUIT */ #define XKB_KEY_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */ #define XKB_KEY_dagger 0x0af1 /* U+2020 DAGGER */ #define XKB_KEY_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */ #define XKB_KEY_checkmark 0x0af3 /* U+2713 CHECK MARK */ #define XKB_KEY_ballotcross 0x0af4 /* U+2717 BALLOT X */ #define XKB_KEY_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */ #define XKB_KEY_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */ #define XKB_KEY_malesymbol 0x0af7 /* U+2642 MALE SIGN */ #define XKB_KEY_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */ #define XKB_KEY_telephone 0x0af9 /* U+260E BLACK TELEPHONE */ #define XKB_KEY_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */ #define XKB_KEY_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */ #define XKB_KEY_caret 0x0afc /* U+2038 CARET */ #define XKB_KEY_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */ #define XKB_KEY_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */ #define XKB_KEY_cursor 0x0aff /* * APL * Byte 3 = 0x0b */ #define XKB_KEY_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/ #define XKB_KEY_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/ #define XKB_KEY_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/ #define XKB_KEY_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/ #define XKB_KEY_overbar 0x0bc0 /*(U+00AF MACRON)*/ #define XKB_KEY_downtack 0x0bc2 /* U+22A4 DOWN TACK */ #define XKB_KEY_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/ #define XKB_KEY_downstile 0x0bc4 /* U+230A LEFT FLOOR */ #define XKB_KEY_underbar 0x0bc6 /*(U+005F LOW LINE)*/ #define XKB_KEY_jot 0x0bca /* U+2218 RING OPERATOR */ #define XKB_KEY_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */ #define XKB_KEY_uptack 0x0bce /* U+22A5 UP TACK */ #define XKB_KEY_circle 0x0bcf /* U+25CB WHITE CIRCLE */ #define XKB_KEY_upstile 0x0bd3 /* U+2308 LEFT CEILING */ #define XKB_KEY_downshoe 0x0bd6 /*(U+222A UNION)*/ #define XKB_KEY_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/ #define XKB_KEY_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/ #define XKB_KEY_lefttack 0x0bdc /* U+22A3 LEFT TACK */ #define XKB_KEY_righttack 0x0bfc /* U+22A2 RIGHT TACK */ /* * Hebrew * Byte 3 = 0x0c */ #define XKB_KEY_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */ #define XKB_KEY_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */ #define XKB_KEY_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */ #define XKB_KEY_hebrew_beth 0x0ce1 /* deprecated */ #define XKB_KEY_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */ #define XKB_KEY_hebrew_gimmel 0x0ce2 /* deprecated */ #define XKB_KEY_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */ #define XKB_KEY_hebrew_daleth 0x0ce3 /* deprecated */ #define XKB_KEY_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */ #define XKB_KEY_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */ #define XKB_KEY_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */ #define XKB_KEY_hebrew_zayin 0x0ce6 /* deprecated */ #define XKB_KEY_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */ #define XKB_KEY_hebrew_het 0x0ce7 /* deprecated */ #define XKB_KEY_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */ #define XKB_KEY_hebrew_teth 0x0ce8 /* deprecated */ #define XKB_KEY_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */ #define XKB_KEY_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */ #define XKB_KEY_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */ #define XKB_KEY_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */ #define XKB_KEY_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */ #define XKB_KEY_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */ #define XKB_KEY_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */ #define XKB_KEY_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */ #define XKB_KEY_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */ #define XKB_KEY_hebrew_samekh 0x0cf1 /* deprecated */ #define XKB_KEY_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */ #define XKB_KEY_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */ #define XKB_KEY_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */ #define XKB_KEY_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */ #define XKB_KEY_hebrew_finalzadi 0x0cf5 /* deprecated */ #define XKB_KEY_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */ #define XKB_KEY_hebrew_zadi 0x0cf6 /* deprecated */ #define XKB_KEY_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ #define XKB_KEY_hebrew_kuf 0x0cf7 /* deprecated */ #define XKB_KEY_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ #define XKB_KEY_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ #define XKB_KEY_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */ #define XKB_KEY_hebrew_taf 0x0cfa /* deprecated */ #define XKB_KEY_Hebrew_switch 0xff7e /* Alias for mode_switch */ /* * Thai * Byte 3 = 0x0d */ #define XKB_KEY_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */ #define XKB_KEY_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */ #define XKB_KEY_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */ #define XKB_KEY_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */ #define XKB_KEY_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */ #define XKB_KEY_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */ #define XKB_KEY_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */ #define XKB_KEY_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */ #define XKB_KEY_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */ #define XKB_KEY_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */ #define XKB_KEY_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */ #define XKB_KEY_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */ #define XKB_KEY_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */ #define XKB_KEY_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */ #define XKB_KEY_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */ #define XKB_KEY_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */ #define XKB_KEY_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */ #define XKB_KEY_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */ #define XKB_KEY_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */ #define XKB_KEY_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */ #define XKB_KEY_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */ #define XKB_KEY_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */ #define XKB_KEY_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */ #define XKB_KEY_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */ #define XKB_KEY_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */ #define XKB_KEY_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */ #define XKB_KEY_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */ #define XKB_KEY_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */ #define XKB_KEY_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */ #define XKB_KEY_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */ #define XKB_KEY_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */ #define XKB_KEY_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */ #define XKB_KEY_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */ #define XKB_KEY_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */ #define XKB_KEY_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */ #define XKB_KEY_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */ #define XKB_KEY_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */ #define XKB_KEY_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */ #define XKB_KEY_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */ #define XKB_KEY_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */ #define XKB_KEY_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */ #define XKB_KEY_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */ #define XKB_KEY_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */ #define XKB_KEY_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */ #define XKB_KEY_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */ #define XKB_KEY_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */ #define XKB_KEY_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */ #define XKB_KEY_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */ #define XKB_KEY_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */ #define XKB_KEY_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */ #define XKB_KEY_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */ #define XKB_KEY_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ #define XKB_KEY_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ #define XKB_KEY_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ #define XKB_KEY_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ #define XKB_KEY_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ #define XKB_KEY_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ #define XKB_KEY_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ #define XKB_KEY_Thai_maihanakat_maitho 0x0dde #define XKB_KEY_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */ #define XKB_KEY_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */ #define XKB_KEY_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */ #define XKB_KEY_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */ #define XKB_KEY_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ #define XKB_KEY_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ #define XKB_KEY_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */ #define XKB_KEY_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */ #define XKB_KEY_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */ #define XKB_KEY_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */ #define XKB_KEY_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */ #define XKB_KEY_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */ #define XKB_KEY_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */ #define XKB_KEY_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */ #define XKB_KEY_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */ #define XKB_KEY_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */ #define XKB_KEY_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */ #define XKB_KEY_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */ #define XKB_KEY_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */ #define XKB_KEY_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */ #define XKB_KEY_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */ #define XKB_KEY_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */ #define XKB_KEY_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */ #define XKB_KEY_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */ #define XKB_KEY_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */ /* * Korean * Byte 3 = 0x0e */ #define XKB_KEY_Hangul 0xff31 /* Hangul start/stop(toggle) */ #define XKB_KEY_Hangul_Start 0xff32 /* Hangul start */ #define XKB_KEY_Hangul_End 0xff33 /* Hangul end, English start */ #define XKB_KEY_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ #define XKB_KEY_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ #define XKB_KEY_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ #define XKB_KEY_Hangul_Codeinput 0xff37 /* Hangul code input mode */ #define XKB_KEY_Hangul_Jeonja 0xff38 /* Jeonja mode */ #define XKB_KEY_Hangul_Banja 0xff39 /* Banja mode */ #define XKB_KEY_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XKB_KEY_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #define XKB_KEY_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XKB_KEY_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XKB_KEY_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XKB_KEY_Hangul_Special 0xff3f /* Special symbols */ #define XKB_KEY_Hangul_switch 0xff7e /* Alias for mode_switch */ /* Hangul Consonant Characters */ #define XKB_KEY_Hangul_Kiyeog 0x0ea1 #define XKB_KEY_Hangul_SsangKiyeog 0x0ea2 #define XKB_KEY_Hangul_KiyeogSios 0x0ea3 #define XKB_KEY_Hangul_Nieun 0x0ea4 #define XKB_KEY_Hangul_NieunJieuj 0x0ea5 #define XKB_KEY_Hangul_NieunHieuh 0x0ea6 #define XKB_KEY_Hangul_Dikeud 0x0ea7 #define XKB_KEY_Hangul_SsangDikeud 0x0ea8 #define XKB_KEY_Hangul_Rieul 0x0ea9 #define XKB_KEY_Hangul_RieulKiyeog 0x0eaa #define XKB_KEY_Hangul_RieulMieum 0x0eab #define XKB_KEY_Hangul_RieulPieub 0x0eac #define XKB_KEY_Hangul_RieulSios 0x0ead #define XKB_KEY_Hangul_RieulTieut 0x0eae #define XKB_KEY_Hangul_RieulPhieuf 0x0eaf #define XKB_KEY_Hangul_RieulHieuh 0x0eb0 #define XKB_KEY_Hangul_Mieum 0x0eb1 #define XKB_KEY_Hangul_Pieub 0x0eb2 #define XKB_KEY_Hangul_SsangPieub 0x0eb3 #define XKB_KEY_Hangul_PieubSios 0x0eb4 #define XKB_KEY_Hangul_Sios 0x0eb5 #define XKB_KEY_Hangul_SsangSios 0x0eb6 #define XKB_KEY_Hangul_Ieung 0x0eb7 #define XKB_KEY_Hangul_Jieuj 0x0eb8 #define XKB_KEY_Hangul_SsangJieuj 0x0eb9 #define XKB_KEY_Hangul_Cieuc 0x0eba #define XKB_KEY_Hangul_Khieuq 0x0ebb #define XKB_KEY_Hangul_Tieut 0x0ebc #define XKB_KEY_Hangul_Phieuf 0x0ebd #define XKB_KEY_Hangul_Hieuh 0x0ebe /* Hangul Vowel Characters */ #define XKB_KEY_Hangul_A 0x0ebf #define XKB_KEY_Hangul_AE 0x0ec0 #define XKB_KEY_Hangul_YA 0x0ec1 #define XKB_KEY_Hangul_YAE 0x0ec2 #define XKB_KEY_Hangul_EO 0x0ec3 #define XKB_KEY_Hangul_E 0x0ec4 #define XKB_KEY_Hangul_YEO 0x0ec5 #define XKB_KEY_Hangul_YE 0x0ec6 #define XKB_KEY_Hangul_O 0x0ec7 #define XKB_KEY_Hangul_WA 0x0ec8 #define XKB_KEY_Hangul_WAE 0x0ec9 #define XKB_KEY_Hangul_OE 0x0eca #define XKB_KEY_Hangul_YO 0x0ecb #define XKB_KEY_Hangul_U 0x0ecc #define XKB_KEY_Hangul_WEO 0x0ecd #define XKB_KEY_Hangul_WE 0x0ece #define XKB_KEY_Hangul_WI 0x0ecf #define XKB_KEY_Hangul_YU 0x0ed0 #define XKB_KEY_Hangul_EU 0x0ed1 #define XKB_KEY_Hangul_YI 0x0ed2 #define XKB_KEY_Hangul_I 0x0ed3 /* Hangul syllable-final (JongSeong) Characters */ #define XKB_KEY_Hangul_J_Kiyeog 0x0ed4 #define XKB_KEY_Hangul_J_SsangKiyeog 0x0ed5 #define XKB_KEY_Hangul_J_KiyeogSios 0x0ed6 #define XKB_KEY_Hangul_J_Nieun 0x0ed7 #define XKB_KEY_Hangul_J_NieunJieuj 0x0ed8 #define XKB_KEY_Hangul_J_NieunHieuh 0x0ed9 #define XKB_KEY_Hangul_J_Dikeud 0x0eda #define XKB_KEY_Hangul_J_Rieul 0x0edb #define XKB_KEY_Hangul_J_RieulKiyeog 0x0edc #define XKB_KEY_Hangul_J_RieulMieum 0x0edd #define XKB_KEY_Hangul_J_RieulPieub 0x0ede #define XKB_KEY_Hangul_J_RieulSios 0x0edf #define XKB_KEY_Hangul_J_RieulTieut 0x0ee0 #define XKB_KEY_Hangul_J_RieulPhieuf 0x0ee1 #define XKB_KEY_Hangul_J_RieulHieuh 0x0ee2 #define XKB_KEY_Hangul_J_Mieum 0x0ee3 #define XKB_KEY_Hangul_J_Pieub 0x0ee4 #define XKB_KEY_Hangul_J_PieubSios 0x0ee5 #define XKB_KEY_Hangul_J_Sios 0x0ee6 #define XKB_KEY_Hangul_J_SsangSios 0x0ee7 #define XKB_KEY_Hangul_J_Ieung 0x0ee8 #define XKB_KEY_Hangul_J_Jieuj 0x0ee9 #define XKB_KEY_Hangul_J_Cieuc 0x0eea #define XKB_KEY_Hangul_J_Khieuq 0x0eeb #define XKB_KEY_Hangul_J_Tieut 0x0eec #define XKB_KEY_Hangul_J_Phieuf 0x0eed #define XKB_KEY_Hangul_J_Hieuh 0x0eee /* Ancient Hangul Consonant Characters */ #define XKB_KEY_Hangul_RieulYeorinHieuh 0x0eef #define XKB_KEY_Hangul_SunkyeongeumMieum 0x0ef0 #define XKB_KEY_Hangul_SunkyeongeumPieub 0x0ef1 #define XKB_KEY_Hangul_PanSios 0x0ef2 #define XKB_KEY_Hangul_KkogjiDalrinIeung 0x0ef3 #define XKB_KEY_Hangul_SunkyeongeumPhieuf 0x0ef4 #define XKB_KEY_Hangul_YeorinHieuh 0x0ef5 /* Ancient Hangul Vowel Characters */ #define XKB_KEY_Hangul_AraeA 0x0ef6 #define XKB_KEY_Hangul_AraeAE 0x0ef7 /* Ancient Hangul syllable-final (JongSeong) Characters */ #define XKB_KEY_Hangul_J_PanSios 0x0ef8 #define XKB_KEY_Hangul_J_KkogjiDalrinIeung 0x0ef9 #define XKB_KEY_Hangul_J_YeorinHieuh 0x0efa /* Korean currency symbol */ #define XKB_KEY_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ /* * Armenian */ #define XKB_KEY_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ #define XKB_KEY_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XKB_KEY_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XKB_KEY_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */ #define XKB_KEY_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */ #define XKB_KEY_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XKB_KEY_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XKB_KEY_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XKB_KEY_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XKB_KEY_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XKB_KEY_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XKB_KEY_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XKB_KEY_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XKB_KEY_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */ #define XKB_KEY_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */ #define XKB_KEY_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */ #define XKB_KEY_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */ #define XKB_KEY_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */ #define XKB_KEY_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */ #define XKB_KEY_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */ #define XKB_KEY_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */ #define XKB_KEY_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */ #define XKB_KEY_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */ #define XKB_KEY_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */ #define XKB_KEY_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */ #define XKB_KEY_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */ #define XKB_KEY_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */ #define XKB_KEY_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */ #define XKB_KEY_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */ #define XKB_KEY_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */ #define XKB_KEY_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */ #define XKB_KEY_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */ #define XKB_KEY_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */ #define XKB_KEY_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */ #define XKB_KEY_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */ #define XKB_KEY_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */ #define XKB_KEY_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */ #define XKB_KEY_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */ #define XKB_KEY_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */ #define XKB_KEY_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */ #define XKB_KEY_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */ #define XKB_KEY_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */ #define XKB_KEY_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */ #define XKB_KEY_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */ #define XKB_KEY_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */ #define XKB_KEY_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */ #define XKB_KEY_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */ #define XKB_KEY_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */ #define XKB_KEY_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */ #define XKB_KEY_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */ #define XKB_KEY_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */ #define XKB_KEY_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */ #define XKB_KEY_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */ #define XKB_KEY_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */ #define XKB_KEY_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */ #define XKB_KEY_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */ #define XKB_KEY_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */ #define XKB_KEY_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */ #define XKB_KEY_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */ #define XKB_KEY_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */ #define XKB_KEY_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */ #define XKB_KEY_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */ #define XKB_KEY_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */ #define XKB_KEY_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */ #define XKB_KEY_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */ #define XKB_KEY_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */ #define XKB_KEY_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */ #define XKB_KEY_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */ #define XKB_KEY_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */ #define XKB_KEY_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */ #define XKB_KEY_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */ #define XKB_KEY_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */ #define XKB_KEY_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */ #define XKB_KEY_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */ #define XKB_KEY_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */ #define XKB_KEY_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */ #define XKB_KEY_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */ #define XKB_KEY_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */ #define XKB_KEY_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */ #define XKB_KEY_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */ #define XKB_KEY_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */ #define XKB_KEY_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */ #define XKB_KEY_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */ #define XKB_KEY_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */ #define XKB_KEY_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */ #define XKB_KEY_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */ #define XKB_KEY_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */ #define XKB_KEY_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */ #define XKB_KEY_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */ #define XKB_KEY_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */ /* * Georgian */ #define XKB_KEY_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */ #define XKB_KEY_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */ #define XKB_KEY_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */ #define XKB_KEY_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */ #define XKB_KEY_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */ #define XKB_KEY_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */ #define XKB_KEY_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */ #define XKB_KEY_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */ #define XKB_KEY_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */ #define XKB_KEY_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */ #define XKB_KEY_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */ #define XKB_KEY_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */ #define XKB_KEY_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */ #define XKB_KEY_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */ #define XKB_KEY_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */ #define XKB_KEY_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */ #define XKB_KEY_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */ #define XKB_KEY_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */ #define XKB_KEY_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */ #define XKB_KEY_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */ #define XKB_KEY_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */ #define XKB_KEY_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */ #define XKB_KEY_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */ #define XKB_KEY_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */ #define XKB_KEY_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */ #define XKB_KEY_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */ #define XKB_KEY_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */ #define XKB_KEY_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */ #define XKB_KEY_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */ #define XKB_KEY_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */ #define XKB_KEY_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */ #define XKB_KEY_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */ #define XKB_KEY_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */ #define XKB_KEY_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */ #define XKB_KEY_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */ #define XKB_KEY_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */ #define XKB_KEY_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */ #define XKB_KEY_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */ #define XKB_KEY_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */ /* * Azeri (and other Turkic or Caucasian languages) */ /* latin */ #define XKB_KEY_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */ #define XKB_KEY_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */ #define XKB_KEY_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */ #define XKB_KEY_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */ #define XKB_KEY_Ocaron 0x10001d1 /* U+01D2 LATIN CAPITAL LETTER O WITH CARON */ #define XKB_KEY_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */ #define XKB_KEY_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */ #define XKB_KEY_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */ #define XKB_KEY_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */ #define XKB_KEY_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */ #define XKB_KEY_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */ #define XKB_KEY_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */ #define XKB_KEY_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */ #define XKB_KEY_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */ #define XKB_KEY_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */ #define XKB_KEY_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */ /* those are not really Caucasus */ /* For Inupiak */ #define XKB_KEY_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */ #define XKB_KEY_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */ /* * Vietnamese */ #define XKB_KEY_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */ #define XKB_KEY_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */ #define XKB_KEY_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */ #define XKB_KEY_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */ #define XKB_KEY_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */ #define XKB_KEY_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */ #define XKB_KEY_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */ #define XKB_KEY_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */ #define XKB_KEY_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ #define XKB_KEY_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ #define XKB_KEY_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */ #define XKB_KEY_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */ #define XKB_KEY_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ #define XKB_KEY_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ #define XKB_KEY_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */ #define XKB_KEY_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */ #define XKB_KEY_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */ #define XKB_KEY_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */ #define XKB_KEY_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */ #define XKB_KEY_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */ #define XKB_KEY_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */ #define XKB_KEY_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */ #define XKB_KEY_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */ #define XKB_KEY_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */ #define XKB_KEY_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */ #define XKB_KEY_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */ #define XKB_KEY_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */ #define XKB_KEY_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */ #define XKB_KEY_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */ #define XKB_KEY_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */ #define XKB_KEY_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */ #define XKB_KEY_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */ #define XKB_KEY_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */ #define XKB_KEY_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */ #define XKB_KEY_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ #define XKB_KEY_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ #define XKB_KEY_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */ #define XKB_KEY_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */ #define XKB_KEY_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ #define XKB_KEY_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ #define XKB_KEY_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */ #define XKB_KEY_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */ #define XKB_KEY_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */ #define XKB_KEY_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */ #define XKB_KEY_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */ #define XKB_KEY_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */ #define XKB_KEY_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */ #define XKB_KEY_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */ #define XKB_KEY_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ #define XKB_KEY_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */ #define XKB_KEY_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */ #define XKB_KEY_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */ #define XKB_KEY_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ #define XKB_KEY_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ #define XKB_KEY_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */ #define XKB_KEY_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */ #define XKB_KEY_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ #define XKB_KEY_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ #define XKB_KEY_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */ #define XKB_KEY_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */ #define XKB_KEY_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */ #define XKB_KEY_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */ #define XKB_KEY_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */ #define XKB_KEY_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */ #define XKB_KEY_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */ #define XKB_KEY_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */ #define XKB_KEY_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */ #define XKB_KEY_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */ #define XKB_KEY_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */ #define XKB_KEY_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */ #define XKB_KEY_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */ #define XKB_KEY_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */ #define XKB_KEY_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */ #define XKB_KEY_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */ #define XKB_KEY_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */ #define XKB_KEY_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */ #define XKB_KEY_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */ #define XKB_KEY_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */ #define XKB_KEY_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */ #define XKB_KEY_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */ #define XKB_KEY_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */ #define XKB_KEY_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */ #define XKB_KEY_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */ #define XKB_KEY_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */ #define XKB_KEY_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */ #define XKB_KEY_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ #define XKB_KEY_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ #define XKB_KEY_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ #define XKB_KEY_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ #define XKB_KEY_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ #define XKB_KEY_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ #define XKB_KEY_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ #define XKB_KEY_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ #define XKB_KEY_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ #define XKB_KEY_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ #define XKB_KEY_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */ #define XKB_KEY_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */ #define XKB_KEY_MillSign 0x10020a5 /* U+20A5 MILL SIGN */ #define XKB_KEY_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */ #define XKB_KEY_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */ #define XKB_KEY_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */ #define XKB_KEY_WonSign 0x10020a9 /* U+20A9 WON SIGN */ #define XKB_KEY_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */ #define XKB_KEY_DongSign 0x10020ab /* U+20AB DONG SIGN */ #define XKB_KEY_EuroSign 0x20ac /* U+20AC EURO SIGN */ /* one, two and three are defined above. */ #define XKB_KEY_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */ #define XKB_KEY_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */ #define XKB_KEY_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */ #define XKB_KEY_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */ #define XKB_KEY_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */ #define XKB_KEY_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */ #define XKB_KEY_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */ #define XKB_KEY_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */ #define XKB_KEY_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */ #define XKB_KEY_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */ #define XKB_KEY_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */ #define XKB_KEY_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */ #define XKB_KEY_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */ #define XKB_KEY_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */ #define XKB_KEY_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ #define XKB_KEY_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ #define XKB_KEY_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */ #define XKB_KEY_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ #define XKB_KEY_emptyset 0x1002205 /* U+2205 NULL SET */ #define XKB_KEY_elementof 0x1002208 /* U+2208 ELEMENT OF */ #define XKB_KEY_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */ #define XKB_KEY_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */ #define XKB_KEY_squareroot 0x100221A /* U+221A SQUARE ROOT */ #define XKB_KEY_cuberoot 0x100221B /* U+221B CUBE ROOT */ #define XKB_KEY_fourthroot 0x100221C /* U+221C FOURTH ROOT */ #define XKB_KEY_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */ #define XKB_KEY_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */ #define XKB_KEY_because 0x1002235 /* U+2235 BECAUSE */ #define XKB_KEY_approxeq 0x1002248 /* U+2245 ALMOST EQUAL TO */ #define XKB_KEY_notapproxeq 0x1002247 /* U+2247 NOT ALMOST EQUAL TO */ #define XKB_KEY_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */ #define XKB_KEY_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */ #define XKB_KEY_braille_dot_1 0xfff1 #define XKB_KEY_braille_dot_2 0xfff2 #define XKB_KEY_braille_dot_3 0xfff3 #define XKB_KEY_braille_dot_4 0xfff4 #define XKB_KEY_braille_dot_5 0xfff5 #define XKB_KEY_braille_dot_6 0xfff6 #define XKB_KEY_braille_dot_7 0xfff7 #define XKB_KEY_braille_dot_8 0xfff8 #define XKB_KEY_braille_dot_9 0xfff9 #define XKB_KEY_braille_dot_10 0xfffa #define XKB_KEY_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */ #define XKB_KEY_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */ #define XKB_KEY_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */ #define XKB_KEY_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ #define XKB_KEY_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ #define XKB_KEY_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ #define XKB_KEY_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ #define XKB_KEY_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ #define XKB_KEY_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ #define XKB_KEY_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ #define XKB_KEY_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */ #define XKB_KEY_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */ #define XKB_KEY_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */ #define XKB_KEY_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */ #define XKB_KEY_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */ #define XKB_KEY_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */ #define XKB_KEY_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */ #define XKB_KEY_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */ #define XKB_KEY_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */ #define XKB_KEY_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */ #define XKB_KEY_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */ #define XKB_KEY_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */ #define XKB_KEY_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */ #define XKB_KEY_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */ #define XKB_KEY_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */ #define XKB_KEY_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */ #define XKB_KEY_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */ #define XKB_KEY_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */ #define XKB_KEY_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */ #define XKB_KEY_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */ #define XKB_KEY_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */ #define XKB_KEY_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */ #define XKB_KEY_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */ #define XKB_KEY_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */ #define XKB_KEY_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */ #define XKB_KEY_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */ #define XKB_KEY_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */ #define XKB_KEY_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */ #define XKB_KEY_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */ #define XKB_KEY_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */ #define XKB_KEY_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */ #define XKB_KEY_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */ #define XKB_KEY_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */ #define XKB_KEY_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */ #define XKB_KEY_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */ #define XKB_KEY_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */ #define XKB_KEY_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */ #define XKB_KEY_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */ #define XKB_KEY_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */ #define XKB_KEY_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */ #define XKB_KEY_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */ #define XKB_KEY_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */ #define XKB_KEY_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */ #define XKB_KEY_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */ #define XKB_KEY_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */ #define XKB_KEY_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */ #define XKB_KEY_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */ #define XKB_KEY_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */ #define XKB_KEY_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */ #define XKB_KEY_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */ #define XKB_KEY_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */ #define XKB_KEY_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */ #define XKB_KEY_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */ #define XKB_KEY_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */ #define XKB_KEY_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */ #define XKB_KEY_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */ #define XKB_KEY_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */ #define XKB_KEY_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */ #define XKB_KEY_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */ #define XKB_KEY_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */ #define XKB_KEY_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */ #define XKB_KEY_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */ #define XKB_KEY_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */ #define XKB_KEY_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */ #define XKB_KEY_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */ #define XKB_KEY_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */ #define XKB_KEY_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */ #define XKB_KEY_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */ #define XKB_KEY_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */ #define XKB_KEY_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */ #define XKB_KEY_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */ #define XKB_KEY_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */ #define XKB_KEY_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */ #define XKB_KEY_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */ #define XKB_KEY_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */ #define XKB_KEY_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */ #define XKB_KEY_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */ #define XKB_KEY_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */ #define XKB_KEY_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */ #define XKB_KEY_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */ #define XKB_KEY_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */ #define XKB_KEY_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */ #define XKB_KEY_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */ #define XKB_KEY_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */ #define XKB_KEY_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */ #define XKB_KEY_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */ #define XKB_KEY_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */ #define XKB_KEY_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */ #define XKB_KEY_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */ #define XKB_KEY_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */ #define XKB_KEY_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */ #define XKB_KEY_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */ #define XKB_KEY_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */ #define XKB_KEY_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */ #define XKB_KEY_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */ #define XKB_KEY_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */ #define XKB_KEY_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */ #define XKB_KEY_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */ #define XKB_KEY_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */ #define XKB_KEY_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */ #define XKB_KEY_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */ #define XKB_KEY_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */ #define XKB_KEY_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */ #define XKB_KEY_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */ #define XKB_KEY_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */ #define XKB_KEY_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */ #define XKB_KEY_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */ #define XKB_KEY_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */ #define XKB_KEY_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */ #define XKB_KEY_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */ #define XKB_KEY_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */ #define XKB_KEY_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */ #define XKB_KEY_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */ #define XKB_KEY_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */ #define XKB_KEY_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */ #define XKB_KEY_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */ #define XKB_KEY_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */ #define XKB_KEY_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */ #define XKB_KEY_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */ #define XKB_KEY_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */ #define XKB_KEY_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */ #define XKB_KEY_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */ #define XKB_KEY_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */ #define XKB_KEY_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */ #define XKB_KEY_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */ #define XKB_KEY_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */ #define XKB_KEY_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */ #define XKB_KEY_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */ #define XKB_KEY_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */ #define XKB_KEY_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */ #define XKB_KEY_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */ #define XKB_KEY_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */ #define XKB_KEY_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */ #define XKB_KEY_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */ #define XKB_KEY_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */ #define XKB_KEY_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */ #define XKB_KEY_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */ #define XKB_KEY_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */ #define XKB_KEY_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */ #define XKB_KEY_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */ #define XKB_KEY_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */ #define XKB_KEY_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */ #define XKB_KEY_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */ #define XKB_KEY_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */ #define XKB_KEY_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */ #define XKB_KEY_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */ #define XKB_KEY_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */ #define XKB_KEY_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */ #define XKB_KEY_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */ #define XKB_KEY_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */ #define XKB_KEY_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */ #define XKB_KEY_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */ #define XKB_KEY_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */ #define XKB_KEY_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */ #define XKB_KEY_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */ #define XKB_KEY_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */ #define XKB_KEY_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */ #define XKB_KEY_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */ #define XKB_KEY_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */ #define XKB_KEY_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */ #define XKB_KEY_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */ #define XKB_KEY_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */ #define XKB_KEY_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */ #define XKB_KEY_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */ #define XKB_KEY_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */ #define XKB_KEY_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */ #define XKB_KEY_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */ #define XKB_KEY_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */ #define XKB_KEY_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */ #define XKB_KEY_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */ #define XKB_KEY_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */ #define XKB_KEY_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */ #define XKB_KEY_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */ #define XKB_KEY_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */ #define XKB_KEY_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */ #define XKB_KEY_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */ #define XKB_KEY_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */ #define XKB_KEY_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */ #define XKB_KEY_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */ #define XKB_KEY_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */ #define XKB_KEY_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */ #define XKB_KEY_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */ #define XKB_KEY_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */ #define XKB_KEY_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */ #define XKB_KEY_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */ #define XKB_KEY_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */ #define XKB_KEY_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */ #define XKB_KEY_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */ #define XKB_KEY_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */ #define XKB_KEY_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */ #define XKB_KEY_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */ #define XKB_KEY_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */ #define XKB_KEY_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */ #define XKB_KEY_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */ #define XKB_KEY_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */ #define XKB_KEY_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */ #define XKB_KEY_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */ #define XKB_KEY_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */ #define XKB_KEY_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */ #define XKB_KEY_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */ #define XKB_KEY_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */ #define XKB_KEY_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */ #define XKB_KEY_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */ #define XKB_KEY_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */ #define XKB_KEY_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */ #define XKB_KEY_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */ #define XKB_KEY_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */ #define XKB_KEY_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */ #define XKB_KEY_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */ #define XKB_KEY_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */ #define XKB_KEY_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */ #define XKB_KEY_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */ #define XKB_KEY_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */ #define XKB_KEY_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */ #define XKB_KEY_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */ #define XKB_KEY_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */ #define XKB_KEY_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */ #define XKB_KEY_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */ #define XKB_KEY_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */ #define XKB_KEY_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */ #define XKB_KEY_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */ #define XKB_KEY_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */ #define XKB_KEY_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */ #define XKB_KEY_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */ #define XKB_KEY_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */ #define XKB_KEY_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */ #define XKB_KEY_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */ #define XKB_KEY_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */ #define XKB_KEY_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */ #define XKB_KEY_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */ #define XKB_KEY_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */ #define XKB_KEY_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */ #define XKB_KEY_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */ #define XKB_KEY_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */ #define XKB_KEY_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */ #define XKB_KEY_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */ #define XKB_KEY_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */ #define XKB_KEY_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */ #define XKB_KEY_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */ #define XKB_KEY_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */ #define XKB_KEY_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */ #define XKB_KEY_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */ #define XKB_KEY_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */ #define XKB_KEY_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */ #define XKB_KEY_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */ #define XKB_KEY_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */ /* * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html */ #define XKB_KEY_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */ #define XKB_KEY_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */ #define XKB_KEY_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */ #define XKB_KEY_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */ #define XKB_KEY_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */ #define XKB_KEY_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */ #define XKB_KEY_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */ #define XKB_KEY_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */ #define XKB_KEY_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */ #define XKB_KEY_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */ #define XKB_KEY_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */ #define XKB_KEY_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */ #define XKB_KEY_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */ #define XKB_KEY_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */ #define XKB_KEY_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */ #define XKB_KEY_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */ #define XKB_KEY_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */ #define XKB_KEY_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */ #define XKB_KEY_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */ #define XKB_KEY_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */ #define XKB_KEY_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */ #define XKB_KEY_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */ #define XKB_KEY_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */ #define XKB_KEY_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */ #define XKB_KEY_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */ #define XKB_KEY_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */ #define XKB_KEY_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */ #define XKB_KEY_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */ #define XKB_KEY_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */ #define XKB_KEY_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */ #define XKB_KEY_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */ #define XKB_KEY_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */ #define XKB_KEY_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */ #define XKB_KEY_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */ #define XKB_KEY_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */ #define XKB_KEY_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */ #define XKB_KEY_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */ #define XKB_KEY_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */ #define XKB_KEY_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */ #define XKB_KEY_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */ #define XKB_KEY_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */ #define XKB_KEY_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */ #define XKB_KEY_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */ #define XKB_KEY_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */ #define XKB_KEY_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */ #define XKB_KEY_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */ #define XKB_KEY_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */ #define XKB_KEY_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */ #define XKB_KEY_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */ #define XKB_KEY_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */ #define XKB_KEY_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */ #define XKB_KEY_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */ #define XKB_KEY_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */ #define XKB_KEY_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */ #define XKB_KEY_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */ #define XKB_KEY_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */ #define XKB_KEY_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */ #define XKB_KEY_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */ #define XKB_KEY_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */ #define XKB_KEY_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */ #define XKB_KEY_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */ #define XKB_KEY_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */ #define XKB_KEY_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */ #define XKB_KEY_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */ #define XKB_KEY_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */ #define XKB_KEY_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */ #define XKB_KEY_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */ #define XKB_KEY_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */ #define XKB_KEY_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */ #define XKB_KEY_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */ #define XKB_KEY_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */ #define XKB_KEY_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */ #define XKB_KEY_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */ #define XKB_KEY_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/ #define XKB_KEY_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/ #define XKB_KEY_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */ #define XKB_KEY_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */ #define XKB_KEY_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */ #define XKB_KEY_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */ #define XKB_KEY_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */ /* * XFree86 vendor specific keysyms. * * The XFree86 keysym range is 0x10080001 - 0x1008FFFF. * * X.Org will not be adding to the XF86 set of keysyms, though they have * been adopted and are considered a "standard" part of X keysym definitions. * XFree86 never properly commented these keysyms, so we have done our * best to explain the semantic meaning of these keys. * * XFree86 has removed their mail archives of the period, that might have * shed more light on some of these definitions. Until/unless we resurrect * these archives, these are from memory and usage. */ /* * ModeLock * * This one is old, and not really used any more since XKB offers this * functionality. */ #define XKB_KEY_XF86ModeLock 0x1008FF01 /* Mode Switch Lock */ /* Backlight controls. */ #define XKB_KEY_XF86MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */ #define XKB_KEY_XF86MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */ #define XKB_KEY_XF86KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */ #define XKB_KEY_XF86KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */ #define XKB_KEY_XF86KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */ /* * Keys found on some "Internet" keyboards. */ #define XKB_KEY_XF86Standby 0x1008FF10 /* System into standby mode */ #define XKB_KEY_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */ #define XKB_KEY_XF86AudioMute 0x1008FF12 /* Mute sound from the system */ #define XKB_KEY_XF86AudioRaiseVolume 0x1008FF13 /* Volume control up */ #define XKB_KEY_XF86AudioPlay 0x1008FF14 /* Start playing of audio > */ #define XKB_KEY_XF86AudioStop 0x1008FF15 /* Stop playing audio */ #define XKB_KEY_XF86AudioPrev 0x1008FF16 /* Previous track */ #define XKB_KEY_XF86AudioNext 0x1008FF17 /* Next track */ #define XKB_KEY_XF86HomePage 0x1008FF18 /* Display user's home page */ #define XKB_KEY_XF86Mail 0x1008FF19 /* Invoke user's mail program */ #define XKB_KEY_XF86Start 0x1008FF1A /* Start application */ #define XKB_KEY_XF86Search 0x1008FF1B /* Search */ #define XKB_KEY_XF86AudioRecord 0x1008FF1C /* Record audio application */ /* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ #define XKB_KEY_XF86Calculator 0x1008FF1D /* Invoke calculator program */ #define XKB_KEY_XF86Memo 0x1008FF1E /* Invoke Memo taking program */ #define XKB_KEY_XF86ToDoList 0x1008FF1F /* Invoke To Do List program */ #define XKB_KEY_XF86Calendar 0x1008FF20 /* Invoke Calendar program */ #define XKB_KEY_XF86PowerDown 0x1008FF21 /* Deep sleep the system */ #define XKB_KEY_XF86ContrastAdjust 0x1008FF22 /* Adjust screen contrast */ #define XKB_KEY_XF86RockerUp 0x1008FF23 /* Rocker switches exist up */ #define XKB_KEY_XF86RockerDown 0x1008FF24 /* and down */ #define XKB_KEY_XF86RockerEnter 0x1008FF25 /* and let you press them */ /* Some more "Internet" keyboard symbols */ #define XKB_KEY_XF86Back 0x1008FF26 /* Like back on a browser */ #define XKB_KEY_XF86Forward 0x1008FF27 /* Like forward on a browser */ #define XKB_KEY_XF86Stop 0x1008FF28 /* Stop current operation */ #define XKB_KEY_XF86Refresh 0x1008FF29 /* Refresh the page */ #define XKB_KEY_XF86PowerOff 0x1008FF2A /* Power off system entirely */ #define XKB_KEY_XF86WakeUp 0x1008FF2B /* Wake up system from sleep */ #define XKB_KEY_XF86Eject 0x1008FF2C /* Eject device (e.g. DVD) */ #define XKB_KEY_XF86ScreenSaver 0x1008FF2D /* Invoke screensaver */ #define XKB_KEY_XF86WWW 0x1008FF2E /* Invoke web browser */ #define XKB_KEY_XF86Sleep 0x1008FF2F /* Put system to sleep */ #define XKB_KEY_XF86Favorites 0x1008FF30 /* Show favorite locations */ #define XKB_KEY_XF86AudioPause 0x1008FF31 /* Pause audio playing */ #define XKB_KEY_XF86AudioMedia 0x1008FF32 /* Launch media collection app */ #define XKB_KEY_XF86MyComputer 0x1008FF33 /* Display "My Computer" window */ #define XKB_KEY_XF86VendorHome 0x1008FF34 /* Display vendor home web site */ #define XKB_KEY_XF86LightBulb 0x1008FF35 /* Light bulb keys exist */ #define XKB_KEY_XF86Shop 0x1008FF36 /* Display shopping web site */ #define XKB_KEY_XF86History 0x1008FF37 /* Show history of web surfing */ #define XKB_KEY_XF86OpenURL 0x1008FF38 /* Open selected URL */ #define XKB_KEY_XF86AddFavorite 0x1008FF39 /* Add URL to favorites list */ #define XKB_KEY_XF86HotLinks 0x1008FF3A /* Show "hot" links */ #define XKB_KEY_XF86BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */ #define XKB_KEY_XF86Finance 0x1008FF3C /* Display financial site */ #define XKB_KEY_XF86Community 0x1008FF3D /* Display user's community */ #define XKB_KEY_XF86AudioRewind 0x1008FF3E /* "rewind" audio track */ #define XKB_KEY_XF86BackForward 0x1008FF3F /* ??? */ #define XKB_KEY_XF86Launch0 0x1008FF40 /* Launch Application */ #define XKB_KEY_XF86Launch1 0x1008FF41 /* Launch Application */ #define XKB_KEY_XF86Launch2 0x1008FF42 /* Launch Application */ #define XKB_KEY_XF86Launch3 0x1008FF43 /* Launch Application */ #define XKB_KEY_XF86Launch4 0x1008FF44 /* Launch Application */ #define XKB_KEY_XF86Launch5 0x1008FF45 /* Launch Application */ #define XKB_KEY_XF86Launch6 0x1008FF46 /* Launch Application */ #define XKB_KEY_XF86Launch7 0x1008FF47 /* Launch Application */ #define XKB_KEY_XF86Launch8 0x1008FF48 /* Launch Application */ #define XKB_KEY_XF86Launch9 0x1008FF49 /* Launch Application */ #define XKB_KEY_XF86LaunchA 0x1008FF4A /* Launch Application */ #define XKB_KEY_XF86LaunchB 0x1008FF4B /* Launch Application */ #define XKB_KEY_XF86LaunchC 0x1008FF4C /* Launch Application */ #define XKB_KEY_XF86LaunchD 0x1008FF4D /* Launch Application */ #define XKB_KEY_XF86LaunchE 0x1008FF4E /* Launch Application */ #define XKB_KEY_XF86LaunchF 0x1008FF4F /* Launch Application */ #define XKB_KEY_XF86ApplicationLeft 0x1008FF50 /* switch to application, left */ #define XKB_KEY_XF86ApplicationRight 0x1008FF51 /* switch to application, right*/ #define XKB_KEY_XF86Book 0x1008FF52 /* Launch bookreader */ #define XKB_KEY_XF86CD 0x1008FF53 /* Launch CD/DVD player */ #define XKB_KEY_XF86Calculater 0x1008FF54 /* Launch Calculater */ #define XKB_KEY_XF86Clear 0x1008FF55 /* Clear window, screen */ #define XKB_KEY_XF86Close 0x1008FF56 /* Close window */ #define XKB_KEY_XF86Copy 0x1008FF57 /* Copy selection */ #define XKB_KEY_XF86Cut 0x1008FF58 /* Cut selection */ #define XKB_KEY_XF86Display 0x1008FF59 /* Output switch key */ #define XKB_KEY_XF86DOS 0x1008FF5A /* Launch DOS (emulation) */ #define XKB_KEY_XF86Documents 0x1008FF5B /* Open documents window */ #define XKB_KEY_XF86Excel 0x1008FF5C /* Launch spread sheet */ #define XKB_KEY_XF86Explorer 0x1008FF5D /* Launch file explorer */ #define XKB_KEY_XF86Game 0x1008FF5E /* Launch game */ #define XKB_KEY_XF86Go 0x1008FF5F /* Go to URL */ #define XKB_KEY_XF86iTouch 0x1008FF60 /* Logitch iTouch- don't use */ #define XKB_KEY_XF86LogOff 0x1008FF61 /* Log off system */ #define XKB_KEY_XF86Market 0x1008FF62 /* ?? */ #define XKB_KEY_XF86Meeting 0x1008FF63 /* enter meeting in calendar */ #define XKB_KEY_XF86MenuKB 0x1008FF65 /* distingush keyboard from PB */ #define XKB_KEY_XF86MenuPB 0x1008FF66 /* distinuish PB from keyboard */ #define XKB_KEY_XF86MySites 0x1008FF67 /* Favourites */ #define XKB_KEY_XF86New 0x1008FF68 /* New (folder, document... */ #define XKB_KEY_XF86News 0x1008FF69 /* News */ #define XKB_KEY_XF86OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/ #define XKB_KEY_XF86Open 0x1008FF6B /* Open */ #define XKB_KEY_XF86Option 0x1008FF6C /* ?? */ #define XKB_KEY_XF86Paste 0x1008FF6D /* Paste */ #define XKB_KEY_XF86Phone 0x1008FF6E /* Launch phone; dial number */ #define XKB_KEY_XF86Q 0x1008FF70 /* Compaq's Q - don't use */ #define XKB_KEY_XF86Reply 0x1008FF72 /* Reply e.g., mail */ #define XKB_KEY_XF86Reload 0x1008FF73 /* Reload web page, file, etc. */ #define XKB_KEY_XF86RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */ #define XKB_KEY_XF86RotationPB 0x1008FF75 /* don't use */ #define XKB_KEY_XF86RotationKB 0x1008FF76 /* don't use */ #define XKB_KEY_XF86Save 0x1008FF77 /* Save (file, document, state */ #define XKB_KEY_XF86ScrollUp 0x1008FF78 /* Scroll window/contents up */ #define XKB_KEY_XF86ScrollDown 0x1008FF79 /* Scrool window/contentd down */ #define XKB_KEY_XF86ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */ #define XKB_KEY_XF86Send 0x1008FF7B /* Send mail, file, object */ #define XKB_KEY_XF86Spell 0x1008FF7C /* Spell checker */ #define XKB_KEY_XF86SplitScreen 0x1008FF7D /* Split window or screen */ #define XKB_KEY_XF86Support 0x1008FF7E /* Get support (??) */ #define XKB_KEY_XF86TaskPane 0x1008FF7F /* Show tasks */ #define XKB_KEY_XF86Terminal 0x1008FF80 /* Launch terminal emulator */ #define XKB_KEY_XF86Tools 0x1008FF81 /* toolbox of desktop/app. */ #define XKB_KEY_XF86Travel 0x1008FF82 /* ?? */ #define XKB_KEY_XF86UserPB 0x1008FF84 /* ?? */ #define XKB_KEY_XF86User1KB 0x1008FF85 /* ?? */ #define XKB_KEY_XF86User2KB 0x1008FF86 /* ?? */ #define XKB_KEY_XF86Video 0x1008FF87 /* Launch video player */ #define XKB_KEY_XF86WheelButton 0x1008FF88 /* button from a mouse wheel */ #define XKB_KEY_XF86Word 0x1008FF89 /* Launch word processor */ #define XKB_KEY_XF86Xfer 0x1008FF8A #define XKB_KEY_XF86ZoomIn 0x1008FF8B /* zoom in view, map, etc. */ #define XKB_KEY_XF86ZoomOut 0x1008FF8C /* zoom out view, map, etc. */ #define XKB_KEY_XF86Away 0x1008FF8D /* mark yourself as away */ #define XKB_KEY_XF86Messenger 0x1008FF8E /* as in instant messaging */ #define XKB_KEY_XF86WebCam 0x1008FF8F /* Launch web camera app. */ #define XKB_KEY_XF86MailForward 0x1008FF90 /* Forward in mail */ #define XKB_KEY_XF86Pictures 0x1008FF91 /* Show pictures */ #define XKB_KEY_XF86Music 0x1008FF92 /* Launch music application */ #define XKB_KEY_XF86Battery 0x1008FF93 /* Display battery information */ #define XKB_KEY_XF86Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */ #define XKB_KEY_XF86WLAN 0x1008FF95 /* Enable/disable WLAN */ #define XKB_KEY_XF86UWB 0x1008FF96 /* Enable/disable UWB */ #define XKB_KEY_XF86AudioForward 0x1008FF97 /* fast-forward audio track */ #define XKB_KEY_XF86AudioRepeat 0x1008FF98 /* toggle repeat mode */ #define XKB_KEY_XF86AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */ #define XKB_KEY_XF86Subtitle 0x1008FF9A /* cycle through subtitle */ #define XKB_KEY_XF86AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */ #define XKB_KEY_XF86CycleAngle 0x1008FF9C /* cycle through angles */ #define XKB_KEY_XF86FrameBack 0x1008FF9D /* video: go one frame back */ #define XKB_KEY_XF86FrameForward 0x1008FF9E /* video: go one frame forward */ #define XKB_KEY_XF86Time 0x1008FF9F /* display, or shows an entry for time seeking */ #define XKB_KEY_XF86Select 0x1008FFA0 /* Select button on joypads and remotes */ #define XKB_KEY_XF86View 0x1008FFA1 /* Show a view options/properties */ #define XKB_KEY_XF86TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */ #define XKB_KEY_XF86Red 0x1008FFA3 /* Red button */ #define XKB_KEY_XF86Green 0x1008FFA4 /* Green button */ #define XKB_KEY_XF86Yellow 0x1008FFA5 /* Yellow button */ #define XKB_KEY_XF86Blue 0x1008FFA6 /* Blue button */ #define XKB_KEY_XF86Suspend 0x1008FFA7 /* Sleep to RAM */ #define XKB_KEY_XF86Hibernate 0x1008FFA8 /* Sleep to disk */ #define XKB_KEY_XF86TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */ #define XKB_KEY_XF86TouchpadOn 0x1008FFB0 /* The touchpad got switched on */ #define XKB_KEY_XF86TouchpadOff 0x1008FFB1 /* The touchpad got switched off */ #define XKB_KEY_XF86AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */ #define XKB_KEY_XF86Keyboard 0x1008FFB3 /* User defined keyboard related action */ #define XKB_KEY_XF86WWAN 0x1008FFB4 /* Toggle WWAN (LTE, UMTS, etc.) radio */ #define XKB_KEY_XF86RFKill 0x1008FFB5 /* Toggle radios on/off */ #define XKB_KEY_XF86AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */ /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ #define XKB_KEY_XF86Switch_VT_1 0x1008FE01 #define XKB_KEY_XF86Switch_VT_2 0x1008FE02 #define XKB_KEY_XF86Switch_VT_3 0x1008FE03 #define XKB_KEY_XF86Switch_VT_4 0x1008FE04 #define XKB_KEY_XF86Switch_VT_5 0x1008FE05 #define XKB_KEY_XF86Switch_VT_6 0x1008FE06 #define XKB_KEY_XF86Switch_VT_7 0x1008FE07 #define XKB_KEY_XF86Switch_VT_8 0x1008FE08 #define XKB_KEY_XF86Switch_VT_9 0x1008FE09 #define XKB_KEY_XF86Switch_VT_10 0x1008FE0A #define XKB_KEY_XF86Switch_VT_11 0x1008FE0B #define XKB_KEY_XF86Switch_VT_12 0x1008FE0C #define XKB_KEY_XF86Ungrab 0x1008FE20 /* force ungrab */ #define XKB_KEY_XF86ClearGrab 0x1008FE21 /* kill application with grab */ #define XKB_KEY_XF86Next_VMode 0x1008FE22 /* next video mode available */ #define XKB_KEY_XF86Prev_VMode 0x1008FE23 /* prev. video mode available */ #define XKB_KEY_XF86LogWindowTree 0x1008FE24 /* print window tree to log */ #define XKB_KEY_XF86LogGrabInfo 0x1008FE25 /* print all active grabs to log */ /* * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved. * * 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: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * 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. */ /************************************************************ Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ***********************************************************/ /* * Floating Accent */ #define XKB_KEY_SunFA_Grave 0x1005FF00 #define XKB_KEY_SunFA_Circum 0x1005FF01 #define XKB_KEY_SunFA_Tilde 0x1005FF02 #define XKB_KEY_SunFA_Acute 0x1005FF03 #define XKB_KEY_SunFA_Diaeresis 0x1005FF04 #define XKB_KEY_SunFA_Cedilla 0x1005FF05 /* * Miscellaneous Functions */ #define XKB_KEY_SunF36 0x1005FF10 /* Labeled F11 */ #define XKB_KEY_SunF37 0x1005FF11 /* Labeled F12 */ #define XKB_KEY_SunSys_Req 0x1005FF60 #define XKB_KEY_SunPrint_Screen 0x0000FF61 /* Same as XK_Print */ /* * International & Multi-Key Character Composition */ #define XKB_KEY_SunCompose 0x0000FF20 /* Same as XK_Multi_key */ #define XKB_KEY_SunAltGraph 0x0000FF7E /* Same as XK_Mode_switch */ /* * Cursor Control */ #define XKB_KEY_SunPageUp 0x0000FF55 /* Same as XK_Prior */ #define XKB_KEY_SunPageDown 0x0000FF56 /* Same as XK_Next */ /* * Open Look Functions */ #define XKB_KEY_SunUndo 0x0000FF65 /* Same as XK_Undo */ #define XKB_KEY_SunAgain 0x0000FF66 /* Same as XK_Redo */ #define XKB_KEY_SunFind 0x0000FF68 /* Same as XK_Find */ #define XKB_KEY_SunStop 0x0000FF69 /* Same as XK_Cancel */ #define XKB_KEY_SunProps 0x1005FF70 #define XKB_KEY_SunFront 0x1005FF71 #define XKB_KEY_SunCopy 0x1005FF72 #define XKB_KEY_SunOpen 0x1005FF73 #define XKB_KEY_SunPaste 0x1005FF74 #define XKB_KEY_SunCut 0x1005FF75 #define XKB_KEY_SunPowerSwitch 0x1005FF76 #define XKB_KEY_SunAudioLowerVolume 0x1005FF77 #define XKB_KEY_SunAudioMute 0x1005FF78 #define XKB_KEY_SunAudioRaiseVolume 0x1005FF79 #define XKB_KEY_SunVideoDegauss 0x1005FF7A #define XKB_KEY_SunVideoLowerBrightness 0x1005FF7B #define XKB_KEY_SunVideoRaiseBrightness 0x1005FF7C #define XKB_KEY_SunPowerSwitchShift 0x1005FF7D /*********************************************************** Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ #define XKB_KEY_Dring_accent 0x1000FEB0 #define XKB_KEY_Dcircumflex_accent 0x1000FE5E #define XKB_KEY_Dcedilla_accent 0x1000FE2C #define XKB_KEY_Dacute_accent 0x1000FE27 #define XKB_KEY_Dgrave_accent 0x1000FE60 #define XKB_KEY_Dtilde 0x1000FE7E #define XKB_KEY_Ddiaeresis 0x1000FE22 /* special keysym for LK2** "Remove" key on editing keypad */ #define XKB_KEY_DRemove 0x1000FF00 /* Remove */ /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Hewlett Packard or Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. */ #define XKB_KEY_hpClearLine 0x1000FF6F #define XKB_KEY_hpInsertLine 0x1000FF70 #define XKB_KEY_hpDeleteLine 0x1000FF71 #define XKB_KEY_hpInsertChar 0x1000FF72 #define XKB_KEY_hpDeleteChar 0x1000FF73 #define XKB_KEY_hpBackTab 0x1000FF74 #define XKB_KEY_hpKP_BackTab 0x1000FF75 #define XKB_KEY_hpModelock1 0x1000FF48 #define XKB_KEY_hpModelock2 0x1000FF49 #define XKB_KEY_hpReset 0x1000FF6C #define XKB_KEY_hpSystem 0x1000FF6D #define XKB_KEY_hpUser 0x1000FF6E #define XKB_KEY_hpmute_acute 0x100000A8 #define XKB_KEY_hpmute_grave 0x100000A9 #define XKB_KEY_hpmute_asciicircum 0x100000AA #define XKB_KEY_hpmute_diaeresis 0x100000AB #define XKB_KEY_hpmute_asciitilde 0x100000AC #define XKB_KEY_hplira 0x100000AF #define XKB_KEY_hpguilder 0x100000BE #define XKB_KEY_hpYdiaeresis 0x100000EE #define XKB_KEY_hpIO 0x100000EE #define XKB_KEY_hplongminus 0x100000F6 #define XKB_KEY_hpblock 0x100000FC #define XKB_KEY_osfCopy 0x1004FF02 #define XKB_KEY_osfCut 0x1004FF03 #define XKB_KEY_osfPaste 0x1004FF04 #define XKB_KEY_osfBackTab 0x1004FF07 #define XKB_KEY_osfBackSpace 0x1004FF08 #define XKB_KEY_osfClear 0x1004FF0B #define XKB_KEY_osfEscape 0x1004FF1B #define XKB_KEY_osfAddMode 0x1004FF31 #define XKB_KEY_osfPrimaryPaste 0x1004FF32 #define XKB_KEY_osfQuickPaste 0x1004FF33 #define XKB_KEY_osfPageLeft 0x1004FF40 #define XKB_KEY_osfPageUp 0x1004FF41 #define XKB_KEY_osfPageDown 0x1004FF42 #define XKB_KEY_osfPageRight 0x1004FF43 #define XKB_KEY_osfActivate 0x1004FF44 #define XKB_KEY_osfMenuBar 0x1004FF45 #define XKB_KEY_osfLeft 0x1004FF51 #define XKB_KEY_osfUp 0x1004FF52 #define XKB_KEY_osfRight 0x1004FF53 #define XKB_KEY_osfDown 0x1004FF54 #define XKB_KEY_osfEndLine 0x1004FF57 #define XKB_KEY_osfBeginLine 0x1004FF58 #define XKB_KEY_osfEndData 0x1004FF59 #define XKB_KEY_osfBeginData 0x1004FF5A #define XKB_KEY_osfPrevMenu 0x1004FF5B #define XKB_KEY_osfNextMenu 0x1004FF5C #define XKB_KEY_osfPrevField 0x1004FF5D #define XKB_KEY_osfNextField 0x1004FF5E #define XKB_KEY_osfSelect 0x1004FF60 #define XKB_KEY_osfInsert 0x1004FF63 #define XKB_KEY_osfUndo 0x1004FF65 #define XKB_KEY_osfMenu 0x1004FF67 #define XKB_KEY_osfCancel 0x1004FF69 #define XKB_KEY_osfHelp 0x1004FF6A #define XKB_KEY_osfSelectAll 0x1004FF71 #define XKB_KEY_osfDeselectAll 0x1004FF72 #define XKB_KEY_osfReselect 0x1004FF73 #define XKB_KEY_osfExtend 0x1004FF74 #define XKB_KEY_osfRestore 0x1004FF78 #define XKB_KEY_osfDelete 0x1004FFFF /************************************************************** * The use of the following macros is deprecated. * They are listed below only for backwards compatibility. */ #define XKB_KEY_Reset 0x1000FF6C #define XKB_KEY_System 0x1000FF6D #define XKB_KEY_User 0x1000FF6E #define XKB_KEY_ClearLine 0x1000FF6F #define XKB_KEY_InsertLine 0x1000FF70 #define XKB_KEY_DeleteLine 0x1000FF71 #define XKB_KEY_InsertChar 0x1000FF72 #define XKB_KEY_DeleteChar 0x1000FF73 #define XKB_KEY_BackTab 0x1000FF74 #define XKB_KEY_KP_BackTab 0x1000FF75 #define XKB_KEY_Ext16bit_L 0x1000FF76 #define XKB_KEY_Ext16bit_R 0x1000FF77 #define XKB_KEY_mute_acute 0x100000a8 #define XKB_KEY_mute_grave 0x100000a9 #define XKB_KEY_mute_asciicircum 0x100000aa #define XKB_KEY_mute_diaeresis 0x100000ab #define XKB_KEY_mute_asciitilde 0x100000ac #define XKB_KEY_lira 0x100000af #define XKB_KEY_guilder 0x100000be #define XKB_KEY_IO 0x100000ee #define XKB_KEY_longminus 0x100000f6 #define XKB_KEY_block 0x100000fc #endif libtsm-4.0.2/src/000077500000000000000000000000001420363367700136115ustar00rootroot00000000000000libtsm-4.0.2/src/CMakeLists.txt000066400000000000000000000001461420363367700163520ustar00rootroot00000000000000add_subdirectory(shared) add_subdirectory(tsm) if(BUILD_GTKTSM) add_subdirectory(gtktsm) endif() libtsm-4.0.2/src/config.h.in000066400000000000000000000003041420363367700156310ustar00rootroot00000000000000#ifndef LIBTSM_CONFIG_H #define LIBTSM_CONFIG_H /* Enable debug mode */ #cmakedefine BUILD_ENABLE_DEBUG /* Have xkbcommon library */ #cmakedefine BUILD_HAVE_XKBCOMMON #endif // LIBTSM_CONFIG_H libtsm-4.0.2/src/gtktsm/000077500000000000000000000000001420363367700151225ustar00rootroot00000000000000libtsm-4.0.2/src/gtktsm/CMakeLists.txt000066400000000000000000000007421420363367700176650ustar00rootroot00000000000000# # GtkTsm - Example # add_executable(gtktsm gtktsm.c gtktsm-app.c gtktsm-terminal.c gtktsm-win.c ) target_link_libraries(gtktsm PRIVATE tsm m PkgConfig::GTK3 PkgConfig::Cairo PkgConfig::Pango PkgConfig::PangoCairo XKB::XKBCommon ) target_link_object_libraries(gtktsm PRIVATE shl ) add_libtsm_compile_options(gtktsm) install(TARGETS gtktsm RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ) libtsm-4.0.2/src/gtktsm/gtktsm-app.c000066400000000000000000000126671420363367700173710ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include #include #include #include "gtktsm-app.h" #include "gtktsm-win.h" #include "shl-macro.h" struct _GtkTsmApp { GtkApplication parent; }; struct _GtkTsmAppClass { GtkApplicationClass parent_class; }; G_DEFINE_TYPE(GtkTsmApp, gtktsm_app, GTK_TYPE_APPLICATION); static gboolean arg_version; static GOptionEntry app_options[] = { { "version", 0, 0, G_OPTION_ARG_NONE, &arg_version, "Show version information and exit", NULL }, { "font", 0, 0, G_OPTION_ARG_STRING, NULL, "Terminal font", "FONT" }, { "sb-size", 0, 0, G_OPTION_ARG_INT, NULL, "Scroll-back buffer size in lines", "COUNT" }, { "anti-aliasing", 0, 0, G_OPTION_ARG_STRING, NULL, "Anti-aliasing mode for font rendering", "{none,gray,subpixel,default}" }, { "subpixel-order", 0, 0, G_OPTION_ARG_STRING, NULL, "Subpixel order for font rendering", "{rgb,bgr,vrgb,vbgr,default}" }, { "show-dirty", 0, 0, G_OPTION_ARG_NONE, NULL, "Mark dirty cells during redraw", NULL }, { "debug", 0, 0, G_OPTION_ARG_NONE, NULL, "Enable extensive live-debugging", NULL }, { NULL } }; static gint app_handle_local_options(GApplication *gapp, GVariantDict *opts) { if (arg_version) { g_print("GtkTsm\n"); return 0; } return -1; } static gint app_command_line(GApplication *gapp, GApplicationCommandLine *cmd) { GtkTsmApp *app = GTKTSM_APP(gapp); GtkTsmWin *win; GtkTsmTerminal *term; GVariantDict *dict; const gchar *sval; GVariant *val; int r; win = gtktsm_win_new(app); term = gtktsm_win_get_terminal(win); dict = g_application_command_line_get_options_dict(cmd); val = g_variant_dict_lookup_value(dict, "font", G_VARIANT_TYPE_STRING); if (val) g_object_set(G_OBJECT(term), "font", g_variant_get_string(val, NULL), NULL); val = g_variant_dict_lookup_value(dict, "sb-size", G_VARIANT_TYPE_INT32); if (val) g_object_set(G_OBJECT(term), "sb-size", shl_max(g_variant_get_int32(val), 0), NULL); val = g_variant_dict_lookup_value(dict, "anti-aliasing", G_VARIANT_TYPE_STRING); if (val) { sval = g_variant_get_string(val, NULL); if (strcmp(sval, "none") && strcmp(sval, "gray") && strcmp(sval, "subpixel") && strcmp(sval, "default")) { g_application_command_line_printerr(cmd, "invalid anti-aliasing argument: %s\n", sval); r = 1; goto error; } g_object_set(G_OBJECT(term), "anti-aliasing", sval, NULL); } val = g_variant_dict_lookup_value(dict, "subpixel-order", G_VARIANT_TYPE_STRING); if (val) { sval = g_variant_get_string(val, NULL); if (strcmp(sval, "rgb") && strcmp(sval, "bgr") && strcmp(sval, "vrgb") && strcmp(sval, "vbgr") && strcmp(sval, "default")) { g_application_command_line_printerr(cmd, "invalid subpixel-order argument: %s\n", sval); r = 1; goto error; } g_object_set(G_OBJECT(term), "subpixel-order", sval, NULL); } val = g_variant_dict_lookup_value(dict, "show-dirty", G_VARIANT_TYPE_BOOLEAN); if (val) g_object_set(G_OBJECT(term), "show-dirty", g_variant_get_boolean(val), NULL); val = g_variant_dict_lookup_value(dict, "debug", G_VARIANT_TYPE_BOOLEAN); if (val) g_object_set(G_OBJECT(term), "debug", g_variant_get_boolean(val), NULL); gtktsm_win_run(win); gtk_window_present(GTK_WINDOW(win)); return 0; error: gtk_widget_destroy(GTK_WIDGET(win)); return r; } static void app_activate(GApplication *gapp) { GtkTsmApp *app = GTKTSM_APP(gapp); GtkTsmWin *win; win = gtktsm_win_new(app); gtktsm_win_run(win); gtk_window_present(GTK_WINDOW(win)); } static void gtktsm_app_init(GtkTsmApp *app) { g_application_add_main_option_entries(G_APPLICATION(app), app_options); } static void gtktsm_app_class_init(GtkTsmAppClass *klass) { GApplicationClass *gapp_klass; gapp_klass = G_APPLICATION_CLASS(klass); gapp_klass->handle_local_options = app_handle_local_options; gapp_klass->command_line = app_command_line; gapp_klass->activate = app_activate; } GtkTsmApp *gtktsm_app_new(void) { return g_object_new(GTKTSM_APP_TYPE, "application-id", "org.freedesktop.libtsm.gtktsm", "flags", G_APPLICATION_SEND_ENVIRONMENT | G_APPLICATION_HANDLES_COMMAND_LINE, NULL); } libtsm-4.0.2/src/gtktsm/gtktsm-app.h000066400000000000000000000031011420363367700173550ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #ifndef GTKTSM_APP_H #define GTKTSM_APP_H #include #include typedef struct _GtkTsmApp GtkTsmApp; typedef struct _GtkTsmAppClass GtkTsmAppClass; #define GTKTSM_APP_TYPE (gtktsm_app_get_type()) #define GTKTSM_APP(_obj) (G_TYPE_CHECK_INSTANCE_CAST((_obj), \ GTKTSM_APP_TYPE, \ GtkTsmApp)) GType gtktsm_app_get_type(void); GtkTsmApp *gtktsm_app_new(void); #endif /* GTKTSM_APP_H */ libtsm-4.0.2/src/gtktsm/gtktsm-terminal.c000066400000000000000000001343321420363367700204160ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #define G_LOG_DOMAIN "GtkTsm" #include #include #include #include #include #include #include #include #include #include #include #include #include #include "gtktsm-terminal.h" #include "shl-htable.h" #include "shl-llog.h" #include "shl-macro.h" #include "shl-pty.h" /* * Glyph Renderer * With terminal-emulators, we have the problem that our grid is fixed. * Existing text-renderers want to apply kerning and other heuristics to * render fonts properly. We cannot do that. Therefore, we render each glyph * separately and provide them as single-glyph objects to the upper layers. * * We also do some heuristics to calculate the real font-metrics. Most fonts * are not mono-space, so they don't provide any generic metrics. We therefore * render the ASCII glyphs and some more one-column glyphs to get a proper * global metric for the font. */ struct gtktsm_font { unsigned long ref; PangoFontMap *map; }; struct gtktsm_face { unsigned long ref; struct gtktsm_font *font; PangoContext *ctx; cairo_antialias_t aa; cairo_subpixel_order_t subpixel; struct shl_htable glyphs; unsigned int width; unsigned int height; unsigned int baseline; unsigned int line_thickness; unsigned int underline_pos; unsigned int strikethrough_pos; }; enum gtktsm_glyph_format { GTKTSM_GLYPH_INVALID, GTKTSM_GLYPH_A1, GTKTSM_GLYPH_A8, GTKTSM_GLYPH_XRGB32, }; struct gtktsm_glyph { unsigned long id; unsigned int cwidth; unsigned int format; unsigned int width; int stride; unsigned int height; uint8_t *buffer; cairo_surface_t *surface; }; #define gtktsm_glyph_from_id(_id) \ shl_htable_offsetof((_id), struct gtktsm_glyph, id) static void gtktsm_face_free(struct gtktsm_face *face); static void gtktsm_glyph_free(struct gtktsm_glyph *glyph); static int gtktsm_font_new(struct gtktsm_font **out) { _shl_free_ struct gtktsm_font *font = NULL; if (!out) return -EINVAL; font = calloc(1, sizeof(*font)); if (!font) return -ENOMEM; font->ref = 1; font->map = pango_cairo_font_map_get_default(); if (font->map) { g_object_ref(font->map); } else { font->map = pango_cairo_font_map_new(); if (!font->map) return -ENOMEM; } *out = font; font = NULL; return 0; } static void gtktsm_font_ref(struct gtktsm_font *font) { if (!font || !font->ref) return; ++font->ref; } static void gtktsm_font_unref(struct gtktsm_font *font) { if (!font || !font->ref || --font->ref) return; g_object_unref(font->map); free(font); } static void init_pango_desc(PangoFontDescription *desc, int desc_size, int desc_bold, int desc_italic) { PangoFontMask mask; int v; if (desc_size >= 0) { v = desc_size * PANGO_SCALE; if (desc_size > 0 && v > 0) pango_font_description_set_absolute_size(desc, v); } if (desc_bold >= 0) { v = desc_bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL; pango_font_description_set_weight(desc, v); } if (desc_italic >= 0) { v = desc_italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL; pango_font_description_set_style(desc, v); } pango_font_description_set_variant(desc, PANGO_VARIANT_NORMAL); pango_font_description_set_stretch(desc, PANGO_STRETCH_NORMAL); pango_font_description_set_gravity(desc, PANGO_GRAVITY_SOUTH); mask = pango_font_description_get_set_fields(desc); if (!(mask & PANGO_FONT_MASK_FAMILY)) pango_font_description_set_family(desc, "monospace"); if (!(mask & PANGO_FONT_MASK_WEIGHT)) pango_font_description_set_weight(desc, PANGO_WEIGHT_NORMAL); if (!(mask & PANGO_FONT_MASK_STYLE)) pango_font_description_set_style(desc, PANGO_STYLE_NORMAL); if (!(mask & PANGO_FONT_MASK_SIZE)) pango_font_description_set_size(desc, 10 * PANGO_SCALE); } static void measure_pango(struct gtktsm_face *face) { static const char str[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "@!\"$%&/()=?\\}][{°^~+*#'<>|-_.:,;`´"; static const size_t str_len = sizeof(str) - 1; PangoLayout *layout; PangoRectangle rec; unsigned int thick, upos, spos; /* * There is no way to check whether a font is a monospace font. * Moreover, there is no "monospace extents" field of fonts that we can * use to calculate a suitable cell size. Any bounding-boxes provided * by the fonts are mostly useless for cell-size computations. * Therefore, we simply render a bunch of ASCII characters and compute * the cell-size from these. If you passed a monospace font, it will * work out greatly. If you passed some other font, you will get a * suitable tradeoff (well, don't do that..). */ layout = pango_layout_new(face->ctx); pango_layout_set_height(layout, 0); pango_layout_set_spacing(layout, 0); pango_layout_set_text(layout, str, str_len); pango_layout_get_pixel_extents(layout, NULL, &rec); /* We use an example layout to render a bunch of ASCII characters in a * single line. The height and baseline of the resulting extents can be * copied unchanged into the face. For the width we calculate the * average (rounding up). */ face->width = (rec.width + (str_len - 1)) / str_len; face->height = rec.height; face->baseline = PANGO_PIXELS_CEIL(pango_layout_get_baseline(layout)); /* heuristics to calculate underline/strikethrough positions */ thick = shl_min((face->height - face->baseline) / 2, face->height / 14); thick = shl_max(thick, 1U); upos = shl_min(face->baseline + thick, face->height - thick); spos = face->baseline - face->height / 4; face->line_thickness = thick; face->underline_pos = upos; face->strikethrough_pos = spos; g_object_unref(layout); } static int init_pango(struct gtktsm_face *face, const char *desc_str, int desc_size, int desc_bold, int desc_italic, cairo_antialias_t aa, cairo_subpixel_order_t subpixel) { PangoFontDescription *desc; cairo_font_options_t *options; /* set context options */ pango_context_set_base_dir(face->ctx, PANGO_DIRECTION_LTR); pango_context_set_language(face->ctx, pango_language_get_default()); /* set font description */ desc = pango_font_description_from_string(desc_str); init_pango_desc(desc, desc_size, desc_bold, desc_italic); pango_context_set_font_description(face->ctx, desc); pango_font_description_free(desc); /* set anti-aliasing */ options = cairo_font_options_create(); if (cairo_font_options_status(options) != CAIRO_STATUS_SUCCESS) return -ENOMEM; cairo_font_options_set_antialias(options, aa); cairo_font_options_set_subpixel_order(options, subpixel); pango_cairo_context_set_font_options(face->ctx, options); cairo_font_options_destroy(options); /* measure font */ measure_pango(face); if (!face->width || !face->height) return -EINVAL; return 0; } static int gtktsm_face_new(struct gtktsm_face **out, struct gtktsm_font *font, const char *desc_str, int desc_size, int desc_bold, int desc_italic, cairo_antialias_t aa, cairo_subpixel_order_t subpixel) { struct gtktsm_face *face; int r; if (!out || !font || !desc_str) return -EINVAL; face = calloc(1, sizeof(*face)); if (!face) return -ENOMEM; face->font = font; gtktsm_font_ref(face->font); shl_htable_init_ulong(&face->glyphs); face->ctx = pango_font_map_create_context(font->map); face->aa = aa; face->subpixel = subpixel; r = init_pango(face, desc_str, desc_size, desc_bold, desc_italic, aa, subpixel); if (r < 0) goto error; *out = face; return 0; error: gtktsm_face_free(face); return r; } static void free_glyph(unsigned long *elem, void *ctx) { gtktsm_glyph_free(gtktsm_glyph_from_id(elem)); } static void gtktsm_face_free(struct gtktsm_face *face) { if (!face) return; if (face->ctx) g_object_unref(face->ctx); shl_htable_clear_ulong(&face->glyphs, free_glyph, NULL); gtktsm_font_unref(face->font); free(face); } static unsigned int c2f(cairo_format_t format) { switch (format) { case CAIRO_FORMAT_A1: return GTKTSM_GLYPH_A1; case CAIRO_FORMAT_A8: return GTKTSM_GLYPH_A8; case CAIRO_FORMAT_RGB24: return GTKTSM_GLYPH_XRGB32; default: return GTKTSM_GLYPH_INVALID; } } static int create_glyph(struct gtktsm_face *face, struct gtktsm_glyph *glyph, const uint32_t *ch, size_t len) { PangoLayoutLine *line; cairo_surface_t *surface; PangoRectangle rec; cairo_format_t format; PangoLayout *layout; cairo_t *cr; size_t cnt; glong ulen; char *val; int r; switch (face->aa) { case CAIRO_ANTIALIAS_NONE: format = CAIRO_FORMAT_A1; break; case CAIRO_ANTIALIAS_GRAY: format = CAIRO_FORMAT_A8; break; case CAIRO_ANTIALIAS_SUBPIXEL: /* fallthrough */ default: format = CAIRO_FORMAT_RGB24; break; } glyph->format = c2f(format); glyph->width = face->width * glyph->cwidth; glyph->stride = cairo_format_stride_for_width(format, glyph->width); glyph->height = face->height; glyph->buffer = calloc(1, glyph->stride * glyph->height); if (!glyph->buffer) return -ENOMEM; surface = cairo_image_surface_create_for_data(glyph->buffer, format, glyph->width, glyph->height, glyph->stride); if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { r = -ENOMEM; goto err_buffer; } cr = cairo_create(surface); if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) { r = -ENOMEM; goto err_surface; } pango_cairo_update_context(cr, face->ctx); layout = pango_layout_new(face->ctx); val = g_ucs4_to_utf8(ch, len, NULL, &ulen, NULL); if (!val) { r = -ERANGE; goto err_layout; } /* render one line only */ pango_layout_set_height(layout, 0); /* no line spacing */ pango_layout_set_spacing(layout, 0); /* set text to char [+combining-chars] */ pango_layout_set_text(layout, val, ulen); g_free(val); cnt = pango_layout_get_line_count(layout); if (cnt == 0) { r = -ERANGE; goto err_layout; } line = pango_layout_get_line_readonly(layout, 0); pango_layout_line_get_pixel_extents(line, NULL, &rec); cairo_move_to(cr, -rec.x, face->baseline), cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); pango_cairo_show_layout_line(cr, line); g_object_unref(layout); cairo_destroy(cr); glyph->surface = surface; return 0; err_layout: g_object_unref(layout); cairo_destroy(cr); err_surface: cairo_surface_destroy(surface); err_buffer: free(glyph->buffer); glyph->buffer = NULL; return r; } static int gtktsm_face_render(struct gtktsm_face *face, struct gtktsm_glyph **out, unsigned long id, const uint32_t *ch, size_t len, size_t cwidth) { struct gtktsm_glyph *glyph; unsigned long *gid; bool b; int r; if (!face || !out) return -EINVAL; b = shl_htable_lookup_ulong(&face->glyphs, id, &gid); if (b) { *out = gtktsm_glyph_from_id(gid); return 0; } if (!len || !ch || !cwidth) return -EINVAL; glyph = calloc(1, sizeof(*glyph)); if (!glyph) return -ENOMEM; glyph->id = id; glyph->cwidth = cwidth; r = create_glyph(face, glyph, ch, len); if (r < 0) goto error; r = shl_htable_insert_ulong(&face->glyphs, &glyph->id); if (r < 0) goto error; *out = glyph; return 0; error: gtktsm_glyph_free(glyph); return r; } static void gtktsm_glyph_free(struct gtktsm_glyph *glyph) { if (glyph->surface) cairo_surface_destroy(glyph->surface); free(glyph->buffer); free(glyph); } /* * Cell Renderer * Gtk uses cairo for rendering. Unfortunately, cairo isn't very suitable for * terminal/cell rendering. Rendering each glyph separately causes like 10 * function calls per cell. Therefore, we render our terminal into a shadow * buffer and only tell cairo to blit it onto the widget-buffer. */ struct gtktsm_renderer { unsigned int width; unsigned int height; int stride; uint8_t *data; cairo_surface_t *surface; tsm_age_t age; }; struct gtktsm_renderer_ctx { struct gtktsm_renderer *rend; cairo_t *cr; struct tsm_screen *screen; struct tsm_vte *vte; struct gtktsm_face *face_regular; struct gtktsm_face *face_bold; struct gtktsm_face *face_italic; struct gtktsm_face *face_bold_italic; unsigned int cell_width; unsigned int cell_height; bool debug; }; static int renderer_realloc(struct gtktsm_renderer *rend, unsigned int width, unsigned int height) { int stride; uint8_t *data; cairo_surface_t *surface; if (!width) width = 1; if (!height) height = 1; stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); data = malloc(abs(stride * height)); if (!data) return -ENOMEM; surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, width, height, stride); if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy(surface); free(data); return -ENOMEM; } if (rend->data) { cairo_surface_destroy(rend->surface); free(rend->data); } rend->width = width; rend->height = height; rend->stride = stride; rend->data = data; rend->surface = surface; rend->age = 0; return 0; } static int gtktsm_renderer_new(struct gtktsm_renderer **out, unsigned int width, unsigned int height) { struct gtktsm_renderer *rend; int r; if (!out) return -EINVAL; rend = calloc(1, sizeof(*rend)); if (!rend) return -ENOMEM; r = renderer_realloc(rend, width, height); if (r < 0) goto err_rend; *out = rend; return 0; err_rend: free(rend); return r; } static void gtktsm_renderer_free(struct gtktsm_renderer *rend) { if (!rend) return; cairo_surface_destroy(rend->surface); free(rend->data); free(rend); } static int gtktsm_renderer_resize(struct gtktsm_renderer *rend, unsigned int width, unsigned int height) { if (!rend) return -EINVAL; return renderer_realloc(rend, width, height); } static void renderer_fill(struct gtktsm_renderer *rend, unsigned int x, unsigned int y, unsigned int width, unsigned int height, uint8_t br, uint8_t bg, uint8_t bb) { unsigned int i, tmp; uint8_t *dst; uint32_t out; /* clip width */ tmp = x + width; if (tmp <= x || x >= rend->width) return; if (tmp > rend->width) width = rend->width - x; /* clip height */ tmp = y + height; if (tmp <= y || y >= rend->height) return; if (tmp > rend->height) height = rend->height - y; /* prepare */ dst = rend->data; dst = &dst[y * rend->stride + x * 4]; out = (0xff << 24) | (br << 16) | (bg << 8) | bb; /* fill buffer */ while (height--) { for (i = 0; i < width; ++i) ((uint32_t*)dst)[i] = out; dst += rend->stride; } } /* used for debugging; draws a border on the given rectangle */ static void renderer_highlight(struct gtktsm_renderer *rend, unsigned int x, unsigned int y, unsigned int width, unsigned int height) { unsigned int i, j, tmp; uint8_t *dst; uint32_t out; /* clip width */ tmp = x + width; if (tmp <= x || x >= rend->width) return; if (tmp > rend->width) width = rend->width - x; /* clip height */ tmp = y + height; if (tmp <= y || y >= rend->height) return; if (tmp > rend->height) height = rend->height - y; /* prepare */ dst = rend->data; dst = &dst[y * rend->stride + x * 4]; out = (0xff << 24) | (0xd0 << 16) | (0x10 << 8) | 0x10; /* draw outline into buffer */ for (i = 0; i < height; ++i) { ((uint32_t*)dst)[0] = out; ((uint32_t*)dst)[width - 1] = out; if (!i || i + 1 == height) { for (j = 0; j < width; ++j) ((uint32_t*)dst)[j] = out; } dst += rend->stride; } } static void renderer_blend_a1(uint8_t *dst, unsigned int dst_stride, const uint8_t *src, unsigned int src_stride, unsigned int width, unsigned int height, uint8_t fr, uint8_t fg, uint8_t fb, uint8_t br, uint8_t bg, uint8_t bb) { unsigned int i; uint32_t out; uint_fast32_t r, g, b; while (height--) { for (i = 0; i < width; ++i) { if (src[i / 8] & (1 << (i % 8))) { r = fr; g = fg; b = fb; } else { r = br; g = bg; b = bb; } out = (0xff << 24) | (r << 16) | (g << 8) | b; ((uint32_t*)dst)[i] = out; } dst += dst_stride; src += src_stride; } } static void renderer_blend_a8(uint8_t *dst, unsigned int dst_stride, const uint8_t *src, unsigned int src_stride, unsigned int width, unsigned int height, uint8_t fr, uint8_t fg, uint8_t fb, uint8_t br, uint8_t bg, uint8_t bb) { unsigned int i; uint32_t out; uint_fast32_t r, g, b; while (height--) { for (i = 0; i < width; ++i) { if (src[i] == 0) { r = br; g = bg; b = bb; } else if (src[i] == 255) { r = fr; g = fg; b = fb; } else { /* Division by 255 (t /= 255) is done with: * t += 0x80 * t = (t + (t >> 8)) >> 8 * This speeds up the computation by ~20% as * the division is skipped. */ r = fr * src[i] + br * (255 - src[i]); r += 0x80; r = (r + (r >> 8)) >> 8; g = fg * src[i] + bg * (255 - src[i]); g += 0x80; g = (g + (g >> 8)) >> 8; b = fb * src[i] + bb * (255 - src[i]); b += 0x80; b = (b + (b >> 8)) >> 8; } out = (0xff << 24) | (r << 16) | (g << 8) | b; ((uint32_t*)dst)[i] = out; } dst += dst_stride; src += src_stride; } } static void renderer_blend_xrgb32(uint8_t *dst, unsigned int dst_stride, const uint8_t *src, unsigned int src_stride, unsigned int width, unsigned int height, uint8_t fr, uint8_t fg, uint8_t fb, uint8_t br, uint8_t bg, uint8_t bb) { unsigned int i; uint32_t out, mask; uint_fast32_t r, g, b; uint_fast8_t rm, gm, bm; while (height--) { for (i = 0; i < width; ++i) { mask = *(uint32_t*)&src[i * 4]; rm = (mask & 0x00ff0000) >> 16; gm = (mask & 0x0000ff00) >> 8; bm = mask & 0x000000ff; /* Division by 255 (t /= 255) is done with: * t += 0x80 * t = (t + (t >> 8)) >> 8 * This speeds up the computation by ~20% as * the division is skipped. */ if (rm == 0) { r = br; } else if (rm == 255) { r = fr; } else { r = fr * rm + br * (255 - rm); r += 0x80; r = (r + (r >> 8)) >> 8; } if (gm == 0) { g = bg; } else if (gm == 255) { g = fg; } else { g = fg * gm + bg * (255 - gm); g += 0x80; g = (g + (g >> 8)) >> 8; } if (bm == 0) { b = bb; } else if (bm == 255) { b = fb; } else { b = fb * bm + bb * (255 - bm); b += 0x80; b = (b + (b >> 8)) >> 8; } out = (0xff << 24) | (r << 16) | (g << 8) | b; ((uint32_t*)dst)[i] = out; } dst += dst_stride; src += src_stride; } } static void renderer_blend(struct gtktsm_renderer *rend, const struct gtktsm_glyph *glyph, unsigned int x, unsigned int y, uint8_t fr, uint8_t fg, uint8_t fb, uint8_t br, uint8_t bg, uint8_t bb) { unsigned int tmp, width, height; const uint8_t *src; uint8_t *dst; /* clip width */ tmp = x + glyph->width; if (tmp <= x || x >= rend->width) return; if (tmp > rend->width) width = rend->width - x; else width = glyph->width; /* clip height */ tmp = y + glyph->height; if (tmp <= y || y >= rend->height) return; if (tmp > rend->height) height = rend->height - y; else height = glyph->height; /* prepare */ dst = rend->data; dst = &dst[y * rend->stride + x * 4]; src = glyph->buffer; switch (glyph->format) { case GTKTSM_GLYPH_A1: renderer_blend_a1(dst, rend->stride, src, glyph->stride, width, height, fr, fg, fb, br, bg, bb); break; case GTKTSM_GLYPH_A8: renderer_blend_a8(dst, rend->stride, src, glyph->stride, width, height, fr, fg, fb, br, bg, bb); break; case GTKTSM_GLYPH_XRGB32: renderer_blend_xrgb32(dst, rend->stride, src, glyph->stride, width, height, fr, fg, fb, br, bg, bb); break; default: g_error("invalid glyph format: %d", glyph->format); break; } } static int renderer_draw_cell(struct tsm_screen *screen, uint64_t id, const uint32_t *ch, size_t len, unsigned int cwidth, unsigned int posx, unsigned int posy, const struct tsm_screen_attr *attr, tsm_age_t age, void *data) { const struct gtktsm_renderer_ctx *ctx = data; struct gtktsm_renderer *rend = ctx->rend; struct gtktsm_face *face; uint8_t fr, fg, fb, br, bg, bb; unsigned int x, y; struct gtktsm_glyph *glyph; bool skip; int r; /* Skip if our age and the cell age is non-zero *and* the cell-age is * smaller than our age. */ skip = age && rend->age && age <= rend->age; if (skip && !ctx->debug) return 0; x = posx * ctx->cell_width; y = posy * ctx->cell_height; /* invert colors if requested */ if (attr->inverse) { fr = attr->br; fg = attr->bg; fb = attr->bb; br = attr->fr; bg = attr->fg; bb = attr->fb; } else { fr = attr->fr; fg = attr->fg; fb = attr->fb; br = attr->br; bg = attr->bg; bb = attr->bb; } /* select correct font */ if (attr->bold && ctx->face_bold) face = ctx->face_bold; else if (attr->italic && ctx->face_italic) face = ctx->face_italic; else face = ctx->face_regular; /* !len means background-only */ if (!len) { renderer_fill(rend, x, y, ctx->cell_width * cwidth, ctx->cell_height, br, bg, bb); } else { r = gtktsm_face_render(face, &glyph, id, ch, len, cwidth); if (r < 0) renderer_fill(rend, x, y, ctx->cell_width * cwidth, ctx->cell_height, br, bg, bb); else renderer_blend(rend, glyph, x, y, fr, fg, fb, br, bg, bb); } if (attr->underline) renderer_fill(rend, x, y + face->underline_pos, ctx->cell_width * cwidth, face->line_thickness, fr, fg, fb); if (!skip && ctx->debug) renderer_highlight(rend, x, y, ctx->cell_width * cwidth, ctx->cell_height); return 0; } static void gtktsm_renderer_draw(const struct gtktsm_renderer_ctx *ctx) { struct gtktsm_renderer *rend = ctx->rend; struct tsm_screen_attr attr; unsigned int w, h; /* cairo is *way* too slow to render all masks efficiently. Therefore, * we render all glyphs into a shadow buffer on the CPU and then tell * cairo to blit it into the gtk buffer. This way we get two mem-writes * but at least it's fast enough to render a whole screen. */ cairo_surface_flush(rend->surface); rend->age = tsm_screen_draw(ctx->screen, renderer_draw_cell, (void*)ctx); cairo_surface_mark_dirty(rend->surface); cairo_set_source_surface(ctx->cr, rend->surface, 0, 0); cairo_paint(ctx->cr); /* draw padding */ w = tsm_screen_get_width(ctx->screen); h = tsm_screen_get_height(ctx->screen); tsm_vte_get_def_attr(ctx->vte, &attr); cairo_set_source_rgb(ctx->cr, attr.br / 255.0, attr.bg / 255.0, attr.bb / 255.0); cairo_move_to(ctx->cr, w * ctx->cell_width, 0); cairo_line_to(ctx->cr, w * ctx->cell_width, h * ctx->cell_height); cairo_line_to(ctx->cr, 0, h * ctx->cell_height); cairo_line_to(ctx->cr, 0, rend->height); cairo_line_to(ctx->cr, rend->width, rend->height); cairo_line_to(ctx->cr, rend->width, 0); cairo_close_path(ctx->cr); cairo_fill(ctx->cr); } /* * GtkTsmTerminal Widget * The GtkTsmTerminal widget is very similar to libvte. It uses libtsm and * the other helpers here to implement a Gtk widget that displays a terminal * emulator. * * The creator of the widget has exclusive control over the PTY process, as it * returns after fork() and before doing any exec(). */ typedef struct _GtkTsmTerminalPrivate { /* child objects */ struct gtktsm_renderer *rend; struct gtktsm_font *font; struct tsm_screen *screen; struct tsm_vte *vte; /* pty bridge */ int pty_bridge; GIOChannel *bridge_chan; guint bridge_src; /* properties */ char *prop_font; cairo_antialias_t prop_aa; cairo_subpixel_order_t prop_subpixel; unsigned int prop_sb_size; /* font faces */ struct gtktsm_face *face_regular; struct gtktsm_face *face_bold; struct gtktsm_face *face_italic; struct gtktsm_face *face_bold_italic; /* selection */ unsigned int sel; guint32 sel_start; gdouble sel_x; gdouble sel_y; /* pty */ struct shl_pty *pty; guint child_src; guint idle_src; /* cache */ GdkKeymap *keymap; unsigned int width; unsigned int height; unsigned int columns; unsigned int rows; bool realized : 1; bool show_dirty : 1; bool debug : 1; } GtkTsmTerminalPrivate; enum { TERMINAL_PROP_0, TERMINAL_PROP_FONT, TERMINAL_PROP_SB_SIZE, TERMINAL_PROP_ANTI_ALIASING, TERMINAL_PROP_SUBPIXEL_ORDER, TERMINAL_PROP_SHOW_DIRTY, TERMINAL_PROP_DEBUG, TERMINAL_PROP_CNT, }; enum { TERMINAL_SIGNAL_CHANGED, TERMINAL_SIGNAL_STOPPED, TERMINAL_SIGNAL_TITLE, TERMINAL_SIGNAL_CNT, }; static GParamSpec *terminal_props[TERMINAL_PROP_CNT]; static guint terminal_signals[TERMINAL_SIGNAL_CNT]; G_DEFINE_TYPE_WITH_PRIVATE(GtkTsmTerminal, gtktsm_terminal, GTK_TYPE_DRAWING_AREA); static void terminal_recalculate_cells(GtkTsmTerminal *term, unsigned int width, unsigned int height) { GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); p->width = width; p->height = height; if (p->face_regular && p->face_regular->width) p->columns = (p->width / p->face_regular->width) ? : 1; else p->columns = 1; if (p->face_regular && p->face_regular->height) p->rows = (p->height / p->face_regular->height) ? : 1; else p->rows = 1; } static void terminal_set_font(GtkTsmTerminal *term) { GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); struct gtktsm_face *regular; int r; r = gtktsm_face_new(®ular, p->font, p->prop_font, -1, 0, 0, p->prop_aa, p->prop_subpixel); if (r < 0) g_error("cannot initialize pango font face (desc: %s)", p->prop_font); gtktsm_face_free(p->face_regular); gtktsm_face_free(p->face_bold); gtktsm_face_free(p->face_italic); gtktsm_face_free(p->face_bold_italic); /* mandatory regular face */ p->face_regular = regular; /* optional bold face */ r = gtktsm_face_new(&p->face_bold, p->font, p->prop_font, -1, 1, 0, p->prop_aa, p->prop_subpixel); if (r < 0) p->face_bold = NULL; /* optional italic face */ r = gtktsm_face_new(&p->face_italic, p->font, p->prop_font, -1, 0, 1, p->prop_aa, p->prop_subpixel); if (r < 0) p->face_italic = NULL; /* optional bold, italic face */ r = gtktsm_face_new(&p->face_bold_italic, p->font, p->prop_font, -1, 1, 1, p->prop_aa, p->prop_subpixel); if (r < 0) p->face_bold_italic = NULL; terminal_recalculate_cells(term, p->width, p->height); gtk_widget_queue_draw(GTK_WIDGET(term)); } static gboolean terminal_configure_fn(GtkWidget *widget, GdkEvent *ev, gpointer data) { GtkTsmTerminal *term = GTKTSM_TERMINAL(widget); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); GdkEventConfigure *cev = (void*)ev; bool state_changed = false; GdkWindow *wnd; GdkEventMask mask; int r; terminal_recalculate_cells(term, cev->width, cev->height); r = gtktsm_renderer_resize(p->rend, p->width, p->height); if (r < 0) g_error("gtktsm_renderer_resize() failed: %d", r); r = tsm_screen_resize(p->screen, p->columns, p->rows); if (r < 0) g_error("tsm_screen_resize() failed: %d", r); if (p->pty) { r = shl_pty_resize(p->pty, p->columns, p->rows); if (r < 0) g_error("shl_pty_resize() failed: %d", r); } if (!p->realized) { p->realized = true; wnd = gtk_widget_get_window(widget); mask = gdk_window_get_events(wnd); mask |= GDK_KEY_PRESS_MASK; mask |= GDK_BUTTON_MOTION_MASK; mask |= GDK_BUTTON_PRESS_MASK; mask |= GDK_BUTTON_RELEASE_MASK; gdk_window_set_events(wnd, mask); } gtk_widget_queue_draw(widget); if (state_changed) g_signal_emit(term, terminal_signals[TERMINAL_SIGNAL_CHANGED], 0); return TRUE; } static gboolean terminal_draw_fn(GtkWidget *widget, cairo_t *cr, gpointer data) { GtkTsmTerminal *term = GTKTSM_TERMINAL(widget); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); struct gtktsm_renderer_ctx ctx; struct tsm_screen_attr attr; int64_t start, end; if (!p->face_regular) { tsm_vte_get_def_attr(p->vte, &attr); cairo_set_source_rgb(cr, attr.br / 255.0, attr.bg / 255.0, attr.bb / 255.0); cairo_paint(cr); return FALSE; } start = g_get_monotonic_time(); memset(&ctx, 0, sizeof(ctx)); ctx.debug = p->show_dirty; ctx.rend = p->rend; ctx.cr = cr; ctx.face_regular = p->face_regular; ctx.face_bold = p->face_bold; ctx.face_italic = p->face_italic; ctx.face_bold_italic = p->face_bold_italic; ctx.screen = p->screen; ctx.vte = p->vte; ctx.cell_width = p->face_regular->width; ctx.cell_height = p->face_regular->height; gtktsm_renderer_draw(&ctx); end = g_get_monotonic_time(); if (p->debug) g_message("frame rendered in: %lldms", (long long)((end - start) / 1000)); return FALSE; } #define ALL_MODS (GDK_SHIFT_MASK | GDK_LOCK_MASK | GDK_CONTROL_MASK | \ GDK_MOD1_MASK | GDK_MOD4_MASK) static gboolean terminal_key_fn(GtkWidget *widget, GdkEvent *ev, gpointer data) { GtkTsmTerminal *term = GTKTSM_TERMINAL(widget); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); GdkEventKey *e = (void*)ev; unsigned int mods = 0; gboolean b; GdkModifierType cmod; guint key; uint32_t ucs4; if (e->type != GDK_KEY_PRESS) return FALSE; if (e->state & GDK_SHIFT_MASK) mods |= TSM_SHIFT_MASK; if (e->state & GDK_LOCK_MASK) mods |= TSM_LOCK_MASK; if (e->state & GDK_CONTROL_MASK) mods |= TSM_CONTROL_MASK; if (e->state & GDK_MOD1_MASK) mods |= TSM_ALT_MASK; if (e->state & GDK_MOD4_MASK) mods |= TSM_LOGO_MASK; if (!p->keymap) p->keymap = gdk_keymap_get_for_display(gtk_widget_get_display(widget)); b = gdk_keymap_translate_keyboard_state(p->keymap, e->hardware_keycode, e->state, e->group, &key, NULL, NULL, &cmod); if (b) { if (key == GDK_KEY_Up && ((e->state & ~cmod & ALL_MODS) == GDK_SHIFT_MASK)) { tsm_screen_sb_up(p->screen, 1); gtk_widget_queue_draw(GTK_WIDGET(term)); return TRUE; } else if (key == GDK_KEY_Down && ((e->state & ~cmod & ALL_MODS) == GDK_SHIFT_MASK)) { tsm_screen_sb_down(p->screen, 1); gtk_widget_queue_draw(GTK_WIDGET(term)); return TRUE; } else if (key == GDK_KEY_Page_Up && ((e->state & ~cmod & ALL_MODS) == GDK_SHIFT_MASK)) { tsm_screen_sb_page_up(p->screen, 1); gtk_widget_queue_draw(GTK_WIDGET(term)); return TRUE; } else if (key == GDK_KEY_Page_Down && ((e->state & ~cmod & ALL_MODS) == GDK_SHIFT_MASK)) { tsm_screen_sb_page_down(p->screen, 1); gtk_widget_queue_draw(GTK_WIDGET(term)); return TRUE; } } ucs4 = xkb_keysym_to_utf32(e->keyval); if (!ucs4) ucs4 = TSM_VTE_INVALID; if (tsm_vte_handle_keyboard(p->vte, e->keyval, 0, mods, ucs4)) { tsm_screen_sb_reset(p->screen); gtk_widget_queue_draw(GTK_WIDGET(term)); return TRUE; } return FALSE; } static gboolean terminal_button_fn(GtkWidget *widget, GdkEvent *ev, gpointer data) { GtkTsmTerminal *term = GTKTSM_TERMINAL(widget); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); GdkEventButton *e = (void*)ev; unsigned int cell_width, cell_height; if (e->button != 1) return FALSE; if (!p->face_regular) return FALSE; cell_width = p->face_regular->width; cell_height = p->face_regular->height; if (e->type == GDK_BUTTON_PRESS) { p->sel = 1; p->sel_start = e->time; p->sel_x = e->x; p->sel_y = e->y; } else if (e->type == GDK_2BUTTON_PRESS) { p->sel = 2; /* TODO: select word */ tsm_screen_selection_start(p->screen, e->x / cell_width, e->y / cell_height); gtk_widget_queue_draw(GTK_WIDGET(term)); } else if (e->type == GDK_3BUTTON_PRESS) { p->sel = 2; /* TODO: select line */ tsm_screen_selection_start(p->screen, e->x / cell_width, e->y / cell_height); gtk_widget_queue_draw(GTK_WIDGET(term)); } else if (e->type == GDK_BUTTON_RELEASE) { if (p->sel == 1 && p->sel_start + 100 > e->time) { tsm_screen_selection_reset(p->screen); gtk_widget_queue_draw(GTK_WIDGET(term)); } else if (p->sel > 1) { /* TODO: copy */ } p->sel = 0; } return TRUE; } static gboolean terminal_motion_fn(GtkWidget *widget, GdkEvent *ev, gpointer data) { GtkTsmTerminal *term = GTKTSM_TERMINAL(widget); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); GdkEventMotion *e = (void*)ev; unsigned int cell_width, cell_height; if (!p->sel) return TRUE; if (!p->face_regular) return FALSE; cell_width = p->face_regular->width; cell_height = p->face_regular->height; if (p->sel == 1) { if (fabs(p->sel_x - e->x) > 3 || fabs(p->sel_y - e->y) > 3) { p->sel = 2; tsm_screen_selection_start(p->screen, p->sel_x / cell_width, p->sel_y / cell_height); gtk_widget_queue_draw(GTK_WIDGET(term)); } } else { tsm_screen_selection_target(p->screen, e->x / cell_width, e->y / cell_height); gtk_widget_queue_draw(GTK_WIDGET(term)); } return FALSE; } static gboolean terminal_idle_fn(gpointer data) { GtkTsmTerminal *term = data; GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); int r; p->idle_src = 0; if (!p->pty) return FALSE; r = shl_pty_bridge_dispatch_pty(p->pty_bridge, p->pty); if (r < 0) g_error("shl_pty_bridge_dispatch() failed: %d", r); return FALSE; } static void terminal_write_fn(struct tsm_vte *vte, const char *u8, size_t len, void *data) { GtkTsmTerminal *term = data; GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); int r; if (!p->pty) return; r = shl_pty_write(p->pty, u8, len); if (r < 0) g_error("OOM in pty-write: %d", r); /* dont directly call into pty-bridge to avoid possible recursion */ if (!p->idle_src) p->idle_src = g_idle_add(terminal_idle_fn, term); } static void terminal_log_fn(void *data, const char *file, int line, const char *fn, const char *subs, unsigned int sev, const char *format, va_list args) { GLogLevelFlags flags = 0; switch (sev) { case LLOG_DEBUG: flags |= G_LOG_LEVEL_DEBUG; break; case LLOG_INFO: flags |= G_LOG_LEVEL_INFO; break; case LLOG_NOTICE: flags |= G_LOG_LEVEL_MESSAGE; break; case LLOG_WARNING: flags |= G_LOG_LEVEL_WARNING; break; case LLOG_ERROR: flags |= G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL; break; case LLOG_CRITICAL: case LLOG_ALERT: case LLOG_FATAL: flags |= G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL; break; } g_logv(G_LOG_DOMAIN "-tsm", flags, format, args); } static void terminal_osc_fn(struct tsm_vte *vte, const char *u8, size_t len, void *data) { GtkTsmTerminal *term = data; if (u8[0] == '2' && u8[1] == ';') { g_signal_emit(term, terminal_signals[TERMINAL_SIGNAL_TITLE], 0, u8 + 2); } } static gboolean terminal_bridge_fn(GIOChannel *chan, GIOCondition cond, gpointer data) { GtkTsmTerminal *term = data; GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); int r; r = shl_pty_bridge_dispatch(p->pty_bridge, 0); if (r < 0) g_error("shl_pty_bridge_dispatch() failed: %d", r); return TRUE; } static void terminal_get_property(GObject *gobj, guint prop, GValue *val, GParamSpec *spec) { GtkTsmTerminal *term = GTKTSM_TERMINAL(gobj); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); const char *str; switch (prop) { case TERMINAL_PROP_FONT: g_value_set_string(val, p->prop_font); break; case TERMINAL_PROP_SB_SIZE: g_value_set_uint(val, p->prop_sb_size); break; case TERMINAL_PROP_ANTI_ALIASING: switch (p->prop_aa) { case CAIRO_ANTIALIAS_NONE: str = "none"; break; case CAIRO_ANTIALIAS_GRAY: str = "gray"; break; case CAIRO_ANTIALIAS_SUBPIXEL: str = "subpixel"; break; default: str = "default"; break; } g_value_set_string(val, str); break; case TERMINAL_PROP_SUBPIXEL_ORDER: switch (p->prop_subpixel) { case CAIRO_SUBPIXEL_ORDER_RGB: str = "rgb"; break; case CAIRO_SUBPIXEL_ORDER_BGR: str = "bgr"; break; case CAIRO_SUBPIXEL_ORDER_VRGB: str = "vrgb"; break; case CAIRO_SUBPIXEL_ORDER_VBGR: str = "vbgr"; break; default: str = "default"; break; } g_value_set_string(val, str); break; case TERMINAL_PROP_SHOW_DIRTY: g_value_set_boolean(val, p->show_dirty); break; case TERMINAL_PROP_DEBUG: g_value_set_boolean(val, p->debug); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobj, prop, spec); break; } } static void terminal_set_property(GObject *gobj, guint prop, const GValue *val, GParamSpec *spec) { GtkTsmTerminal *term = GTKTSM_TERMINAL(gobj); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); const char *str; bool update_font = false; switch (prop) { case TERMINAL_PROP_FONT: update_font = true; g_free(p->prop_font); p->prop_font = g_strdup(g_value_get_string(val)); break; case TERMINAL_PROP_SB_SIZE: p->prop_sb_size = g_value_get_uint(val); tsm_screen_set_max_sb(p->screen, p->prop_sb_size); break; case TERMINAL_PROP_ANTI_ALIASING: update_font = true; str = g_value_get_string(val); if (!strcmp(str, "none")) p->prop_aa = CAIRO_ANTIALIAS_NONE; else if (!strcmp(str, "gray")) p->prop_aa = CAIRO_ANTIALIAS_GRAY; else if (!strcmp(str, "subpixel")) p->prop_aa = CAIRO_ANTIALIAS_SUBPIXEL; else p->prop_aa = CAIRO_ANTIALIAS_DEFAULT; break; case TERMINAL_PROP_SUBPIXEL_ORDER: update_font = true; str = g_value_get_string(val); if (!strcmp(str, "rgb")) p->prop_subpixel = CAIRO_SUBPIXEL_ORDER_RGB; else if (!strcmp(str, "bgr")) p->prop_subpixel = CAIRO_SUBPIXEL_ORDER_BGR; else if (!strcmp(str, "vrgb")) p->prop_subpixel = CAIRO_SUBPIXEL_ORDER_VRGB; else if (!strcmp(str, "vbgr")) p->prop_subpixel = CAIRO_SUBPIXEL_ORDER_VBGR; else p->prop_subpixel = CAIRO_SUBPIXEL_ORDER_DEFAULT; break; case TERMINAL_PROP_SHOW_DIRTY: p->show_dirty = g_value_get_boolean(val); gtk_widget_queue_draw(GTK_WIDGET(term)); break; case TERMINAL_PROP_DEBUG: p->debug = g_value_get_boolean(val); gtk_widget_queue_draw(GTK_WIDGET(term)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobj, prop, spec); break; } /* Only update font if we already have one. Otherwise, a new font is * created on demand. */ if (update_font && p->face_regular) terminal_set_font(term); } static void terminal_finalize(GObject *gobj) { GtkTsmTerminal *term = GTKTSM_TERMINAL(gobj); GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); if (p->pty) { if (p->child_src) g_source_remove(p->child_src); shl_pty_bridge_remove(p->pty_bridge, p->pty); shl_pty_close(p->pty); shl_pty_unref(p->pty); } if (p->idle_src) g_source_remove(p->idle_src); gtktsm_face_free(p->face_regular); gtktsm_face_free(p->face_bold); gtktsm_face_free(p->face_italic); gtktsm_face_free(p->face_bold_italic); g_free(p->prop_font); g_source_remove(p->bridge_src); g_io_channel_unref(p->bridge_chan); shl_pty_bridge_free(p->pty_bridge); tsm_vte_unref(p->vte); tsm_screen_unref(p->screen); gtktsm_font_unref(p->font); gtktsm_renderer_free(p->rend); G_OBJECT_CLASS(gtktsm_terminal_parent_class)->finalize(gobj); } static void gtktsm_terminal_init(GtkTsmTerminal *term) { GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); int r; r = gtktsm_renderer_new(&p->rend, 0, 0); if (r < 0) g_error("gtktsm_renderer_new() failed: %d", r); r = gtktsm_font_new(&p->font); if (r < 0) g_error("gtktsm_font_new() failed: %d", r); r = tsm_screen_new(&p->screen, terminal_log_fn, term); if (r < 0) g_error("tsm_screen_new() failed: %d", r); r = tsm_vte_new(&p->vte, p->screen, terminal_write_fn, term, terminal_log_fn, term); if (r < 0) g_error("tsm_vte_new() failed: %d", r); tsm_vte_set_osc_cb(p->vte, terminal_osc_fn, term); p->pty_bridge = shl_pty_bridge_new(); if (p->pty_bridge < 0) g_error("shl_pty_bridge_new() failed: %d", p->pty_bridge); p->bridge_chan = g_io_channel_unix_new(p->pty_bridge); p->bridge_src = g_io_add_watch(p->bridge_chan, G_IO_IN, terminal_bridge_fn, term); g_signal_connect(G_OBJECT(term), "configure-event", G_CALLBACK(terminal_configure_fn), NULL); g_signal_connect(G_OBJECT(term), "draw", G_CALLBACK(terminal_draw_fn), NULL); gtk_widget_set_can_focus(GTK_WIDGET(term), TRUE); g_signal_connect(GTK_WIDGET(term), "key-press-event", G_CALLBACK(terminal_key_fn), term); g_signal_connect(GTK_WIDGET(term), "button-press-event", G_CALLBACK(terminal_button_fn), term); g_signal_connect(GTK_WIDGET(term), "button-release-event", G_CALLBACK(terminal_button_fn), term); g_signal_connect(GTK_WIDGET(term), "motion-notify-event", G_CALLBACK(terminal_motion_fn), term); } static void gtktsm_terminal_class_init(GtkTsmTerminalClass *klass) { GParamSpec **prop; guint *sig; G_OBJECT_CLASS(klass)->finalize = terminal_finalize; G_OBJECT_CLASS(klass)->set_property = terminal_set_property; G_OBJECT_CLASS(klass)->get_property = terminal_get_property; /* properties */ prop = &terminal_props[TERMINAL_PROP_FONT]; *prop = g_param_spec_string("font", "Terminal font", "The font to be used for terminal screens", "Monospace", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); prop = &terminal_props[TERMINAL_PROP_SB_SIZE]; *prop = g_param_spec_uint("sb-size", "Scrollback-buffer size", "Number of lines that are kept in the scrollback buffer", 0, G_MAXUINT, 2000, G_PARAM_CONSTRUCT | G_PARAM_READWRITE); prop = &terminal_props[TERMINAL_PROP_ANTI_ALIASING]; *prop = g_param_spec_string("anti-aliasing", "Anti-Aliasing", "The anti-aliasing mode for terminal fonts", "default", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); prop = &terminal_props[TERMINAL_PROP_SUBPIXEL_ORDER]; *prop = g_param_spec_string("subpixel-order", "Subpixel-Order", "The subpixel-order used for anti-aliasing", "default", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); prop = &terminal_props[TERMINAL_PROP_SHOW_DIRTY]; *prop = g_param_spec_boolean("show-dirty", "Show dirty cells", "Highlight dirty cells to debug terminal rendering", FALSE, G_PARAM_READWRITE); prop = &terminal_props[TERMINAL_PROP_DEBUG]; *prop = g_param_spec_boolean("debug", "Debug mode", "Enable extensive live debugging", FALSE, G_PARAM_READWRITE); g_object_class_install_properties(G_OBJECT_CLASS(klass), TERMINAL_PROP_CNT, terminal_props); /* signals */ sig = &terminal_signals[TERMINAL_SIGNAL_CHANGED]; *sig = g_signal_new("terminal-changed", G_OBJECT_CLASS_TYPE(G_OBJECT_CLASS(klass)), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, /* accu + accu-data */ g_cclosure_marshal_generic, G_TYPE_NONE, 0); sig = &terminal_signals[TERMINAL_SIGNAL_STOPPED]; *sig = g_signal_new("terminal-stopped", G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, /* accu + accu-data */ g_cclosure_marshal_generic, G_TYPE_NONE, 0); sig = &terminal_signals[TERMINAL_SIGNAL_TITLE]; *sig = g_signal_new("terminal-title-changed", G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, /* accu + accu-data */ g_cclosure_marshal_generic, G_TYPE_NONE, 1, G_TYPE_STRING); } GtkTsmTerminal *gtktsm_terminal_new(void) { return g_object_new(GTKTSM_TYPE_TERMINAL, NULL); } static void terminal_read_fn(struct shl_pty *pty, void *data, char *u8, size_t len) { GtkTsmTerminal *term = data; GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); tsm_vte_input(p->vte, u8, len); gtk_widget_queue_draw(GTK_WIDGET(term)); } static void terminal_child_fn(GPid pid, gint status, gpointer data) { GtkTsmTerminal *term = data; GtkTsmTerminalPrivate *p = gtktsm_terminal_get_instance_private(term); g_spawn_close_pid(pid); p->child_src = 0; shl_pty_bridge_remove(p->pty_bridge, p->pty); shl_pty_close(p->pty); shl_pty_unref(p->pty); p->pty = NULL; g_signal_emit(term, terminal_signals[TERMINAL_SIGNAL_STOPPED], 0); } pid_t gtktsm_terminal_fork(GtkTsmTerminal *term) { GtkTsmTerminalPrivate *p; pid_t pid; int r; if (!term) return -EINVAL; p = gtktsm_terminal_get_instance_private(term); if (p->pty) return -EALREADY; if (!p->face_regular) terminal_set_font(term); pid = shl_pty_open(&p->pty, terminal_read_fn, term, p->columns, p->rows); if (pid < 0) g_error("shl_pty_open() failed: %d", (int)pid); else if (!pid) return pid; r = shl_pty_bridge_add(p->pty_bridge, p->pty); if (r < 0) g_error("shl_pty_bridge_add() failed: %d", r); p->child_src = g_child_watch_add(pid, terminal_child_fn, term); return pid; } void gtktsm_terminal_kill(GtkTsmTerminal *term, int sig) { GtkTsmTerminalPrivate *p; if (!term || sig < 1) return; p = gtktsm_terminal_get_instance_private(term); if (!p->pty) return; shl_pty_signal(p->pty, sig); } libtsm-4.0.2/src/gtktsm/gtktsm-terminal.h000066400000000000000000000047771420363367700204340ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #ifndef GTKTSM_TERMINAL_H #define GTKTSM_TERMINAL_H #include #include #include #include #include G_BEGIN_DECLS typedef struct _GtkTsmTerminal GtkTsmTerminal; typedef struct _GtkTsmTerminalClass GtkTsmTerminalClass; struct _GtkTsmTerminal { GtkDrawingArea parent; }; struct _GtkTsmTerminalClass { GtkDrawingAreaClass parent_class; }; #define GTKTSM_TYPE_TERMINAL (gtktsm_terminal_get_type()) #define GTKTSM_TERMINAL(_obj) (G_TYPE_CHECK_INSTANCE_CAST((_obj), \ GTKTSM_TYPE_TERMINAL, \ GtkTsmTerminal)) #define GTKTSM_TERMINAL_CLASS(_klass) \ (G_TYPE_CHECK_CLASS_CAST((_klass), \ GTKTSM_TYPE_TERMINAL, \ GtkTsmTerminalClass)) #define GTKTSM_IS_TERMINAL(_obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((_obj), \ GTKTSM_TYPE_TERMINAL)) #define GTKTSM_IS_TERMINAL_CLASS(_klass) \ (G_TYPE_CHECK_CLASS_TYPE((_klass), \ GTKTSM_TYPE_TERMINAL)) #define GTKTSM_TERMINAL_GET_CLASS(_obj) \ (G_TYPE_INSTANCE_GET_CLASS((_obj), \ GTKTSM_TYPE_TERMINAL, \ GtkTsmTerminalClass)) #define GTKTSM_TERMINAL_DONT_CARE (-1) GType gtktsm_terminal_get_type(void) G_GNUC_CONST; GtkTsmTerminal *gtktsm_terminal_new(void); pid_t gtktsm_terminal_fork(GtkTsmTerminal *term); void gtktsm_terminal_kill(GtkTsmTerminal *term, int sig); G_END_DECLS #endif /* GTKTSM_TERMINAL_H */ libtsm-4.0.2/src/gtktsm/gtktsm-win.c000066400000000000000000000074741420363367700174060ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include #include #include #include #include #include #include #include "gtktsm-app.h" #include "gtktsm-terminal.h" #include "gtktsm-win.h" #include "shl-macro.h" struct _GtkTsmWin { GtkWindow parent; }; struct _GtkTsmWinClass { GtkWindowClass parent_class; }; typedef struct _GtkTsmWinPrivate { GtkTsmTerminal *term; } GtkTsmWinPrivate; G_DEFINE_TYPE_WITH_PRIVATE(GtkTsmWin, gtktsm_win, GTK_TYPE_WINDOW); static void win_realize(GtkWidget *widget) { GtkTsmWin *win = GTKTSM_WIN(widget); GdkWindow *w; GdkRGBA col; GTK_WIDGET_CLASS(gtktsm_win_parent_class)->realize(widget); w = gtk_widget_get_window(GTK_WIDGET(win)); col.red = 0.0; col.green = 0.0; col.blue = 0.0; col.alpha = 1.0; gdk_window_set_background_rgba(w, &col); } static gboolean win_title_fn(GtkTsmTerminal *term, gchar *title, gpointer data) { GtkTsmWin *win = data; gtk_window_set_title(GTK_WINDOW(win), title); return FALSE; } static gboolean win_stopped_fn(GtkTsmTerminal *term, gpointer data) { GtkTsmWin *win = data; gtk_widget_destroy(GTK_WIDGET(win)); return FALSE; } static void gtktsm_win_init(GtkTsmWin *win) { GtkTsmWinPrivate *p = gtktsm_win_get_instance_private(win); gtk_window_set_default_size(GTK_WINDOW(win), 800, 600); p->term = gtktsm_terminal_new(); gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(p->term)); gtk_widget_show(GTK_WIDGET(p->term)); g_signal_connect(G_OBJECT(p->term), "terminal-title-changed", G_CALLBACK(win_title_fn), win); g_signal_connect(G_OBJECT(p->term), "terminal-stopped", G_CALLBACK(win_stopped_fn), win); } static void gtktsm_win_class_init(GtkTsmWinClass *klass) { GTK_WIDGET_CLASS(klass)->realize = win_realize; } GtkTsmWin *gtktsm_win_new(GtkTsmApp *app) { return g_object_new(GTKTSM_WIN_TYPE, "application", app, NULL); } void gtktsm_win_run(GtkTsmWin *win) { char **argv = (char*[]) { getenv("SHELL") ? : _PATH_BSHELL, NULL }; GtkTsmWinPrivate *p; pid_t pid; int r; if (!win) return; p = gtktsm_win_get_instance_private(win); pid = gtktsm_terminal_fork(p->term); if (pid < 0) { if (pid != -EALREADY) g_error("gtktsm_terminal_fork() failed: %d", (int)pid); return; } else if (pid != 0) { /* parent */ return; } /* child */ setenv("TERM", "xterm-256color", 1); setenv("COLORTERM", "gtktsm", 1); r = execve(argv[0], argv, environ); if (r < 0) g_error("gtktsm_win_run() execve(%s) failed: %m", argv[0]); _exit(1); } GtkTsmTerminal *gtktsm_win_get_terminal(GtkTsmWin *win) { GtkTsmWinPrivate *p; if (!win) return NULL; p = gtktsm_win_get_instance_private(win); return p->term; } libtsm-4.0.2/src/gtktsm/gtktsm-win.h000066400000000000000000000034071420363367700174030ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #ifndef GTKTSM_WIN_H #define GTKTSM_WIN_H #include #include #include #include #include "gtktsm-app.h" #include "gtktsm-terminal.h" typedef struct _GtkTsmWin GtkTsmWin; typedef struct _GtkTsmWinClass GtkTsmWinClass; #define GTKTSM_WIN_TYPE (gtktsm_win_get_type()) #define GTKTSM_WIN(_obj) (G_TYPE_CHECK_INSTANCE_CAST((_obj), \ GTKTSM_WIN_TYPE, \ GtkTsmWin)) GType gtktsm_win_get_type(void); GtkTsmWin *gtktsm_win_new(GtkTsmApp *app); void gtktsm_win_run(GtkTsmWin *win); GtkTsmTerminal *gtktsm_win_get_terminal(GtkTsmWin *win); #endif /* GTKTSM_WIN_H */ libtsm-4.0.2/src/gtktsm/gtktsm.c000066400000000000000000000027471420363367700166110ustar00rootroot00000000000000/* * GtkTsm - Terminal Emulator * * Copyright (c) 2011-2014 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include #include #include #include "gtktsm-app.h" int main(int argc, char **argv) { GApplication *app; int r; setlocale(LC_ALL, ""); g_set_application_name("GtkTsm"); app = G_APPLICATION(gtktsm_app_new()); r = g_application_run(app, argc, argv); g_object_unref(app); return r; } libtsm-4.0.2/src/shared/000077500000000000000000000000001420363367700150575ustar00rootroot00000000000000libtsm-4.0.2/src/shared/CMakeLists.txt000066400000000000000000000006471420363367700176260ustar00rootroot00000000000000# # SHL - Static Helper Library # The SHL subsystem contains several small code pieces used all over libtsm and # other applications. # add_library(shl OBJECT shl-htable.c shl-pty.c shl-ring.c ) target_include_directories(shl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) set_target_properties(shl PROPERTIES C_VISIBILITY_PRESET hidden POSITION_INDEPENDENT_CODE ON ) add_libtsm_compile_options(shl) libtsm-4.0.2/src/shared/shl-array.h000066400000000000000000000076601420363367700171430ustar00rootroot00000000000000/* * shl - Dynamic Array * * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * A dynamic array implementation */ #ifndef SHL_ARRAY_H #define SHL_ARRAY_H #include #include #include struct shl_array { size_t element_size; size_t length; size_t size; void *data; }; #define SHL_ARRAY_AT(_arr, _type, _pos) \ (&((_type*)shl_array_get_array(_arr))[(_pos)]) static inline int shl_array_new(struct shl_array **out, size_t element_size, size_t initial_size) { struct shl_array *arr; if (!out || !element_size) return -EINVAL; if (!initial_size) initial_size = 4; arr = malloc(sizeof(*arr)); if (!arr) return -ENOMEM; memset(arr, 0, sizeof(*arr)); arr->element_size = element_size; arr->length = 0; arr->size = initial_size; arr->data = malloc(arr->element_size * arr->size); if (!arr->data) { free(arr); return -ENOMEM; } *out = arr; return 0; } static inline void shl_array_free(struct shl_array *arr) { if (!arr) return; free(arr->data); free(arr); } /* Compute next higher power-of-2 of @v. Returns 4 in case v is 0. */ static inline size_t shl_array_pow2(size_t v) { size_t i; if (!v) return 4; --v; for (i = 1; i < 8 * sizeof(size_t); i *= 2) v |= v >> i; return ++v; } /* resize to length=size and zero out new array entries */ static inline int shl_array_zresize(struct shl_array *arr, size_t size) { void *tmp; size_t newsize; if (!arr) return -EINVAL; if (size > arr->size) { newsize = shl_array_pow2(size); tmp = realloc(arr->data, arr->element_size * newsize); if (!tmp) return -ENOMEM; arr->data = tmp; arr->size = newsize; memset(((uint8_t*)arr->data) + arr->element_size * arr->length, 0, arr->element_size * (size - arr->length)); } arr->length = size; return 0; } static inline int shl_array_push(struct shl_array *arr, const void *data) { void *tmp; size_t newsize; if (!arr || !data) return -EINVAL; if (arr->length >= arr->size) { newsize = arr->size * 2; tmp = realloc(arr->data, arr->element_size * newsize); if (!tmp) return -ENOMEM; arr->data = tmp; arr->size = newsize; } memcpy(((uint8_t*)arr->data) + arr->element_size * arr->length, data, arr->element_size); ++arr->length; return 0; } static inline void shl_array_pop(struct shl_array *arr) { if (!arr || !arr->length) return; --arr->length; } static inline void *shl_array_get_array(struct shl_array *arr) { if (!arr) return NULL; return arr->data; } static inline size_t shl_array_get_length(struct shl_array *arr) { if (!arr) return 0; return arr->length; } static inline size_t shl_array_get_bsize(struct shl_array *arr) { if (!arr) return 0; return arr->length * arr->element_size; } static inline size_t shl_array_get_element_size(struct shl_array *arr) { if (!arr) return 0; return arr->element_size; } #endif /* SHL_ARRAY_H */ libtsm-4.0.2/src/shared/shl-htable.c000066400000000000000000000236331420363367700172550ustar00rootroot00000000000000/* * SHL - Dynamic hash-table * * Written-by: Rusty Russell * Adjusted-by: David Herrmann * Licensed under LGPLv2+ - see LICENSE_htable file for details */ /* * Please see ccan/htable/_info at: * https://github.com/rustyrussell/ccan/tree/master/ccan/htable * for information on the hashtable algorithm. This file copies the code inline * and is released under the same conditions. * * At the end of the file you can find some helpers to use this htable to store * objects with "unsigned long" or "char*" keys. */ #include #include #include #include #include #include #include #include "shl-htable.h" #define COLD __attribute__((cold)) struct htable { /* KEEP IN SYNC WITH "struct shl_htable_int" */ size_t (*rehash)(const void *elem, void *priv); void *priv; unsigned int bits; size_t elems, deleted, max, max_with_deleted; /* These are the bits which are the same in all pointers. */ uintptr_t common_mask, common_bits; uintptr_t perfect_bit; uintptr_t *table; }; #define HTABLE_INITIALIZER(name, rehash, priv) \ { rehash, priv, 0, 0, 0, 0, 0, -1, 0, 0, &name.perfect_bit } struct htable_iter { size_t off; }; /* * INLINE COPY OF ccan/htable.c */ /* We use 0x1 as deleted marker. */ #define HTABLE_DELETED (0x1) /* We clear out the bits which are always the same, and put metadata there. */ static inline uintptr_t get_extra_ptr_bits(const struct htable *ht, uintptr_t e) { return e & ht->common_mask; } static inline void *get_raw_ptr(const struct htable *ht, uintptr_t e) { return (void *)((e & ~ht->common_mask) | ht->common_bits); } static inline uintptr_t make_hval(const struct htable *ht, const void *p, uintptr_t bits) { return ((uintptr_t)p & ~ht->common_mask) | bits; } static inline bool entry_is_valid(uintptr_t e) { return e > HTABLE_DELETED; } static inline uintptr_t get_hash_ptr_bits(const struct htable *ht, size_t hash) { /* Shuffling the extra bits (as specified in mask) down the * end is quite expensive. But the lower bits are redundant, so * we fold the value first. */ return (hash ^ (hash >> ht->bits)) & ht->common_mask & ~ht->perfect_bit; } static void htable_init(struct htable *ht, size_t (*rehash)(const void *elem, void *priv), void *priv) { struct htable empty = HTABLE_INITIALIZER(empty, NULL, NULL); *ht = empty; ht->rehash = rehash; ht->priv = priv; ht->table = &ht->perfect_bit; } static void htable_clear(struct htable *ht, void (*free_cb) (void *entry, void *ctx), void *ctx) { size_t i; if (ht->table != &ht->perfect_bit) { if (free_cb) { for (i = 0; i < (size_t)1 << ht->bits; ++i) { if (entry_is_valid(ht->table[i])) free_cb(get_raw_ptr(ht, ht->table[i]), ctx); } } free((void *)ht->table); } htable_init(ht, ht->rehash, ht->priv); } static void htable_visit(struct htable *ht, void (*visit_cb) (void *elem, void *ctx), void *ctx) { size_t i; if (visit_cb && ht->table != &ht->perfect_bit) { for (i = 0; i < (size_t)1 << ht->bits; ++i) { if (entry_is_valid(ht->table[i])) visit_cb(get_raw_ptr(ht, ht->table[i]), ctx); } } } static size_t hash_bucket(const struct htable *ht, size_t h) { return h & ((1 << ht->bits)-1); } static void *htable_val(const struct htable *ht, struct htable_iter *i, size_t hash, uintptr_t perfect) { uintptr_t h2 = get_hash_ptr_bits(ht, hash) | perfect; while (ht->table[i->off]) { if (ht->table[i->off] != HTABLE_DELETED) { if (get_extra_ptr_bits(ht, ht->table[i->off]) == h2) return get_raw_ptr(ht, ht->table[i->off]); } i->off = (i->off + 1) & ((1 << ht->bits)-1); h2 &= ~perfect; } return NULL; } static void *htable_firstval(const struct htable *ht, struct htable_iter *i, size_t hash) { i->off = hash_bucket(ht, hash); return htable_val(ht, i, hash, ht->perfect_bit); } static void *htable_nextval(const struct htable *ht, struct htable_iter *i, size_t hash) { i->off = (i->off + 1) & ((1 << ht->bits)-1); return htable_val(ht, i, hash, 0); } /* This does not expand the hash table, that's up to caller. */ static void ht_add(struct htable *ht, const void *new, size_t h) { size_t i; uintptr_t perfect = ht->perfect_bit; i = hash_bucket(ht, h); while (entry_is_valid(ht->table[i])) { perfect = 0; i = (i + 1) & ((1 << ht->bits)-1); } ht->table[i] = make_hval(ht, new, get_hash_ptr_bits(ht, h)|perfect); } static COLD bool double_table(struct htable *ht) { unsigned int i; size_t oldnum = (size_t)1 << ht->bits; uintptr_t *oldtable, e; oldtable = ht->table; ht->table = calloc(1 << (ht->bits+1), sizeof(size_t)); if (!ht->table) { ht->table = oldtable; return false; } ht->bits++; ht->max = ((size_t)3 << ht->bits) / 4; ht->max_with_deleted = ((size_t)9 << ht->bits) / 10; /* If we lost our "perfect bit", get it back now. */ if (!ht->perfect_bit && ht->common_mask) { for (i = 0; i < sizeof(ht->common_mask) * CHAR_BIT; i++) { if (ht->common_mask & ((size_t)1 << i)) { ht->perfect_bit = (size_t)1 << i; break; } } } if (oldtable != &ht->perfect_bit) { for (i = 0; i < oldnum; i++) { if (entry_is_valid(e = oldtable[i])) { void *p = get_raw_ptr(ht, e); ht_add(ht, p, ht->rehash(p, ht->priv)); } } free(oldtable); } ht->deleted = 0; return true; } static COLD void rehash_table(struct htable *ht) { size_t start, i; uintptr_t e; /* Beware wrap cases: we need to start from first empty bucket. */ for (start = 0; ht->table[start]; start++); for (i = 0; i < (size_t)1 << ht->bits; i++) { size_t h = (i + start) & ((1 << ht->bits)-1); e = ht->table[h]; if (!e) continue; if (e == HTABLE_DELETED) ht->table[h] = 0; else if (!(e & ht->perfect_bit)) { void *p = get_raw_ptr(ht, e); ht->table[h] = 0; ht_add(ht, p, ht->rehash(p, ht->priv)); } } ht->deleted = 0; } /* We stole some bits, now we need to put them back... */ static COLD void update_common(struct htable *ht, const void *p) { unsigned int i; uintptr_t maskdiff, bitsdiff; if (ht->elems == 0) { /* Always reveal one bit of the pointer in the bucket, * so it's not zero or HTABLE_DELETED (1), even if * hash happens to be 0. Assumes (void *)1 is not a * valid pointer. */ for (i = sizeof(uintptr_t)*CHAR_BIT - 1; i > 0; i--) { if ((uintptr_t)p & ((uintptr_t)1 << i)) break; } ht->common_mask = ~((uintptr_t)1 << i); ht->common_bits = ((uintptr_t)p & ht->common_mask); ht->perfect_bit = 1; return; } /* Find bits which are unequal to old common set. */ maskdiff = ht->common_bits ^ ((uintptr_t)p & ht->common_mask); /* These are the bits which go there in existing entries. */ bitsdiff = ht->common_bits & maskdiff; for (i = 0; i < (size_t)1 << ht->bits; i++) { if (!entry_is_valid(ht->table[i])) continue; /* Clear the bits no longer in the mask, set them as * expected. */ ht->table[i] &= ~maskdiff; ht->table[i] |= bitsdiff; } /* Take away those bits from our mask, bits and perfect bit. */ ht->common_mask &= ~maskdiff; ht->common_bits &= ~maskdiff; ht->perfect_bit &= ~maskdiff; } static bool htable_add(struct htable *ht, size_t hash, const void *p) { if (ht->elems+1 > ht->max && !double_table(ht)) return false; if (ht->elems+1 + ht->deleted > ht->max_with_deleted) rehash_table(ht); assert(p); if (((uintptr_t)p & ht->common_mask) != ht->common_bits) update_common(ht, p); ht_add(ht, p, hash); ht->elems++; return true; } static void htable_delval(struct htable *ht, struct htable_iter *i) { assert(i->off < (size_t)1 << ht->bits); assert(entry_is_valid(ht->table[i->off])); ht->elems--; ht->table[i->off] = HTABLE_DELETED; ht->deleted++; } /* * Wrapper code to make it easier to use this hash-table as map. */ void shl_htable_init(struct shl_htable *htable, bool (*compare) (const void *a, const void *b), size_t (*rehash)(const void *elem, void *priv), void *priv) { struct htable *ht = (void*)&htable->htable; htable->compare = compare; htable_init(ht, rehash, priv); } void shl_htable_clear(struct shl_htable *htable, void (*free_cb) (void *elem, void *ctx), void *ctx) { struct htable *ht = (void*)&htable->htable; htable_clear(ht, free_cb, ctx); } void shl_htable_visit(struct shl_htable *htable, void (*visit_cb) (void *elem, void *ctx), void *ctx) { struct htable *ht = (void*)&htable->htable; htable_visit(ht, visit_cb, ctx); } bool shl_htable_lookup(struct shl_htable *htable, const void *obj, size_t hash, void **out) { struct htable *ht = (void*)&htable->htable; struct htable_iter i; void *c; for (c = htable_firstval(ht, &i, hash); c; c = htable_nextval(ht, &i, hash)) { if (htable->compare(obj, c)) { if (out) *out = c; return true; } } return false; } int shl_htable_insert(struct shl_htable *htable, const void *obj, size_t hash) { struct htable *ht = (void*)&htable->htable; bool b; b = htable_add(ht, hash, (void*)obj); return b ? 0 : -ENOMEM; } bool shl_htable_remove(struct shl_htable *htable, const void *obj, size_t hash, void **out) { struct htable *ht = (void*)&htable->htable; struct htable_iter i; void *c; for (c = htable_firstval(ht, &i, hash); c; c = htable_nextval(ht, &i, hash)) { if (htable->compare(obj, c)) { if (out) *out = c; htable_delval(ht, &i); return true; } } return false; } /* * Helpers */ bool shl_htable_compare_ulong(const void *a, const void *b) { return *(const unsigned long*)a == *(const unsigned long*)b; } size_t shl_htable_rehash_ulong(const void *elem, void *priv) { return (size_t)*(const unsigned long*)elem; } bool shl_htable_compare_str(const void *a, const void *b) { return !strcmp(*(char**)a, *(char**)b); } /* DJB's hash function */ size_t shl_htable_rehash_str(const void *elem, void *priv) { const char *str = *(char**)elem; size_t hash = 5381; for ( ; *str; ++str) hash = (hash << 5) + hash + (size_t)*str; return hash; } libtsm-4.0.2/src/shared/shl-htable.h000066400000000000000000000134641420363367700172630ustar00rootroot00000000000000/* * SHL - Dynamic hash-table * * Copyright (c) 2010-2013 David Herrmann * Licensed under LGPLv2+ - see LICENSE_htable file for details */ /* * Dynamic hash-table * Implementation of a self-resizing hashtable to store arbitrary objects. * Entries are not allocated by the table itself but are user-allocated. A * single entry can be stored multiple times in the hashtable. No * maintenance-members need to be embedded in user-allocated objects. However, * the key (and optionally the hash) must be stored in the objects. * * Uses internally the htable from CCAN. See LICENSE_htable. */ #ifndef SHL_HTABLE_H #define SHL_HTABLE_H #include #include #include #include #include /* miscellaneous */ #define shl_htable_offsetof(pointer, type, member) ({ \ const typeof(((type*)0)->member) *__ptr = (pointer); \ (type*)(((char*)__ptr) - offsetof(type, member)); \ }) /* htable */ struct shl_htable_int { size_t (*rehash)(const void *elem, void *priv); void *priv; unsigned int bits; size_t elems, deleted, max, max_with_deleted; /* These are the bits which are the same in all pointers. */ uintptr_t common_mask, common_bits; uintptr_t perfect_bit; uintptr_t *table; }; struct shl_htable { bool (*compare) (const void *a, const void *b); struct shl_htable_int htable; }; #define SHL_HTABLE_INIT(_obj, _compare, _rehash, _priv) \ { \ .compare = (_compare), \ .htable = { \ .rehash = (_rehash), \ .priv = (_priv), \ .bits = 0, \ .elems = 0, \ .deleted = 0, \ .max = 0, \ .max_with_deleted = 0, \ .common_mask = -1, \ .common_bits = 0, \ .perfect_bit = 0, \ .table = &(_obj).htable.perfect_bit \ } \ } void shl_htable_init(struct shl_htable *htable, bool (*compare) (const void *a, const void *b), size_t (*rehash)(const void *elem, void *priv), void *priv); void shl_htable_clear(struct shl_htable *htable, void (*free_cb) (void *elem, void *ctx), void *ctx); void shl_htable_visit(struct shl_htable *htable, void (*visit_cb) (void *elem, void *ctx), void *ctx); bool shl_htable_lookup(struct shl_htable *htable, const void *obj, size_t hash, void **out); int shl_htable_insert(struct shl_htable *htable, const void *obj, size_t hash); bool shl_htable_remove(struct shl_htable *htable, const void *obj, size_t hash, void **out); /* ulong htables */ #if SIZE_MAX < ULONG_MAX # error "'size_t' is smaller than 'unsigned long'" #endif bool shl_htable_compare_ulong(const void *a, const void *b); size_t shl_htable_rehash_ulong(const void *elem, void *priv); #define SHL_HTABLE_INIT_ULONG(_obj) \ SHL_HTABLE_INIT((_obj), shl_htable_compare_ulong, \ shl_htable_rehash_ulong, \ NULL) static inline void shl_htable_init_ulong(struct shl_htable *htable) { shl_htable_init(htable, shl_htable_compare_ulong, shl_htable_rehash_ulong, NULL); } static inline void shl_htable_clear_ulong(struct shl_htable *htable, void (*cb) (unsigned long *elem, void *ctx), void *ctx) { shl_htable_clear(htable, (void (*) (void*, void*))cb, ctx); } static inline void shl_htable_visit_ulong(struct shl_htable *htable, void (*cb) (unsigned long *elem, void *ctx), void *ctx) { shl_htable_visit(htable, (void (*) (void*, void*))cb, ctx); } static inline bool shl_htable_lookup_ulong(struct shl_htable *htable, unsigned long key, unsigned long **out) { return shl_htable_lookup(htable, (const void*)&key, (size_t)key, (void**)out); } static inline int shl_htable_insert_ulong(struct shl_htable *htable, const unsigned long *key) { return shl_htable_insert(htable, (const void*)key, (size_t)*key); } static inline bool shl_htable_remove_ulong(struct shl_htable *htable, unsigned long key, unsigned long **out) { return shl_htable_remove(htable, (const void*)&key, (size_t)key, (void**)out); } /* string htables */ bool shl_htable_compare_str(const void *a, const void *b); size_t shl_htable_rehash_str(const void *elem, void *priv); #define SHL_HTABLE_INIT_STR(_obj) \ SHL_HTABLE_INIT((_obj), shl_htable_compare_str, \ shl_htable_rehash_str, \ NULL) static inline void shl_htable_init_str(struct shl_htable *htable) { shl_htable_init(htable, shl_htable_compare_str, shl_htable_rehash_str, NULL); } static inline void shl_htable_clear_str(struct shl_htable *htable, void (*cb) (char **elem, void *ctx), void *ctx) { shl_htable_clear(htable, (void (*) (void*, void*))cb, ctx); } static inline void shl_htable_visit_str(struct shl_htable *htable, void (*cb) (char **elem, void *ctx), void *ctx) { shl_htable_visit(htable, (void (*) (void*, void*))cb, ctx); } static inline size_t shl_htable_hash_str(struct shl_htable *htable, const char *str, size_t *hash) { size_t h; if (hash && *hash) { h = *hash; } else { h = htable->htable.rehash((const void*)&str, NULL); if (hash) *hash = h; } return h; } static inline bool shl_htable_lookup_str(struct shl_htable *htable, const char *str, size_t *hash, char ***out) { size_t h; h = shl_htable_hash_str(htable, str, hash); return shl_htable_lookup(htable, (const void*)&str, h, (void**)out); } static inline int shl_htable_insert_str(struct shl_htable *htable, char **str, size_t *hash) { size_t h; h = shl_htable_hash_str(htable, *str, hash); return shl_htable_insert(htable, (const void*)str, h); } static inline bool shl_htable_remove_str(struct shl_htable *htable, const char *str, size_t *hash, char ***out) { size_t h; h = shl_htable_hash_str(htable, str, hash); return shl_htable_remove(htable, (const void*)&str, h, (void **)out); } #endif /* SHL_HTABLE_H */ libtsm-4.0.2/src/shared/shl-llog.h000066400000000000000000000210021420363367700167440ustar00rootroot00000000000000/* * SHL - Library Log/Debug Interface * * Copyright (c) 2010-2013 David Herrmann * Dedicated to the Public Domain */ /* * Library Log/Debug Interface * Libraries should always avoid producing side-effects. This includes writing * log-messages of any kind. However, you often don't want to disable debugging * entirely, therefore, the core objects often contain a pointer to a function * which performs logging. If that pointer is NULL (default), logging is * disabled. * * This header should never be installed into the system! This is _no_ public * header. Instead, copy it into your application if you want and use it there. * Your public library API should include something like this: * * typedef void (*MYPREFIX_log_t) (void *data, * const char *file, * int line, * const char *func, * const char *subs, * unsigned int sev, * const char *format, * va_list args); * * And then the user can supply such a function when creating a new context * object of your library or simply supply NULL. Internally, you have a field of * type "MYPREFIX_log_t llog" in your main structure. If you pass this to the * convenience helpers like llog_dbg(), llog_warn() etc. it will automatically * use the "llog" field to print the message. If it is NULL, nothing is done. * * The arguments of the log-function are defined as: * data: User-supplied data field that is passed straight through. * file: Zero terminated string of the file-name where the log-message * occurred. Can be NULL. * line: Line number of @file where the message occurred. Set to 0 or smaller * if not available. * func: Function name where the log-message occurred. Can be NULL. * subs: Subsystem where the message occurred (zero terminated). Can be NULL. * sev: Severity of log-message. An integer between 0 and 7 as defined below. * These are identical to the linux-kernel severities so there is no need * to include these in your public API. Every app can define them * themselves, if they need it. * format: Format string. Must not be NULL. * args: Argument array * * The user should also be able to optionally provide a data field which is * always passed unmodified as first parameter to the log-function. This allows * to add context to the logger. */ #ifndef SHL_LLOG_H #define SHL_LLOG_H #include #include #include #include enum llog_severity { LLOG_FATAL = 0, LLOG_ALERT = 1, LLOG_CRITICAL = 2, LLOG_ERROR = 3, LLOG_WARNING = 4, LLOG_NOTICE = 5, LLOG_INFO = 6, LLOG_DEBUG = 7, LLOG_SEV_NUM, }; typedef void (*llog_submit_t) (void *data, const char *file, int line, const char *func, const char *subs, unsigned int sev, const char *format, va_list args); static inline __attribute__((format(printf, 8, 9))) void llog_format(llog_submit_t llog, void *data, const char *file, int line, const char *func, const char *subs, unsigned int sev, const char *format, ...) { int saved_errno = errno; va_list list; if (llog) { va_start(list, format); errno = saved_errno; llog(data, file, line, func, subs, sev, format, list); va_end(list); } } #ifndef LLOG_SUBSYSTEM static const char *LLOG_SUBSYSTEM __attribute__((__unused__)); #endif #define LLOG_DEFAULT __FILE__, __LINE__, __func__, LLOG_SUBSYSTEM #define llog_printf(obj, sev, format, ...) \ llog_format((obj)->llog, \ (obj)->llog_data, \ LLOG_DEFAULT, \ (sev), \ (format), \ ##__VA_ARGS__) #define llog_dprintf(obj, data, sev, format, ...) \ llog_format((obj), \ (data), \ LLOG_DEFAULT, \ (sev), \ (format), \ ##__VA_ARGS__) static inline __attribute__((format(printf, 4, 5))) void llog_dummyf(llog_submit_t llog, void *data, unsigned int sev, const char *format, ...) { } /* * Helpers * They pick up all the default values and submit the message to the * llog-subsystem. The llog_debug() function will discard the message unless * BUILD_ENABLE_DEBUG is defined. */ #ifdef BUILD_ENABLE_DEBUG #define llog_ddebug(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_DEBUG, (format), ##__VA_ARGS__) #define llog_debug(obj, format, ...) \ llog_ddebug((obj)->llog, (obj)->llog_data, (format), ##__VA_ARGS__) #else #define llog_ddebug(obj, data, format, ...) \ llog_dummyf((obj), (data), LLOG_DEBUG, (format), ##__VA_ARGS__) #define llog_debug(obj, format, ...) \ llog_ddebug((obj)->llog, (obj)->llog_data, (format), ##__VA_ARGS__) #endif #define llog_info(obj, format, ...) \ llog_printf((obj), LLOG_INFO, (format), ##__VA_ARGS__) #define llog_dinfo(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_INFO, (format), ##__VA_ARGS__) #define llog_notice(obj, format, ...) \ llog_printf((obj), LLOG_NOTICE, (format), ##__VA_ARGS__) #define llog_dnotice(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_NOTICE, (format), ##__VA_ARGS__) #define llog_warning(obj, format, ...) \ llog_printf((obj), LLOG_WARNING, (format), ##__VA_ARGS__) #define llog_dwarning(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_WARNING, (format), ##__VA_ARGS__) #define llog_error(obj, format, ...) \ llog_printf((obj), LLOG_ERROR, (format), ##__VA_ARGS__) #define llog_derror(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_ERROR, (format), ##__VA_ARGS__) #define llog_critical(obj, format, ...) \ llog_printf((obj), LLOG_CRITICAL, (format), ##__VA_ARGS__) #define llog_dcritical(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_CRITICAL, (format), ##__VA_ARGS__) #define llog_alert(obj, format, ...) \ llog_printf((obj), LLOG_ALERT, (format), ##__VA_ARGS__) #define llog_dalert(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_ALERT, (format), ##__VA_ARGS__) #define llog_fatal(obj, format, ...) \ llog_printf((obj), LLOG_FATAL, (format), ##__VA_ARGS__) #define llog_dfatal(obj, data, format, ...) \ llog_dprintf((obj), (data), LLOG_FATAL, (format), ##__VA_ARGS__) /* * Default log messages * These macros can be used to produce default log messages. You can use them * directly in an "return" statement. The "v" variants automatically cast the * result to void so it can be used in return statements inside of void * functions. The "d" variants use the logging object directly as the parent * might not exist, yet. * * Most of the messages work only if debugging is enabled. This is, because they * are used in debug paths and would slow down normal applications. */ #define llog_dEINVAL(obj, data) \ (llog_derror((obj), (data), "invalid arguments"), -EINVAL) #define llog_EINVAL(obj) \ (llog_dEINVAL((obj)->llog, (obj)->llog_data)) #define llog_vEINVAL(obj) \ ((void)llog_EINVAL(obj)) #define llog_vdEINVAL(obj, data) \ ((void)llog_dEINVAL((obj), (data))) #define llog_dEFAULT(obj, data) \ (llog_derror((obj), (data), "internal operation failed"), -EFAULT) #define llog_EFAULT(obj) \ (llog_dEFAULT((obj)->llog, (obj)->llog_data)) #define llog_vEFAULT(obj) \ ((void)llog_EFAULT(obj)) #define llog_vdEFAULT(obj, data) \ ((void)llog_dEFAULT((obj), (data))) #define llog_dENOMEM(obj, data) \ (llog_derror((obj), (data), "out of memory"), -ENOMEM) #define llog_ENOMEM(obj) \ (llog_dENOMEM((obj)->llog, (obj)->llog_data)) #define llog_vENOMEM(obj) \ ((void)llog_ENOMEM(obj)) #define llog_vdENOMEM(obj, data) \ ((void)llog_dENOMEM((obj), (data))) #define llog_dEPIPE(obj, data) \ (llog_derror((obj), (data), "fd closed unexpectedly"), -EPIPE) #define llog_EPIPE(obj) \ (llog_dEPIPE((obj)->llog, (obj)->llog_data)) #define llog_vEPIPE(obj) \ ((void)llog_EPIPE(obj)) #define llog_vdEPIPE(obj, data) \ ((void)llog_dEPIPE((obj), (data))) #define llog_dERRNO(obj, data) \ (llog_derror((obj), (data), "syscall failed (%d): %m", errno), -errno) #define llog_ERRNO(obj) \ (llog_dERRNO((obj)->llog, (obj)->llog_data)) #define llog_vERRNO(obj) \ ((void)llog_ERRNO(obj)) #define llog_vdERRNO(obj, data) \ ((void)llog_dERRNO((obj), (data))) #define llog_dERR(obj, data, _r) \ (errno = -(_r), llog_derror((obj), (data), "syscall failed (%d): %m", (_r)), (_r)) #define llog_ERR(obj, _r) \ (llog_dERR((obj)->llog, (obj)->llog_data, (_r))) #define llog_vERR(obj, _r) \ ((void)llog_ERR((obj), (_r))) #define llog_vdERR(obj, data, _r) \ ((void)llog_dERR((obj), (data), (_r))) #endif /* SHL_LLOG_H */ libtsm-4.0.2/src/shared/shl-macro.h000066400000000000000000000163671420363367700171320ustar00rootroot00000000000000/* * SHL - Macros * * Copyright (c) 2011-2014 David Herrmann * Dedicated to the Public Domain */ /* * Macros */ #ifndef SHL_MACRO_H #define SHL_MACRO_H #include #include #include #include #include #include #include /* sanity checks required for some macros */ #if __SIZEOF_POINTER__ != 4 && __SIZEOF_POINTER__ != 8 #error "Pointer size is neither 4 nor 8 bytes" #endif /* gcc attributes; look them up for more information */ #define _shl_printf_(_a, _b) __attribute__((__format__(printf, _a, _b))) #define _shl_alloc_(...) __attribute__((__alloc_size__(__VA_ARGS__))) #define _shl_sentinel_ __attribute__((__sentinel__)) #define _shl_noreturn_ __attribute__((__noreturn__)) #define _shl_unused_ __attribute__((__unused__)) #define _shl_pure_ __attribute__((__pure__)) #define _shl_const_ __attribute__((__const__)) #define _shl_deprecated_ __attribute__((__deprecated__)) #define _shl_packed_ __attribute__((__packed__)) #define _shl_malloc_ __attribute__((__malloc__)) #define _shl_weak_ __attribute__((__weak__)) #define _shl_likely_(_val) (__builtin_expect(!!(_val), 1)) #define _shl_unlikely_(_val) (__builtin_expect(!!(_val), 0)) #define _shl_public_ __attribute__((__visibility__("default"))) #define _shl_hidden_ __attribute__((__visibility__("hidden"))) #define _shl_weakref_(_val) __attribute__((__weakref__(#_val))) #define _shl_cleanup_(_val) __attribute__((__cleanup__(_val))) static inline void shl_freep(void *p) { free(*(void**)p); } #define _shl_free_ _shl_cleanup_(shl_freep) static inline void shl_closep(int *p) { if (*p >= 0) close(*p); } #define _shl_close_ _shl_cleanup_(shl_closep) static inline void shl_set_errno(int *r) { errno = *r; } #define SHL_PROTECT_ERRNO \ _shl_cleanup_(shl_set_errno) _shl_unused_ int shl__errno = errno /* 2-level stringify helper */ #define SHL__STRINGIFY(_val) #_val #define SHL_STRINGIFY(_val) SHL__STRINGIFY(_val) /* 2-level concatenate helper */ #define SHL__CONCATENATE(_a, _b) _a ## _b #define SHL_CONCATENATE(_a, _b) SHL__CONCATENATE(_a, _b) /* unique identifier with prefix */ #define SHL_UNIQUE(_prefix) SHL_CONCATENATE(_prefix, __COUNTER__) /* array element count */ #define SHL_ARRAY_LENGTH(_array) (sizeof(_array)/sizeof(*(_array))) /* get parent pointer by container-type, member and member-pointer */ #define shl_container_of(_ptr, _type, _member) \ ({ \ const typeof( ((_type *)0)->_member ) *__mptr = (_ptr); \ (_type *)( (char *)__mptr - offsetof(_type, _member) ); \ }) /* return maximum of two values and do strict type checking */ #define shl_max(_a, _b) \ ({ \ typeof(_a) __a = (_a); \ typeof(_b) __b = (_b); \ (void) (&__a == &__b); \ __a > __b ? __a : __b; \ }) /* same as shl_max() but perform explicit cast beforehand */ #define shl_max_t(_type, _a, _b) \ ({ \ _type __a = (_type)(_a); \ _type __b = (_type)(_b); \ __a > __b ? __a : __b; \ }) /* return minimum of two values and do strict type checking */ #define shl_min(_a, _b) \ ({ \ typeof(_a) __a = (_a); \ typeof(_b) __b = (_b); \ (void) (&__a == &__b); \ __a < __b ? __a : __b; \ }) /* same as shl_min() but perform explicit cast beforehand */ #define shl_min_t(_type, _a, _b) \ ({ \ _type __a = (_type)(_a); \ _type __b = (_type)(_b); \ __a < __b ? __a : __b; \ }) /* clamp value between low and high barriers */ #define shl_clamp(_val, _low, _high) \ ({ \ typeof(_val) __v = (_val); \ typeof(_low) __l = (_low); \ typeof(_high) __h = (_high); \ (void) (&__v == &__l); \ (void) (&__v == &__h); \ ((__v > __h) ? __h : ((__v < __l) ? __l : __v)); \ }) /* align to next higher power-of-2 (except for: 0 => 0, overflow => 0) */ static inline size_t SHL_ALIGN_POWER2(size_t u) { return 1ULL << ((sizeof(u) * 8ULL) - __builtin_clzll(u - 1ULL)); } /* zero memory or type */ #define shl_memzero(_ptr, _size) (memset((_ptr), 0, (_size))) #define shl_zero(_ptr) (shl_memzero(&(_ptr), sizeof(_ptr))) /* ptr <=> uint casts */ #define SHL_PTR_TO_TYPE(_type, _ptr) ((_type)((uintptr_t)(_ptr))) #define SHL_TYPE_TO_PTR(_type, _int) ((void*)((uintptr_t)(_int))) #define SHL_PTR_TO_INT(_ptr) SHL_PTR_TO_TYPE(int, (_ptr)) #define SHL_INT_TO_PTR(_ptr) SHL_TYPE_TO_PTR(int, (_ptr)) #define SHL_PTR_TO_UINT(_ptr) SHL_PTR_TO_TYPE(unsigned int, (_ptr)) #define SHL_UINT_TO_PTR(_ptr) SHL_TYPE_TO_PTR(unsigned int, (_ptr)) #define SHL_PTR_TO_LONG(_ptr) SHL_PTR_TO_TYPE(long, (_ptr)) #define SHL_LONG_TO_PTR(_ptr) SHL_TYPE_TO_PTR(long, (_ptr)) #define SHL_PTR_TO_ULONG(_ptr) SHL_PTR_TO_TYPE(unsigned long, (_ptr)) #define SHL_ULONG_TO_PTR(_ptr) SHL_TYPE_TO_PTR(unsigned long, (_ptr)) #define SHL_PTR_TO_S32(_ptr) SHL_PTR_TO_TYPE(int32_t, (_ptr)) #define SHL_S32_TO_PTR(_ptr) SHL_TYPE_TO_PTR(int32_t, (_ptr)) #define SHL_PTR_TO_U32(_ptr) SHL_PTR_TO_TYPE(uint32_t, (_ptr)) #define SHL_U32_TO_PTR(_ptr) SHL_TYPE_TO_PTR(uint32_t, (_ptr)) #define SHL_PTR_TO_S64(_ptr) SHL_PTR_TO_TYPE(int64_t, (_ptr)) #define SHL_S64_TO_PTR(_ptr) SHL_TYPE_TO_PTR(int64_t, (_ptr)) #define SHL_PTR_TO_U64(_ptr) SHL_PTR_TO_TYPE(uint64_t, (_ptr)) #define SHL_U64_TO_PTR(_ptr) SHL_TYPE_TO_PTR(uint64_t, (_ptr)) /* compile-time assertions */ #define shl_assert_cc(_expr) static_assert(_expr, #_expr) /* * Safe Multiplications * Multiplications are subject to overflows. These helpers guarantee that the * multiplication can be done safely and return -ERANGE if not. * * Note: This is horribly slow for ull/uint64_t as we need a division to test * for overflows. Take that into account when using these. For smaller integers, * we can simply use an upcast-multiplication which gcc should be smart enough * to optimize. */ #define SHL__REAL_MULT(_max, _val, _factor) \ ({ \ (_factor == 0 || *(_val) <= (_max) / (_factor)) ? \ ((*(_val) *= (_factor)), 0) : \ -ERANGE; \ }) #define SHL__UPCAST_MULT(_type, _max, _val, _factor) \ ({ \ _type v = *(_val) * (_type)(_factor); \ (v <= (_max)) ? \ ((*(_val) = v), 0) : \ -ERANGE; \ }) static inline int shl_mult_ull(unsigned long long *val, unsigned long long factor) { return SHL__REAL_MULT(ULLONG_MAX, val, factor); } static inline int shl_mult_ul(unsigned long *val, unsigned long factor) { #if ULONG_MAX < ULLONG_MAX return SHL__UPCAST_MULT(unsigned long long, ULONG_MAX, val, factor); #else shl_assert_cc(sizeof(unsigned long) == sizeof(unsigned long long)); return shl_mult_ull((unsigned long long*)val, factor); #endif } static inline int shl_mult_u(unsigned int *val, unsigned int factor) { #if UINT_MAX < ULONG_MAX return SHL__UPCAST_MULT(unsigned long, UINT_MAX, val, factor); #elif UINT_MAX < ULLONG_MAX return SHL__UPCAST_MULT(unsigned long long, UINT_MAX, val, factor); #else shl_assert_cc(sizeof(unsigned int) == sizeof(unsigned long long)); return shl_mult_ull(val, factor); #endif } static inline int shl_mult_u64(uint64_t *val, uint64_t factor) { return SHL__REAL_MULT(UINT64_MAX, val, factor); } static inline int shl_mult_u32(uint32_t *val, uint32_t factor) { return SHL__UPCAST_MULT(uint_fast64_t, UINT32_MAX, val, factor); } static inline int shl_mult_u16(uint16_t *val, uint16_t factor) { return SHL__UPCAST_MULT(uint_fast32_t, UINT16_MAX, val, factor); } static inline int shl_mult_u8(uint8_t *val, uint8_t factor) { return SHL__UPCAST_MULT(uint_fast16_t, UINT8_MAX, val, factor); } #endif /* SHL_MACRO_H */ libtsm-4.0.2/src/shared/shl-pty.c000066400000000000000000000251751420363367700166350ustar00rootroot00000000000000/* * SHL - PTY Helpers * * Copyright (c) 2011-2014 David Herrmann * Dedicated to the Public Domain */ /* * PTY Helpers */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "shl-macro.h" #include "shl-pty.h" #include "shl-ring.h" #define SHL_PTY_BUFSIZE 16384 /* * PTY * A PTY object represents a single PTY connection between a master and a * child. The child process is fork()ed so the caller controls what program * will be run. * * Programs like /bin/login tend to perform a vhangup() on their TTY * before running the login procedure. This also causes the pty master * to get a EPOLLHUP event as long as no client has the TTY opened. * This means, we cannot use the TTY connection as reliable way to track * the client. Instead, we _must_ rely on the PID of the client to track * them. * However, this has the side effect that if the client forks and the * parent exits, we loose them and restart the client. But this seems to * be the expected behavior so we implement it here. * * Unfortunately, epoll always polls for EPOLLHUP so as long as the * vhangup() is ongoing, we will _always_ get EPOLLHUP and cannot sleep. * This gets worse if the client closes the TTY but doesn't exit. * Therefore, the fd must be edge-triggered in the epoll-set so we * only get the events once they change. This has to be taken into account by * the user of shl_pty. As many event-loops don't support edge-triggered * behavior, you can use the shl_pty_bridge interface. * * Note that shl_pty does not track SIGHUP, you need to do that yourself * and call shl_pty_close() once the client exited. */ struct shl_pty { unsigned long ref; int fd; pid_t child; char in_buf[SHL_PTY_BUFSIZE]; struct shl_ring out_buf; shl_pty_input_fn fn_input; void *fn_input_data; }; enum shl_pty_msg { SHL_PTY_FAILED, SHL_PTY_SETUP, }; static char pty_recv(int fd) { int r; char d; do { r = read(fd, &d, 1); } while (r < 0 && (errno == EINTR || errno == EAGAIN)); return (r <= 0) ? SHL_PTY_FAILED : d; } static int pty_send(int fd, char d) { int r; do { r = write(fd, &d, 1); } while (r < 0 && (errno == EINTR || errno == EAGAIN)); return (r == 1) ? 0 : -EINVAL; } static int pty_setup_child(int slave, unsigned short term_width, unsigned short term_height) { struct termios attr; struct winsize ws; /* get terminal attributes */ if (tcgetattr(slave, &attr) < 0) return -errno; /* erase character should be normal backspace, PLEASEEE! */ attr.c_cc[VERASE] = 010; /* always set UTF8 flag */ attr.c_iflag |= IUTF8; /* set changed terminal attributes */ if (tcsetattr(slave, TCSANOW, &attr) < 0) return -errno; memset(&ws, 0, sizeof(ws)); ws.ws_col = term_width; ws.ws_row = term_height; if (ioctl(slave, TIOCSWINSZ, &ws) < 0) return -errno; if (dup2(slave, STDIN_FILENO) != STDIN_FILENO || dup2(slave, STDOUT_FILENO) != STDOUT_FILENO || dup2(slave, STDERR_FILENO) != STDERR_FILENO) return -errno; return 0; } static int pty_init_child(int fd) { int r; sigset_t sigset; char *slave_name; int slave, i; pid_t pid; /* unlockpt() requires unset signal-handlers */ sigemptyset(&sigset); r = sigprocmask(SIG_SETMASK, &sigset, NULL); if (r < 0) return -errno; for (i = 1; i < SIGSYS; ++i) signal(i, SIG_DFL); r = grantpt(fd); if (r < 0) return -errno; r = unlockpt(fd); if (r < 0) return -errno; slave_name = ptsname(fd); if (!slave_name) return -errno; /* open slave-TTY */ slave = open(slave_name, O_RDWR | O_CLOEXEC | O_NOCTTY); if (slave < 0) return -errno; /* open session so we loose our controlling TTY */ pid = setsid(); if (pid < 0) { close(slave); return -errno; } /* set controlling TTY */ r = ioctl(slave, TIOCSCTTY, 0); if (r < 0) { close(slave); return -errno; } return slave; } pid_t shl_pty_open(struct shl_pty **out, shl_pty_input_fn fn_input, void *fn_input_data, unsigned short term_width, unsigned short term_height) { _shl_pty_unref_ struct shl_pty *pty = NULL; _shl_close_ int fd = -1; int slave, r, comm[2]; pid_t pid; char d; if (!out) return -EINVAL; pty = calloc(1, sizeof(*pty)); if (!pty) return -ENOMEM; pty->ref = 1; pty->fd = -1; pty->fn_input = fn_input; pty->fn_input_data = fn_input_data; fd = posix_openpt(O_RDWR | O_NOCTTY | O_CLOEXEC | O_NONBLOCK); if (fd < 0) return -errno; r = pipe2(comm, O_CLOEXEC); if (r < 0) return -errno; pid = fork(); if (pid < 0) { /* error */ pid = -errno; close(comm[0]); close(comm[1]); return pid; } else if (!pid) { /* child */ slave = pty_init_child(fd); if (slave < 0) exit(1); close(comm[0]); close(fd); fd = -1; free(pty); pty = NULL; r = pty_setup_child(slave, term_width, term_height); if (r < 0) exit(1); /* close slave if it's not one of the std-fds */ if (slave > 2) close(slave); /* wake parent */ pty_send(comm[1], SHL_PTY_SETUP); close(comm[1]); *out = NULL; return pid; } /* parent */ pty->fd = fd; pty->child = pid; close(comm[1]); fd = -1; /* wait for child setup */ d = pty_recv(comm[0]); close(comm[0]); if (d != SHL_PTY_SETUP) return -EINVAL; *out = pty; pty = NULL; return pid; } void shl_pty_ref(struct shl_pty *pty) { if (!pty || !pty->ref) return; ++pty->ref; } void shl_pty_unref(struct shl_pty *pty) { if (!pty || !pty->ref || --pty->ref) return; shl_pty_close(pty); shl_ring_clear(&pty->out_buf); free(pty); } void shl_pty_close(struct shl_pty *pty) { if (!pty || pty->fd < 0) return; close(pty->fd); pty->fd = -1; } bool shl_pty_is_open(struct shl_pty *pty) { return pty && pty->fd >= 0; } int shl_pty_get_fd(struct shl_pty *pty) { if (!pty) return -EINVAL; return pty->fd >= 0 ? pty->fd : -EPIPE; } pid_t shl_pty_get_child(struct shl_pty *pty) { if (!pty) return -EINVAL; return pty->child > 0 ? pty->child : -ECHILD; } static int pty_write(struct shl_pty *pty) { struct iovec vec[2]; unsigned int i; size_t num; ssize_t r; /* * Same as pty_read(), we're edge-triggered so we need to call write() * until either all data is written or it return EAGAIN. We call it * twice and if it still writes successfully, we return EAGAIN. If we * bail out early, we also return EAGAIN if there's still data. */ for (i = 0; i < 2; ++i) { num = shl_ring_peek(&pty->out_buf, vec); if (!num) return 0; r = writev(pty->fd, vec, (int)num); if (r < 0) { if (errno == EAGAIN) return 0; if (errno == EINTR) return -EAGAIN; return -errno; } else if (!r) { return -EPIPE; } else { shl_ring_pull(&pty->out_buf, (size_t)r); } } return shl_ring_get_size(&pty->out_buf) > 0 ? -EAGAIN : 0; } static int pty_read(struct shl_pty *pty) { unsigned int i; ssize_t len; /* * We're edge-triggered, means we need to read the whole queue. This, * however, might cause us to stall if the writer is faster than we * are. Therefore, we read twice and if the second read still returned * data, we return -EAGAIN and let the caller deal with rescheduling the * dispatcher. */ for (i = 0; i < 2; ++i) { len = read(pty->fd, pty->in_buf, sizeof(pty->in_buf) - 1); if (len < 0) { if (errno == EAGAIN) return 0; if (errno == EINTR) return -EAGAIN; return -errno; } else if (!len) { return -EPIPE; } else if (len > 0 && pty->fn_input) { /* set terminating zero for debugging safety */ pty->in_buf[len] = 0; pty->fn_input(pty, pty->fn_input_data, pty->in_buf, len); } } return -EAGAIN; } int shl_pty_dispatch(struct shl_pty *pty) { int r; if (!shl_pty_is_open(pty)) return -ENODEV; r = pty_read(pty); pty_write(pty); return r; } int shl_pty_write(struct shl_pty *pty, const char *u8, size_t len) { if (!shl_pty_is_open(pty)) return -ENODEV; return shl_ring_push(&pty->out_buf, u8, len); } int shl_pty_signal(struct shl_pty *pty, int sig) { if (!shl_pty_is_open(pty)) return -ENODEV; return ioctl(pty->fd, TIOCSIG, sig) < 0 ? -errno : 0; } int shl_pty_resize(struct shl_pty *pty, unsigned short term_width, unsigned short term_height) { struct winsize ws; if (!shl_pty_is_open(pty)) return -ENODEV; memset(&ws, 0, sizeof(ws)); ws.ws_col = term_width; ws.ws_row = term_height; /* * This will send SIGWINCH to the pty slave foreground process group. * We will also get one, but we don't need it. */ return ioctl(pty->fd, TIOCSWINSZ, &ws) < 0 ? -errno : 0; } /* * PTY Bridge * The PTY bridge wraps multiple ptys in a single file-descriptor. It is * enough for the caller to listen for read-events on the fd. * * This interface is provided to allow integration of PTYs into event-loops * that do not support edge-triggered interfaces. There is no other reason * to use this bridge. */ int shl_pty_bridge_new(void) { int fd; fd = epoll_create1(EPOLL_CLOEXEC); if (fd < 0) return -errno; return fd; } void shl_pty_bridge_free(int bridge) { if (bridge < 0) return; close(bridge); } int shl_pty_bridge_dispatch_pty(int bridge, struct shl_pty *pty) { struct epoll_event up; int r; if (bridge < 0 || !pty) return -EINVAL; r = shl_pty_dispatch(pty); if (r == -EAGAIN) { /* EAGAIN means we couldn't dispatch data fast enough. Modify * the fd in the epoll-set so we get edge-triggered events * next round. */ memset(&up, 0, sizeof(up)); up.events = EPOLLHUP | EPOLLERR | EPOLLIN | EPOLLOUT | EPOLLET; up.data.ptr = pty; epoll_ctl(bridge, EPOLL_CTL_ADD, shl_pty_get_fd(pty), &up); } return 0; } int shl_pty_bridge_dispatch(int bridge, int timeout) { struct epoll_event ev; struct shl_pty *pty; int r; if (bridge < 0) return -EINVAL; r = epoll_wait(bridge, &ev, 1, timeout); if (r < 0) { if (errno == EAGAIN || errno == EINTR) return 0; return -errno; } if (!r) return 0; pty = ev.data.ptr; return shl_pty_bridge_dispatch_pty(bridge, pty); } int shl_pty_bridge_add(int bridge, struct shl_pty *pty) { struct epoll_event ev; int r; if (bridge < 0) return -EINVAL; if (!shl_pty_is_open(pty)) return -ENODEV; memset(&ev, 0, sizeof(ev)); ev.events = EPOLLHUP | EPOLLERR | EPOLLIN | EPOLLOUT | EPOLLET; ev.data.ptr = pty; r = epoll_ctl(bridge, EPOLL_CTL_ADD, shl_pty_get_fd(pty), &ev); if (r < 0) return -errno; return 0; } void shl_pty_bridge_remove(int bridge, struct shl_pty *pty) { if (bridge < 0 || !shl_pty_is_open(pty)) return; epoll_ctl(bridge, EPOLL_CTL_DEL, shl_pty_get_fd(pty), NULL); } libtsm-4.0.2/src/shared/shl-pty.h000066400000000000000000000031611420363367700166310ustar00rootroot00000000000000/* * SHL - PTY Helpers * * Copyright (c) 2011-2014 David Herrmann * Dedicated to the Public Domain */ /* * PTY Helpers */ #ifndef SHL_PTY_H #define SHL_PTY_H #include #include #include #include #include #include #include "shl-macro.h" /* pty */ struct shl_pty; typedef void (*shl_pty_input_fn) (struct shl_pty *pty, void *data, char *u8, size_t len); pid_t shl_pty_open(struct shl_pty **out, shl_pty_input_fn fn_input, void *fn_input_data, unsigned short term_width, unsigned short term_height); void shl_pty_ref(struct shl_pty *pty); void shl_pty_unref(struct shl_pty *pty); void shl_pty_close(struct shl_pty *pty); static inline void shl_pty_unref_p(struct shl_pty **pty) { shl_pty_unref(*pty); } #define _shl_pty_unref_ _shl_cleanup_(shl_pty_unref_p) bool shl_pty_is_open(struct shl_pty *pty); int shl_pty_get_fd(struct shl_pty *pty); pid_t shl_pty_get_child(struct shl_pty *pty); int shl_pty_dispatch(struct shl_pty *pty); int shl_pty_write(struct shl_pty *pty, const char *u8, size_t len); int shl_pty_signal(struct shl_pty *pty, int sig); int shl_pty_resize(struct shl_pty *pty, unsigned short term_width, unsigned short term_height); /* pty bridge */ int shl_pty_bridge_new(void); void shl_pty_bridge_free(int bridge); int shl_pty_bridge_dispatch_pty(int bridge, struct shl_pty *pty); int shl_pty_bridge_dispatch(int bridge, int timeout); int shl_pty_bridge_add(int bridge, struct shl_pty *pty); void shl_pty_bridge_remove(int bridge, struct shl_pty *pty); #endif /* SHL_PTY_H */ libtsm-4.0.2/src/shared/shl-ring.c000066400000000000000000000074141420363367700167540ustar00rootroot00000000000000/* * SHL - Ring buffer * * Copyright (c) 2011-2014 David Herrmann * Dedicated to the Public Domain */ /* * Ring buffer */ #include #include #include #include #include "shl-macro.h" #include "shl-ring.h" #define RING_MASK(_r, _v) ((_v) & ((_r)->size - 1)) void shl_ring_flush(struct shl_ring *r) { r->start = 0; r->used = 0; } void shl_ring_clear(struct shl_ring *r) { free(r->buf); memset(r, 0, sizeof(*r)); } /* * Get data pointers for current ring-buffer data. @vec must be an array of 2 * iovec objects. They are filled according to the data available in the * ring-buffer. 0, 1 or 2 is returned according to the number of iovec objects * that were filled (0 meaning buffer is empty). * * Hint: "struct iovec" is defined in and looks like this: * struct iovec { * void *iov_base; * size_t iov_len; * }; */ size_t shl_ring_peek(struct shl_ring *r, struct iovec *vec) { if (r->used == 0) { return 0; } else if (r->start + r->used <= r->size) { if (vec) { vec[0].iov_base = &r->buf[r->start]; vec[0].iov_len = r->used; } return 1; } else { if (vec) { vec[0].iov_base = &r->buf[r->start]; vec[0].iov_len = r->size - r->start; vec[1].iov_base = r->buf; vec[1].iov_len = r->used - (r->size - r->start); } return 2; } } /* * Copy data from the ring buffer into the linear external buffer @buf. Copy * at most @size bytes. If the ring buffer size is smaller, copy less bytes and * return the number of bytes copied. */ size_t shl_ring_copy(struct shl_ring *r, void *buf, size_t size) { size_t l; if (size > r->used) size = r->used; if (size > 0) { l = r->size - r->start; if (size <= l) { memcpy(buf, &r->buf[r->start], size); } else { memcpy(buf, &r->buf[r->start], l); memcpy((uint8_t*)buf + l, r->buf, size - l); } } return size; } /* * Resize ring-buffer to size @nsize. @nsize must be a power-of-2, otherwise * ring operations will behave incorrectly. */ static int ring_resize(struct shl_ring *r, size_t nsize) { uint8_t *buf; size_t l; buf = malloc(nsize); if (!buf) return -ENOMEM; if (r->used > 0) { l = r->size - r->start; if (r->used <= l) { memcpy(buf, &r->buf[r->start], r->used); } else { memcpy(buf, &r->buf[r->start], l); memcpy(&buf[l], r->buf, r->used - l); } } free(r->buf); r->buf = buf; r->size = nsize; r->start = 0; return 0; } /* * Resize ring-buffer to provide enough room for @add bytes of new data. This * resizes the buffer if it is too small. It returns -ENOMEM on OOM and 0 on * success. */ static int ring_grow(struct shl_ring *r, size_t add) { size_t need; if (r->size - r->used >= add) return 0; need = r->used + add; if (need <= r->used) return -ENOMEM; else if (need < 4096) need = 4096; need = SHL_ALIGN_POWER2(need); if (need == 0) return -ENOMEM; return ring_resize(r, need); } /* * Push @len bytes from @u8 into the ring buffer. The buffer is resized if it * is too small. -ENOMEM is returned on OOM, 0 on success. */ int shl_ring_push(struct shl_ring *r, const void *u8, size_t size) { int err; size_t pos, l; if (size == 0) return 0; err = ring_grow(r, size); if (err < 0) return err; pos = RING_MASK(r, r->start + r->used); l = r->size - pos; if (l >= size) { memcpy(&r->buf[pos], u8, size); } else { memcpy(&r->buf[pos], u8, l); memcpy(r->buf, (const uint8_t*)u8 + l, size - l); } r->used += size; return 0; } /* * Remove @len bytes from the start of the ring-buffer. Note that we protect * against overflows so removing more bytes than available is safe. */ void shl_ring_pull(struct shl_ring *r, size_t size) { if (size > r->used) size = r->used; r->start = RING_MASK(r, r->start + size); r->used -= size; } libtsm-4.0.2/src/shared/shl-ring.h000066400000000000000000000023651420363367700167610ustar00rootroot00000000000000/* * SHL - Ring buffer * * Copyright (c) 2011-2014 David Herrmann * Dedicated to the Public Domain */ /* * Ring buffer */ #ifndef SHL_RING_H #define SHL_RING_H #include #include #include #include #include struct shl_ring { uint8_t *buf; /* buffer or NULL */ size_t size; /* actual size of @buf */ size_t start; /* start position of ring */ size_t used; /* number of actually used bytes */ }; /* flush buffer so it is empty again */ void shl_ring_flush(struct shl_ring *r); /* flush buffer, free allocated data and reset to initial state */ void shl_ring_clear(struct shl_ring *r); /* get pointers to buffer data and their length */ size_t shl_ring_peek(struct shl_ring *r, struct iovec *vec); /* copy data into external linear buffer */ size_t shl_ring_copy(struct shl_ring *r, void *buf, size_t size); /* push data to the end of the buffer */ int shl_ring_push(struct shl_ring *r, const void *u8, size_t size); /* pull data from the front of the buffer */ void shl_ring_pull(struct shl_ring *r, size_t size); /* return size of occupied buffer in bytes */ static inline size_t shl_ring_get_size(struct shl_ring *r) { return r->used; } #endif /* SHL_RING_H */ libtsm-4.0.2/src/tsm/000077500000000000000000000000001420363367700144145ustar00rootroot00000000000000libtsm-4.0.2/src/tsm/CMakeLists.txt000066400000000000000000000052621420363367700171610ustar00rootroot00000000000000# # libtsm # Main library build instructions # # # Use a separate object library that is shared between tsm and tsm_test # add_library(tsm_obj OBJECT tsm-render.c tsm-screen.c tsm-selection.c tsm-unicode.c tsm-vte.c tsm-vte-charsets.c ) set_target_properties(tsm_obj PROPERTIES POSITION_INDEPENDENT_CODE ON C_VISIBILITY_PRESET hidden ) # Fix include path for tsm_obj because it can't directly link to # external and shl. TODO: remove after we require 3.12 foreach(lib IN ITEMS external shl) target_include_directories(tsm_obj PRIVATE $) endforeach() # Other non-compilation properties shared between tsm and tsm_test function(apply_properties target) # TODO: set this on tsm_obj after we require 3.12 # Link to dependencies target_link_object_libraries(${target} PRIVATE external shl ) if(XKBCommon_KeySyms_FOUND) target_link_libraries(${target} PRIVATE XKB::KeySyms ) endif() target_include_directories(${target} INTERFACE $ $ ) set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON C_VISIBILITY_PRESET hidden VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}" PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/libtsm.h" ) add_libtsm_compile_options(${target}) endfunction() # # Main production library # add_library(tsm) target_link_object_libraries(tsm PRIVATE tsm_obj) apply_properties(tsm) # The production library additionally use version script set_property(TARGET tsm APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--version-script=\"${CMAKE_CURRENT_SOURCE_DIR}/libtsm.sym\"" ) set_property(TARGET tsm APPEND PROPERTY LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/libtsm.sym" ) # Add an alias so that library can be used inside the build tree add_library(libtsm::tsm ALIAS tsm) # # Add an additional static library for testing # if(BUILD_TESTING) # Must be static to avoid visibility=hidden add_library(tsm_test STATIC) target_link_object_libraries(tsm_test PRIVATE tsm_obj) apply_properties(tsm_test) # Additionally expose internal private header path target_include_directories(tsm_test INTERFACE $ ) endif() # # Installation # install(TARGETS tsm EXPORT tsm-targets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) libtsm-4.0.2/src/tsm/libtsm-int.h000066400000000000000000000126021420363367700166500ustar00rootroot00000000000000/* * TSM - Main internal header * * Copyright (c) 2018 Aetf * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #ifndef TSM_LIBTSM_INT_H #define TSM_LIBTSM_INT_H #include #include #include #include #include "libtsm.h" #include "shl-llog.h" #define SHL_EXPORT __attribute__((visibility("default"))) /* max combined-symbol length */ #define TSM_UCS4_MAXLEN 10 /* symbols */ struct tsm_symbol_table; extern const tsm_symbol_t tsm_symbol_default; int tsm_symbol_table_new(struct tsm_symbol_table **out); void tsm_symbol_table_ref(struct tsm_symbol_table *tbl); void tsm_symbol_table_unref(struct tsm_symbol_table *tbl); tsm_symbol_t tsm_symbol_make(uint32_t ucs4); tsm_symbol_t tsm_symbol_append(struct tsm_symbol_table *tbl, tsm_symbol_t sym, uint32_t ucs4); const uint32_t *tsm_symbol_get(struct tsm_symbol_table *tbl, tsm_symbol_t *sym, size_t *size); unsigned int tsm_symbol_get_width(struct tsm_symbol_table *tbl, tsm_symbol_t sym); /* utf8 state machine */ struct tsm_utf8_mach; enum tsm_utf8_mach_state { TSM_UTF8_START, TSM_UTF8_ACCEPT, TSM_UTF8_REJECT, TSM_UTF8_EXPECT1, TSM_UTF8_EXPECT2, TSM_UTF8_EXPECT3, }; int tsm_utf8_mach_new(struct tsm_utf8_mach **out); void tsm_utf8_mach_free(struct tsm_utf8_mach *mach); int tsm_utf8_mach_feed(struct tsm_utf8_mach *mach, char c); uint32_t tsm_utf8_mach_get(struct tsm_utf8_mach *mach); void tsm_utf8_mach_reset(struct tsm_utf8_mach *mach); /* TSM screen */ struct cell { tsm_symbol_t ch; /* stored character */ unsigned int width; /* character width */ struct tsm_screen_attr attr; /* cell attributes */ tsm_age_t age; /* age of the single cell */ }; struct line { struct line *next; /* next line (NULL if not sb) */ struct line *prev; /* prev line (NULL if not sb) */ unsigned int size; /* real width */ struct cell *cells; /* actuall cells */ uint64_t sb_id; /* sb ID */ tsm_age_t age; /* age of the whole line */ }; #define SELECTION_TOP -1 struct selection_pos { struct line *line; unsigned int x; int y; }; struct tsm_screen { size_t ref; llog_submit_t llog; void *llog_data; unsigned int opts; unsigned int flags; struct tsm_symbol_table *sym_table; /* default attributes for new cells */ struct tsm_screen_attr def_attr; /* ageing */ tsm_age_t age_cnt; /* current age counter */ unsigned int age_reset : 1; /* age-overflow flag */ /* current buffer */ unsigned int size_x; /* width of screen */ unsigned int size_y; /* height of screen */ unsigned int margin_top; /* top-margin index */ unsigned int margin_bottom; /* bottom-margin index */ unsigned int line_num; /* real number of allocated lines */ struct line **lines; /* active lines; copy of main/alt */ struct line **main_lines; /* real main lines */ struct line **alt_lines; /* real alternative lines */ tsm_age_t age; /* whole screen age */ /* scroll-back buffer */ unsigned int sb_count; /* number of lines in sb */ struct line *sb_first; /* first line; was moved first */ struct line *sb_last; /* last line; was moved last*/ unsigned int sb_max; /* max-limit of lines in sb */ struct line *sb_pos; /* current position in sb or NULL */ uint64_t sb_last_id; /* last id given to sb-line */ /* cursor: positions are always in-bound, but cursor_x might be * bigger than size_x if new-line is pending */ unsigned int cursor_x; /* current cursor x-pos */ unsigned int cursor_y; /* current cursor y-pos */ /* tab ruler */ bool *tab_ruler; /* tab-flag for all cells of one row */ /* selection */ bool sel_active; struct selection_pos sel_start; struct selection_pos sel_end; }; void screen_cell_init(struct tsm_screen *con, struct cell *cell); void tsm_screen_set_opts(struct tsm_screen *scr, unsigned int opts); void tsm_screen_reset_opts(struct tsm_screen *scr, unsigned int opts); unsigned int tsm_screen_get_opts(struct tsm_screen *scr); static inline void screen_inc_age(struct tsm_screen *con) { if (!++con->age_cnt) { con->age_reset = 1; ++con->age_cnt; } } /* available character sets */ typedef tsm_symbol_t tsm_vte_charset[96]; extern tsm_vte_charset tsm_vte_unicode_lower; extern tsm_vte_charset tsm_vte_unicode_upper; extern tsm_vte_charset tsm_vte_dec_supplemental_graphics; extern tsm_vte_charset tsm_vte_dec_special_graphics; #endif /* TSM_LIBTSM_INT_H */ libtsm-4.0.2/src/tsm/libtsm.h000066400000000000000000000344161420363367700160670ustar00rootroot00000000000000/* * TSM - Main Header * * Copyright (c) 2018 Aetf * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #ifndef TSM_LIBTSM_H #define TSM_LIBTSM_H #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif /** * @mainpage * * TSM is a Terminal-emulator State Machine. It implements all common DEC-VT100 * to DEC-VT520 control codes and features. A state-machine is used to parse TTY * input and saved in a virtual screen. TSM does not provide any rendering, * glyph/font handling or anything more advanced. TSM is just a simple * state-machine for control-codes handling. * The main use-case for TSM are terminal-emulators. TSM has no dependencies * other than an ISO-C99 compiler and C-library. Any terminal emulator for any * window-environment or rendering-pipline can make use of TSM. However, TSM can * also be used for control-code validation, TTY-screen-capturing or other * advanced users of terminal escape-sequences. */ /** * @defgroup misc Miscellaneous Definitions * Miscellaneous definitions * * This section contains several miscellaneous definitions of small helpers and * constants. These are shared between other parts of the API and have common * semantics/syntax. * * @{ */ /** * Logging Callback * * @param data: User-provided data * @param file: Source code file where the log message originated or NULL * @param line: Line number in source code or 0 * @param func: C function name or NULL * @param subs: Subsystem where the message came from or NULL * @param sev: Kernel-style severity between 0=FATAL and 7=DEBUG * @param format: Printf-formatted message * @param args: Arguments for printf-style @p format * * This is the type of a logging callback function. You can always pass NULL * instead of such a function to disable logging. */ typedef void (*tsm_log_t) (void *data, const char *file, int line, const char *func, const char *subs, unsigned int sev, const char *format, va_list args); /** @} */ /** * @defgroup symbols Unicode Helpers * Unicode helpers * * Unicode uses 32bit types to uniquely represent symbols. However, combining * characters allow modifications of such symbols but require additional space. * To avoid passing around allocated strings, TSM provides a symbol-table which * can store combining-characters with their base-symbol to create a new symbol. * This way, only the symbol-identifiers have to be passed around (which are * simple integers). No string allocation is needed by the API user. * * The symbol table is currently not exported. Once the API is fixed, we will * provide it to outside users. * * Additionally, this contains some general UTF8/UCS4 helpers. * * @{ */ /* UCS4 helpers */ #define TSM_UCS4_MAX_BITS 31 #define TSM_UCS4_MAX ((1UL << TSM_UCS4_MAX_BITS) - 1UL) #define TSM_UCS4_INVALID (TSM_UCS4_MAX + 1) #define TSM_UCS4_REPLACEMENT (0xfffdUL) /* ucs4 to utf8 converter */ unsigned int tsm_ucs4_get_width(uint32_t ucs4); size_t tsm_ucs4_to_utf8(uint32_t ucs4, char *out); char *tsm_ucs4_to_utf8_alloc(const uint32_t *ucs4, size_t len, size_t *len_out); /* symbols */ typedef uint32_t tsm_symbol_t; /** @} */ /** * @defgroup screen Terminal Screens * Virtual terminal-screen implementation * * A TSM screen respresents the real screen of a terminal/application. It does * not render anything, but only provides a table of cells. Each cell contains * the stored symbol, attributes and more. Applications iterate a screen to * render each cell on their framebuffer. * * Screens provide all features that are expected from terminals. They include * scroll-back buffers, alternate screens, cursor positions and selection * support. Thus, it needs event-input from applications to drive these * features. Most of them are optional, though. * * @{ */ struct tsm_screen; typedef uint_fast32_t tsm_age_t; #define TSM_SCREEN_INSERT_MODE 0x01 #define TSM_SCREEN_AUTO_WRAP 0x02 #define TSM_SCREEN_REL_ORIGIN 0x04 #define TSM_SCREEN_INVERSE 0x08 #define TSM_SCREEN_HIDE_CURSOR 0x10 #define TSM_SCREEN_FIXED_POS 0x20 #define TSM_SCREEN_ALTERNATE 0x40 struct tsm_screen_attr { int8_t fccode; /* foreground color code or <0 for rgb */ int8_t bccode; /* background color code or <0 for rgb */ uint8_t fr; /* foreground red */ uint8_t fg; /* foreground green */ uint8_t fb; /* foreground blue */ uint8_t br; /* background red */ uint8_t bg; /* background green */ uint8_t bb; /* background blue */ unsigned int bold : 1; /* bold character */ unsigned int italic : 1; /* italics character */ unsigned int underline : 1; /* underlined character */ unsigned int inverse : 1; /* inverse colors */ unsigned int protect : 1; /* cannot be erased */ unsigned int blink : 1; /* blinking character */ }; typedef int (*tsm_screen_draw_cb) (struct tsm_screen *con, uint64_t id, const uint32_t *ch, size_t len, unsigned int width, unsigned int posx, unsigned int posy, const struct tsm_screen_attr *attr, tsm_age_t age, void *data); int tsm_screen_new(struct tsm_screen **out, tsm_log_t log, void *log_data); void tsm_screen_ref(struct tsm_screen *con); void tsm_screen_unref(struct tsm_screen *con); unsigned int tsm_screen_get_width(struct tsm_screen *con); unsigned int tsm_screen_get_height(struct tsm_screen *con); int tsm_screen_resize(struct tsm_screen *con, unsigned int x, unsigned int y); int tsm_screen_set_margins(struct tsm_screen *con, unsigned int top, unsigned int bottom); void tsm_screen_set_max_sb(struct tsm_screen *con, unsigned int max); void tsm_screen_clear_sb(struct tsm_screen *con); void tsm_screen_sb_up(struct tsm_screen *con, unsigned int num); void tsm_screen_sb_down(struct tsm_screen *con, unsigned int num); void tsm_screen_sb_page_up(struct tsm_screen *con, unsigned int num); void tsm_screen_sb_page_down(struct tsm_screen *con, unsigned int num); void tsm_screen_sb_reset(struct tsm_screen *con); void tsm_screen_set_def_attr(struct tsm_screen *con, const struct tsm_screen_attr *attr); void tsm_screen_reset(struct tsm_screen *con); void tsm_screen_set_flags(struct tsm_screen *con, unsigned int flags); void tsm_screen_reset_flags(struct tsm_screen *con, unsigned int flags); unsigned int tsm_screen_get_flags(struct tsm_screen *con); unsigned int tsm_screen_get_cursor_x(struct tsm_screen *con); unsigned int tsm_screen_get_cursor_y(struct tsm_screen *con); void tsm_screen_set_tabstop(struct tsm_screen *con); void tsm_screen_reset_tabstop(struct tsm_screen *con); void tsm_screen_reset_all_tabstops(struct tsm_screen *con); void tsm_screen_write(struct tsm_screen *con, tsm_symbol_t ch, const struct tsm_screen_attr *attr); void tsm_screen_newline(struct tsm_screen *con); void tsm_screen_scroll_up(struct tsm_screen *con, unsigned int num); void tsm_screen_scroll_down(struct tsm_screen *con, unsigned int num); void tsm_screen_move_to(struct tsm_screen *con, unsigned int x, unsigned int y); void tsm_screen_move_up(struct tsm_screen *con, unsigned int num, bool scroll); void tsm_screen_move_down(struct tsm_screen *con, unsigned int num, bool scroll); void tsm_screen_move_left(struct tsm_screen *con, unsigned int num); void tsm_screen_move_right(struct tsm_screen *con, unsigned int num); void tsm_screen_move_line_end(struct tsm_screen *con); void tsm_screen_move_line_home(struct tsm_screen *con); void tsm_screen_tab_right(struct tsm_screen *con, unsigned int num); void tsm_screen_tab_left(struct tsm_screen *con, unsigned int num); void tsm_screen_insert_lines(struct tsm_screen *con, unsigned int num); void tsm_screen_delete_lines(struct tsm_screen *con, unsigned int num); void tsm_screen_insert_chars(struct tsm_screen *con, unsigned int num); void tsm_screen_delete_chars(struct tsm_screen *con, unsigned int num); void tsm_screen_erase_cursor(struct tsm_screen *con); void tsm_screen_erase_chars(struct tsm_screen *con, unsigned int num); void tsm_screen_erase_cursor_to_end(struct tsm_screen *con, bool protect); void tsm_screen_erase_home_to_cursor(struct tsm_screen *con, bool protect); void tsm_screen_erase_current_line(struct tsm_screen *con, bool protect); void tsm_screen_erase_screen_to_cursor(struct tsm_screen *con, bool protect); void tsm_screen_erase_cursor_to_screen(struct tsm_screen *con, bool protect); void tsm_screen_erase_screen(struct tsm_screen *con, bool protect); void tsm_screen_selection_reset(struct tsm_screen *con); void tsm_screen_selection_start(struct tsm_screen *con, unsigned int posx, unsigned int posy); void tsm_screen_selection_target(struct tsm_screen *con, unsigned int posx, unsigned int posy); int tsm_screen_selection_copy(struct tsm_screen *con, char **out); tsm_age_t tsm_screen_draw(struct tsm_screen *con, tsm_screen_draw_cb draw_cb, void *data); /** @} */ /** * @defgroup vte State Machine * Virtual terminal emulation with state machine * * A TSM VTE object provides the terminal state machine. It takes input from the * application (which usually comes from a TTY/PTY from a client), parses it, * modifies the attach screen or returns data which has to be written back to * the client. * * Furthermore, VTE objects accept keyboard or mouse input from the application * which is interpreted compliant to DEV-VTs. * * @{ */ /* virtual terminal emulator */ struct tsm_vte; /* keep in sync with shl_xkb_mods */ enum tsm_vte_modifier { TSM_SHIFT_MASK = (1 << 0), TSM_LOCK_MASK = (1 << 1), TSM_CONTROL_MASK = (1 << 2), TSM_ALT_MASK = (1 << 3), TSM_LOGO_MASK = (1 << 4), }; /* keep in sync with TSM_INPUT_INVALID */ #define TSM_VTE_INVALID 0xffffffff enum tsm_vte_color { TSM_COLOR_BLACK, TSM_COLOR_RED, TSM_COLOR_GREEN, TSM_COLOR_YELLOW, TSM_COLOR_BLUE, TSM_COLOR_MAGENTA, TSM_COLOR_CYAN, TSM_COLOR_LIGHT_GREY, TSM_COLOR_DARK_GREY, TSM_COLOR_LIGHT_RED, TSM_COLOR_LIGHT_GREEN, TSM_COLOR_LIGHT_YELLOW, TSM_COLOR_LIGHT_BLUE, TSM_COLOR_LIGHT_MAGENTA, TSM_COLOR_LIGHT_CYAN, TSM_COLOR_WHITE, TSM_COLOR_FOREGROUND, TSM_COLOR_BACKGROUND, TSM_COLOR_NUM }; typedef void (*tsm_vte_write_cb) (struct tsm_vte *vte, const char *u8, size_t len, void *data); typedef void (*tsm_vte_osc_cb) (struct tsm_vte *vte, const char *u8, size_t len, void *data); int tsm_vte_new(struct tsm_vte **out, struct tsm_screen *con, tsm_vte_write_cb write_cb, void *data, tsm_log_t log, void *log_data); void tsm_vte_ref(struct tsm_vte *vte); void tsm_vte_unref(struct tsm_vte *vte); void tsm_vte_set_osc_cb(struct tsm_vte *vte, tsm_vte_osc_cb osc_cb, void *osc_data); /** * @brief Set color palette to one of the predefined palette on the vte object. * * Current supported palette names are * * - solarized * - solarized-black * - solarized-white * - soft-black * - base16-dark * - base16-light * * In addition, when palette name is "custom", the custom palette set in * tsm_vte_set_custom_palette() is used. * * @sa tsm_vte_set_custom_palette to set custom palette. * * @param vte The vte object to set on. * @param palette_name Name of the color palette. Pass NULL to reset to default. * * @retval 0 on success. * @retval -EINVAL if vte is NULL. * @retval -ENOMEM if malloc fails. */ int tsm_vte_set_palette(struct tsm_vte *vte, const char *palette_name); /** * @brief Set a custom palette on the vte object. * * An example: * * @code * static uint8_t color_palette[TSM_COLOR_NUM][3] = { * [TSM_COLOR_BLACK] = { 0x00, 0x00, 0x00 }, * [TSM_COLOR_RED] = { 0xab, 0x46, 0x42 }, * [TSM_COLOR_GREEN] = { 0xa1, 0xb5, 0x6c }, * [TSM_COLOR_YELLOW] = { 0xf7, 0xca, 0x88 }, * [TSM_COLOR_BLUE] = { 0x7c, 0xaf, 0xc2 }, * [TSM_COLOR_MAGENTA] = { 0xba, 0x8b, 0xaf }, * [TSM_COLOR_CYAN] = { 0x86, 0xc1, 0xb9 }, * [TSM_COLOR_LIGHT_GREY] = { 0xaa, 0xaa, 0xaa }, * [TSM_COLOR_DARK_GREY] = { 0x55, 0x55, 0x55 }, * [TSM_COLOR_LIGHT_RED] = { 0xab, 0x46, 0x42 }, * [TSM_COLOR_LIGHT_GREEN] = { 0xa1, 0xb5, 0x6c }, * [TSM_COLOR_LIGHT_YELLOW] = { 0xf7, 0xca, 0x88 }, * [TSM_COLOR_LIGHT_BLUE] = { 0x7c, 0xaf, 0xc2 }, * [TSM_COLOR_LIGHT_MAGENTA] = { 0xba, 0x8b, 0xaf }, * [TSM_COLOR_LIGHT_CYAN] = { 0x86, 0xc1, 0xb9 }, * [TSM_COLOR_WHITE] = { 0xff, 0xff, 0xff }, * * [TSM_COLOR_FOREGROUND] = { 0x18, 0x18, 0x18 }, * [TSM_COLOR_BACKGROUND] = { 0xd8, 0xd8, 0xd8 }, * }; * @endcode * * The palette array is copied into the vte object. * * @param vte The vte object to set on * @param palette The palette array, which should have shape `uint8_t palette[TSM_COLOR_NUM][3]`. Pass NULL to clear. * * @retval 0 on success. * @retval -EINVAL if vte is NULL. * @retval -ENOMEM if malloc fails. */ int tsm_vte_set_custom_palette(struct tsm_vte *vte, uint8_t (*palette)[3]); void tsm_vte_get_def_attr(struct tsm_vte *vte, struct tsm_screen_attr *out); void tsm_vte_reset(struct tsm_vte *vte); void tsm_vte_hard_reset(struct tsm_vte *vte); void tsm_vte_input(struct tsm_vte *vte, const char *u8, size_t len); bool tsm_vte_handle_keyboard(struct tsm_vte *vte, uint32_t keysym, uint32_t ascii, unsigned int mods, uint32_t unicode); /** @} */ #ifdef __cplusplus } #endif #endif /* TSM_LIBTSM_H */ libtsm-4.0.2/src/tsm/libtsm.sym000066400000000000000000000056271420363367700164520ustar00rootroot00000000000000/* * libtsm - Terminal-Emulator State Machine * * Copyright (c) 2012-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ LIBTSM_1 { global: tsm_ucs4_get_width; local: *; }; LIBTSM_2 { global: tsm_ucs4_to_utf8; tsm_ucs4_to_utf8_alloc; } LIBTSM_1; LIBTSM_3 { global: tsm_screen_new; tsm_screen_ref; tsm_screen_unref; tsm_screen_get_width; tsm_screen_get_height; tsm_screen_resize; tsm_screen_set_margins; tsm_screen_set_max_sb; tsm_screen_clear_sb; tsm_screen_sb_up; tsm_screen_sb_down; tsm_screen_sb_page_up; tsm_screen_sb_page_down; tsm_screen_sb_reset; tsm_screen_set_def_attr; tsm_screen_reset; tsm_screen_set_flags; tsm_screen_reset_flags; tsm_screen_get_flags; tsm_screen_get_cursor_x; tsm_screen_get_cursor_y; tsm_screen_set_tabstop; tsm_screen_reset_tabstop; tsm_screen_reset_all_tabstops; tsm_screen_write; tsm_screen_newline; tsm_screen_scroll_up; tsm_screen_scroll_down; tsm_screen_move_to; tsm_screen_move_up; tsm_screen_move_down; tsm_screen_move_left; tsm_screen_move_right; tsm_screen_move_line_end; tsm_screen_move_line_home; tsm_screen_tab_right; tsm_screen_tab_left; tsm_screen_insert_lines; tsm_screen_delete_lines; tsm_screen_insert_chars; tsm_screen_delete_chars; tsm_screen_erase_cursor; tsm_screen_erase_chars; tsm_screen_erase_cursor_to_end; tsm_screen_erase_home_to_cursor; tsm_screen_erase_current_line; tsm_screen_erase_screen_to_cursor; tsm_screen_erase_cursor_to_screen; tsm_screen_erase_screen; tsm_screen_selection_reset; tsm_screen_selection_start; tsm_screen_selection_target; tsm_screen_selection_copy; tsm_vte_new; tsm_vte_ref; tsm_vte_unref; tsm_vte_set_osc_cb; tsm_vte_set_palette; tsm_vte_get_def_attr; tsm_vte_reset; tsm_vte_hard_reset; tsm_vte_input; tsm_vte_handle_keyboard; } LIBTSM_2; LIBTSM_4 { global: tsm_screen_draw; tsm_vte_set_custom_palette; } LIBTSM_3; libtsm-4.0.2/src/tsm/tsm-render.c000066400000000000000000000121441420363367700166420ustar00rootroot00000000000000/* * libtsm - Rendering * * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * Rendering * TSM does not depend on any graphics system or rendering libraries. Instead, * it provides iterators and ageing support so you can implement renderers * yourself. */ #include #include #include #include #include #include "libtsm.h" #include "libtsm-int.h" #include "shl-llog.h" #define LLOG_SUBSYSTEM "tsm-render" SHL_EXPORT tsm_age_t tsm_screen_draw(struct tsm_screen *con, tsm_screen_draw_cb draw_cb, void *data) { unsigned int cur_x, cur_y; unsigned int i, j, k; struct line *iter, *line = NULL; struct cell *cell, empty; struct tsm_screen_attr attr; int ret, warned = 0; const uint32_t *ch; uint64_t id; size_t len; bool in_sel = false, sel_start = false, sel_end = false; bool was_sel = false; tsm_age_t age; if (!con || !draw_cb) return 0; screen_cell_init(con, &empty); cur_x = con->cursor_x; if (con->cursor_x >= con->size_x) cur_x = con->size_x - 1; cur_y = con->cursor_y; if (con->cursor_y >= con->size_y) cur_y = con->size_y - 1; /* push each character into rendering pipeline */ iter = con->sb_pos; k = 0; if (con->sel_active) { if (!con->sel_start.line && con->sel_start.y == SELECTION_TOP) in_sel = !in_sel; if (!con->sel_end.line && con->sel_end.y == SELECTION_TOP) in_sel = !in_sel; if (con->sel_start.line && (!iter || con->sel_start.line->sb_id < iter->sb_id)) in_sel = !in_sel; if (con->sel_end.line && (!iter || con->sel_end.line->sb_id < iter->sb_id)) in_sel = !in_sel; } for (i = 0; i < con->size_y; ++i) { if (iter) { line = iter; iter = iter->next; } else { line = con->lines[k]; k++; } if (con->sel_active) { if (con->sel_start.line == line || (!con->sel_start.line && con->sel_start.y == k - 1)) sel_start = true; else sel_start = false; if (con->sel_end.line == line || (!con->sel_end.line && con->sel_end.y == k - 1)) sel_end = true; else sel_end = false; was_sel = false; } for (j = 0; j < con->size_x; ++j) { if (j < line->size) cell = &line->cells[j]; else cell = ∅ memcpy(&attr, &cell->attr, sizeof(attr)); if (con->sel_active) { if (sel_start && j == con->sel_start.x) { was_sel = in_sel; in_sel = !in_sel; } if (sel_end && j == con->sel_end.x) { was_sel = in_sel; in_sel = !in_sel; } } if (k == cur_y + 1 && j == cur_x && !(con->flags & TSM_SCREEN_HIDE_CURSOR)) attr.inverse = !attr.inverse; /* TODO: do some more sophisticated inverse here. When * INVERSE mode is set, we should instead just select * inverse colors instead of switching background and * foreground */ if (con->flags & TSM_SCREEN_INVERSE) attr.inverse = !attr.inverse; if (in_sel || was_sel) { was_sel = false; attr.inverse = !attr.inverse; } if (con->age_reset) { age = 0; } else { age = cell->age; if (line->age > age) age = line->age; if (con->age > age) age = con->age; } /* Encode attributes into the id to avoid caching problems */ id = cell->ch; if (attr.bold) id |= 1ULL << TSM_UCS4_MAX_BITS; if (attr.italic) id |= 1ULL << (TSM_UCS4_MAX_BITS + 1); if (attr.underline) id |= 1ULL << (TSM_UCS4_MAX_BITS + 2); if (attr.inverse) id |= 1ULL << (TSM_UCS4_MAX_BITS + 3); if (attr.blink) id |= 1ULL << (TSM_UCS4_MAX_BITS + 4); ch = tsm_symbol_get(con->sym_table, &cell->ch, &len); if (cell->ch == 0 || (cell->ch == ' ' && !attr.underline)) len = 0; ret = draw_cb(con, id, ch, len, cell->width, j, i, &attr, age, data); if (ret && warned++ < 3) { llog_debug(con, "cannot draw glyph at %ux%u via text-renderer", j, i); if (warned == 3) llog_debug(con, "suppressing further warnings during this rendering round"); } } } if (con->age_reset) { con->age_reset = 0; return 0; } else { return con->age_cnt; } } libtsm-4.0.2/src/tsm/tsm-screen.c000066400000000000000000001020771420363367700166470ustar00rootroot00000000000000/* * libtsm - Screen Management * * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * Screen Management * This provides the abstracted screen management. It does not do any * terminal-emulation, instead it provides a resizable table of cells. You can * insert, remove and modify the cells freely. * A screen has always a fixed, but changeable, width and height. This defines * the number of columns and rows. The screen doesn't care for pixels, glyphs or * framebuffers. The screen only contains information about each cell. * * Screens are the logical model behind a real screen of a terminal emulator. * Users usually allocate a screen for each terminal-emulator they run. All they * have to do is render the screen onto their widget on each change and forward * any widget-events to the screen. * * The screen object already includes scrollback-buffers, selection support and * more. This simplifies terminal emulators a lot, but also prevents them from * accessing the real screen data. However, terminal emulators should have no * reason to access the data directly. The screen API should provide everything * they need. * * AGEING: * Each cell, line and screen has an "age" field. This field describes when it * was changed the last time. After drawing a screen, the current screen age is * returned. This allows users to skip drawing specific cells, if their * framebuffer was already drawn with a newer age than a given cell. * However, the screen-age might overflow. This is properly detected and causes * drawing functions to return "0" as age. Users must reset all their * framebuffer ages then. Otherwise, further drawing operations might * incorrectly skip cells. * Furthermore, if a cell has age "0", it means it _has_ to be drawn. No ageing * information is available. */ #include #include #include #include #include #include "libtsm.h" #include "libtsm-int.h" #include "shl-llog.h" #define LLOG_SUBSYSTEM "tsm-screen" static struct cell *get_cursor_cell(struct tsm_screen *con) { unsigned int cur_x, cur_y; cur_x = con->cursor_x; if (cur_x >= con->size_x) cur_x = con->size_x - 1; cur_y = con->cursor_y; if (cur_y >= con->size_y) cur_y = con->size_y - 1; return &con->lines[cur_y]->cells[cur_x]; } static void move_cursor(struct tsm_screen *con, unsigned int x, unsigned int y) { struct cell *c; /* if cursor is hidden, just move it */ if (con->flags & TSM_SCREEN_HIDE_CURSOR) { con->cursor_x = x; con->cursor_y = y; return; } /* If cursor is visible, we have to mark the current and the new cell * as changed by resetting their age. We skip it if the cursor-position * didn't actually change. */ if (con->cursor_x == x && con->cursor_y == y) return; c = get_cursor_cell(con); c->age = con->age_cnt; con->cursor_x = x; con->cursor_y = y; c = get_cursor_cell(con); c->age = con->age_cnt; } void screen_cell_init(struct tsm_screen *con, struct cell *cell) { cell->ch = 0; cell->width = 1; cell->age = con->age_cnt; memcpy(&cell->attr, &con->def_attr, sizeof(cell->attr)); } static int line_new(struct tsm_screen *con, struct line **out, unsigned int width) { struct line *line; unsigned int i; if (!width) return -EINVAL; line = malloc(sizeof(*line)); if (!line) return -ENOMEM; line->next = NULL; line->prev = NULL; line->size = width; line->age = con->age_cnt; line->cells = malloc(sizeof(struct cell) * width); if (!line->cells) { free(line); return -ENOMEM; } for (i = 0; i < width; ++i) screen_cell_init(con, &line->cells[i]); *out = line; return 0; } static void line_free(struct line *line) { free(line->cells); free(line); } static int line_resize(struct tsm_screen *con, struct line *line, unsigned int width) { struct cell *tmp; if (!line || !width) return -EINVAL; if (line->size < width) { tmp = realloc(line->cells, width * sizeof(struct cell)); if (!tmp) return -ENOMEM; line->cells = tmp; while (line->size < width) { screen_cell_init(con, &line->cells[line->size]); ++line->size; } } return 0; } /* This links the given line into the scrollback-buffer */ static void link_to_scrollback(struct tsm_screen *con, struct line *line) { struct line *tmp; /* TODO: more sophisticated ageing */ con->age = con->age_cnt; if (con->sb_max == 0) { if (con->sel_active) { if (con->sel_start.line == line) { con->sel_start.line = NULL; con->sel_start.y = SELECTION_TOP; } if (con->sel_end.line == line) { con->sel_end.line = NULL; con->sel_end.y = SELECTION_TOP; } } line_free(line); return; } /* Remove a line from the scrollback buffer if it reaches its maximum. * We must take care to correctly keep the current position as the new * line is linked in after we remove the top-most line here. * sb_max == 0 is tested earlier so we can assume sb_max > 0 here. In * other words, buf->sb_first is a valid line if sb_count >= sb_max. */ if (con->sb_count >= con->sb_max) { tmp = con->sb_first; con->sb_first = tmp->next; if (tmp->next) tmp->next->prev = NULL; else con->sb_last = NULL; --con->sb_count; /* (position == tmp && !next) means we have sb_max=1 so set * position to the new line. Otherwise, set to new first line. * If position!=tmp and we have a fixed-position then nothing * needs to be done because we can stay at the same line. If we * have no fixed-position, we need to set the position to the * next inserted line, which can be "line", too. */ if (con->sb_pos) { if (con->sb_pos == tmp || !(con->flags & TSM_SCREEN_FIXED_POS)) { if (con->sb_pos->next) con->sb_pos = con->sb_pos->next; else con->sb_pos = line; } } if (con->sel_active) { if (con->sel_start.line == tmp) { con->sel_start.line = NULL; con->sel_start.y = SELECTION_TOP; } if (con->sel_end.line == tmp) { con->sel_end.line = NULL; con->sel_end.y = SELECTION_TOP; } } line_free(tmp); } line->sb_id = ++con->sb_last_id; line->next = NULL; line->prev = con->sb_last; if (con->sb_last) con->sb_last->next = line; else con->sb_first = line; con->sb_last = line; ++con->sb_count; } static void screen_scroll_up(struct tsm_screen *con, unsigned int num) { unsigned int i, j, max, pos; int ret; if (!num) return; /* TODO: more sophisticated ageing */ con->age = con->age_cnt; max = con->margin_bottom + 1 - con->margin_top; if (num > max) num = max; /* We cache lines on the stack to speed up the scrolling. However, if * num is too big we might get overflows here so use recursion if num * exceeds a hard-coded limit. * 128 seems to be a sane limit that should never be reached but should * also be small enough so we do not get stack overflows. */ if (num > 128) { screen_scroll_up(con, 128); return screen_scroll_up(con, num - 128); } struct line *cache[num]; for (i = 0; i < num; ++i) { pos = con->margin_top + i; if (!(con->flags & TSM_SCREEN_ALTERNATE)) ret = line_new(con, &cache[i], con->size_x); else ret = -EAGAIN; if (!ret) { link_to_scrollback(con, con->lines[pos]); } else { cache[i] = con->lines[pos]; for (j = 0; j < con->size_x; ++j) screen_cell_init(con, &cache[i]->cells[j]); } } if (num < max) { memmove(&con->lines[con->margin_top], &con->lines[con->margin_top + num], (max - num) * sizeof(struct line*)); } memcpy(&con->lines[con->margin_top + (max - num)], cache, num * sizeof(struct line*)); if (con->sel_active) { if (!con->sel_start.line && con->sel_start.y >= 0) { con->sel_start.y -= num; if (con->sel_start.y < 0) { con->sel_start.line = con->sb_last; while (con->sel_start.line && ++con->sel_start.y < 0) con->sel_start.line = con->sel_start.line->prev; con->sel_start.y = SELECTION_TOP; } } if (!con->sel_end.line && con->sel_end.y >= 0) { con->sel_end.y -= num; if (con->sel_end.y < 0) { con->sel_end.line = con->sb_last; while (con->sel_end.line && ++con->sel_end.y < 0) con->sel_end.line = con->sel_end.line->prev; con->sel_end.y = SELECTION_TOP; } } } } static void screen_scroll_down(struct tsm_screen *con, unsigned int num) { unsigned int i, j, max; if (!num) return; /* TODO: more sophisticated ageing */ con->age = con->age_cnt; max = con->margin_bottom + 1 - con->margin_top; if (num > max) num = max; /* see screen_scroll_up() for an explanation */ if (num > 128) { screen_scroll_down(con, 128); return screen_scroll_down(con, num - 128); } struct line *cache[num]; for (i = 0; i < num; ++i) { cache[i] = con->lines[con->margin_bottom - i]; for (j = 0; j < con->size_x; ++j) screen_cell_init(con, &cache[i]->cells[j]); } if (num < max) { memmove(&con->lines[con->margin_top + num], &con->lines[con->margin_top], (max - num) * sizeof(struct line*)); } memcpy(&con->lines[con->margin_top], cache, num * sizeof(struct line*)); if (con->sel_active) { if (!con->sel_start.line && con->sel_start.y >= 0) con->sel_start.y += num; if (!con->sel_end.line && con->sel_end.y >= 0) con->sel_end.y += num; } } static void screen_write(struct tsm_screen *con, unsigned int x, unsigned int y, tsm_symbol_t ch, unsigned int len, const struct tsm_screen_attr *attr) { struct line *line; unsigned int i; if (!len) return; if (x >= con->size_x || y >= con->size_y) { llog_warning(con, "writing beyond buffer boundary"); return; } line = con->lines[y]; if ((con->flags & TSM_SCREEN_INSERT_MODE) && (int)x < ((int)con->size_x - len)) { line->age = con->age_cnt; memmove(&line->cells[x + len], &line->cells[x], sizeof(struct cell) * (con->size_x - len - x)); } line->cells[x].age = con->age_cnt; line->cells[x].ch = ch; line->cells[x].width = len; memcpy(&line->cells[x].attr, attr, sizeof(*attr)); for (i = 1; i < len && i + x < con->size_x; ++i) { line->cells[x + i].age = con->age_cnt; line->cells[x + i].width = 0; } } static void screen_erase_region(struct tsm_screen *con, unsigned int x_from, unsigned int y_from, unsigned int x_to, unsigned int y_to, bool protect) { unsigned int to; struct line *line; /* TODO: more sophisticated ageing */ con->age = con->age_cnt; if (y_to >= con->size_y) y_to = con->size_y - 1; if (x_to >= con->size_x) x_to = con->size_x - 1; for ( ; y_from <= y_to; ++y_from) { line = con->lines[y_from]; if (!line) { x_from = 0; continue; } if (y_from == y_to) to = x_to; else to = con->size_x - 1; for ( ; x_from <= to; ++x_from) { if (protect && line->cells[x_from].attr.protect) continue; screen_cell_init(con, &line->cells[x_from]); } x_from = 0; } } static inline unsigned int to_abs_x(struct tsm_screen *con, unsigned int x) { return x; } static inline unsigned int to_abs_y(struct tsm_screen *con, unsigned int y) { if (!(con->flags & TSM_SCREEN_REL_ORIGIN)) return y; return con->margin_top + y; } SHL_EXPORT int tsm_screen_new(struct tsm_screen **out, tsm_log_t log, void *log_data) { struct tsm_screen *con; int ret; unsigned int i; if (!out) return -EINVAL; con = malloc(sizeof(*con)); if (!con) return -ENOMEM; memset(con, 0, sizeof(*con)); con->ref = 1; con->llog = log; con->llog_data = log_data; con->age_cnt = 1; con->age = con->age_cnt; con->def_attr.fr = 255; con->def_attr.fg = 255; con->def_attr.fb = 255; ret = tsm_symbol_table_new(&con->sym_table); if (ret) goto err_free; ret = tsm_screen_resize(con, 80, 24); if (ret) goto err_free; llog_debug(con, "new screen"); *out = con; return 0; err_free: for (i = 0; i < con->line_num; ++i) { line_free(con->main_lines[i]); line_free(con->alt_lines[i]); } free(con->main_lines); free(con->alt_lines); free(con->tab_ruler); tsm_symbol_table_unref(con->sym_table); free(con); return ret; } SHL_EXPORT void tsm_screen_ref(struct tsm_screen *con) { if (!con) return; ++con->ref; } SHL_EXPORT void tsm_screen_unref(struct tsm_screen *con) { unsigned int i; if (!con || !con->ref || --con->ref) return; llog_debug(con, "destroying screen"); for (i = 0; i < con->line_num; ++i) { line_free(con->main_lines[i]); line_free(con->alt_lines[i]); } free(con->main_lines); free(con->alt_lines); free(con->tab_ruler); tsm_symbol_table_unref(con->sym_table); free(con); } void tsm_screen_set_opts(struct tsm_screen *scr, unsigned int opts) { if (!scr || !opts) return; scr->opts |= opts; } void tsm_screen_reset_opts(struct tsm_screen *scr, unsigned int opts) { if (!scr || !opts) return; scr->opts &= ~opts; } unsigned int tsm_screen_get_opts(struct tsm_screen *scr) { if (!scr) return 0; return scr->opts; } SHL_EXPORT unsigned int tsm_screen_get_width(struct tsm_screen *con) { if (!con) return 0; return con->size_x; } SHL_EXPORT unsigned int tsm_screen_get_height(struct tsm_screen *con) { if (!con) return 0; return con->size_y; } SHL_EXPORT int tsm_screen_resize(struct tsm_screen *con, unsigned int x, unsigned int y) { struct line **cache; unsigned int i, j, width, diff, start; int ret; bool *tab_ruler; if (!con || !x || !y) return -EINVAL; if (con->size_x == x && con->size_y == y) return 0; /* First make sure the line buffer is big enough for our new screen. * That is, allocate all new lines and make sure each line has enough * cells to hold the new screen or the current screen. If we fail, we * can safely return -ENOMEM and the buffer is still valid. We must * allocate the new lines to at least the same size as the current * lines. Otherwise, if this function fails in later turns, we will have * invalid lines in the buffer. */ if (y > con->line_num) { /* resize main buffer */ cache = realloc(con->main_lines, sizeof(struct line*) * y); if (!cache) return -ENOMEM; if (con->lines == con->main_lines) con->lines = cache; con->main_lines = cache; /* resize alt buffer */ cache = realloc(con->alt_lines, sizeof(struct line*) * y); if (!cache) return -ENOMEM; if (con->lines == con->alt_lines) con->lines = cache; con->alt_lines = cache; /* allocate new lines */ if (x > con->size_x) width = x; else width = con->size_x; while (con->line_num < y) { ret = line_new(con, &con->main_lines[con->line_num], width); if (ret) return ret; ret = line_new(con, &con->alt_lines[con->line_num], width); if (ret) { line_free(con->main_lines[con->line_num]); return ret; } ++con->line_num; } } /* Resize all lines in the buffer if we increase screen width. This * will guarantee that all lines are big enough so we can resize the * buffer without reallocating them later. */ if (x > con->size_x) { tab_ruler = realloc(con->tab_ruler, sizeof(bool) * x); if (!tab_ruler) return -ENOMEM; con->tab_ruler = tab_ruler; for (i = 0; i < con->line_num; ++i) { ret = line_resize(con, con->main_lines[i], x); if (ret) return ret; ret = line_resize(con, con->alt_lines[i], x); if (ret) return ret; } } screen_inc_age(con); /* clear expansion/padding area */ start = x; if (x > con->size_x) start = con->size_x; for (j = 0; j < con->line_num; ++j) { /* main-lines may go into SB, so clear all cells */ i = 0; if (j < con->size_y) i = start; for ( ; i < con->main_lines[j]->size; ++i) screen_cell_init(con, &con->main_lines[j]->cells[i]); /* alt-lines never go into SB, only clear visible cells */ i = 0; if (j < con->size_y) i = con->size_x; for ( ; i < x; ++i) screen_cell_init(con, &con->alt_lines[j]->cells[i]); } /* xterm destroys margins on resize, so do we */ con->margin_top = 0; con->margin_bottom = con->size_y - 1; /* reset tabs */ for (i = 0; i < x; ++i) { if (i % 8 == 0) con->tab_ruler[i] = true; else con->tab_ruler[i] = false; } /* We need to adjust x-size first as screen_scroll_up() and friends may * have to reallocate lines. The y-size is adjusted after them to avoid * missing lines when shrinking y-size. * We need to carefully look for the functions that we call here as they * have stronger invariants as when called normally. */ con->size_x = x; if (con->cursor_x >= con->size_x) move_cursor(con, con->size_x - 1, con->cursor_y); /* scroll buffer if screen height shrinks */ if (y < con->size_y) { diff = con->size_y - y; screen_scroll_up(con, diff); if (con->cursor_y > diff) move_cursor(con, con->cursor_x, con->cursor_y - diff); else move_cursor(con, con->cursor_x, 0); } con->size_y = y; con->margin_bottom = con->size_y - 1; if (con->cursor_y >= con->size_y) move_cursor(con, con->cursor_x, con->size_y - 1); return 0; } SHL_EXPORT int tsm_screen_set_margins(struct tsm_screen *con, unsigned int top, unsigned int bottom) { unsigned int upper, lower; if (!con) return -EINVAL; if (!top) top = 1; if (bottom <= top) { upper = 0; lower = con->size_y - 1; } else if (bottom > con->size_y) { upper = 0; lower = con->size_y - 1; } else { upper = top - 1; lower = bottom - 1; } con->margin_top = upper; con->margin_bottom = lower; return 0; } /* set maximum scrollback buffer size */ SHL_EXPORT void tsm_screen_set_max_sb(struct tsm_screen *con, unsigned int max) { struct line *line; if (!con) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; while (con->sb_count > max) { line = con->sb_first; con->sb_first = line->next; if (line->next) line->next->prev = NULL; else con->sb_last = NULL; con->sb_count--; /* We treat fixed/unfixed position the same here because we * remove lines from the TOP of the scrollback buffer. */ if (con->sb_pos == line) con->sb_pos = con->sb_first; if (con->sel_active) { if (con->sel_start.line == line) { con->sel_start.line = NULL; con->sel_start.y = SELECTION_TOP; } if (con->sel_end.line == line) { con->sel_end.line = NULL; con->sel_end.y = SELECTION_TOP; } } line_free(line); } con->sb_max = max; } /* clear scrollback buffer */ SHL_EXPORT void tsm_screen_clear_sb(struct tsm_screen *con) { struct line *iter, *tmp; if (!con) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; for (iter = con->sb_first; iter; ) { tmp = iter; iter = iter->next; line_free(tmp); } con->sb_first = NULL; con->sb_last = NULL; con->sb_count = 0; con->sb_pos = NULL; if (con->sel_active) { if (con->sel_start.line) { con->sel_start.line = NULL; con->sel_start.y = SELECTION_TOP; } if (con->sel_end.line) { con->sel_end.line = NULL; con->sel_end.y = SELECTION_TOP; } } } SHL_EXPORT void tsm_screen_sb_up(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; while (num--) { if (con->sb_pos) { if (!con->sb_pos->prev) return; con->sb_pos = con->sb_pos->prev; } else if (!con->sb_last) { return; } else { con->sb_pos = con->sb_last; } } } SHL_EXPORT void tsm_screen_sb_down(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; while (num--) { if (con->sb_pos) con->sb_pos = con->sb_pos->next; else return; } } SHL_EXPORT void tsm_screen_sb_page_up(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); tsm_screen_sb_up(con, num * con->size_y); } SHL_EXPORT void tsm_screen_sb_page_down(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); tsm_screen_sb_down(con, num * con->size_y); } SHL_EXPORT void tsm_screen_sb_reset(struct tsm_screen *con) { if (!con || !con->sb_pos) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; con->sb_pos = NULL; } SHL_EXPORT void tsm_screen_set_def_attr(struct tsm_screen *con, const struct tsm_screen_attr *attr) { if (!con || !attr) return; memcpy(&con->def_attr, attr, sizeof(*attr)); } SHL_EXPORT void tsm_screen_reset(struct tsm_screen *con) { unsigned int i; if (!con) return; screen_inc_age(con); con->age = con->age_cnt; con->flags = 0; con->margin_top = 0; con->margin_bottom = con->size_y - 1; con->lines = con->main_lines; for (i = 0; i < con->size_x; ++i) { if (i % 8 == 0) con->tab_ruler[i] = true; else con->tab_ruler[i] = false; } } SHL_EXPORT void tsm_screen_set_flags(struct tsm_screen *con, unsigned int flags) { unsigned int old; struct cell *c; if (!con || !flags) return; screen_inc_age(con); old = con->flags; con->flags |= flags; if (!(old & TSM_SCREEN_ALTERNATE) && (flags & TSM_SCREEN_ALTERNATE)) { con->age = con->age_cnt; con->lines = con->alt_lines; } if (!(old & TSM_SCREEN_HIDE_CURSOR) && (flags & TSM_SCREEN_HIDE_CURSOR)) { c = get_cursor_cell(con); c->age = con->age_cnt; } if (!(old & TSM_SCREEN_INVERSE) && (flags & TSM_SCREEN_INVERSE)) con->age = con->age_cnt; } SHL_EXPORT void tsm_screen_reset_flags(struct tsm_screen *con, unsigned int flags) { unsigned int old; struct cell *c; if (!con || !flags) return; screen_inc_age(con); old = con->flags; con->flags &= ~flags; if ((old & TSM_SCREEN_ALTERNATE) && (flags & TSM_SCREEN_ALTERNATE)) { con->age = con->age_cnt; con->lines = con->main_lines; } if ((old & TSM_SCREEN_HIDE_CURSOR) && (flags & TSM_SCREEN_HIDE_CURSOR)) { c = get_cursor_cell(con); c->age = con->age_cnt; } if ((old & TSM_SCREEN_INVERSE) && (flags & TSM_SCREEN_INVERSE)) con->age = con->age_cnt; } SHL_EXPORT unsigned int tsm_screen_get_flags(struct tsm_screen *con) { if (!con) return 0; return con->flags; } SHL_EXPORT unsigned int tsm_screen_get_cursor_x(struct tsm_screen *con) { if (!con) return 0; return con->cursor_x; } SHL_EXPORT unsigned int tsm_screen_get_cursor_y(struct tsm_screen *con) { if (!con) return 0; return con->cursor_y; } SHL_EXPORT void tsm_screen_set_tabstop(struct tsm_screen *con) { if (!con || con->cursor_x >= con->size_x) return; con->tab_ruler[con->cursor_x] = true; } SHL_EXPORT void tsm_screen_reset_tabstop(struct tsm_screen *con) { if (!con || con->cursor_x >= con->size_x) return; con->tab_ruler[con->cursor_x] = false; } SHL_EXPORT void tsm_screen_reset_all_tabstops(struct tsm_screen *con) { unsigned int i; if (!con) return; for (i = 0; i < con->size_x; ++i) con->tab_ruler[i] = false; } SHL_EXPORT void tsm_screen_write(struct tsm_screen *con, tsm_symbol_t ch, const struct tsm_screen_attr *attr) { unsigned int last, len; if (!con) return; len = tsm_symbol_get_width(con->sym_table, ch); if (!len) return; screen_inc_age(con); if (con->cursor_y <= con->margin_bottom || con->cursor_y >= con->size_y) last = con->margin_bottom; else last = con->size_y - 1; if (con->cursor_x >= con->size_x) { if (con->flags & TSM_SCREEN_AUTO_WRAP) move_cursor(con, 0, con->cursor_y + 1); else move_cursor(con, con->size_x - 1, con->cursor_y); } if (con->cursor_y > last) { move_cursor(con, con->cursor_x, last); screen_scroll_up(con, 1); } screen_write(con, con->cursor_x, con->cursor_y, ch, len, attr); move_cursor(con, con->cursor_x + len, con->cursor_y); } SHL_EXPORT void tsm_screen_newline(struct tsm_screen *con) { if (!con) return; screen_inc_age(con); tsm_screen_move_down(con, 1, true); tsm_screen_move_line_home(con); } SHL_EXPORT void tsm_screen_scroll_up(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); screen_scroll_up(con, num); } SHL_EXPORT void tsm_screen_scroll_down(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); screen_scroll_down(con, num); } SHL_EXPORT void tsm_screen_move_to(struct tsm_screen *con, unsigned int x, unsigned int y) { unsigned int last; if (!con) return; screen_inc_age(con); if (con->flags & TSM_SCREEN_REL_ORIGIN) last = con->margin_bottom; else last = con->size_y - 1; x = to_abs_x(con, x); if (x >= con->size_x) x = con->size_x - 1; y = to_abs_y(con, y); if (y > last) y = last; move_cursor(con, x, y); } SHL_EXPORT void tsm_screen_move_up(struct tsm_screen *con, unsigned int num, bool scroll) { unsigned int diff, size; if (!con || !num) return; screen_inc_age(con); if (con->cursor_y >= con->margin_top) size = con->margin_top; else size = 0; diff = con->cursor_y - size; if (num > diff) { num -= diff; if (scroll) screen_scroll_down(con, num); move_cursor(con, con->cursor_x, size); } else { move_cursor(con, con->cursor_x, con->cursor_y - num); } } SHL_EXPORT void tsm_screen_move_down(struct tsm_screen *con, unsigned int num, bool scroll) { unsigned int diff, size; if (!con || !num) return; screen_inc_age(con); if (con->cursor_y <= con->margin_bottom) size = con->margin_bottom + 1; else size = con->size_y; diff = size - con->cursor_y - 1; if (num > diff) { num -= diff; if (scroll) screen_scroll_up(con, num); move_cursor(con, con->cursor_x, size - 1); } else { move_cursor(con, con->cursor_x, con->cursor_y + num); } } SHL_EXPORT void tsm_screen_move_left(struct tsm_screen *con, unsigned int num) { unsigned int x; if (!con || !num) return; screen_inc_age(con); if (num > con->size_x) num = con->size_x; x = con->cursor_x; if (x >= con->size_x) x = con->size_x - 1; if (num > x) move_cursor(con, 0, con->cursor_y); else move_cursor(con, x - num, con->cursor_y); } SHL_EXPORT void tsm_screen_move_right(struct tsm_screen *con, unsigned int num) { if (!con || !num) return; screen_inc_age(con); if (num > con->size_x) num = con->size_x; if (num + con->cursor_x >= con->size_x) move_cursor(con, con->size_x - 1, con->cursor_y); else move_cursor(con, con->cursor_x + num, con->cursor_y); } SHL_EXPORT void tsm_screen_move_line_end(struct tsm_screen *con) { if (!con) return; screen_inc_age(con); move_cursor(con, con->size_x - 1, con->cursor_y); } SHL_EXPORT void tsm_screen_move_line_home(struct tsm_screen *con) { if (!con) return; screen_inc_age(con); move_cursor(con, 0, con->cursor_y); } SHL_EXPORT void tsm_screen_tab_right(struct tsm_screen *con, unsigned int num) { unsigned int i, j, x; if (!con || !num) return; screen_inc_age(con); x = con->cursor_x; for (i = 0; i < num; ++i) { for (j = x + 1; j < con->size_x; ++j) { if (con->tab_ruler[j]) break; } x = j; if (x + 1 >= con->size_x) break; } /* tabs never cause pending new-lines */ if (x >= con->size_x) x = con->size_x - 1; move_cursor(con, x, con->cursor_y); } SHL_EXPORT void tsm_screen_tab_left(struct tsm_screen *con, unsigned int num) { unsigned int i, x; int j; if (!con || !num) return; screen_inc_age(con); x = con->cursor_x; for (i = 0; i < num; ++i) { for (j = x - 1; j > 0; --j) { if (con->tab_ruler[j]) break; } if (j <= 0) { x = 0; break; } x = j; } move_cursor(con, x, con->cursor_y); } SHL_EXPORT void tsm_screen_insert_lines(struct tsm_screen *con, unsigned int num) { unsigned int i, j, max; if (!con || !num) return; if (con->cursor_y < con->margin_top || con->cursor_y > con->margin_bottom) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; max = con->margin_bottom - con->cursor_y + 1; if (num > max) num = max; struct line *cache[num]; for (i = 0; i < num; ++i) { cache[i] = con->lines[con->margin_bottom - i]; for (j = 0; j < con->size_x; ++j) screen_cell_init(con, &cache[i]->cells[j]); } if (num < max) { memmove(&con->lines[con->cursor_y + num], &con->lines[con->cursor_y], (max - num) * sizeof(struct line*)); memcpy(&con->lines[con->cursor_y], cache, num * sizeof(struct line*)); } con->cursor_x = 0; } SHL_EXPORT void tsm_screen_delete_lines(struct tsm_screen *con, unsigned int num) { unsigned int i, j, max; if (!con || !num) return; if (con->cursor_y < con->margin_top || con->cursor_y > con->margin_bottom) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; max = con->margin_bottom - con->cursor_y + 1; if (num > max) num = max; struct line *cache[num]; for (i = 0; i < num; ++i) { cache[i] = con->lines[con->cursor_y + i]; for (j = 0; j < con->size_x; ++j) screen_cell_init(con, &cache[i]->cells[j]); } if (num < max) { memmove(&con->lines[con->cursor_y], &con->lines[con->cursor_y + num], (max - num) * sizeof(struct line*)); memcpy(&con->lines[con->cursor_y + (max - num)], cache, num * sizeof(struct line*)); } con->cursor_x = 0; } SHL_EXPORT void tsm_screen_insert_chars(struct tsm_screen *con, unsigned int num) { struct cell *cells; unsigned int max, mv, i; if (!con || !num || !con->size_y || !con->size_x) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; if (con->cursor_x >= con->size_x) con->cursor_x = con->size_x - 1; if (con->cursor_y >= con->size_y) con->cursor_y = con->size_y - 1; max = con->size_x - con->cursor_x; if (num > max) num = max; mv = max - num; cells = con->lines[con->cursor_y]->cells; if (mv) memmove(&cells[con->cursor_x + num], &cells[con->cursor_x], mv * sizeof(*cells)); for (i = 0; i < num; ++i) screen_cell_init(con, &cells[con->cursor_x + i]); } SHL_EXPORT void tsm_screen_delete_chars(struct tsm_screen *con, unsigned int num) { struct cell *cells; unsigned int max, mv, i; if (!con || !num || !con->size_y || !con->size_x) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; if (con->cursor_x >= con->size_x) con->cursor_x = con->size_x - 1; if (con->cursor_y >= con->size_y) con->cursor_y = con->size_y - 1; max = con->size_x - con->cursor_x; if (num > max) num = max; mv = max - num; cells = con->lines[con->cursor_y]->cells; if (mv) memmove(&cells[con->cursor_x], &cells[con->cursor_x + num], mv * sizeof(*cells)); for (i = 0; i < num; ++i) screen_cell_init(con, &cells[con->cursor_x + mv + i]); } SHL_EXPORT void tsm_screen_erase_cursor(struct tsm_screen *con) { unsigned int x; if (!con) return; screen_inc_age(con); if (con->cursor_x >= con->size_x) x = con->size_x - 1; else x = con->cursor_x; screen_erase_region(con, x, con->cursor_y, x, con->cursor_y, false); } SHL_EXPORT void tsm_screen_erase_chars(struct tsm_screen *con, unsigned int num) { unsigned int x; if (!con || !num) return; screen_inc_age(con); if (con->cursor_x >= con->size_x) x = con->size_x - 1; else x = con->cursor_x; screen_erase_region(con, x, con->cursor_y, x + num - 1, con->cursor_y, false); } SHL_EXPORT void tsm_screen_erase_cursor_to_end(struct tsm_screen *con, bool protect) { unsigned int x; if (!con) return; screen_inc_age(con); if (con->cursor_x >= con->size_x) x = con->size_x - 1; else x = con->cursor_x; screen_erase_region(con, x, con->cursor_y, con->size_x - 1, con->cursor_y, protect); } SHL_EXPORT void tsm_screen_erase_home_to_cursor(struct tsm_screen *con, bool protect) { if (!con) return; screen_inc_age(con); screen_erase_region(con, 0, con->cursor_y, con->cursor_x, con->cursor_y, protect); } SHL_EXPORT void tsm_screen_erase_current_line(struct tsm_screen *con, bool protect) { if (!con) return; screen_inc_age(con); screen_erase_region(con, 0, con->cursor_y, con->size_x - 1, con->cursor_y, protect); } SHL_EXPORT void tsm_screen_erase_screen_to_cursor(struct tsm_screen *con, bool protect) { if (!con) return; screen_inc_age(con); screen_erase_region(con, 0, 0, con->cursor_x, con->cursor_y, protect); } SHL_EXPORT void tsm_screen_erase_cursor_to_screen(struct tsm_screen *con, bool protect) { unsigned int x; if (!con) return; screen_inc_age(con); if (con->cursor_x >= con->size_x) x = con->size_x - 1; else x = con->cursor_x; screen_erase_region(con, x, con->cursor_y, con->size_x - 1, con->size_y - 1, protect); } SHL_EXPORT void tsm_screen_erase_screen(struct tsm_screen *con, bool protect) { if (!con) return; screen_inc_age(con); screen_erase_region(con, 0, 0, con->size_x - 1, con->size_y - 1, protect); } libtsm-4.0.2/src/tsm/tsm-selection.c000066400000000000000000000225351420363367700173550ustar00rootroot00000000000000/* * libtsm - Screen Selections * * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * Screen Selections * If a running pty-client does not support mouse-tracking extensions, a * terminal can manually mark selected areas if it does mouse-tracking itself. * This tracking is slightly different than the integrated client-tracking: * * Initial state is no-selection. At any time selection_reset() can be called to * clear the selection and go back to initial state. * If the user presses a mouse-button, the terminal can calculate the selected * cell and call selection_start() to notify the terminal that the user started * the selection. While the mouse-button is held down, the terminal should call * selection_target() whenever a mouse-event occurs. This will tell the screen * layer to draw the selection from the initial start up to the last given * target. * Please note that the selection-start cannot be modified by the terminal * during a selection. Instead, the screen-layer automatically moves it along * with any scroll-operations or inserts/deletes. This also means, the terminal * must _not_ cache the start-position itself as it may change under the hood. * This selection takes also care of scrollback-buffer selections and correctly * moves selection state along. * * Please note that this is not the kind of selection that some PTY applications * support. If the client supports the mouse-protocol, then it can also control * a separate screen-selection which is always inside of the actual screen. This * is a totally different selection. */ #include #include #include #include #include #include "libtsm.h" #include "libtsm-int.h" #include "shl-llog.h" #define LLOG_SUBSYSTEM "tsm-selection" static void selection_set(struct tsm_screen *con, struct selection_pos *sel, unsigned int x, unsigned int y) { struct line *pos; sel->line = NULL; pos = con->sb_pos; while (y && pos) { --y; pos = pos->next; } if (pos) sel->line = pos; sel->x = x; sel->y = y; } SHL_EXPORT void tsm_screen_selection_reset(struct tsm_screen *con) { if (!con) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; con->sel_active = false; } SHL_EXPORT void tsm_screen_selection_start(struct tsm_screen *con, unsigned int posx, unsigned int posy) { if (!con) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; con->sel_active = true; selection_set(con, &con->sel_start, posx, posy); memcpy(&con->sel_end, &con->sel_start, sizeof(con->sel_end)); } SHL_EXPORT void tsm_screen_selection_target(struct tsm_screen *con, unsigned int posx, unsigned int posy) { if (!con || !con->sel_active) return; screen_inc_age(con); /* TODO: more sophisticated ageing */ con->age = con->age_cnt; selection_set(con, &con->sel_end, posx, posy); } /* TODO: tsm_ucs4_to_utf8 expects UCS4 characters, but a cell contains a * tsm-symbol (which can contain multiple UCS4 chars). Fix this when introducing * support for combining characters. */ static unsigned int copy_line(struct line *line, char *buf, unsigned int start, unsigned int len) { unsigned int i, end; char *pos = buf; end = start + len; for (i = start; i < line->size && i < end; ++i) { if (i < line->size || !line->cells[i].ch) pos += tsm_ucs4_to_utf8(line->cells[i].ch, pos); else pos += tsm_ucs4_to_utf8(' ', pos); } return pos - buf; } /* TODO: This beast definitely needs some "beautification", however, it's meant * as a "proof-of-concept" so its enough for now. */ SHL_EXPORT int tsm_screen_selection_copy(struct tsm_screen *con, char **out) { unsigned int len, i; struct selection_pos *start, *end; struct line *iter; char *str, *pos; if (!con || !out) return -EINVAL; if (!con->sel_active) return -ENOENT; /* check whether sel_start or sel_end comes first */ if (!con->sel_start.line && con->sel_start.y == SELECTION_TOP) { if (!con->sel_end.line && con->sel_end.y == SELECTION_TOP) { str = strdup(""); if (!str) return -ENOMEM; *out = str; return 0; } start = &con->sel_start; end = &con->sel_end; } else if (!con->sel_end.line && con->sel_end.y == SELECTION_TOP) { start = &con->sel_end; end = &con->sel_start; } else if (con->sel_start.line && con->sel_end.line) { if (con->sel_start.line->sb_id < con->sel_end.line->sb_id) { start = &con->sel_start; end = &con->sel_end; } else if (con->sel_start.line->sb_id > con->sel_end.line->sb_id) { start = &con->sel_end; end = &con->sel_start; } else if (con->sel_start.x < con->sel_end.x) { start = &con->sel_start; end = &con->sel_end; } else { start = &con->sel_end; end = &con->sel_start; } } else if (con->sel_start.line) { start = &con->sel_start; end = &con->sel_end; } else if (con->sel_end.line) { start = &con->sel_end; end = &con->sel_start; } else if (con->sel_start.y < con->sel_end.y) { start = &con->sel_start; end = &con->sel_end; } else if (con->sel_start.y > con->sel_end.y) { start = &con->sel_end; end = &con->sel_start; } else if (con->sel_start.x < con->sel_end.x) { start = &con->sel_start; end = &con->sel_end; } else { start = &con->sel_end; end = &con->sel_start; } /* calculate size of buffer */ len = 0; iter = start->line; if (!iter && start->y == SELECTION_TOP) iter = con->sb_first; while (iter) { if (iter == start->line && iter == end->line) { if (iter->size > start->x) { if (iter->size > end->x) len += end->x - start->x + 1; else len += iter->size - start->x; } break; } else if (iter == start->line) { if (iter->size > start->x) len += iter->size - start->x; } else if (iter == end->line) { if (iter->size > end->x) len += end->x + 1; else len += iter->size; break; } else { len += iter->size; } ++len; iter = iter->next; } if (!end->line) { if (start->line || start->y == SELECTION_TOP) i = 0; else i = start->y; for ( ; i < con->size_y; ++i) { if (!start->line && start->y == i && end->y == i) { if (con->size_x > start->x) { if (con->size_x > end->x) len += end->x - start->x + 1; else len += con->size_x - start->x; } break; } else if (!start->line && start->y == i) { if (con->size_x > start->x) len += con->size_x - start->x; } else if (end->y == i) { if (con->size_x > end->x) len += end->x + 1; else len += con->size_x; break; } else { len += con->size_x; } ++len; } } /* allocate buffer */ len *= 4; ++len; str = malloc(len); if (!str) return -ENOMEM; pos = str; /* copy data into buffer */ iter = start->line; if (!iter && start->y == SELECTION_TOP) iter = con->sb_first; while (iter) { if (iter == start->line && iter == end->line) { if (iter->size > start->x) { if (iter->size > end->x) len = end->x - start->x + 1; else len = iter->size - start->x; pos += copy_line(iter, pos, start->x, len); } break; } else if (iter == start->line) { if (iter->size > start->x) pos += copy_line(iter, pos, start->x, iter->size - start->x); } else if (iter == end->line) { if (iter->size > end->x) len = end->x + 1; else len = iter->size; pos += copy_line(iter, pos, 0, len); break; } else { pos += copy_line(iter, pos, 0, iter->size); } *pos++ = '\n'; iter = iter->next; } if (!end->line) { if (start->line || start->y == SELECTION_TOP) i = 0; else i = start->y; for ( ; i < con->size_y; ++i) { iter = con->lines[i]; if (!start->line && start->y == i && end->y == i) { if (con->size_x > start->x) { if (con->size_x > end->x) len = end->x - start->x + 1; else len = con->size_x - start->x; pos += copy_line(iter, pos, start->x, len); } break; } else if (!start->line && start->y == i) { if (con->size_x > start->x) pos += copy_line(iter, pos, start->x, con->size_x - start->x); } else if (end->y == i) { if (con->size_x > end->x) len = end->x + 1; else len = con->size_x; pos += copy_line(iter, pos, 0, len); break; } else { pos += copy_line(iter, pos, 0, con->size_x); } *pos++ = '\n'; } } /* return buffer */ *pos = 0; *out = str; return pos - str; } libtsm-4.0.2/src/tsm/tsm-unicode.c000066400000000000000000000376461420363367700170270ustar00rootroot00000000000000/* * libtsm - Unicode Handling * * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * The tsm-utf8-state-machine is based on the wayland-compositor demos: * * Copyright © 2008 Kristian Høgsberg * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of the copyright holders not be used in * advertising or publicity pertaining to distribution of the software * without specific, written prior permission. The copyright holders make * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Unicode Helpers * This implements several helpers for Unicode/UTF8/UCS4 input and output. See * below for comments on each helper. */ #include #include #include #include #include "wcwidth/wcwidth.h" #include "libtsm.h" #include "libtsm-int.h" #include "shl-array.h" #include "shl-htable.h" /* * Unicode Symbol Handling * The main goal of the tsm_symbol_* functions is to provide a datatype which * can contain the representation of any printable character. This includes all * basic Unicode characters but also combined characters. * To avoid all the memory management we still represent a character as a single * integer value (tsm_symbol_t) but internally we allocate a string which is * represented by this value. * * A tsm_symbol_t is an integer which represents a single character point. * For most Unicode characters this is simply the UCS4 representation. In fact, * every UCS4 characters is a valid tsm_symbol_t object. * However, Unicode standard allows combining marks. Therefore, some characters * consists of more than one Unicode character. * A global symbol-table provides all those combined characters as single * integers. You simply create a valid base character and append your combining * marks and the table will return a new valid tsm_symbol_t. It is no longer * a valid UCS4 value, though. But no memory management is needed as all * tsm_symbol_t objects are simple integers. * * The symbol table contains two-way * references. The Hash Table contains all the symbols with the symbol ucs4 * string as key and the symbol ID as value. * The index array contains the symbol ID as key and a pointer to the ucs4 * string as value. But the hash table owns the ucs4 string. * This allows fast implementations of *_get() and *_append() without long * search intervals. * * When creating a new symbol, we simply return the UCS4 value as new symbol. We * do not add it to our symbol table as it is only one character. However, if a * character is appended to an existing symbol, we create a new ucs4 string and * push the new symbol into the symbol table. */ const tsm_symbol_t tsm_symbol_default = 0; struct tsm_symbol_table { unsigned long ref; uint32_t next_id; struct shl_array *index; struct shl_htable symbols; }; static size_t hash_ucs4(const void *key, void *priv) { size_t i, val = 5381; const uint32_t *ucs4 = key; for (i = 0; ucs4[i] <= TSM_UCS4_MAX; ++i) val = val * 33 + ucs4[i]; return val; } static bool cmp_ucs4(const void *a, const void *b) { size_t i; const uint32_t *v1, *v2; v1 = a; v2 = b; for (i = 0; ; ++i) { if (v1[i] > TSM_UCS4_MAX && v2[i] > TSM_UCS4_MAX) return true; if (v1[i] != v2[i]) return false; } } static void free_ucs4(void *elem, void *priv) { uint32_t *v = elem; /* key is prefix with actual value so pass correct pointer */ free(--v); } int tsm_symbol_table_new(struct tsm_symbol_table **out) { struct tsm_symbol_table *tbl; int ret; static const uint32_t *val = NULL; /* we need a valid lvalue */ if (!out) return -EINVAL; tbl = malloc(sizeof(*tbl)); if (!tbl) return -ENOMEM; memset(tbl, 0, sizeof(*tbl)); tbl->ref = 1; tbl->next_id = TSM_UCS4_MAX + 2; shl_htable_init(&tbl->symbols, cmp_ucs4, hash_ucs4, NULL); ret = shl_array_new(&tbl->index, sizeof(uint32_t*), 4); if (ret) goto err_free; /* first entry is not used so add dummy */ shl_array_push(tbl->index, &val); *out = tbl; return 0; err_free: free(tbl); return ret; } void tsm_symbol_table_ref(struct tsm_symbol_table *tbl) { if (!tbl || !tbl->ref) return; ++tbl->ref; } void tsm_symbol_table_unref(struct tsm_symbol_table *tbl) { if (!tbl || !tbl->ref || --tbl->ref) return; shl_htable_clear(&tbl->symbols, free_ucs4, NULL); shl_array_free(tbl->index); free(tbl); } tsm_symbol_t tsm_symbol_make(uint32_t ucs4) { if (ucs4 > TSM_UCS4_MAX) return 0; else return ucs4; } /* * This decomposes a symbol into a ucs4 string and a size value. If \sym is a * valid UCS4 character, this returns a pointer to \sym and writes 1 into \size. * Therefore, the returned value may get destroyed if your \sym argument gets * destroyed. * If \sym is a composed ucs4 string, then the returned value points into the * hash table of the symbol table and lives as long as the symbol table does. * * This always returns a valid value. If an error happens, the default character * is returned. If \size is NULL, then the size value is omitted. */ const uint32_t *tsm_symbol_get(struct tsm_symbol_table *tbl, tsm_symbol_t *sym, size_t *size) { uint32_t *ucs4, idx; if (*sym <= TSM_UCS4_MAX) { if (size) *size = 1; return sym; } if (!tbl) return sym; idx = *sym - (TSM_UCS4_MAX + 1); if (idx >= shl_array_get_length(tbl->index)) ucs4 = NULL; else ucs4 = *SHL_ARRAY_AT(tbl->index, uint32_t*, idx); if (!ucs4) { if (size) *size = 1; return &tsm_symbol_default; } if (size) { *size = 0; while (ucs4[*size] <= TSM_UCS4_MAX) ++*size; } return ucs4; } tsm_symbol_t tsm_symbol_append(struct tsm_symbol_table *tbl, tsm_symbol_t sym, uint32_t ucs4) { uint32_t buf[TSM_UCS4_MAXLEN + 1], nsym, *nval; const uint32_t *ptr; size_t s; bool res; int ret; if (!tbl) return sym; if (ucs4 > TSM_UCS4_MAX) return sym; ptr = tsm_symbol_get(tbl, &sym, &s); if (s >= TSM_UCS4_MAXLEN) return sym; memcpy(buf, ptr, s * sizeof(uint32_t)); buf[s++] = ucs4; buf[s++] = TSM_UCS4_MAX + 1; res = shl_htable_lookup(&tbl->symbols, buf, hash_ucs4(buf, NULL), (void**)&nval); if (res) { /* key is prefixed with actual value */ return *--nval; } /* We save the key in nval and prefix it with the new ID. Note that * the prefix is hidden, we actually store "++nval" in the htable. */ nval = malloc(sizeof(uint32_t) * (s + 1)); if (!nval) return sym; ++nval; memcpy(nval, buf, s * sizeof(uint32_t)); nsym = tbl->next_id + 1; /* Out of IDs; we actually have 2 Billion IDs so this seems * very unlikely but lets be safe here */ if (nsym <= tbl->next_id++) goto err_id; /* store ID hidden before the key */ *(nval - 1) = nsym; ret = shl_htable_insert(&tbl->symbols, nval, hash_ucs4(nval, NULL)); if (ret) goto err_id; ret = shl_array_push(tbl->index, &nval); if (ret) goto err_symbol; return nsym; err_symbol: shl_htable_remove(&tbl->symbols, nval, hash_ucs4(nval, NULL), NULL); err_id: --tbl->next_id; free(nval); return sym; } unsigned int tsm_symbol_get_width(struct tsm_symbol_table *tbl, tsm_symbol_t sym) { const uint32_t *ch; size_t len; if (!tbl) return 0; ch = tsm_symbol_get(tbl, &sym, &len); if (len == 0) return 0; return tsm_ucs4_get_width(*ch); } SHL_EXPORT unsigned int tsm_ucs4_get_width(uint32_t ucs4) { int ret; ret = wcwidth(ucs4); if (ret <= 0) return 0; return ret; } /* * Convert UCS4 character to UTF-8. This creates one of: * 0xxxxxxx * 110xxxxx 10xxxxxx * 1110xxxx 10xxxxxx 10xxxxxx * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx * This is based on the same function from "terminology" from the Enlightenment * project. See COPYING for more information. * * @txt must point to a 4 byte-buffer. A number between 0 and 4 is returned and * indicates how long the written UTF8 string is. * * Please note @g is a real UCS4 code and not a tsm_symbol_t object! * * Unicode symbols between 0xD800 and 0xDFFF are not assigned and reserved for * UTF16 compatibility. It is an error to encode them. Same applies to numbers * greater than 0x10FFFF, the range 0xFDD0-0xFDEF and codepoints ending with * 0xFFFF or 0xFFFE. */ SHL_EXPORT size_t tsm_ucs4_to_utf8(uint32_t g, char *txt) { if (g >= 0xd800 && g <= 0xdfff) return 0; if (g > 0x10ffff || (g & 0xffff) == 0xffff || (g & 0xffff) == 0xfffe) return 0; if (g >= 0xfdd0 && g <= 0xfdef) return 0; if (g < (1 << 7)) { txt[0] = g & 0x7f; return 1; } else if (g < (1 << (5 + 6))) { txt[0] = 0xc0 | ((g >> 6) & 0x1f); txt[1] = 0x80 | ((g ) & 0x3f); return 2; } else if (g < (1 << (4 + 6 + 6))) { txt[0] = 0xe0 | ((g >> 12) & 0x0f); txt[1] = 0x80 | ((g >> 6) & 0x3f); txt[2] = 0x80 | ((g ) & 0x3f); return 3; } else if (g < (1 << (3 + 6 + 6 + 6))) { txt[0] = 0xf0 | ((g >> 18) & 0x07); txt[1] = 0x80 | ((g >> 12) & 0x3f); txt[2] = 0x80 | ((g >> 6) & 0x3f); txt[3] = 0x80 | ((g ) & 0x3f); return 4; } else { return 0; } } SHL_EXPORT char *tsm_ucs4_to_utf8_alloc(const uint32_t *ucs4, size_t len, size_t *len_out) { char *val; size_t i, pos; val = malloc(4 * len); if (!val) return NULL; pos = 0; for (i = 0; i < len; ++i) pos += tsm_ucs4_to_utf8(ucs4[i], &val[pos]); if (!pos) { free(val); return NULL; } if (len_out) *len_out = pos; return val; } /* * UTF8 State Machine * This state machine parses UTF8 and converts it into a stream of Unicode * characters (UCS4 values). A state-machine is represented by a * "struct tsm_utf8_mach" object. It has no global state and all functions are * re-entrant if called with different state-machine objects. * * tsm_utf8_mach_new(): This creates a new state-machine and resets it to its * initial state. Returns 0 on success. * * tsm_uft8_mach_free(): This destroys a state-machine and frees all internally * allocated memory. * * tsm_utf8_mach_reset(): Reset a given state-machine to its initial state. This * is the same state the machine is in after it got created. * * tsm_uft8_mach_feed(): Feed one byte of the UTF8 input stream into the * state-machine. This function returns the new state of the state-machine after * this character has been parsed. If it is TSM_UTF8_ACCEPT or TSM_UTF8_REJECT, * then there is a pending UCS4 character that you should retrieve via * tsm_utf8_mach_get(). If it is TSM_UTF8_ACCEPT, then a character was * successfully parsed. If it is TSM_UTF8_REJECT, the input was invalid UTF8 and * some error recovery was tried or a replacement character was choosen. All * other states mean that the machine needs more input to parse the stream. * * tsm_utf8_mach_get(): Returns the last parsed character. It has no effect on * the state machine so you can call it multiple times. * * Internally, we use TSM_UTF8_START whenever the state-machine is reset. This * can be used to ignore the last read input or to simply reset the machine. * TSM_UTF8_EXPECT* is used to remember how many bytes are still to be read to * get a full UTF8 sequence. * If an error occurs during reading, we go to state TSM_UTF8_REJECT and the * user will read a replacement character. If further errors occur, we go to * state TSM_UTF8_START to avoid printing multiple replacement characters for a * single misinterpreted UTF8 sequence. However, under some circumstances it may * happen that we stay in TSM_UTF8_REJECT and a next replacement character is * returned. * It is difficult to decide how to interpret wrong input but this machine seems * to be quite good at deciding what to do. Generally, we prefer discarding or * replacing input instead of trying to decipher ASCII values from the invalid * data. This guarantees that we do not send wrong values to the terminal * emulator. Some might argue that an ASCII fallback would be better. However, * this means that we might send very weird escape-sequences to the VTE layer. * Especially with C1 codes applications can really break many terminal features * so we avoid any non-ASCII+non-UTF8 input to prevent this. */ struct tsm_utf8_mach { int state; uint32_t ch; }; int tsm_utf8_mach_new(struct tsm_utf8_mach **out) { struct tsm_utf8_mach *mach; if (!out) return -EINVAL; mach = malloc(sizeof(*mach)); if (!mach) return -ENOMEM; memset(mach, 0, sizeof(*mach)); mach->state = TSM_UTF8_START; *out = mach; return 0; } void tsm_utf8_mach_free(struct tsm_utf8_mach *mach) { if (!mach) return; free(mach); } int tsm_utf8_mach_feed(struct tsm_utf8_mach *mach, char ci) { uint32_t c; if (!mach) return TSM_UTF8_START; c = ci; switch (mach->state) { case TSM_UTF8_START: case TSM_UTF8_ACCEPT: case TSM_UTF8_REJECT: if (c == 0xC0 || c == 0xC1) { /* overlong encoding for ASCII, reject */ mach->state = TSM_UTF8_REJECT; } else if ((c & 0x80) == 0) { /* single byte, accept */ mach->ch = c; mach->state = TSM_UTF8_ACCEPT; } else if ((c & 0xC0) == 0x80) { /* parser out of sync, ignore byte */ mach->state = TSM_UTF8_START; } else if ((c & 0xE0) == 0xC0) { /* start of two byte sequence */ mach->ch = (c & 0x1F) << 6; mach->state = TSM_UTF8_EXPECT1; } else if ((c & 0xF0) == 0xE0) { /* start of three byte sequence */ mach->ch = (c & 0x0F) << 12; mach->state = TSM_UTF8_EXPECT2; } else if ((c & 0xF8) == 0xF0) { /* start of four byte sequence */ mach->ch = (c & 0x07) << 18; mach->state = TSM_UTF8_EXPECT3; } else { /* overlong encoding, reject */ mach->state = TSM_UTF8_REJECT; } break; case TSM_UTF8_EXPECT3: mach->ch |= (c & 0x3F) << 12; if ((c & 0xC0) == 0x80) mach->state = TSM_UTF8_EXPECT2; else mach->state = TSM_UTF8_REJECT; break; case TSM_UTF8_EXPECT2: mach->ch |= (c & 0x3F) << 6; if ((c & 0xC0) == 0x80) mach->state = TSM_UTF8_EXPECT1; else mach->state = TSM_UTF8_REJECT; break; case TSM_UTF8_EXPECT1: mach->ch |= c & 0x3F; if ((c & 0xC0) == 0x80) mach->state = TSM_UTF8_ACCEPT; else mach->state = TSM_UTF8_REJECT; break; default: mach->state = TSM_UTF8_REJECT; break; } return mach->state; } uint32_t tsm_utf8_mach_get(struct tsm_utf8_mach *mach) { if (!mach || mach->state != TSM_UTF8_ACCEPT) return TSM_UCS4_REPLACEMENT; return mach->ch; } void tsm_utf8_mach_reset(struct tsm_utf8_mach *mach) { if (!mach) return; mach->state = TSM_UTF8_START; } libtsm-4.0.2/src/tsm/tsm-vte-charsets.c000066400000000000000000000235101420363367700177720ustar00rootroot00000000000000/* * TSM - VT Emulator * * Copyright (c) 2012 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * VTE Character Sets * These are predefined charactersets that can be loaded into GL and GR. By * default we use unicode_lower and unicode_upper, that is, both sets have the * exact unicode mapping. unicode_lower is effectively ASCII and unicode_upper * as defined by the unicode standard. * Several other character sets are defined here. However, all of them are * limited to the 96 character space of GL or GR. Everything beyond GR (which * was not supported by the classic VTs by DEC but is available in VT emulators * that support unicode/UTF8) is always mapped to unicode and cannot be changed * by these character sets. Even mapping GL and GR is only available for * backwards compatibility as new applications can use the Unicode functionality * of the VTE. * * Moreover, mapping GR is almost unnecessary to support. In fact, Unicode UTF-8 * support in VTE works by reading every incoming data as UTF-8 stream. This * maps GL/ASCII to ASCII, as UTF-8 is backwards compatible to ASCII, however, * everything that has the 8th bit set is a >=2-byte haracter in UTF-8. That is, * this is in no way backwards compatible to >=VT220 8bit support. Therefore, if * someone maps a character set into GR and wants to use them with this VTE, * then they must already send UTF-8 characters to use GR (all GR characters are * 8-bits). Hence, they can easily also send the correct UTF-8 character for the * unicode mapping. * The only advantage is that most characters in many sets are 3-byte UTF-8 * characters and by mapping the set into GR/GL you can use 2 or 1 byte UTF-8 * characters which saves bandwidth. * Another reason is, if you have older applications that use the VT220 8-bit * support and you put a ASCII/8bit-extension to UTF-8 converter in between, you * need these mappings to have the application behave correctly if it uses GL/GR * mappings extensively. * * Anyway, we support GL/GR mappings so here are the most commonly used maps as * defined by Unicode-standard, DEC-private maps and other famous charmaps. * * Characters 1-32 are always the control characters (part of CL) and cannot be * mapped. Characters 34-127 (94 characters) are part of GL and can be mapped. * Characters 33 and 128 are not part of GL and always mapped by VTE but are * included here in the maps for alignment reasons but always set to 0. */ #include #include #include #include "libtsm.h" #include "libtsm-int.h" /* * Lower Unicode character set. This maps the characters to the basic ASCII * characters 33-126. These are all graphics characters defined in ASCII. The * first an last entry are never used so we can safely set them to anything. */ tsm_vte_charset tsm_vte_unicode_lower = { [0] = 0, [1] = 33, [2] = 34, [3] = 35, [4] = 36, [5] = 37, [6] = 38, [7] = 39, [8] = 40, [9] = 41, [10] = 42, [11] = 43, [12] = 44, [13] = 45, [14] = 46, [15] = 47, [16] = 48, [17] = 49, [18] = 50, [19] = 51, [20] = 52, [21] = 53, [22] = 54, [23] = 55, [24] = 56, [25] = 57, [26] = 58, [27] = 59, [28] = 60, [29] = 61, [30] = 62, [31] = 63, [32] = 64, [33] = 65, [34] = 66, [35] = 67, [36] = 68, [37] = 69, [38] = 70, [39] = 71, [40] = 72, [41] = 73, [42] = 74, [43] = 75, [44] = 76, [45] = 77, [46] = 78, [47] = 79, [48] = 80, [49] = 81, [50] = 82, [51] = 83, [52] = 84, [53] = 85, [54] = 86, [55] = 87, [56] = 88, [57] = 89, [58] = 90, [59] = 91, [60] = 92, [61] = 93, [62] = 94, [63] = 95, [64] = 96, [65] = 97, [66] = 98, [67] = 99, [68] = 100, [69] = 101, [70] = 102, [71] = 103, [72] = 104, [73] = 105, [74] = 106, [75] = 107, [76] = 108, [77] = 109, [78] = 110, [79] = 111, [80] = 112, [81] = 113, [82] = 114, [83] = 115, [84] = 116, [85] = 117, [86] = 118, [87] = 119, [88] = 120, [89] = 121, [90] = 122, [91] = 123, [92] = 124, [93] = 125, [94] = 126, [95] = 0, }; /* * Upper Unicode Table * This maps all characters to the upper unicode characters 161-254. These are * not compatible to any older 8 bit character sets. See the Unicode standard * for the definitions of each symbol. Again, the first an last entry are never * used so set them to 0. */ tsm_vte_charset tsm_vte_unicode_upper = { [0] = 0, [1] = 161, [2] = 162, [3] = 163, [4] = 164, [5] = 165, [6] = 166, [7] = 167, [8] = 168, [9] = 169, [10] = 170, [11] = 171, [12] = 172, [13] = 173, [14] = 174, [15] = 175, [16] = 176, [17] = 177, [18] = 178, [19] = 179, [20] = 180, [21] = 181, [22] = 182, [23] = 183, [24] = 184, [25] = 185, [26] = 186, [27] = 187, [28] = 188, [29] = 189, [30] = 190, [31] = 191, [32] = 192, [33] = 193, [34] = 194, [35] = 195, [36] = 196, [37] = 197, [38] = 198, [39] = 199, [40] = 200, [41] = 201, [42] = 202, [43] = 203, [44] = 204, [45] = 205, [46] = 206, [47] = 207, [48] = 208, [49] = 209, [50] = 210, [51] = 211, [52] = 212, [53] = 213, [54] = 214, [55] = 215, [56] = 216, [57] = 217, [58] = 218, [59] = 219, [60] = 220, [61] = 221, [62] = 222, [63] = 223, [64] = 224, [65] = 225, [66] = 226, [67] = 227, [68] = 228, [69] = 229, [70] = 230, [71] = 231, [72] = 232, [73] = 233, [74] = 234, [75] = 235, [76] = 236, [77] = 237, [78] = 238, [79] = 239, [80] = 240, [81] = 241, [82] = 242, [83] = 243, [84] = 244, [85] = 245, [86] = 246, [87] = 247, [88] = 248, [89] = 249, [90] = 250, [91] = 251, [92] = 252, [93] = 253, [94] = 254, [95] = 0, }; /* * The DEC supplemental graphics set. For its definition see here: * http://vt100.net/docs/vt220-rm/table2-3b.html * Its basically a mixture of common European symbols that are not part of * ASCII. Most often, this is mapped into GR to extend the basci ASCII part. * * This is very similar to unicode_upper, however, few symbols differ so do not * mix them up! */ tsm_vte_charset tsm_vte_dec_supplemental_graphics = { [0] = 0, [1] = 161, [2] = 162, [3] = 163, [4] = 0, [5] = 165, [6] = 0, [7] = 167, [8] = 164, [9] = 169, [10] = 170, [11] = 171, [12] = 0, [13] = 0, [14] = 0, [15] = 0, [16] = 176, [17] = 177, [18] = 178, [19] = 179, [20] = 0, [21] = 181, [22] = 182, [23] = 183, [24] = 0, [25] = 185, [26] = 186, [27] = 187, [28] = 188, [29] = 189, [30] = 0, [31] = 191, [32] = 192, [33] = 193, [34] = 194, [35] = 195, [36] = 196, [37] = 197, [38] = 198, [39] = 199, [40] = 200, [41] = 201, [42] = 202, [43] = 203, [44] = 204, [45] = 205, [46] = 206, [47] = 207, [48] = 0, [49] = 209, [50] = 210, [51] = 211, [52] = 212, [53] = 213, [54] = 214, [55] = 338, [56] = 216, [57] = 217, [58] = 218, [59] = 219, [60] = 220, [61] = 376, [62] = 0, [63] = 223, [64] = 224, [65] = 225, [66] = 226, [67] = 227, [68] = 228, [69] = 229, [70] = 230, [71] = 231, [72] = 232, [73] = 233, [74] = 234, [75] = 235, [76] = 236, [77] = 237, [78] = 238, [79] = 239, [80] = 0, [81] = 241, [82] = 242, [83] = 243, [84] = 244, [85] = 245, [86] = 246, [87] = 339, [88] = 248, [89] = 249, [90] = 250, [91] = 251, [92] = 252, [93] = 255, [94] = 0, [95] = 0, }; /* * DEC special graphics character set. See here for its definition: * http://vt100.net/docs/vt220-rm/table2-4.html * This contains several characters to create ASCII drawings and similar. Its * commonly mapped into GR to extend the basic ASCII characters. * * Lower 62 characters map to ASCII 33-64, everything beyond is special and * commonly used for ASCII drawings. It depends on the Unicode Standard 3.2 for * the extended horizontal scan-line characters 3, 5, 7, and 9. */ tsm_vte_charset tsm_vte_dec_special_graphics = { [0] = 0, [1] = 33, [2] = 34, [3] = 35, [4] = 36, [5] = 37, [6] = 38, [7] = 39, [8] = 40, [9] = 41, [10] = 42, [11] = 43, [12] = 44, [13] = 45, [14] = 46, [15] = 47, [16] = 48, [17] = 49, [18] = 50, [19] = 51, [20] = 52, [21] = 53, [22] = 54, [23] = 55, [24] = 56, [25] = 57, [26] = 58, [27] = 59, [28] = 60, [29] = 61, [30] = 62, [31] = 63, [32] = 64, [33] = 65, [34] = 66, [35] = 67, [36] = 68, [37] = 69, [38] = 70, [39] = 71, [40] = 72, [41] = 73, [42] = 74, [43] = 75, [44] = 76, [45] = 77, [46] = 78, [47] = 79, [48] = 80, [49] = 81, [50] = 82, [51] = 83, [52] = 84, [53] = 85, [54] = 86, [55] = 87, [56] = 88, [57] = 89, [58] = 90, [59] = 91, [60] = 92, [61] = 93, [62] = 94, [63] = 0, [64] = 9830, [65] = 9618, [66] = 9225, [67] = 9228, [68] = 9229, [69] = 9226, [70] = 176, [71] = 177, [72] = 9252, [73] = 9227, [74] = 9496, [75] = 9488, [76] = 9484, [77] = 9492, [78] = 9532, [79] = 9146, [80] = 9147, [81] = 9472, [82] = 9148, [83] = 9149, [84] = 9500, [85] = 9508, [86] = 9524, [87] = 9516, [88] = 9474, [89] = 8804, [90] = 8805, [91] = 960, [92] = 8800, [93] = 163, [94] = 8901, [95] = 0, }; libtsm-4.0.2/src/tsm/tsm-vte.c000066400000000000000000002363041420363367700161670ustar00rootroot00000000000000/* * libtsm - VT Emulator * * Copyright (c) 2018 Aetf * Copyright (c) 2011-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * Virtual Terminal Emulator * This is the VT implementation. It is written from scratch. It uses the * screen state-machine as output and is tightly bound to it. It supports * functionality from vt100 up to vt500 series. It doesn't implement an * explicitly selected terminal but tries to support the most important commands * to be compatible with existing implementations. However, full vt102 * compatibility is the least that is provided. * * The main parser in this file controls the parser-state and dispatches the * actions to the related handlers. The parser is based on the state-diagram * from Paul Williams: http://vt100.net/emu/ * It is written from scratch, though. * This parser is fully compatible up to the vt500 series. It requires UTF-8 and * does not support any other input encoding. The G0 and G1 sets are therefore * defined as subsets of UTF-8. You may still map G0-G3 into GL, though. * * However, the CSI/DCS/etc handlers are not designed after a specific VT * series. We try to support all vt102 commands but implement several other * often used sequences, too. Feel free to add further. */ #include #include #include #include #include "libtsm.h" #include "libtsm-int.h" #include "shl-llog.h" #include #define LLOG_SUBSYSTEM "tsm-vte" /* Input parser states */ enum parser_state { STATE_NONE, /* placeholder */ STATE_GROUND, /* initial state and ground */ STATE_ESC, /* ESC sequence was started */ STATE_ESC_INT, /* intermediate escape characters */ STATE_CSI_ENTRY, /* starting CSI sequence */ STATE_CSI_PARAM, /* CSI parameters */ STATE_CSI_INT, /* intermediate CSI characters */ STATE_CSI_IGNORE, /* CSI error; ignore this CSI sequence */ STATE_DCS_ENTRY, /* starting DCS sequence */ STATE_DCS_PARAM, /* DCS parameters */ STATE_DCS_INT, /* intermediate DCS characters */ STATE_DCS_PASS, /* DCS data passthrough */ STATE_DCS_IGNORE, /* DCS error; ignore this DCS sequence */ STATE_OSC_STRING, /* parsing OCS sequence */ STATE_ST_IGNORE, /* unimplemented seq; ignore until ST */ STATE_NUM }; /* Input parser actions */ enum parser_action { ACTION_NONE, /* placeholder */ ACTION_IGNORE, /* ignore the character entirely */ ACTION_PRINT, /* print the character on the console */ ACTION_EXECUTE, /* execute single control character (C0/C1) */ ACTION_CLEAR, /* clear current parameter state */ ACTION_COLLECT, /* collect intermediate character */ ACTION_PARAM, /* collect parameter character */ ACTION_ESC_DISPATCH, /* dispatch escape sequence */ ACTION_CSI_DISPATCH, /* dispatch csi sequence */ ACTION_DCS_START, /* start of DCS data */ ACTION_DCS_COLLECT, /* collect DCS data */ ACTION_DCS_END, /* end of DCS data */ ACTION_OSC_START, /* start of OSC data */ ACTION_OSC_COLLECT, /* collect OSC data */ ACTION_OSC_END, /* end of OSC data */ ACTION_NUM }; /* CSI flags */ #define CSI_BANG 0x0001 /* CSI: ! */ #define CSI_CASH 0x0002 /* CSI: $ */ #define CSI_WHAT 0x0004 /* CSI: ? */ #define CSI_GT 0x0008 /* CSI: > */ #define CSI_SPACE 0x0010 /* CSI: */ #define CSI_SQUOTE 0x0020 /* CSI: ' */ #define CSI_DQUOTE 0x0040 /* CSI: " */ #define CSI_MULT 0x0080 /* CSI: * */ #define CSI_PLUS 0x0100 /* CSI: + */ #define CSI_POPEN 0x0200 /* CSI: ( */ #define CSI_PCLOSE 0x0400 /* CSI: ) */ /* max CSI arguments */ #define CSI_ARG_MAX 16 /* max length of an OSC code */ #define OSC_MAX_LEN 128 /* terminal flags */ #define FLAG_CURSOR_KEY_MODE 0x00000001 /* DEC cursor key mode */ #define FLAG_KEYPAD_APPLICATION_MODE 0x00000002 /* DEC keypad application mode; TODO: toggle on numlock? */ #define FLAG_LINE_FEED_NEW_LINE_MODE 0x00000004 /* DEC line-feed/new-line mode */ #define FLAG_8BIT_MODE 0x00000008 /* Disable UTF-8 mode and enable 8bit compatible mode */ #define FLAG_7BIT_MODE 0x00000010 /* Disable 8bit mode and use 7bit compatible mode */ #define FLAG_USE_C1 0x00000020 /* Explicitly use 8bit C1 codes; TODO: implement */ #define FLAG_KEYBOARD_ACTION_MODE 0x00000040 /* Disable keyboard; TODO: implement? */ #define FLAG_INSERT_REPLACE_MODE 0x00000080 /* Enable insert mode */ #define FLAG_SEND_RECEIVE_MODE 0x00000100 /* Disable local echo */ #define FLAG_TEXT_CURSOR_MODE 0x00000200 /* Show cursor */ #define FLAG_INVERSE_SCREEN_MODE 0x00000400 /* Inverse colors */ #define FLAG_ORIGIN_MODE 0x00000800 /* Relative origin for cursor */ #define FLAG_AUTO_WRAP_MODE 0x00001000 /* Auto line wrap mode */ #define FLAG_AUTO_REPEAT_MODE 0x00002000 /* Auto repeat key press; TODO: implement */ #define FLAG_NATIONAL_CHARSET_MODE 0x00004000 /* Send keys from nation charsets; TODO: implement */ #define FLAG_BACKGROUND_COLOR_ERASE_MODE 0x00008000 /* Set background color on erase (bce) */ #define FLAG_PREPEND_ESCAPE 0x00010000 /* Prepend escape character to next output */ #define FLAG_TITE_INHIBIT_MODE 0x00020000 /* Prevent switching to alternate screen buffer */ struct vte_saved_state { unsigned int cursor_x; unsigned int cursor_y; struct tsm_screen_attr cattr; tsm_vte_charset **gl; tsm_vte_charset **gr; bool wrap_mode; bool origin_mode; }; struct tsm_vte { unsigned long ref; tsm_log_t llog; void *llog_data; struct tsm_screen *con; tsm_vte_write_cb write_cb; void *data; char *palette_name; struct tsm_utf8_mach *mach; unsigned long parse_cnt; unsigned int state; unsigned int csi_argc; int csi_argv[CSI_ARG_MAX]; unsigned int csi_flags; tsm_vte_osc_cb osc_cb; void *osc_data; unsigned int osc_len; char osc_arg[OSC_MAX_LEN]; uint8_t (*custom_palette_storage)[3]; uint8_t (*palette)[3]; struct tsm_screen_attr def_attr; struct tsm_screen_attr cattr; unsigned int flags; tsm_vte_charset **gl; tsm_vte_charset **gr; tsm_vte_charset **glt; tsm_vte_charset **grt; tsm_vte_charset *g0; tsm_vte_charset *g1; tsm_vte_charset *g2; tsm_vte_charset *g3; struct vte_saved_state saved_state; unsigned int alt_cursor_x; unsigned int alt_cursor_y; }; static uint8_t color_palette[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 0, 0, 0 }, /* black */ [TSM_COLOR_RED] = { 205, 0, 0 }, /* red */ [TSM_COLOR_GREEN] = { 0, 205, 0 }, /* green */ [TSM_COLOR_YELLOW] = { 205, 205, 0 }, /* yellow */ [TSM_COLOR_BLUE] = { 0, 0, 238 }, /* blue */ [TSM_COLOR_MAGENTA] = { 205, 0, 205 }, /* magenta */ [TSM_COLOR_CYAN] = { 0, 205, 205 }, /* cyan */ [TSM_COLOR_LIGHT_GREY] = { 229, 229, 229 }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 127, 127, 127 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 255, 0, 0 }, /* light red */ [TSM_COLOR_LIGHT_GREEN] = { 0, 255, 0 }, /* light green */ [TSM_COLOR_LIGHT_YELLOW] = { 255, 255, 0 }, /* light yellow */ [TSM_COLOR_LIGHT_BLUE] = { 92, 92, 255 }, /* light blue */ [TSM_COLOR_LIGHT_MAGENTA] = { 255, 0, 255 }, /* light magenta */ [TSM_COLOR_LIGHT_CYAN] = { 0, 255, 255 }, /* light cyan */ [TSM_COLOR_WHITE] = { 255, 255, 255 }, /* white */ [TSM_COLOR_FOREGROUND] = { 229, 229, 229 }, /* light grey */ [TSM_COLOR_BACKGROUND] = { 0, 0, 0 }, /* black */ }; static uint8_t color_palette_solarized[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 7, 54, 66 }, /* black */ [TSM_COLOR_RED] = { 220, 50, 47 }, /* red */ [TSM_COLOR_GREEN] = { 133, 153, 0 }, /* green */ [TSM_COLOR_YELLOW] = { 181, 137, 0 }, /* yellow */ [TSM_COLOR_BLUE] = { 38, 139, 210 }, /* blue */ [TSM_COLOR_MAGENTA] = { 211, 54, 130 }, /* magenta */ [TSM_COLOR_CYAN] = { 42, 161, 152 }, /* cyan */ [TSM_COLOR_LIGHT_GREY] = { 238, 232, 213 }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 0, 43, 54 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 203, 75, 22 }, /* light red */ [TSM_COLOR_LIGHT_GREEN] = { 88, 110, 117 }, /* light green */ [TSM_COLOR_LIGHT_YELLOW] = { 101, 123, 131 }, /* light yellow */ [TSM_COLOR_LIGHT_BLUE] = { 131, 148, 150 }, /* light blue */ [TSM_COLOR_LIGHT_MAGENTA] = { 108, 113, 196 }, /* light magenta */ [TSM_COLOR_LIGHT_CYAN] = { 147, 161, 161 }, /* light cyan */ [TSM_COLOR_WHITE] = { 253, 246, 227 }, /* white */ [TSM_COLOR_FOREGROUND] = { 238, 232, 213 }, /* light grey */ [TSM_COLOR_BACKGROUND] = { 7, 54, 66 }, /* black */ }; static uint8_t color_palette_solarized_black[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 0, 0, 0 }, /* black */ [TSM_COLOR_RED] = { 220, 50, 47 }, /* red */ [TSM_COLOR_GREEN] = { 133, 153, 0 }, /* green */ [TSM_COLOR_YELLOW] = { 181, 137, 0 }, /* yellow */ [TSM_COLOR_BLUE] = { 38, 139, 210 }, /* blue */ [TSM_COLOR_MAGENTA] = { 211, 54, 130 }, /* magenta */ [TSM_COLOR_CYAN] = { 42, 161, 152 }, /* cyan */ [TSM_COLOR_LIGHT_GREY] = { 238, 232, 213 }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 0, 43, 54 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 203, 75, 22 }, /* light red */ [TSM_COLOR_LIGHT_GREEN] = { 88, 110, 117 }, /* light green */ [TSM_COLOR_LIGHT_YELLOW] = { 101, 123, 131 }, /* light yellow */ [TSM_COLOR_LIGHT_BLUE] = { 131, 148, 150 }, /* light blue */ [TSM_COLOR_LIGHT_MAGENTA] = { 108, 113, 196 }, /* light magenta */ [TSM_COLOR_LIGHT_CYAN] = { 147, 161, 161 }, /* light cyan */ [TSM_COLOR_WHITE] = { 253, 246, 227 }, /* white */ [TSM_COLOR_FOREGROUND] = { 238, 232, 213 }, /* light grey */ [TSM_COLOR_BACKGROUND] = { 0, 0, 0 }, /* black */ }; static uint8_t color_palette_solarized_white[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 7, 54, 66 }, /* black */ [TSM_COLOR_RED] = { 220, 50, 47 }, /* red */ [TSM_COLOR_GREEN] = { 133, 153, 0 }, /* green */ [TSM_COLOR_YELLOW] = { 181, 137, 0 }, /* yellow */ [TSM_COLOR_BLUE] = { 38, 139, 210 }, /* blue */ [TSM_COLOR_MAGENTA] = { 211, 54, 130 }, /* magenta */ [TSM_COLOR_CYAN] = { 42, 161, 152 }, /* cyan */ [TSM_COLOR_LIGHT_GREY] = { 238, 232, 213 }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 0, 43, 54 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 203, 75, 22 }, /* light red */ [TSM_COLOR_LIGHT_GREEN] = { 88, 110, 117 }, /* light green */ [TSM_COLOR_LIGHT_YELLOW] = { 101, 123, 131 }, /* light yellow */ [TSM_COLOR_LIGHT_BLUE] = { 131, 148, 150 }, /* light blue */ [TSM_COLOR_LIGHT_MAGENTA] = { 108, 113, 196 }, /* light magenta */ [TSM_COLOR_LIGHT_CYAN] = { 147, 161, 161 }, /* light cyan */ [TSM_COLOR_WHITE] = { 253, 246, 227 }, /* white */ [TSM_COLOR_FOREGROUND] = { 7, 54, 66 }, /* black */ [TSM_COLOR_BACKGROUND] = { 238, 232, 213 }, /* light grey */ }; static uint8_t color_palette_soft_black[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 0x3f, 0x3f, 0x3f }, /* black */ [TSM_COLOR_RED] = { 0x70, 0x50, 0x50 }, /* red */ [TSM_COLOR_GREEN] = { 0x60, 0xb4, 0x8a }, /* green */ [TSM_COLOR_YELLOW] = { 0xdf, 0xaf, 0x8f }, /* yellow */ [TSM_COLOR_BLUE] = { 0x9a, 0xb8, 0xd7 }, /* blue */ [TSM_COLOR_MAGENTA] = { 0xdc, 0x8c, 0xc3 }, /* magenta */ [TSM_COLOR_CYAN] = { 0x8c, 0xd0, 0xd3 }, /* cyan */ [TSM_COLOR_LIGHT_GREY] = { 0xff, 0xff, 0xff }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 0x70, 0x90, 0x80 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 0xdc, 0xa3, 0xa3 }, /* light red */ [TSM_COLOR_LIGHT_GREEN] = { 0x72, 0xd5, 0xa3 }, /* light green */ [TSM_COLOR_LIGHT_YELLOW] = { 0xf0, 0xdf, 0xaf }, /* light yellow */ [TSM_COLOR_LIGHT_BLUE] = { 0x94, 0xbf, 0xf3 }, /* light blue */ [TSM_COLOR_LIGHT_MAGENTA] = { 0xec, 0x93, 0xd3 }, /* light magenta */ [TSM_COLOR_LIGHT_CYAN] = { 0x93, 0xe0, 0xe3 }, /* light cyan */ [TSM_COLOR_WHITE] = { 0xdc, 0xdc, 0xcc }, /* white */ [TSM_COLOR_FOREGROUND] = { 0xdc, 0xdc, 0xcc }, /* white */ [TSM_COLOR_BACKGROUND] = { 0x2c, 0x2c, 0x2c }, /* light grey */ }; static uint8_t color_palette_base16_dark[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 0x00, 0x00, 0x00 }, /* black */ [TSM_COLOR_RED] = { 0xab, 0x46, 0x42 }, /* red, base08 */ [TSM_COLOR_GREEN] = { 0xa1, 0xb5, 0x6c }, /* green, base0B */ [TSM_COLOR_YELLOW] = { 0xf7, 0xca, 0x88 }, /* yellow, base0A */ [TSM_COLOR_BLUE] = { 0x7c, 0xaf, 0xc2 }, /* blue, base0D */ [TSM_COLOR_MAGENTA] = { 0xba, 0x8b, 0xaf }, /* magenta, base0E */ [TSM_COLOR_CYAN] = { 0x86, 0xc1, 0xb9 }, /* cyan, base0C */ [TSM_COLOR_LIGHT_GREY] = { 0xaa, 0xaa, 0xaa }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 0x55, 0x55, 0x55 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 0xab, 0x46, 0x42 }, /* red, base08 */ [TSM_COLOR_LIGHT_GREEN] = { 0xa1, 0xb5, 0x6c }, /* green, base0B */ [TSM_COLOR_LIGHT_YELLOW] = { 0xf7, 0xca, 0x88 }, /* yellow, base0A */ [TSM_COLOR_LIGHT_BLUE] = { 0x7c, 0xaf, 0xc2 }, /* blue, base0D */ [TSM_COLOR_LIGHT_MAGENTA] = { 0xba, 0x8b, 0xaf }, /* magenta, base0E */ [TSM_COLOR_LIGHT_CYAN] = { 0x86, 0xc1, 0xb9 }, /* cyan, base0C */ [TSM_COLOR_WHITE] = { 0xff, 0xff, 0xff }, /* white */ [TSM_COLOR_FOREGROUND] = { 0xd8, 0xd8, 0xd8 }, /* light grey */ [TSM_COLOR_BACKGROUND] = { 0x18, 0x18, 0x18 }, /* dark grey */ }; static uint8_t color_palette_base16_light[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 0x00, 0x00, 0x00 }, /* black */ [TSM_COLOR_RED] = { 0xab, 0x46, 0x42 }, /* red, base08 */ [TSM_COLOR_GREEN] = { 0xa1, 0xb5, 0x6c }, /* green, base0B */ [TSM_COLOR_YELLOW] = { 0xf7, 0xca, 0x88 }, /* yellow, base0A */ [TSM_COLOR_BLUE] = { 0x7c, 0xaf, 0xc2 }, /* blue, base0D */ [TSM_COLOR_MAGENTA] = { 0xba, 0x8b, 0xaf }, /* magenta, base0E */ [TSM_COLOR_CYAN] = { 0x86, 0xc1, 0xb9 }, /* cyan, base0C */ [TSM_COLOR_LIGHT_GREY] = { 0xaa, 0xaa, 0xaa }, /* light grey */ [TSM_COLOR_DARK_GREY] = { 0x55, 0x55, 0x55 }, /* dark grey */ [TSM_COLOR_LIGHT_RED] = { 0xab, 0x46, 0x42 }, /* red, base08 */ [TSM_COLOR_LIGHT_GREEN] = { 0xa1, 0xb5, 0x6c }, /* green, base0B */ [TSM_COLOR_LIGHT_YELLOW] = { 0xf7, 0xca, 0x88 }, /* yellow, base0A */ [TSM_COLOR_LIGHT_BLUE] = { 0x7c, 0xaf, 0xc2 }, /* blue, base0D */ [TSM_COLOR_LIGHT_MAGENTA] = { 0xba, 0x8b, 0xaf }, /* magenta, base0E */ [TSM_COLOR_LIGHT_CYAN] = { 0x86, 0xc1, 0xb9 }, /* cyan, base0C */ [TSM_COLOR_WHITE] = { 0xff, 0xff, 0xff }, /* white */ [TSM_COLOR_FOREGROUND] = { 0x18, 0x18, 0x18 }, /* dark grey */ [TSM_COLOR_BACKGROUND] = { 0xd8, 0xd8, 0xd8 }, /* light grey */ }; static uint8_t (*get_palette(struct tsm_vte *vte))[3] { if (!vte->palette_name) return color_palette; if (!strcmp(vte->palette_name, "custom") && vte->custom_palette_storage) return vte->custom_palette_storage; if (!strcmp(vte->palette_name, "solarized")) return color_palette_solarized; if (!strcmp(vte->palette_name, "solarized-black")) return color_palette_solarized_black; if (!strcmp(vte->palette_name, "solarized-white")) return color_palette_solarized_white; if (!strcmp(vte->palette_name, "soft-black")) return color_palette_soft_black; if (!strcmp(vte->palette_name, "base16-dark")) return color_palette_base16_dark; if (!strcmp(vte->palette_name, "base16-light")) return color_palette_base16_light; return color_palette; } /* Several effects may occur when non-RGB colors are used. For instance, if bold * is enabled, then a dark color code is always converted to a light color to * simulate bold (even though bold may actually be supported!). To support this, * we need to differentiate between a set color-code and a set rgb-color. * This function actually converts a set color-code into an RGB color. This must * be called before passing the attribute to the console layer so the console * layer can always work with RGB values and does not have to care for color * codes. */ static void to_rgb(struct tsm_vte *vte, struct tsm_screen_attr *attr) { int8_t code; code = attr->fccode; if (code >= 0) { /* bold causes light colors */ if (attr->bold && code < 8) code += 8; if (code >= TSM_COLOR_NUM) code = TSM_COLOR_FOREGROUND; attr->fr = vte->palette[code][0]; attr->fg = vte->palette[code][1]; attr->fb = vte->palette[code][2]; } code = attr->bccode; if (code >= 0) { if (code >= TSM_COLOR_NUM) code = TSM_COLOR_BACKGROUND; attr->br = vte->palette[code][0]; attr->bg = vte->palette[code][1]; attr->bb = vte->palette[code][2]; } } static void copy_fcolor(struct tsm_screen_attr *dest, const struct tsm_screen_attr *src) { dest->fccode = src->fccode; dest->fr = src->fr; dest->fg = src->fg; dest->fb = src->fb; } static void copy_bcolor(struct tsm_screen_attr *dest, const struct tsm_screen_attr *src) { dest->bccode = src->bccode; dest->br = src->br; dest->bg = src->bg; dest->bb = src->bb; } SHL_EXPORT int tsm_vte_new(struct tsm_vte **out, struct tsm_screen *con, tsm_vte_write_cb write_cb, void *data, tsm_log_t log, void *log_data) { struct tsm_vte *vte; int ret; if (!out || !con || !write_cb) return -EINVAL; vte = malloc(sizeof(*vte)); if (!vte) return -ENOMEM; memset(vte, 0, sizeof(*vte)); vte->ref = 1; vte->llog = log; vte->llog_data = log_data; vte->con = con; vte->write_cb = write_cb; vte->data = data; vte->osc_cb = NULL; vte->osc_data = NULL; vte->custom_palette_storage = NULL; vte->palette = get_palette(vte); vte->def_attr.fccode = TSM_COLOR_FOREGROUND; vte->def_attr.bccode = TSM_COLOR_BACKGROUND; to_rgb(vte, &vte->def_attr); ret = tsm_utf8_mach_new(&vte->mach); if (ret) goto err_free; tsm_vte_reset(vte); tsm_screen_erase_screen(vte->con, false); llog_debug(vte, "new vte object"); tsm_screen_ref(vte->con); *out = vte; return 0; err_free: free(vte); return ret; } SHL_EXPORT void tsm_vte_ref(struct tsm_vte *vte) { if (!vte) return; vte->ref++; } SHL_EXPORT void tsm_vte_unref(struct tsm_vte *vte) { if (!vte || !vte->ref) return; if (--vte->ref) return; llog_debug(vte, "destroying vte object"); free(vte->palette_name); tsm_screen_unref(vte->con); tsm_utf8_mach_free(vte->mach); free(vte->custom_palette_storage); free(vte); } SHL_EXPORT void tsm_vte_set_osc_cb(struct tsm_vte *vte, tsm_vte_osc_cb osc_cb, void *osc_data) { if (!vte) return; vte->osc_cb = osc_cb; vte->osc_data = osc_data; } static int vte_update_palette(struct tsm_vte *vte) { vte->palette = get_palette(vte); vte->def_attr.fccode = TSM_COLOR_FOREGROUND; vte->def_attr.bccode = TSM_COLOR_BACKGROUND; to_rgb(vte, &vte->def_attr); memcpy(&vte->cattr, &vte->def_attr, sizeof(vte->cattr)); tsm_screen_set_def_attr(vte->con, &vte->def_attr); tsm_screen_erase_screen(vte->con, false); return 0; } SHL_EXPORT int tsm_vte_set_palette(struct tsm_vte *vte, const char *palette_name) { char *tmp = NULL; if (!vte) return -EINVAL; if (palette_name) { tmp = strdup(palette_name); if (!tmp) return -ENOMEM; } free(vte->palette_name); vte->palette_name = tmp; return vte_update_palette(vte); } SHL_EXPORT int tsm_vte_set_custom_palette(struct tsm_vte *vte, uint8_t (*palette)[3]) { const size_t palette_byte_size = sizeof(color_palette); uint8_t (*tmp)[3] = NULL; if (!vte) return -EINVAL; if (palette) { tmp = malloc(palette_byte_size); if (!tmp) return -ENOMEM; memcpy(tmp, palette, palette_byte_size); } free(vte->custom_palette_storage); vte->custom_palette_storage = tmp; return vte_update_palette(vte); } SHL_EXPORT void tsm_vte_get_def_attr(struct tsm_vte *vte, struct tsm_screen_attr *out) { if (!vte || !out) return; memcpy(out, &vte->def_attr, sizeof(*out)); } /* * Write raw byte-stream to pty. * When writing data to the client we must make sure that we send the correct * encoding. For backwards-compatibility reasons we should always send 7bit * characters exclusively. However, when FLAG_7BIT_MODE is not set, then we can * also send raw 8bit characters. For instance, in FLAG_8BIT_MODE we can use the * GR characters as keyboard input and send them directly or even use the C1 * escape characters. In unicode mode (default) we can send multi-byte utf-8 * characters which are also 8bit. When sending these characters, set the \raw * flag to true so this function does not perform debug checks on data we send. * If debugging is disabled, these checks are also disabled and won't affect * performance. * For better debugging, we also use the __LINE__ and __FILE__ macros. Use the * vte_write() and vte_write_raw() macros below for more convenient use. * * As a rule of thumb do never send 8bit characters in escape sequences and also * avoid all 8bit escape codes including the C1 codes. This will guarantee that * all kind of clients are always compatible to us. * * If SEND_RECEIVE_MODE is off (that is, local echo is on) we have to send all * data directly to ourself again. However, we must avoid recursion when * tsm_vte_input() itself calls vte_write*(), therefore, we increase the * PARSER counter when entering tsm_vte_input() and reset it when leaving it * so we never echo data that origins from tsm_vte_input(). * But note that SEND_RECEIVE_MODE is inherently broken for escape sequences * that request answers. That is, if we send a request to the client that awaits * a response and parse that request via local echo ourself, then we will also * send a response to the client even though he didn't request one. This * recursion fix does not avoid this but only prevents us from endless loops * here. Anyway, only few applications rely on local echo so we can safely * ignore this. */ static void vte_write_debug(struct tsm_vte *vte, const char *u8, size_t len, bool raw, const char *file, int line) { #ifdef BUILD_ENABLE_DEBUG /* in debug mode we check that escape sequences are always <0x7f so they * are correctly parsed by non-unicode and non-8bit-mode clients. */ size_t i; if (!raw) { for (i = 0; i < len; ++i) { if (u8[i] & 0x80) llog_warning(vte, "sending 8bit character inline to client in %s:%d", file, line); } } #endif /* in local echo mode, directly parse the data again */ if (!vte->parse_cnt && !(vte->flags & FLAG_SEND_RECEIVE_MODE)) { if (vte->flags & FLAG_PREPEND_ESCAPE) tsm_vte_input(vte, "\e", 1); tsm_vte_input(vte, u8, len); } if (vte->flags & FLAG_PREPEND_ESCAPE) vte->write_cb(vte, "\e", 1, vte->data); vte->write_cb(vte, u8, len, vte->data); vte->flags &= ~FLAG_PREPEND_ESCAPE; } #define vte_write(_vte, _u8, _len) \ vte_write_debug((_vte), (_u8), (_len), false, __FILE__, __LINE__) #define vte_write_raw(_vte, _u8, _len) \ vte_write_debug((_vte), (_u8), (_len), true, __FILE__, __LINE__) /* write to console */ static void write_console(struct tsm_vte *vte, tsm_symbol_t sym) { to_rgb(vte, &vte->cattr); tsm_screen_write(vte->con, sym, &vte->cattr); } static void reset_state(struct tsm_vte *vte) { vte->saved_state.cursor_x = 0; vte->saved_state.cursor_y = 0; vte->saved_state.origin_mode = false; vte->saved_state.wrap_mode = true; vte->saved_state.gl = &vte->g0; vte->saved_state.gr = &vte->g1; copy_fcolor(&vte->saved_state.cattr, &vte->def_attr); copy_bcolor(&vte->saved_state.cattr, &vte->def_attr); vte->saved_state.cattr.bold = 0; vte->saved_state.cattr.italic = 0; vte->saved_state.cattr.underline = 0; vte->saved_state.cattr.inverse = 0; vte->saved_state.cattr.protect = 0; vte->saved_state.cattr.blink = 0; } static void save_state(struct tsm_vte *vte) { vte->saved_state.cursor_x = tsm_screen_get_cursor_x(vte->con); vte->saved_state.cursor_y = tsm_screen_get_cursor_y(vte->con); vte->saved_state.cattr = vte->cattr; vte->saved_state.gl = vte->gl; vte->saved_state.gr = vte->gr; vte->saved_state.wrap_mode = vte->flags & FLAG_AUTO_WRAP_MODE; vte->saved_state.origin_mode = vte->flags & FLAG_ORIGIN_MODE; } static void restore_state(struct tsm_vte *vte) { tsm_screen_move_to(vte->con, vte->saved_state.cursor_x, vte->saved_state.cursor_y); vte->cattr = vte->saved_state.cattr; to_rgb(vte, &vte->cattr); if (vte->flags & FLAG_BACKGROUND_COLOR_ERASE_MODE) tsm_screen_set_def_attr(vte->con, &vte->cattr); vte->gl = vte->saved_state.gl; vte->gr = vte->saved_state.gr; if (vte->saved_state.wrap_mode) { vte->flags |= FLAG_AUTO_WRAP_MODE; tsm_screen_set_flags(vte->con, TSM_SCREEN_AUTO_WRAP); } else { vte->flags &= ~FLAG_AUTO_WRAP_MODE; tsm_screen_reset_flags(vte->con, TSM_SCREEN_AUTO_WRAP); } if (vte->saved_state.origin_mode) { vte->flags |= FLAG_ORIGIN_MODE; tsm_screen_set_flags(vte->con, TSM_SCREEN_REL_ORIGIN); } else { vte->flags &= ~FLAG_ORIGIN_MODE; tsm_screen_reset_flags(vte->con, TSM_SCREEN_REL_ORIGIN); } } /* * Reset VTE state * This performs a soft reset of the VTE. That is, everything is reset to the * same state as when the VTE was created. This does not affect the console, * though. */ SHL_EXPORT void tsm_vte_reset(struct tsm_vte *vte) { if (!vte) return; vte->flags = 0; vte->flags |= FLAG_TEXT_CURSOR_MODE; vte->flags |= FLAG_AUTO_REPEAT_MODE; vte->flags |= FLAG_SEND_RECEIVE_MODE; vte->flags |= FLAG_AUTO_WRAP_MODE; vte->flags |= FLAG_BACKGROUND_COLOR_ERASE_MODE; tsm_screen_reset(vte->con); tsm_screen_set_flags(vte->con, TSM_SCREEN_AUTO_WRAP); tsm_utf8_mach_reset(vte->mach); vte->state = STATE_GROUND; vte->gl = &vte->g0; vte->gr = &vte->g1; vte->glt = NULL; vte->grt = NULL; vte->g0 = &tsm_vte_unicode_lower; vte->g1 = &tsm_vte_unicode_upper; vte->g2 = &tsm_vte_unicode_lower; vte->g3 = &tsm_vte_unicode_upper; memcpy(&vte->cattr, &vte->def_attr, sizeof(vte->cattr)); to_rgb(vte, &vte->cattr); tsm_screen_set_def_attr(vte->con, &vte->def_attr); reset_state(vte); } SHL_EXPORT void tsm_vte_hard_reset(struct tsm_vte *vte) { if (!vte) return; tsm_vte_reset(vte); tsm_screen_erase_screen(vte->con, false); tsm_screen_clear_sb(vte->con); tsm_screen_move_to(vte->con, 0, 0); } static void send_primary_da(struct tsm_vte *vte) { const static char str[] = "\e[?60;1;6;9;15c"; vte_write(vte, str, sizeof(str) - 1); } /* execute control character (C0 or C1) */ static void do_execute(struct tsm_vte *vte, uint32_t ctrl) { switch (ctrl) { case 0x00: /* NUL */ /* Ignore on input */ break; case 0x05: /* ENQ */ /* Transmit answerback message */ /* TODO: is there a better answer than ACK? */ vte_write(vte, "\x06", 1); break; case 0x07: /* BEL */ /* Sound bell tone */ /* TODO: I always considered this annying, however, we * should at least provide some way to enable it if the * user *really* wants it. */ break; case 0x08: /* BS */ /* Move cursor one position left */ tsm_screen_move_left(vte->con, 1); break; case 0x09: /* HT */ /* Move to next tab stop or end of line */ tsm_screen_tab_right(vte->con, 1); break; case 0x0a: /* LF */ case 0x0b: /* VT */ case 0x0c: /* FF */ /* Line feed or newline (CR/NL mode) */ if (vte->flags & FLAG_LINE_FEED_NEW_LINE_MODE) tsm_screen_newline(vte->con); else tsm_screen_move_down(vte->con, 1, true); break; case 0x0d: /* CR */ /* Move cursor to left margin */ tsm_screen_move_line_home(vte->con); break; case 0x0e: /* SO */ /* Map G1 character set into GL */ vte->gl = &vte->g1; break; case 0x0f: /* SI */ /* Map G0 character set into GL */ vte->gl = &vte->g0; break; case 0x11: /* XON */ /* Resume transmission */ /* TODO */ break; case 0x13: /* XOFF */ /* Stop transmission */ /* TODO */ break; case 0x18: /* CAN */ /* Cancel escape sequence */ /* nothing to do here */ break; case 0x1a: /* SUB */ /* Discard current escape sequence and show err-sym */ write_console(vte, 0xbf); break; case 0x1b: /* ESC */ /* Invokes an escape sequence */ /* nothing to do here */ break; case 0x1f: /* DEL */ /* Ignored */ break; case 0x84: /* IND */ /* Move down one row, perform scroll-up if needed */ tsm_screen_move_down(vte->con, 1, true); break; case 0x85: /* NEL */ /* CR/NL with scroll-up if needed */ tsm_screen_newline(vte->con); break; case 0x88: /* HTS */ /* Set tab stop at current position */ tsm_screen_set_tabstop(vte->con); break; case 0x8d: /* RI */ /* Move up one row, perform scroll-down if needed */ tsm_screen_move_up(vte->con, 1, true); break; case 0x8e: /* SS2 */ /* Temporarily map G2 into GL for next char only */ vte->glt = &vte->g2; break; case 0x8f: /* SS3 */ /* Temporarily map G3 into GL for next char only */ vte->glt = &vte->g3; break; case 0x9a: /* DECID */ /* Send device attributes response like ANSI DA */ send_primary_da(vte); break; case 0x9c: /* ST */ /* End control string */ /* nothing to do here */ break; default: llog_debug(vte, "unhandled control char %u", ctrl); } } static void do_clear(struct tsm_vte *vte) { int i; vte->csi_argc = 0; for (i = 0; i < CSI_ARG_MAX; ++i) vte->csi_argv[i] = -1; vte->csi_flags = 0; vte->osc_len = 0; memset(vte->osc_arg, 0, sizeof(vte->osc_arg)); } static void do_collect(struct tsm_vte *vte, uint32_t data) { switch (data) { case '!': vte->csi_flags |= CSI_BANG; break; case '$': vte->csi_flags |= CSI_CASH; break; case '?': vte->csi_flags |= CSI_WHAT; break; case '>': vte->csi_flags |= CSI_GT; break; case ' ': vte->csi_flags |= CSI_SPACE; break; case '\'': vte->csi_flags |= CSI_SQUOTE; break; case '"': vte->csi_flags |= CSI_DQUOTE; break; case '*': vte->csi_flags |= CSI_MULT; break; case '+': vte->csi_flags |= CSI_PLUS; break; case '(': vte->csi_flags |= CSI_POPEN; break; case ')': vte->csi_flags |= CSI_PCLOSE; break; } } static void do_param(struct tsm_vte *vte, uint32_t data) { int new; if (data == ';') { if (vte->csi_argc < CSI_ARG_MAX) vte->csi_argc++; return; } if (vte->csi_argc >= CSI_ARG_MAX) return; /* avoid integer overflows; max allowed value is 16384 anyway */ if (vte->csi_argv[vte->csi_argc] > 0xffff) return; if (data >= '0' && data <= '9') { new = vte->csi_argv[vte->csi_argc]; if (new <= 0) new = data - '0'; else new = new * 10 + data - '0'; vte->csi_argv[vte->csi_argc] = new; } } static bool set_charset(struct tsm_vte *vte, tsm_vte_charset *set) { if (vte->csi_flags & CSI_POPEN) vte->g0 = set; else if (vte->csi_flags & CSI_PCLOSE) vte->g1 = set; else if (vte->csi_flags & CSI_MULT) vte->g2 = set; else if (vte->csi_flags & CSI_PLUS) vte->g3 = set; else return false; return true; } static void do_esc(struct tsm_vte *vte, uint32_t data) { switch (data) { case 'B': /* map ASCII into G0-G3 */ if (set_charset(vte, &tsm_vte_unicode_lower)) return; break; case '<': /* map DEC supplemental into G0-G3 */ if (set_charset(vte, &tsm_vte_dec_supplemental_graphics)) return; break; case '0': /* map DEC special into G0-G3 */ if (set_charset(vte, &tsm_vte_dec_special_graphics)) return; break; case 'A': /* map British into G0-G3 */ /* TODO: create British charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case '4': /* map Dutch into G0-G3 */ /* TODO: create Dutch charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'C': case '5': /* map Finnish into G0-G3 */ /* TODO: create Finnish charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'R': /* map French into G0-G3 */ /* TODO: create French charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'Q': /* map French-Canadian into G0-G3 */ /* TODO: create French-Canadian charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'K': /* map German into G0-G3 */ /* TODO: create German charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'Y': /* map Italian into G0-G3 */ /* TODO: create Italian charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'E': case '6': /* map Norwegian/Danish into G0-G3 */ /* TODO: create Norwegian/Danish charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'Z': /* map Spanish into G0-G3 */ /* TODO: create Spanish charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'H': case '7': /* map Swedish into G0-G3 */ /* TODO: create Swedish charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case '=': /* map Swiss into G0-G3 */ /* TODO: create Swiss charset from DEC */ if (set_charset(vte, &tsm_vte_unicode_upper)) return; break; case 'F': if (vte->csi_flags & CSI_SPACE) { /* S7C1T */ /* Disable 8bit C1 mode */ vte->flags &= ~FLAG_USE_C1; return; } break; case 'G': if (vte->csi_flags & CSI_SPACE) { /* S8C1T */ /* Enable 8bit C1 mode */ vte->flags |= FLAG_USE_C1; return; } break; } /* everything below is only valid without CSI flags */ if (vte->csi_flags) { llog_debug(vte, "unhandled escape seq %u", data); return; } switch (data) { case 'D': /* IND */ /* Move down one row, perform scroll-up if needed */ tsm_screen_move_down(vte->con, 1, true); break; case 'E': /* NEL */ /* CR/NL with scroll-up if needed */ tsm_screen_newline(vte->con); break; case 'H': /* HTS */ /* Set tab stop at current position */ tsm_screen_set_tabstop(vte->con); break; case 'M': /* RI */ /* Move up one row, perform scroll-down if needed */ tsm_screen_move_up(vte->con, 1, true); break; case 'N': /* SS2 */ /* Temporarily map G2 into GL for next char only */ vte->glt = &vte->g2; break; case 'O': /* SS3 */ /* Temporarily map G3 into GL for next char only */ vte->glt = &vte->g3; break; case 'Z': /* DECID */ /* Send device attributes response like ANSI DA */ send_primary_da(vte); break; case '\\': /* ST */ /* End control string */ /* nothing to do here */ break; case '~': /* LS1R */ /* Invoke G1 into GR */ vte->gr = &vte->g1; break; case 'n': /* LS2 */ /* Invoke G2 into GL */ vte->gl = &vte->g2; break; case '}': /* LS2R */ /* Invoke G2 into GR */ vte->gr = &vte->g2; break; case 'o': /* LS3 */ /* Invoke G3 into GL */ vte->gl = &vte->g3; break; case '|': /* LS3R */ /* Invoke G3 into GR */ vte->gr = &vte->g3; break; case '=': /* DECKPAM */ /* Set application keypad mode */ vte->flags |= FLAG_KEYPAD_APPLICATION_MODE; break; case '>': /* DECKPNM */ /* Set numeric keypad mode */ vte->flags &= ~FLAG_KEYPAD_APPLICATION_MODE; break; case 'c': /* RIS */ /* hard reset */ tsm_vte_hard_reset(vte); break; case '7': /* DECSC */ /* save console state */ save_state(vte); break; case '8': /* DECRC */ /* restore console state */ restore_state(vte); break; default: llog_debug(vte, "unhandled escape seq %u", data); } } static void csi_attribute(struct tsm_vte *vte) { static const uint8_t bval[6] = { 0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff }; unsigned int i, code, val; uint8_t cr, cg, cb; if (vte->csi_argc <= 1 && vte->csi_argv[0] == -1) { vte->csi_argc = 1; vte->csi_argv[0] = 0; } for (i = 0; i < vte->csi_argc; ++i) { switch (vte->csi_argv[i]) { case -1: break; case 0: copy_fcolor(&vte->cattr, &vte->def_attr); copy_bcolor(&vte->cattr, &vte->def_attr); vte->cattr.bold = 0; vte->cattr.italic = 0; vte->cattr.underline = 0; vte->cattr.inverse = 0; vte->cattr.blink = 0; break; case 1: vte->cattr.bold = 1; break; case 3: vte->cattr.italic = 1; break; case 4: vte->cattr.underline = 1; break; case 5: vte->cattr.blink = 1; break; case 7: vte->cattr.inverse = 1; break; case 22: vte->cattr.bold = 0; break; case 23: vte->cattr.italic = 0; break; case 24: vte->cattr.underline = 0; break; case 25: vte->cattr.blink = 0; break; case 27: vte->cattr.inverse = 0; break; case 30: vte->cattr.fccode = TSM_COLOR_BLACK; break; case 31: vte->cattr.fccode = TSM_COLOR_RED; break; case 32: vte->cattr.fccode = TSM_COLOR_GREEN; break; case 33: vte->cattr.fccode = TSM_COLOR_YELLOW; break; case 34: vte->cattr.fccode = TSM_COLOR_BLUE; break; case 35: vte->cattr.fccode = TSM_COLOR_MAGENTA; break; case 36: vte->cattr.fccode = TSM_COLOR_CYAN; break; case 37: vte->cattr.fccode = TSM_COLOR_LIGHT_GREY; break; case 39: copy_fcolor(&vte->cattr, &vte->def_attr); break; case 40: vte->cattr.bccode = TSM_COLOR_BLACK; break; case 41: vte->cattr.bccode = TSM_COLOR_RED; break; case 42: vte->cattr.bccode = TSM_COLOR_GREEN; break; case 43: vte->cattr.bccode = TSM_COLOR_YELLOW; break; case 44: vte->cattr.bccode = TSM_COLOR_BLUE; break; case 45: vte->cattr.bccode = TSM_COLOR_MAGENTA; break; case 46: vte->cattr.bccode = TSM_COLOR_CYAN; break; case 47: vte->cattr.bccode = TSM_COLOR_LIGHT_GREY; break; case 49: copy_bcolor(&vte->cattr, &vte->def_attr); break; case 90: vte->cattr.fccode = TSM_COLOR_DARK_GREY; break; case 91: vte->cattr.fccode = TSM_COLOR_LIGHT_RED; break; case 92: vte->cattr.fccode = TSM_COLOR_LIGHT_GREEN; break; case 93: vte->cattr.fccode = TSM_COLOR_LIGHT_YELLOW; break; case 94: vte->cattr.fccode = TSM_COLOR_LIGHT_BLUE; break; case 95: vte->cattr.fccode = TSM_COLOR_LIGHT_MAGENTA; break; case 96: vte->cattr.fccode = TSM_COLOR_LIGHT_CYAN; break; case 97: vte->cattr.fccode = TSM_COLOR_WHITE; break; case 100: vte->cattr.bccode = TSM_COLOR_DARK_GREY; break; case 101: vte->cattr.bccode = TSM_COLOR_LIGHT_RED; break; case 102: vte->cattr.bccode = TSM_COLOR_LIGHT_GREEN; break; case 103: vte->cattr.bccode = TSM_COLOR_LIGHT_YELLOW; break; case 104: vte->cattr.bccode = TSM_COLOR_LIGHT_BLUE; break; case 105: vte->cattr.bccode = TSM_COLOR_LIGHT_MAGENTA; break; case 106: vte->cattr.bccode = TSM_COLOR_LIGHT_CYAN; break; case 107: vte->cattr.bccode = TSM_COLOR_WHITE; break; case 38: /* fallthrough */ case 48: val = vte->csi_argv[i]; if (vte->csi_argv[i + 1] == 5) { // 256color mode if (i + 2 >= vte->csi_argc || vte->csi_argv[i + 2] < 0) { llog_debug(vte, "invalid 256color SGR"); break; } code = vte->csi_argv[i + 2]; if (code < 16) { //no change cb = cg = cr = 0; } else if (code < 232) { code -= 16; cb = bval[code % 6]; code /= 6; cg = bval[code % 6]; code /= 6; cr = bval[code % 6]; code = -1; } else { code = (code - 232) * 10 + 8; cr = code; cg = code; cb = code; code = -1; } i += 2; } else if (vte->csi_argv[i + 1] == 2) { // true color mode if (i + 4 >= vte->csi_argc || vte->csi_argv[i + 2] < 0 || vte->csi_argv[i + 3] < 0 || vte->csi_argv[i + 4] < 0) { llog_debug(vte, "invalid true color SGR"); break; } cr = vte->csi_argv[i + 2]; cg = vte->csi_argv[i + 3]; cb = vte->csi_argv[i + 4]; code = -1; i += 4; } else { llog_debug(vte, "invalid SGR"); break; } if (val == 38) { vte->cattr.fccode = code; vte->cattr.fr = cr; vte->cattr.fg = cg; vte->cattr.fb = cb; } else { vte->cattr.bccode = code; vte->cattr.br = cr; vte->cattr.bg = cg; vte->cattr.bb = cb; } break; default: llog_debug(vte, "unhandled SGR attr %i", vte->csi_argv[i]); } } to_rgb(vte, &vte->cattr); if (vte->flags & FLAG_BACKGROUND_COLOR_ERASE_MODE) tsm_screen_set_def_attr(vte->con, &vte->cattr); } static void csi_soft_reset(struct tsm_vte *vte) { tsm_vte_reset(vte); } static void csi_compat_mode(struct tsm_vte *vte) { /* always perform soft reset */ csi_soft_reset(vte); if (vte->csi_argv[0] == 61) { /* Switching to VT100 compatibility mode. We do * not support this mode, so ignore it. In fact, * we are almost compatible to it, anyway, so * there is no need to explicitly select it. * However, we enable 7bit mode to avoid * character-table problems */ vte->flags |= FLAG_7BIT_MODE; vte->g0 = &tsm_vte_unicode_lower; vte->g1 = &tsm_vte_dec_supplemental_graphics; } else if (vte->csi_argv[0] == 62 || vte->csi_argv[0] == 63 || vte->csi_argv[0] == 64) { /* Switching to VT2/3/4 compatibility mode. We * are always compatible with this so ignore it. * We always send 7bit controls so we also do * not care for the parameter value here that * select the control-mode. * VT220 defines argument 2 as 7bit mode but * VT3xx up to VT5xx use it as 8bit mode. We * choose to conform with the latter here. * We also enable 8bit mode when VT220 * compatibility is requested explicitly. */ if (vte->csi_argv[1] == 1 || vte->csi_argv[1] == 2) vte->flags |= FLAG_USE_C1; vte->flags |= FLAG_8BIT_MODE; vte->g0 = &tsm_vte_unicode_lower; vte->g1 = &tsm_vte_dec_supplemental_graphics; } else { llog_debug(vte, "unhandled DECSCL 'p' CSI %i, switching to utf-8 mode again", vte->csi_argv[0]); } } static inline void set_reset_flag(struct tsm_vte *vte, bool set, unsigned int flag) { if (set) vte->flags |= flag; else vte->flags &= ~flag; } static void csi_mode(struct tsm_vte *vte, bool set) { unsigned int i; for (i = 0; i < vte->csi_argc; ++i) { if (!(vte->csi_flags & CSI_WHAT)) { switch (vte->csi_argv[i]) { case -1: continue; case 2: /* KAM */ set_reset_flag(vte, set, FLAG_KEYBOARD_ACTION_MODE); continue; case 4: /* IRM */ set_reset_flag(vte, set, FLAG_INSERT_REPLACE_MODE); if (set) tsm_screen_set_flags(vte->con, TSM_SCREEN_INSERT_MODE); else tsm_screen_reset_flags(vte->con, TSM_SCREEN_INSERT_MODE); continue; case 12: /* SRM */ set_reset_flag(vte, set, FLAG_SEND_RECEIVE_MODE); continue; case 20: /* LNM */ set_reset_flag(vte, set, FLAG_LINE_FEED_NEW_LINE_MODE); continue; default: llog_debug(vte, "unknown non-DEC (Re)Set-Mode %d", vte->csi_argv[i]); continue; } } switch (vte->csi_argv[i]) { case -1: continue; case 1: /* DECCKM */ set_reset_flag(vte, set, FLAG_CURSOR_KEY_MODE); continue; case 2: /* DECANM */ /* Select VT52 mode */ /* We do not support VT52 mode. Is there any reason why * we should support it? We ignore it here and do not * mark it as to-do item unless someone has strong * arguments to support it. */ continue; case 3: /* DECCOLM */ /* If set, select 132 column mode, otherwise use 80 * column mode. If neither is selected explicitly, we * use dynamic mode, that is, we send SIGWCH when the * size changes and we allow arbitrary buffer * dimensions. On soft-reset, we automatically fall back * to the default, that is, dynamic mode. * Dynamic-mode can be forced to a static mode in the * config. That is, every time dynamic-mode becomes * active, the terminal will be set to the dimensions * that were selected in the config. This allows setting * a fixed size for the terminal regardless of the * display size. * TODO: Implement this */ continue; case 4: /* DECSCLM */ /* Select smooth scrolling. We do not support the * classic smooth scrolling because we have a scrollback * buffer. There is no need to implement smooth * scrolling so ignore this here. */ continue; case 5: /* DECSCNM */ set_reset_flag(vte, set, FLAG_INVERSE_SCREEN_MODE); if (set) tsm_screen_set_flags(vte->con, TSM_SCREEN_INVERSE); else tsm_screen_reset_flags(vte->con, TSM_SCREEN_INVERSE); continue; case 6: /* DECOM */ set_reset_flag(vte, set, FLAG_ORIGIN_MODE); if (set) tsm_screen_set_flags(vte->con, TSM_SCREEN_REL_ORIGIN); else tsm_screen_reset_flags(vte->con, TSM_SCREEN_REL_ORIGIN); continue; case 7: /* DECAWN */ set_reset_flag(vte, set, FLAG_AUTO_WRAP_MODE); if (set) tsm_screen_set_flags(vte->con, TSM_SCREEN_AUTO_WRAP); else tsm_screen_reset_flags(vte->con, TSM_SCREEN_AUTO_WRAP); continue; case 8: /* DECARM */ set_reset_flag(vte, set, FLAG_AUTO_REPEAT_MODE); continue; case 12: /* blinking cursor */ /* TODO: implement */ continue; case 18: /* DECPFF */ /* If set, a form feed (FF) is sent to the printer after * every screen that is printed. We don't have printers * these days directly attached to terminals so we * ignore this here. */ continue; case 19: /* DECPEX */ /* If set, the full screen is printed instead of * scrolling region only. We have no printer so ignore * this mode. */ continue; case 25: /* DECTCEM */ set_reset_flag(vte, set, FLAG_TEXT_CURSOR_MODE); if (set) tsm_screen_reset_flags(vte->con, TSM_SCREEN_HIDE_CURSOR); else tsm_screen_set_flags(vte->con, TSM_SCREEN_HIDE_CURSOR); continue; case 42: /* DECNRCM */ set_reset_flag(vte, set, FLAG_NATIONAL_CHARSET_MODE); continue; case 47: /* Alternate screen buffer */ if (vte->flags & FLAG_TITE_INHIBIT_MODE) continue; if (set) tsm_screen_set_flags(vte->con, TSM_SCREEN_ALTERNATE); else tsm_screen_reset_flags(vte->con, TSM_SCREEN_ALTERNATE); continue; case 1047: /* Alternate screen buffer with post-erase */ if (vte->flags & FLAG_TITE_INHIBIT_MODE) continue; if (set) { tsm_screen_set_flags(vte->con, TSM_SCREEN_ALTERNATE); } else { tsm_screen_erase_screen(vte->con, false); tsm_screen_reset_flags(vte->con, TSM_SCREEN_ALTERNATE); } continue; case 1048: /* Set/Reset alternate-screen buffer cursor */ if (vte->flags & FLAG_TITE_INHIBIT_MODE) continue; if (set) { vte->alt_cursor_x = tsm_screen_get_cursor_x(vte->con); vte->alt_cursor_y = tsm_screen_get_cursor_y(vte->con); } else { tsm_screen_move_to(vte->con, vte->alt_cursor_x, vte->alt_cursor_y); } continue; case 1049: /* Alternate screen buffer with pre-erase+cursor */ if (vte->flags & FLAG_TITE_INHIBIT_MODE) continue; if (set) { vte->alt_cursor_x = tsm_screen_get_cursor_x(vte->con); vte->alt_cursor_y = tsm_screen_get_cursor_y(vte->con); tsm_screen_set_flags(vte->con, TSM_SCREEN_ALTERNATE); tsm_screen_erase_screen(vte->con, false); } else { tsm_screen_reset_flags(vte->con, TSM_SCREEN_ALTERNATE); tsm_screen_move_to(vte->con, vte->alt_cursor_x, vte->alt_cursor_y); } continue; default: llog_debug(vte, "unknown DEC %set-Mode %d", set?"S":"Res", vte->csi_argv[i]); continue; } } } static void csi_dev_attr(struct tsm_vte *vte) { if (vte->csi_argc <= 1 && vte->csi_argv[0] <= 0) { if (vte->csi_flags == 0) { send_primary_da(vte); return; } else if (vte->csi_flags & CSI_GT) { vte_write(vte, "\e[>1;1;0c", 9); return; } } llog_debug(vte, "unhandled DA: %x %d %d %d...", vte->csi_flags, vte->csi_argv[0], vte->csi_argv[1], vte->csi_argv[2]); } static void csi_dsr(struct tsm_vte *vte) { char buf[64]; unsigned int x, y, len; if (vte->csi_argv[0] == 5) { vte_write(vte, "\e[0n", 4); } else if (vte->csi_argv[0] == 6) { x = tsm_screen_get_cursor_x(vte->con); y = tsm_screen_get_cursor_y(vte->con); len = snprintf(buf, sizeof(buf), "\e[%u;%uR", y + 1, x + 1); if (len >= sizeof(buf)) vte_write(vte, "\e[0;0R", 6); else vte_write(vte, buf, len); } } static void do_csi(struct tsm_vte *vte, uint32_t data) { int num, x, y, upper, lower; bool protect; if (vte->csi_argc < CSI_ARG_MAX) vte->csi_argc++; switch (data) { case 'A': /* CUU */ /* move cursor up */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_move_up(vte->con, num, false); break; case 'B': /* CUD */ /* move cursor down */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_move_down(vte->con, num, false); break; case 'C': /* CUF */ /* move cursor forward */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_move_right(vte->con, num); break; case 'D': /* CUB */ /* move cursor backward */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_move_left(vte->con, num); break; case 'd': /* VPA */ /* Vertical Line Position Absolute */ num = vte->csi_argv[0]; if (num <= 0) num = 1; x = tsm_screen_get_cursor_x(vte->con); tsm_screen_move_to(vte->con, x, num - 1); break; case 'e': /* VPR */ /* Vertical Line Position Relative */ num = vte->csi_argv[0]; if (num <= 0) num = 1; x = tsm_screen_get_cursor_x(vte->con); y = tsm_screen_get_cursor_y(vte->con); tsm_screen_move_to(vte->con, x, y + num); break; case 'H': /* CUP */ case 'f': /* HVP */ /* position cursor */ x = vte->csi_argv[0]; if (x <= 0) x = 1; y = vte->csi_argv[1]; if (y <= 0) y = 1; tsm_screen_move_to(vte->con, y - 1, x - 1); break; case 'G': /* CHA */ /* Cursor Character Absolute */ num = vte->csi_argv[0]; if (num <= 0) num = 1; y = tsm_screen_get_cursor_y(vte->con); tsm_screen_move_to(vte->con, num - 1, y); break; case 'J': if (vte->csi_flags & CSI_WHAT) protect = true; else protect = false; if (vte->csi_argv[0] <= 0) tsm_screen_erase_cursor_to_screen(vte->con, protect); else if (vte->csi_argv[0] == 1) tsm_screen_erase_screen_to_cursor(vte->con, protect); else if (vte->csi_argv[0] == 2) tsm_screen_erase_screen(vte->con, protect); else llog_debug(vte, "unknown parameter to CSI-J: %d", vte->csi_argv[0]); break; case 'K': if (vte->csi_flags & CSI_WHAT) protect = true; else protect = false; if (vte->csi_argv[0] <= 0) tsm_screen_erase_cursor_to_end(vte->con, protect); else if (vte->csi_argv[0] == 1) tsm_screen_erase_home_to_cursor(vte->con, protect); else if (vte->csi_argv[0] == 2) tsm_screen_erase_current_line(vte->con, protect); else llog_debug(vte, "unknown parameter to CSI-K: %d", vte->csi_argv[0]); break; case 'X': /* ECH */ /* erase characters */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_erase_chars(vte->con, num); break; case 'm': csi_attribute(vte); break; case 'p': if (vte->csi_flags & CSI_GT) { /* xterm: select X11 visual cursor mode */ csi_soft_reset(vte); } else if (vte->csi_flags & CSI_BANG) { /* DECSTR: Soft Reset */ csi_soft_reset(vte); } else if (vte->csi_flags & CSI_CASH) { /* DECRQM: Request DEC Private Mode */ /* If CSI_WHAT is set, then enable, * otherwise disable */ csi_soft_reset(vte); } else { /* DECSCL: Compatibility Level */ /* Sometimes CSI_DQUOTE is set here, too */ csi_compat_mode(vte); } break; case 'h': /* SM: Set Mode */ csi_mode(vte, true); break; case 'l': /* RM: Reset Mode */ csi_mode(vte, false); break; case 'r': /* DECSTBM */ /* set margin size */ upper = vte->csi_argv[0]; if (upper < 0) upper = 0; lower = vte->csi_argv[1]; if (lower < 0) lower = 0; tsm_screen_set_margins(vte->con, upper, lower); break; case 'c': /* DA */ /* device attributes */ csi_dev_attr(vte); break; case 'L': /* IL */ /* insert lines */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_insert_lines(vte->con, num); break; case 'M': /* DL */ /* delete lines */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_delete_lines(vte->con, num); break; case 'g': /* TBC */ /* tabulation clear */ num = vte->csi_argv[0]; if (num <= 0) tsm_screen_reset_tabstop(vte->con); else if (num == 3) tsm_screen_reset_all_tabstops(vte->con); else llog_debug(vte, "invalid parameter %d to TBC CSI", num); break; case '@': /* ICH */ /* insert characters */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_insert_chars(vte->con, num); break; case 'P': /* DCH */ /* delete characters */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_delete_chars(vte->con, num); break; case 'Z': /* CBT */ /* cursor horizontal backwards tab */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_tab_left(vte->con, num); break; case 'I': /* CHT */ /* cursor horizontal forward tab */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_tab_right(vte->con, num); break; case 'n': /* DSR */ /* device status reports */ csi_dsr(vte); break; case 'S': /* SU */ /* scroll up */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_scroll_up(vte->con, num); break; case 'T': /* SD */ /* scroll down */ num = vte->csi_argv[0]; if (num <= 0) num = 1; tsm_screen_scroll_down(vte->con, num); break; default: llog_debug(vte, "unhandled CSI sequence %c", data); } } /* map a character according to current GL and GR maps */ static uint32_t vte_map(struct tsm_vte *vte, uint32_t val) { /* 32, 127, 160 and 255 map to identity like all values >255 */ switch (val) { case 33 ... 126: if (vte->glt) { val = (**vte->glt)[val - 32]; vte->glt = NULL; } else { val = (**vte->gl)[val - 32]; } break; case 161 ... 254: if (vte->grt) { val = (**vte->grt)[val - 160]; vte->grt = NULL; } else { val = (**vte->gr)[val - 160]; } break; } return val; } static void do_osc_collect(struct tsm_vte *vte, uint32_t val) { char buf[4]; int len = tsm_ucs4_to_utf8(val, buf); if (vte->osc_len + len > sizeof(vte->osc_arg) - 1) { return; } memcpy(vte->osc_arg + vte->osc_len, buf, len); vte->osc_len += len; } static void do_osc_end(struct tsm_vte *vte) { if (!vte->osc_cb) { return; } vte->osc_arg[vte->osc_len] = 0; vte->osc_cb(vte, vte->osc_arg, vte->osc_len, vte->osc_data); } /* perform parser action */ static void do_action(struct tsm_vte *vte, uint32_t data, int action) { tsm_symbol_t sym; switch (action) { case ACTION_NONE: /* do nothing */ return; case ACTION_IGNORE: /* ignore character */ break; case ACTION_PRINT: sym = tsm_symbol_make(vte_map(vte, data)); write_console(vte, sym); break; case ACTION_EXECUTE: do_execute(vte, data); break; case ACTION_CLEAR: do_clear(vte); break; case ACTION_COLLECT: do_collect(vte, data); break; case ACTION_PARAM: do_param(vte, data); break; case ACTION_ESC_DISPATCH: do_esc(vte, data); break; case ACTION_CSI_DISPATCH: do_csi(vte, data); break; case ACTION_DCS_START: break; case ACTION_DCS_COLLECT: break; case ACTION_DCS_END: break; case ACTION_OSC_START: do_clear(vte); break; case ACTION_OSC_COLLECT: do_osc_collect(vte, data); break; case ACTION_OSC_END: do_osc_end(vte); break; default: llog_warning(vte, "invalid action %d", action); } } /* entry actions to be performed when entering the selected state */ static const int entry_action[] = { [STATE_CSI_ENTRY] = ACTION_CLEAR, [STATE_DCS_ENTRY] = ACTION_CLEAR, [STATE_DCS_PASS] = ACTION_DCS_START, [STATE_ESC] = ACTION_CLEAR, [STATE_OSC_STRING] = ACTION_OSC_START, [STATE_NUM] = ACTION_NONE, }; /* exit actions to be performed when leaving the selected state */ static const int exit_action[] = { [STATE_DCS_PASS] = ACTION_DCS_END, [STATE_OSC_STRING] = ACTION_OSC_END, [STATE_NUM] = ACTION_NONE, }; /* perform state transition and dispatch related actions */ static void do_trans(struct tsm_vte *vte, uint32_t data, int state, int act) { if (state != STATE_NONE) { /* A state transition occurs. Perform exit-action, * transition-action and entry-action. Even when performing a * transition to the same state as the current state we do this. * Use STATE_NONE if this is not the desired behavior. */ do_action(vte, data, exit_action[vte->state]); do_action(vte, data, act); do_action(vte, data, entry_action[state]); vte->state = state; } else { do_action(vte, data, act); } } /* * Escape sequence parser * This parses the new input character \data. It performs state transition and * calls the right callbacks for each action. */ static void parse_data(struct tsm_vte *vte, uint32_t raw) { /* events that may occur in any state */ switch (raw) { case 0x18: case 0x1a: case 0x80 ... 0x8f: case 0x91 ... 0x97: case 0x99: case 0x9a: case 0x9c: do_trans(vte, raw, STATE_GROUND, ACTION_EXECUTE); return; case 0x1b: do_trans(vte, raw, STATE_ESC, ACTION_NONE); return; case 0x98: case 0x9e: case 0x9f: do_trans(vte, raw, STATE_ST_IGNORE, ACTION_NONE); return; case 0x90: do_trans(vte, raw, STATE_DCS_ENTRY, ACTION_NONE); return; case 0x9d: do_trans(vte, raw, STATE_OSC_STRING, ACTION_NONE); return; case 0x9b: do_trans(vte, raw, STATE_CSI_ENTRY, ACTION_NONE); return; } /* events that depend on the current state */ switch (vte->state) { case STATE_GROUND: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x80 ... 0x8f: case 0x91 ... 0x9a: case 0x9c: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x20 ... 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_PRINT); return; } do_trans(vte, raw, STATE_NONE, ACTION_PRINT); return; case STATE_ESC: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_ESC_INT, ACTION_COLLECT); return; case 0x30 ... 0x4f: case 0x51 ... 0x57: case 0x59: case 0x5a: case 0x5c: case 0x60 ... 0x7e: do_trans(vte, raw, STATE_GROUND, ACTION_ESC_DISPATCH); return; case 0x5b: do_trans(vte, raw, STATE_CSI_ENTRY, ACTION_NONE); return; case 0x5d: do_trans(vte, raw, STATE_OSC_STRING, ACTION_NONE); return; case 0x50: do_trans(vte, raw, STATE_DCS_ENTRY, ACTION_NONE); return; case 0x58: case 0x5e: case 0x5f: do_trans(vte, raw, STATE_ST_IGNORE, ACTION_NONE); return; } do_trans(vte, raw, STATE_ESC_INT, ACTION_COLLECT); return; case STATE_ESC_INT: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_NONE, ACTION_COLLECT); return; case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x30 ... 0x7e: do_trans(vte, raw, STATE_GROUND, ACTION_ESC_DISPATCH); return; } do_trans(vte, raw, STATE_NONE, ACTION_COLLECT); return; case STATE_CSI_ENTRY: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_CSI_INT, ACTION_COLLECT); return; case 0x3a: do_trans(vte, raw, STATE_CSI_IGNORE, ACTION_NONE); return; case 0x30 ... 0x39: case 0x3b: do_trans(vte, raw, STATE_CSI_PARAM, ACTION_PARAM); return; case 0x3c ... 0x3f: do_trans(vte, raw, STATE_CSI_PARAM, ACTION_COLLECT); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_GROUND, ACTION_CSI_DISPATCH); return; } do_trans(vte, raw, STATE_CSI_IGNORE, ACTION_NONE); return; case STATE_CSI_PARAM: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x30 ... 0x39: case 0x3b: do_trans(vte, raw, STATE_NONE, ACTION_PARAM); return; case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x3a: case 0x3c ... 0x3f: do_trans(vte, raw, STATE_CSI_IGNORE, ACTION_NONE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_CSI_INT, ACTION_COLLECT); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_GROUND, ACTION_CSI_DISPATCH); return; } do_trans(vte, raw, STATE_CSI_IGNORE, ACTION_NONE); return; case STATE_CSI_INT: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_NONE, ACTION_COLLECT); return; case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x30 ... 0x3f: do_trans(vte, raw, STATE_CSI_IGNORE, ACTION_NONE); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_GROUND, ACTION_CSI_DISPATCH); return; } do_trans(vte, raw, STATE_CSI_IGNORE, ACTION_NONE); return; case STATE_CSI_IGNORE: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_EXECUTE); return; case 0x20 ... 0x3f: case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_GROUND, ACTION_NONE); return; } do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case STATE_DCS_ENTRY: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x3a: do_trans(vte, raw, STATE_DCS_IGNORE, ACTION_NONE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_DCS_INT, ACTION_COLLECT); return; case 0x30 ... 0x39: case 0x3b: do_trans(vte, raw, STATE_DCS_PARAM, ACTION_PARAM); return; case 0x3c ... 0x3f: do_trans(vte, raw, STATE_DCS_PARAM, ACTION_COLLECT); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_DCS_PASS, ACTION_NONE); return; } do_trans(vte, raw, STATE_DCS_PASS, ACTION_NONE); return; case STATE_DCS_PARAM: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x30 ... 0x39: case 0x3b: do_trans(vte, raw, STATE_NONE, ACTION_PARAM); return; case 0x3a: case 0x3c ... 0x3f: do_trans(vte, raw, STATE_DCS_IGNORE, ACTION_NONE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_DCS_INT, ACTION_COLLECT); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_DCS_PASS, ACTION_NONE); return; } do_trans(vte, raw, STATE_DCS_PASS, ACTION_NONE); return; case STATE_DCS_INT: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x20 ... 0x2f: do_trans(vte, raw, STATE_NONE, ACTION_COLLECT); return; case 0x30 ... 0x3f: do_trans(vte, raw, STATE_DCS_IGNORE, ACTION_NONE); return; case 0x40 ... 0x7e: do_trans(vte, raw, STATE_DCS_PASS, ACTION_NONE); return; } do_trans(vte, raw, STATE_DCS_PASS, ACTION_NONE); return; case STATE_DCS_PASS: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x20 ... 0x7e: do_trans(vte, raw, STATE_NONE, ACTION_DCS_COLLECT); return; case 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x9c: do_trans(vte, raw, STATE_GROUND, ACTION_NONE); return; } do_trans(vte, raw, STATE_NONE, ACTION_DCS_COLLECT); return; case STATE_DCS_IGNORE: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x20 ... 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x9c: do_trans(vte, raw, STATE_GROUND, ACTION_NONE); return; } do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case STATE_OSC_STRING: switch (raw) { case 0x00 ... 0x06: case 0x08 ... 0x17: case 0x19: case 0x1c ... 0x1f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x20 ... 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_OSC_COLLECT); return; case 0x07: case 0x9c: do_trans(vte, raw, STATE_GROUND, ACTION_NONE); return; } do_trans(vte, raw, STATE_NONE, ACTION_OSC_COLLECT); return; case STATE_ST_IGNORE: switch (raw) { case 0x00 ... 0x17: case 0x19: case 0x1c ... 0x1f: case 0x20 ... 0x7f: do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; case 0x9c: do_trans(vte, raw, STATE_GROUND, ACTION_NONE); return; } do_trans(vte, raw, STATE_NONE, ACTION_IGNORE); return; } llog_warning(vte, "unhandled input %u in state %d", raw, vte->state); } SHL_EXPORT void tsm_vte_input(struct tsm_vte *vte, const char *u8, size_t len) { int state; uint32_t ucs4; size_t i; if (!vte || !vte->con) return; ++vte->parse_cnt; for (i = 0; i < len; ++i) { if (vte->flags & FLAG_7BIT_MODE) { if (u8[i] & 0x80) llog_debug(vte, "receiving 8bit character U+%d from pty while in 7bit mode", (int)u8[i]); parse_data(vte, u8[i] & 0x7f); } else if (vte->flags & FLAG_8BIT_MODE) { parse_data(vte, u8[i]); } else { state = tsm_utf8_mach_feed(vte->mach, u8[i]); if (state == TSM_UTF8_ACCEPT || state == TSM_UTF8_REJECT) { ucs4 = tsm_utf8_mach_get(vte->mach); parse_data(vte, ucs4); } } } --vte->parse_cnt; } SHL_EXPORT bool tsm_vte_handle_keyboard(struct tsm_vte *vte, uint32_t keysym, uint32_t ascii, unsigned int mods, uint32_t unicode) { char val, u8[4]; size_t len; uint32_t sym; if (!vte) { return false; } /* MOD1 (mostly labeled 'Alt') prepends an escape character to every * input that is sent by a key. * TODO: Transform this huge handler into a lookup table to save a lot * of code and make such modifiers easier to implement. * Also check whether altSendsEscape should be the default (xterm * disables this by default, why?) and whether we should implement the * fallback shifting that xterm does. */ if (mods & TSM_ALT_MASK) vte->flags |= FLAG_PREPEND_ESCAPE; /* A user might actually use multiple layouts for keyboard input. The * @keysym variable contains the actual keysym that the user used. But * if this keysym is not in the ascii range, the input handler does * check all other layouts that the user specified whether one of them * maps the key to some ASCII keysym and provides this via @ascii. * We always use the real keysym except when handling CTRL+ * shortcuts we use the ascii keysym. This is for compatibility to xterm * et. al. so ctrl+c always works regardless of the currently active * keyboard layout. * But if no ascii-sym is found, we still use the real keysym. */ sym = ascii; if (sym == XKB_KEY_NoSymbol) sym = keysym; if (mods & TSM_CONTROL_MASK) { switch (sym) { case XKB_KEY_2: case XKB_KEY_space: vte_write(vte, "\x00", 1); return true; case XKB_KEY_a: case XKB_KEY_A: vte_write(vte, "\x01", 1); return true; case XKB_KEY_b: case XKB_KEY_B: vte_write(vte, "\x02", 1); return true; case XKB_KEY_c: case XKB_KEY_C: vte_write(vte, "\x03", 1); return true; case XKB_KEY_d: case XKB_KEY_D: vte_write(vte, "\x04", 1); return true; case XKB_KEY_e: case XKB_KEY_E: vte_write(vte, "\x05", 1); return true; case XKB_KEY_f: case XKB_KEY_F: vte_write(vte, "\x06", 1); return true; case XKB_KEY_g: case XKB_KEY_G: vte_write(vte, "\x07", 1); return true; case XKB_KEY_h: case XKB_KEY_H: vte_write(vte, "\x08", 1); return true; case XKB_KEY_i: case XKB_KEY_I: vte_write(vte, "\x09", 1); return true; case XKB_KEY_j: case XKB_KEY_J: vte_write(vte, "\x0a", 1); return true; case XKB_KEY_k: case XKB_KEY_K: vte_write(vte, "\x0b", 1); return true; case XKB_KEY_l: case XKB_KEY_L: vte_write(vte, "\x0c", 1); return true; case XKB_KEY_m: case XKB_KEY_M: vte_write(vte, "\x0d", 1); return true; case XKB_KEY_n: case XKB_KEY_N: vte_write(vte, "\x0e", 1); return true; case XKB_KEY_o: case XKB_KEY_O: vte_write(vte, "\x0f", 1); return true; case XKB_KEY_p: case XKB_KEY_P: vte_write(vte, "\x10", 1); return true; case XKB_KEY_q: case XKB_KEY_Q: vte_write(vte, "\x11", 1); return true; case XKB_KEY_r: case XKB_KEY_R: vte_write(vte, "\x12", 1); return true; case XKB_KEY_s: case XKB_KEY_S: vte_write(vte, "\x13", 1); return true; case XKB_KEY_t: case XKB_KEY_T: vte_write(vte, "\x14", 1); return true; case XKB_KEY_u: case XKB_KEY_U: vte_write(vte, "\x15", 1); return true; case XKB_KEY_v: case XKB_KEY_V: vte_write(vte, "\x16", 1); return true; case XKB_KEY_w: case XKB_KEY_W: vte_write(vte, "\x17", 1); return true; case XKB_KEY_x: case XKB_KEY_X: vte_write(vte, "\x18", 1); return true; case XKB_KEY_y: case XKB_KEY_Y: vte_write(vte, "\x19", 1); return true; case XKB_KEY_z: case XKB_KEY_Z: vte_write(vte, "\x1a", 1); return true; case XKB_KEY_3: case XKB_KEY_bracketleft: case XKB_KEY_braceleft: vte_write(vte, "\x1b", 1); return true; case XKB_KEY_4: case XKB_KEY_backslash: case XKB_KEY_bar: vte_write(vte, "\x1c", 1); return true; case XKB_KEY_5: case XKB_KEY_bracketright: case XKB_KEY_braceright: vte_write(vte, "\x1d", 1); return true; case XKB_KEY_6: case XKB_KEY_grave: case XKB_KEY_asciitilde: vte_write(vte, "\x1e", 1); return true; case XKB_KEY_7: case XKB_KEY_slash: case XKB_KEY_question: vte_write(vte, "\x1f", 1); return true; case XKB_KEY_8: vte_write(vte, "\x7f", 1); return true; } } switch (keysym) { case XKB_KEY_BackSpace: vte_write(vte, "\x08", 1); return true; case XKB_KEY_Tab: case XKB_KEY_KP_Tab: vte_write(vte, "\x09", 1); return true; case XKB_KEY_ISO_Left_Tab: vte_write(vte, "\e[Z", 3); return true; case XKB_KEY_Linefeed: vte_write(vte, "\x0a", 1); return true; case XKB_KEY_Clear: vte_write(vte, "\x0b", 1); return true; /* TODO: What should we do with this key? Sending XOFF is awful as there is no simple way on modern keyboards to send XON again. If someone wants this, we can re-eanble it and set some flag. case XKB_KEY_Pause: vte_write(vte, "\x13", 1); return true; */ /* TODO: What should we do on scroll-lock? Sending 0x14 is what the specs say but it is not used today the way most users would expect so we disable it. If someone wants this, we can re-enable it and set some flag. case XKB_KEY_Scroll_Lock: vte_write(vte, "\x14", 1); return true; */ case XKB_KEY_Sys_Req: vte_write(vte, "\x15", 1); return true; case XKB_KEY_Escape: vte_write(vte, "\x1b", 1); return true; case XKB_KEY_KP_Enter: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) { vte_write(vte, "\eOM", 3); return true; } /* fallthrough */ case XKB_KEY_Return: if (vte->flags & FLAG_LINE_FEED_NEW_LINE_MODE) vte_write(vte, "\x0d\x0a", 2); else vte_write(vte, "\x0d", 1); return true; case XKB_KEY_Find: vte_write(vte, "\e[1~", 4); return true; case XKB_KEY_Insert: vte_write(vte, "\e[2~", 4); return true; case XKB_KEY_Delete: vte_write(vte, "\e[3~", 4); return true; case XKB_KEY_Select: vte_write(vte, "\e[4~", 4); return true; case XKB_KEY_Page_Up: case XKB_KEY_KP_Page_Up: vte_write(vte, "\e[5~", 4); return true; case XKB_KEY_KP_Page_Down: case XKB_KEY_Page_Down: vte_write(vte, "\e[6~", 4); return true; case XKB_KEY_Up: case XKB_KEY_KP_Up: if (mods & TSM_CONTROL_MASK) { vte_write(vte, "\e[1;5A", 6); } else if (vte->flags & FLAG_CURSOR_KEY_MODE) { vte_write(vte, "\eOA", 3); } else { vte_write(vte, "\e[A", 3); } return true; case XKB_KEY_Down: case XKB_KEY_KP_Down: if (mods & TSM_CONTROL_MASK) { vte_write(vte, "\e[1;5B", 6); } else if (vte->flags & FLAG_CURSOR_KEY_MODE) { vte_write(vte, "\eOB", 3); } else { vte_write(vte, "\e[B", 3); } return true; case XKB_KEY_Right: case XKB_KEY_KP_Right: if (mods & TSM_CONTROL_MASK) { vte_write(vte, "\e[1;5C", 6); } else if (vte->flags & FLAG_CURSOR_KEY_MODE) { vte_write(vte, "\eOC", 3); } else { vte_write(vte, "\e[C", 3); } return true; case XKB_KEY_Left: case XKB_KEY_KP_Left: if (mods & TSM_CONTROL_MASK) { vte_write(vte, "\e[1;5D", 6); } else if (vte->flags & FLAG_CURSOR_KEY_MODE) { vte_write(vte, "\eOD", 3); } else { vte_write(vte, "\e[D", 3); } return true; case XKB_KEY_KP_Insert: case XKB_KEY_KP_0: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOp", 3); else vte_write(vte, "0", 1); return true; case XKB_KEY_KP_1: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOq", 3); else vte_write(vte, "1", 1); return true; case XKB_KEY_KP_2: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOr", 3); else vte_write(vte, "2", 1); return true; case XKB_KEY_KP_3: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOs", 3); else vte_write(vte, "3", 1); return true; case XKB_KEY_KP_4: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOt", 3); else vte_write(vte, "4", 1); return true; case XKB_KEY_KP_5: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOu", 3); else vte_write(vte, "5", 1); return true; case XKB_KEY_KP_6: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOv", 3); else vte_write(vte, "6", 1); return true; case XKB_KEY_KP_7: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOw", 3); else vte_write(vte, "7", 1); return true; case XKB_KEY_KP_8: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOx", 3); else vte_write(vte, "8", 1); return true; case XKB_KEY_KP_9: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOy", 3); else vte_write(vte, "9", 1); return true; case XKB_KEY_KP_Subtract: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOm", 3); else vte_write(vte, "-", 1); return true; case XKB_KEY_KP_Separator: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOl", 3); else vte_write(vte, ",", 1); return true; case XKB_KEY_KP_Delete: case XKB_KEY_KP_Decimal: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOn", 3); else vte_write(vte, ".", 1); return true; case XKB_KEY_KP_Equal: case XKB_KEY_KP_Divide: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOj", 3); else vte_write(vte, "/", 1); return true; case XKB_KEY_KP_Multiply: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOo", 3); else vte_write(vte, "*", 1); return true; case XKB_KEY_KP_Add: if (vte->flags & FLAG_KEYPAD_APPLICATION_MODE) vte_write(vte, "\eOk", 3); else vte_write(vte, "+", 1); return true; case XKB_KEY_Home: case XKB_KEY_KP_Home: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOH", 3); else vte_write(vte, "\e[H", 3); return true; case XKB_KEY_End: case XKB_KEY_KP_End: if (vte->flags & FLAG_CURSOR_KEY_MODE) vte_write(vte, "\eOF", 3); else vte_write(vte, "\e[F", 3); return true; case XKB_KEY_KP_Space: vte_write(vte, " ", 1); return true; /* TODO: check what to transmit for functions keys when * shift/ctrl etc. are pressed. Every terminal behaves * differently here which is really weird. * We now map F4 to F14 if shift is pressed and so on for all * keys. However, such mappings should rather be done via * xkb-configurations and we should instead add a flags argument * to the CSIs as some of the keys here already do. */ case XKB_KEY_F1: case XKB_KEY_KP_F1: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[23~", 5); else vte_write(vte, "\eOP", 3); return true; case XKB_KEY_F2: case XKB_KEY_KP_F2: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[24~", 5); else vte_write(vte, "\eOQ", 3); return true; case XKB_KEY_F3: case XKB_KEY_KP_F3: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[25~", 5); else vte_write(vte, "\eOR", 3); return true; case XKB_KEY_F4: case XKB_KEY_KP_F4: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[1;2S", 6); vte_write(vte, "\e[26~", 5); else vte_write(vte, "\eOS", 3); return true; case XKB_KEY_F5: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[15;2~", 7); vte_write(vte, "\e[28~", 5); else vte_write(vte, "\e[15~", 5); return true; case XKB_KEY_F6: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[17;2~", 7); vte_write(vte, "\e[29~", 5); else vte_write(vte, "\e[17~", 5); return true; case XKB_KEY_F7: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[18;2~", 7); vte_write(vte, "\e[31~", 5); else vte_write(vte, "\e[18~", 5); return true; case XKB_KEY_F8: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[19;2~", 7); vte_write(vte, "\e[32~", 5); else vte_write(vte, "\e[19~", 5); return true; case XKB_KEY_F9: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[20;2~", 7); vte_write(vte, "\e[33~", 5); else vte_write(vte, "\e[20~", 5); return true; case XKB_KEY_F10: if (mods & TSM_SHIFT_MASK) //vte_write(vte, "\e[21;2~", 7); vte_write(vte, "\e[34~", 5); else vte_write(vte, "\e[21~", 5); return true; case XKB_KEY_F11: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[23;2~", 7); else vte_write(vte, "\e[23~", 5); return true; case XKB_KEY_F12: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[24;2~", 7); else vte_write(vte, "\e[24~", 5); return true; case XKB_KEY_F13: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[25;2~", 7); else vte_write(vte, "\e[25~", 5); return true; case XKB_KEY_F14: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[26;2~", 7); else vte_write(vte, "\e[26~", 5); return true; case XKB_KEY_F15: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[28;2~", 7); else vte_write(vte, "\e[28~", 5); return true; case XKB_KEY_F16: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[29;2~", 7); else vte_write(vte, "\e[29~", 5); return true; case XKB_KEY_F17: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[31;2~", 7); else vte_write(vte, "\e[31~", 5); return true; case XKB_KEY_F18: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[32;2~", 7); else vte_write(vte, "\e[32~", 5); return true; case XKB_KEY_F19: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[33;2~", 7); else vte_write(vte, "\e[33~", 5); return true; case XKB_KEY_F20: if (mods & TSM_SHIFT_MASK) vte_write(vte, "\e[34;2~", 7); else vte_write(vte, "\e[34~", 5); return true; } if (unicode != TSM_VTE_INVALID) { if (vte->flags & FLAG_7BIT_MODE) { val = unicode; if (unicode & 0x80) { llog_debug(vte, "invalid keyboard input in 7bit mode U+%x; mapping to '?'", unicode); val = '?'; } vte_write(vte, &val, 1); } else if (vte->flags & FLAG_8BIT_MODE) { val = unicode; if (unicode > 0xff) { llog_debug(vte, "invalid keyboard input in 8bit mode U+%x; mapping to '?'", unicode); val = '?'; } vte_write_raw(vte, &val, 1); } else { len = tsm_ucs4_to_utf8(tsm_symbol_make(unicode), u8); vte_write_raw(vte, u8, len); } return true; } vte->flags &= ~FLAG_PREPEND_ESCAPE; return false; } libtsm-4.0.2/test/000077500000000000000000000000001420363367700140015ustar00rootroot00000000000000libtsm-4.0.2/test/CMakeLists.txt000066400000000000000000000027231420363367700165450ustar00rootroot00000000000000# # Tests # These tests are included in a separate "test" target that can be run manually via `make test' # But a more useful way to run the tests is using ctest, which runs valgrind on all tests. # This is also the setup using in our CI. # Note that ctest fails if _any_ leak is detected by valgrind. Thus, you # need to have valgrind installed and libcheck running properly (without leaks) # to make the tests succeed. function(libtsm_add_test name) set(options) set(oneValueArgs) set(multiValueArgs LINK_LIBRARIES) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) add_executable(${name} ${name}) if(ARG_LINK_LIBRARIES) target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBRARIES}) endif() add_test(NAME ${name} COMMAND ${name}) endfunction() libtsm_add_test(test_htable LINK_LIBRARIES check::check ) target_link_object_libraries(test_htable PRIVATE shl ) libtsm_add_test(test_symbol LINK_LIBRARIES tsm_test check::check ) libtsm_add_test(test_screen LINK_LIBRARIES tsm_test check::check ) libtsm_add_test(test_vte LINK_LIBRARIES tsm_test check::check ) # This is only a quick sanity check that verifies the # valgrind tests work properly. libtsm_add_test(test_valgrind LINK_LIBRARIES check::check ) # mark the test as will fail in memcheck set_tests_properties(test_valgrind PROPERTIES LABELS memcheck-xfail) libtsm-4.0.2/test/test_common.h000066400000000000000000000056061420363367700165100ustar00rootroot00000000000000/* * TSM - Test Helper * * Copyright (c) 2012-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* * Test Helper * This header includes all kinds of helpers for testing. It tries to include * everything required and provides simple macros to avoid duplicating code in * each test. We try to keep tests as small as possible and move everything that * might be common here. * * We avoid sticking to our usual coding conventions (including headers in * source files, etc. ..) and instead make this the most convenient we can. */ #ifndef TEST_COMMON_H #define TEST_COMMON_H #include #include #include #include #include #include /* lower address-space is protected from user-allocation, so this is invalid */ #define TEST_INVALID_PTR ((void*)0x10) #define UNUSED(x) (void)(x) #define TEST_DEFINE_CASE(_name) \ static TCase *test_create_case_##_name(void) \ { \ TCase *tc; \ \ tc = tcase_create(#_name); \ #define TEST(_name) tcase_add_test(tc, _name); #define TEST_END_CASE \ return tc; \ } \ #define TEST_END NULL #define TEST_CASE(_name) test_create_case_##_name static inline Suite *test_create_suite(const char *name, ...) { Suite *s; va_list list; TCase *(*fn)(void); s = suite_create(name); va_start(list, name); while ((fn = va_arg(list, TCase *(*)(void)))) suite_add_tcase(s, fn()); va_end(list); return s; } #define TEST_SUITE(_name, ...) test_create_suite((#_name), ##__VA_ARGS__) static inline int test_run_suite(Suite *s) { int ret; SRunner *sr; sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); ret = srunner_ntests_failed(sr); srunner_free(sr); return ret; } #define TEST_DEFINE(_suite) \ int main(int argc, char **argv) \ { \ return test_run_suite(_suite); \ } #endif /* TEST_COMMON_H */ libtsm-4.0.2/test/test_htable.c000066400000000000000000000162411420363367700164470ustar00rootroot00000000000000/* * TSM - Hashtable Tests * * Copyright (c) 2012-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include "test_common.h" #include "shl-htable.h" static struct shl_htable ht = SHL_HTABLE_INIT_STR(ht); static struct shl_htable uht = SHL_HTABLE_INIT_ULONG(uht); struct node { char huge_padding[16384]; uint8_t v; char paaaaaadding[16384]; char *key; unsigned long ul; char more_padding[32768]; size_t hash; }; #define to_node(_key) shl_htable_offsetof((_key), struct node, key) #define ul_to_node(_key) shl_htable_offsetof((_key), struct node, ul) static struct node o[] = { { .v = 0, .key = "o0", .ul = 0 }, { .v = 1, .key = "o1", .ul = 1 }, { .v = 2, .key = "o2", .ul = 2 }, { .v = 3, .key = "o3", .ul = 3 }, { .v = 4, .key = "o4", .ul = 4 }, { .v = 5, .key = "o5", .ul = 5 }, { .v = 6, .key = "o6", .ul = 6 }, { .v = 7, .key = "o7", .ul = 7 }, }; static void test_htable_str_cb(char **k, void *ctx) { int *num = ctx; ck_assert(to_node(k)->v == to_node(k)->ul); ++*num; } START_TEST(test_htable_str) { int r, i, num; char **k; bool b; /* insert once, remove once, try removing again */ ck_assert(!o[0].hash); r = shl_htable_insert_str(&ht, &o[0].key, &o[0].hash); ck_assert(!r); ck_assert(o[0].hash == shl_htable_rehash_str(&o[0].key, NULL)); b = shl_htable_remove_str(&ht, o[0].key, &o[0].hash, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == 0); k = NULL; b = shl_htable_remove_str(&ht, o[0].key, &o[0].hash, &k); ck_assert(!b); ck_assert(k == NULL); /* insert twice, remove twice, try removing again */ r = shl_htable_insert_str(&ht, &o[0].key, &o[0].hash); ck_assert(!r); ck_assert(o[0].hash == shl_htable_rehash_str(&o[0].key, NULL)); r = shl_htable_insert_str(&ht, &o[0].key, &o[0].hash); ck_assert(!r); ck_assert(o[0].hash == shl_htable_rehash_str(&o[0].key, NULL)); b = shl_htable_remove_str(&ht, o[0].key, &o[0].hash, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == 0); b = shl_htable_remove_str(&ht, o[0].key, &o[0].hash, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == 0); k = NULL; b = shl_htable_remove_str(&ht, o[0].key, &o[0].hash, &k); ck_assert(!b); ck_assert(k == NULL); /* same as before but without hash-cache */ r = shl_htable_insert_str(&ht, &o[0].key, NULL); ck_assert(!r); r = shl_htable_insert_str(&ht, &o[0].key, NULL); ck_assert(!r); b = shl_htable_remove_str(&ht, o[0].key, NULL, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == 0); b = shl_htable_remove_str(&ht, o[0].key, NULL, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == 0); k = NULL; b = shl_htable_remove_str(&ht, o[0].key, NULL, &k); ck_assert(!b); ck_assert(k == NULL); /* insert all elements and verify empty hash-caches */ o[0].hash = 0; for (i = 0; i < 8; ++i) { ck_assert(!o[i].hash); r = shl_htable_insert_str(&ht, &o[i].key, &o[i].hash); ck_assert(!r); ck_assert(o[i].hash == shl_htable_rehash_str(&o[i].key, NULL)); } /* verify */ for (i = 0; i < 8; ++i) { k = NULL; b = shl_htable_lookup_str(&ht, o[i].key, NULL, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == i); } /* remove all elements again */ for (i = 0; i < 8; ++i) { b = shl_htable_remove_str(&ht, o[i].key, NULL, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(to_node(k)->v == i); } /* verify they're gone */ for (i = 0; i < 8; ++i) { k = NULL; b = shl_htable_remove_str(&ht, o[i].key, NULL, &k); ck_assert(!b); ck_assert(k == NULL); } for (i = 0; i < 8; ++i) { k = NULL; b = shl_htable_lookup_str(&ht, o[i].key, NULL, &k); ck_assert(!b); ck_assert(k == NULL); } num = 0; shl_htable_visit_str(&ht, test_htable_str_cb, &num); ck_assert(num == 0); num = 0; shl_htable_clear_str(&ht, test_htable_str_cb, &num); ck_assert(num == 0); /* test shl_htable_clear_str() */ for (i = 0; i < 8; ++i) { r = shl_htable_insert_str(&ht, &o[i].key, &o[i].hash); ck_assert(!r); } num = 0; shl_htable_visit_str(&ht, test_htable_str_cb, &num); ck_assert(num == 8); num = 0; shl_htable_clear_str(&ht, test_htable_str_cb, &num); ck_assert(num == 8); } END_TEST static void test_htable_ulong_cb(unsigned long *k, void *ctx) { int *num = ctx; ck_assert(ul_to_node(k)->v == ul_to_node(k)->ul); ++*num; } START_TEST(test_htable_ulong) { int r, i, num; unsigned long *k; bool b; /* insert once, remove once, try removing again */ r = shl_htable_insert_ulong(&uht, &o[0].ul); ck_assert(!r); ck_assert(o[0].ul == shl_htable_rehash_ulong(&o[0].ul, NULL)); b = shl_htable_remove_ulong(&uht, o[0].ul, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(ul_to_node(k)->v == 0); k = NULL; b = shl_htable_remove_ulong(&uht, o[0].ul, &k); ck_assert(!b); ck_assert(k == NULL); /* insert all */ for (i = 0; i < 8; ++i) { r = shl_htable_insert_ulong(&uht, &o[i].ul); ck_assert(!r); } /* verify */ for (i = 0; i < 8; ++i) { k = NULL; b = shl_htable_lookup_ulong(&uht, o[i].ul, &k); ck_assert(b); ck_assert(k != NULL); } /* remove all elements again */ for (i = 0; i < 8; ++i) { b = shl_htable_remove_ulong(&uht, o[i].ul, &k); ck_assert(b); ck_assert(k != NULL); ck_assert(ul_to_node(k)->v == i); } /* verify they're gone */ for (i = 0; i < 8; ++i) { k = NULL; b = shl_htable_remove_ulong(&uht, o[i].ul, &k); ck_assert(!b); ck_assert(k == NULL); } for (i = 0; i < 8; ++i) { k = NULL; b = shl_htable_lookup_ulong(&uht, o[i].ul, &k); ck_assert(!b); ck_assert(k == NULL); } num = 0; shl_htable_visit_ulong(&uht, test_htable_ulong_cb, &num); ck_assert(num == 0); num = 0; shl_htable_clear_ulong(&uht, test_htable_ulong_cb, &num); ck_assert(num == 0); /* test shl_htable_clear_ulong() */ for (i = 0; i < 8; ++i) { r = shl_htable_insert_ulong(&uht, &o[i].ul); ck_assert(!r); } num = 0; shl_htable_visit_ulong(&uht, test_htable_ulong_cb, &num); ck_assert(num == 8); num = 0; shl_htable_clear_ulong(&uht, test_htable_ulong_cb, &num); ck_assert(num == 8); } END_TEST TEST_DEFINE_CASE(misc) TEST(test_htable_str) TEST(test_htable_ulong) TEST_END_CASE TEST_DEFINE( TEST_SUITE(hashtable, TEST_CASE(misc), TEST_END ) ) libtsm-4.0.2/test/test_screen.c000066400000000000000000000072741420363367700164750ustar00rootroot00000000000000/* * TSM - Screen Management Tests * * Copyright (c) 2018 Aetf * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include "test_common.h" #include "libtsm.h" #include "libtsm-int.h" START_TEST(test_screen_init) { struct tsm_screen *screen; int r; r = tsm_screen_new(&screen, NULL, NULL); ck_assert_int_eq(r, 0); tsm_screen_unref(screen); screen = NULL; } END_TEST START_TEST(test_screen_null) { int r; unsigned int n; r = tsm_screen_new(NULL, NULL, NULL); ck_assert_int_eq(r, -EINVAL); tsm_screen_ref(NULL); tsm_screen_unref(NULL); tsm_screen_set_opts(NULL, 0u); tsm_screen_reset_opts(NULL, 0u); n = tsm_screen_get_opts(NULL); ck_assert_int_eq(n, 0); n = tsm_screen_get_width(NULL); ck_assert_int_eq(n, 0); n = tsm_screen_get_height(NULL); ck_assert_int_eq(n, 0); r = tsm_screen_resize(NULL, 0, 0); ck_assert_int_eq(r, -EINVAL); r = tsm_screen_set_margins(NULL, 0u, 0u); ck_assert_int_eq(r, -EINVAL); tsm_screen_set_max_sb(NULL, 0u); tsm_screen_clear_sb(NULL); tsm_screen_sb_up(NULL, 0u); tsm_screen_sb_down(NULL, 0u); tsm_screen_sb_page_up(NULL, 0u); tsm_screen_sb_page_down(NULL, 0u); tsm_screen_sb_reset(NULL); tsm_screen_set_def_attr(NULL, NULL); tsm_screen_reset(NULL); tsm_screen_set_flags(NULL, 0u); tsm_screen_reset_flags(NULL, 0u); n = tsm_screen_get_flags(NULL); ck_assert_int_eq(n, 0); n = tsm_screen_get_cursor_x(NULL); ck_assert_int_eq(n, 0); n = tsm_screen_get_cursor_y(NULL); ck_assert_int_eq(n, 0); tsm_screen_set_tabstop(NULL); tsm_screen_reset_tabstop(NULL); tsm_screen_reset_all_tabstops(NULL); tsm_screen_write(NULL, 0u, NULL); tsm_screen_newline(NULL); tsm_screen_scroll_up(NULL, 0u); tsm_screen_scroll_down(NULL, 0u); tsm_screen_move_to(NULL, 0u, 0u); tsm_screen_move_up(NULL, 0u, false); tsm_screen_move_down(NULL, 0u, false); tsm_screen_move_right(NULL, 0u); tsm_screen_move_left(NULL, 0u); tsm_screen_move_line_end(NULL); tsm_screen_move_line_home(NULL); tsm_screen_tab_right(NULL, 0u); tsm_screen_tab_left(NULL, 0u); tsm_screen_insert_lines(NULL, 0u); tsm_screen_delete_lines(NULL, 0u); tsm_screen_insert_chars(NULL, 0u); tsm_screen_delete_chars(NULL, 0u); tsm_screen_erase_cursor(NULL); tsm_screen_erase_chars(NULL, 0u); tsm_screen_erase_cursor_to_end(NULL, false); tsm_screen_erase_home_to_cursor(NULL, false); tsm_screen_erase_current_line(NULL, false); tsm_screen_erase_screen_to_cursor(NULL, false); tsm_screen_erase_cursor_to_screen(NULL, false); tsm_screen_erase_screen(NULL, false); } END_TEST TEST_DEFINE_CASE(misc) TEST(test_screen_init) TEST(test_screen_null) TEST_END_CASE TEST_DEFINE( TEST_SUITE(screen, TEST_CASE(misc), TEST_END ) ) libtsm-4.0.2/test/test_symbol.c000066400000000000000000000037161420363367700165200ustar00rootroot00000000000000/* * TSM - Symbol Table Tests * * Copyright (c) 2012-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include "test_common.h" #include "libtsm.h" #include "libtsm-int.h" START_TEST(test_symbol_null) { int r; tsm_symbol_t sym = 0, s; const tsm_symbol_t *sp; unsigned int n; r = tsm_symbol_table_new(NULL); ck_assert(r == -EINVAL); tsm_symbol_table_ref(NULL); tsm_symbol_table_unref(NULL); sp = tsm_symbol_get(NULL, &sym, NULL); ck_assert(sp == &sym); s = tsm_symbol_append(NULL, sym, 'a'); ck_assert(s == sym); n = tsm_symbol_get_width(NULL, sym); ck_assert(!n); } END_TEST START_TEST(test_symbol_init) { struct tsm_symbol_table *t; int r; r = tsm_symbol_table_new(&t); ck_assert(!r); tsm_symbol_table_unref(t); t = NULL; } END_TEST TEST_DEFINE_CASE(misc) TEST(test_symbol_null) TEST(test_symbol_init) TEST_END_CASE TEST_DEFINE( TEST_SUITE(symbol, TEST_CASE(misc), TEST_END ) ) libtsm-4.0.2/test/test_valgrind.c000066400000000000000000000027501420363367700170160ustar00rootroot00000000000000/* * TSM - Valgrind Verification * * Copyright (c) 2012-2013 David Herrmann * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ /* Dummy which just leaks memory. Used to verify valgrind memcheck. */ #include "test_common.h" START_TEST(test_valgrind) { void *p; p = malloc(0x100); ck_assert_ptr_ne(p, NULL); } END_TEST TEST_DEFINE_CASE(misc) TEST(test_valgrind) TEST_END_CASE TEST_DEFINE( TEST_SUITE(valgrind, TEST_CASE(misc), TEST_END ) ) libtsm-4.0.2/test/test_vte.c000066400000000000000000000111351420363367700160030ustar00rootroot00000000000000/* * TSM - VTE State Machine Tests * * Copyright (c) 2018 Aetf * * 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: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * 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. */ #include "libtsm-int.h" #include "libtsm.h" #include "test_common.h" static void log_cb(void *data, const char *file, int line, const char *func, const char *subs, unsigned int sev, const char *format, va_list args) { UNUSED(data); UNUSED(file); UNUSED(line); UNUSED(func); UNUSED(subs); UNUSED(sev); UNUSED(format); UNUSED(args); } static void write_cb(struct tsm_vte *vte, const char *u8, size_t len, void *data) { UNUSED(len); UNUSED(data); ck_assert_ptr_ne(vte, NULL); ck_assert_ptr_ne(u8, NULL); } START_TEST(test_vte_init) { struct tsm_screen *screen; struct tsm_vte *vte; int r; r = tsm_screen_new(&screen, log_cb, NULL); ck_assert_int_eq(r, 0); r = tsm_vte_new(&vte, screen, write_cb, NULL, log_cb, NULL); ck_assert_int_eq(r, 0); tsm_vte_unref(vte); vte = NULL; tsm_screen_unref(screen); screen = NULL; } END_TEST START_TEST(test_vte_null) { int r; bool rb; r = tsm_vte_new(NULL, NULL, NULL, NULL, log_cb, NULL); ck_assert_int_eq(r, -EINVAL); tsm_vte_ref(NULL); tsm_vte_unref(NULL); tsm_vte_set_osc_cb(NULL, NULL, NULL); r = tsm_vte_set_palette(NULL, ""); ck_assert_int_eq(r, -EINVAL); r = tsm_vte_set_custom_palette(NULL, NULL); ck_assert_int_eq(r, -EINVAL); tsm_vte_get_def_attr(NULL, NULL); tsm_vte_reset(NULL); tsm_vte_hard_reset(NULL); tsm_vte_input(NULL, "", 0); rb = tsm_vte_handle_keyboard(NULL, 0, 0, 0, 0); ck_assert(!rb); } END_TEST static uint8_t test_palette[TSM_COLOR_NUM][3] = { [TSM_COLOR_BLACK] = { 0, 18, 36 }, [TSM_COLOR_RED] = { 1, 19, 37 }, [TSM_COLOR_GREEN] = { 2, 20, 38 }, [TSM_COLOR_YELLOW] = { 3, 21, 39 }, [TSM_COLOR_BLUE] = { 4, 22, 40 }, [TSM_COLOR_MAGENTA] = { 5, 23, 41 }, [TSM_COLOR_CYAN] = { 6, 24, 42 }, [TSM_COLOR_LIGHT_GREY] = { 7, 25, 43 }, [TSM_COLOR_DARK_GREY] = { 8, 26, 44 }, [TSM_COLOR_LIGHT_RED] = { 9, 27, 45 }, [TSM_COLOR_LIGHT_GREEN] = { 10, 28, 46 }, [TSM_COLOR_LIGHT_YELLOW] = { 11, 29, 47 }, [TSM_COLOR_LIGHT_BLUE] = { 12, 30, 48 }, [TSM_COLOR_LIGHT_MAGENTA] = { 13, 31, 49 }, [TSM_COLOR_LIGHT_CYAN] = { 14, 32, 50 }, [TSM_COLOR_WHITE] = { 15, 33, 51 }, [TSM_COLOR_FOREGROUND] = { 16, 34, 52 }, [TSM_COLOR_BACKGROUND] = { 17, 35, 53 }, }; START_TEST(test_vte_custom_palette) { struct tsm_screen *screen; struct tsm_vte *vte; int r; r = tsm_screen_new(&screen, log_cb, NULL); ck_assert_int_eq(r, 0); r = tsm_vte_new(&vte, screen, write_cb, NULL, log_cb, NULL); ck_assert_int_eq(r, 0); r = tsm_vte_set_custom_palette(vte, test_palette); ck_assert_int_eq(r, 0); r = tsm_vte_set_palette(vte, "custom"); ck_assert_int_eq(r, 0); struct tsm_screen_attr attr; tsm_vte_get_def_attr(vte, &attr); ck_assert_uint_eq(attr.fr, test_palette[TSM_COLOR_FOREGROUND][0]); ck_assert_uint_eq(attr.fg, test_palette[TSM_COLOR_FOREGROUND][1]); ck_assert_uint_eq(attr.fb, test_palette[TSM_COLOR_FOREGROUND][2]); ck_assert_uint_eq(attr.br, test_palette[TSM_COLOR_BACKGROUND][0]); ck_assert_uint_eq(attr.bg, test_palette[TSM_COLOR_BACKGROUND][1]); ck_assert_uint_eq(attr.bb, test_palette[TSM_COLOR_BACKGROUND][2]); tsm_vte_unref(vte); vte = NULL; tsm_screen_unref(screen); screen = NULL; } END_TEST TEST_DEFINE_CASE(misc) TEST(test_vte_init) TEST(test_vte_null) TEST(test_vte_custom_palette) TEST_END_CASE // clang-format off TEST_DEFINE( TEST_SUITE(vte, TEST_CASE(misc), TEST_END ) ) // clang-format on