diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-04-02 11:23:37 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-04-02 11:23:37 +0000 |
commit | b721254769212d671a4729f1c88b059979b80efc (patch) | |
tree | 31ec396f3488f579309ba729e6d756026b40ccc0 | |
parent | bb620df7aa98c129687382e4866e643b8482fc59 (diff) | |
parent | 27a11762abbf0dbeb6d406fee4eee89229b6a660 (diff) | |
download | xorg-lib-libxkbcommon-baserock/genivi/baseline.tar.gz |
Merge tag 'xkbcommon-0.3.0' into baserock/genivi/baselinebaserock/genivi/baseline
Bug fixes and minor API tweaks.
73 files changed, 6316 insertions, 4288 deletions
diff --git a/Makefile.am b/Makefile.am index 6ecb8f5..f7e7fb1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,18 +3,6 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = xkbcommon.pc -MAINTAINERCLEANFILES = ChangeLog INSTALL - -.PHONY: ChangeLog INSTALL - -INSTALL: - $(INSTALL_CMD) - -ChangeLog: - $(CHANGELOG_CMD) - -dist-hook: ChangeLog INSTALL - AM_CPPFLAGS = \ -DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' \ -I$(top_srcdir)/src \ @@ -48,8 +36,8 @@ libxkbcommon_la_SOURCES = \ src/xkbcomp/include.c \ src/xkbcomp/include.h \ src/xkbcomp/keycodes.c \ - src/xkbcomp/keycodes.h \ src/xkbcomp/keymap.c \ + src/xkbcomp/keymap-dump.c \ src/xkbcomp/parser.y \ src/xkbcomp/parser-priv.h \ src/xkbcomp/rules.c \ @@ -67,12 +55,10 @@ libxkbcommon_la_SOURCES = \ src/context.h \ src/compat.c \ src/darray.h \ - src/keymap-dump.c \ src/keysym.c \ src/keysym.h \ src/keysym-utf.c \ src/ks_tables.h \ - src/list.h \ src/keymap.c \ src/keymap.h \ src/state.c \ @@ -135,37 +121,47 @@ AM_TESTS_ENVIRONMENT = \ TESTS = \ test/keysym \ test/filecomp \ - test/rulescomp \ - test/state \ test/context \ test/rules-file \ test/stringcomp \ - test/keyseq \ + test/buffercomp \ test/log TESTS_LDADD = libtest.la test_keysym_LDADD = $(TESTS_LDADD) test_filecomp_LDADD = $(TESTS_LDADD) test_rulescomp_LDADD = $(TESTS_LDADD) -lrt -test_state_LDADD = $(TESTS_LDADD) test_context_LDADD = $(TESTS_LDADD) test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement test_rules_file_LDADD = $(TESTS_LDADD) -lrt test_stringcomp_LDADD = $(TESTS_LDADD) -test_keyseq_LDADD = $(TESTS_LDADD) +test_buffercomp_LDADD = $(TESTS_LDADD) test_log_LDADD = $(TESTS_LDADD) -test_interactive_LDADD = $(TESTS_LDADD) test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD) test_print_compiled_keymap_LDADD = $(TESTS_LDADD) test_bench_key_proc_LDADD = $(TESTS_LDADD) -lrt check_PROGRAMS = \ $(TESTS) \ - test/interactive \ test/rmlvo-to-kccgst \ test/print-compiled-keymap \ test/bench-key-proc +if BUILD_LINUX_TESTS +TESTS += \ + test/state \ + test/keyseq \ + test/rulescomp + +test_keyseq_LDADD = $(TESTS_LDADD) +test_state_LDADD = $(TESTS_LDADD) +test_interactive_LDADD = $(TESTS_LDADD) + +check_PROGRAMS += \ + test/interactive + +endif BUILD_LINUX_TESTS + EXTRA_DIST = \ test/data @@ -1,5 +1,5 @@ -xkbcommon -========= +Overview {#mainpage} +======== xkbcommon is a keymap compiler and support library which processes a reduced subset of keymaps as defined by the XKB specification. Primarily, @@ -9,9 +9,9 @@ which is the base type for all xkbcommon operations. From an xkb_keymap, an xkb_state object is created which holds the current state of all modifiers, groups, LEDs, etc, relating to that keymap. All -key events must be fed into the xkb_state object using xkb_state_update_key. +key events must be fed into the xkb_state object using xkb_state_update_key(). Once this is done, the xkb_state object will be properly updated, and the -keysyms to use can be obtained with xkb_key_get_syms. +keysyms to use can be obtained with xkb_state_key_get_syms(). libxkbcommon does not distribute a dataset itself, other than for testing purposes. The most common dataset is xkeyboard-config, as used by all diff --git a/configure.ac b/configure.ac index bfdec28..10a64f4 100644 --- a/configure.ac +++ b/configure.ac @@ -22,8 +22,9 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.62]) -AC_INIT([libxkbcommon], [0.2.0], - [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon]) +AC_INIT([libxkbcommon], [0.3.0], + [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon], + [libxkbcommon], [http://xkbcommon.org]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -38,9 +39,9 @@ AC_USE_SYSTEM_EXTENSIONS # Initialize libtool LT_INIT -# Require xorg-macros minimum of 1.8 for AM_SILENT_RULES +# Add xorg-macros stuff m4_ifndef([XORG_MACROS_VERSION], - [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) + [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])]) XORG_MACROS_VERSION(1.16) XORG_DEFAULT_OPTIONS XORG_MEMORY_CHECK_FLAGS @@ -49,7 +50,6 @@ XORG_WITH_DOXYGEN # Check for compiler features AC_C_INLINE -AC_C_TYPEOF # Check for programs AC_PROG_MKDIR_P @@ -72,6 +72,10 @@ fi AC_CHECK_FUNCS([eaccess euidaccess]) +# Some tests use Linux-specific headers +AC_CHECK_HEADER([linux/input.h]) +AM_CONDITIONAL(BUILD_LINUX_TESTS, [test "x$ac_cv_header_linux_input_h" = xyes]) + XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden]) # Define a configuration option for the XKB config root @@ -110,6 +114,26 @@ AC_ARG_WITH([default_layout], AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"], [Default XKB layout]) +AC_ARG_WITH([default_variant], + [AS_HELP_STRING([--with-default-variant=<path>], + [Default XKB variant (default: (none))])], + [DEFAULT_XKB_VARIANT="$withval"], + [DEFAULT_XKB_VARAINT=]) +if ! test "x$DEFAULT_XKB_VARIANT" = x; then + AC_DEFINE_UNQUOTED([DEFAULT_XKB_VARIANT], ["$DEFAULT_XKB_VARIANT"], + [Default XKB variant]) +fi + +AC_ARG_WITH([default_options], + [AS_HELP_STRING([--with-default-options=<path>], + [Default XKB options (default: (none))])], + [DEFAULT_XKB_OPTIONS="$withval"], + [DEFAULT_XKB_OPTIONS=]) +if ! test "x$DEFAULT_XKB_OPTIONS" = x; then + AC_DEFINE_UNQUOTED([DEFAULT_XKB_OPTIONS], ["$DEFAULT_XKB_OPTIONS"], + [Default XKB options]) +fi + AC_CONFIG_FILES([ Makefile xkbcommon-uninstalled.pc diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 0521467..a63db25 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -1,14 +1,14 @@ -# Doxyfile 1.8.2 +# Doxyfile 1.8.3.1 # This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project +# doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored +# All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") +# Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options @@ -241,7 +241,7 @@ OPTIMIZE_OUTPUT_VHDL = NO # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. -EXTENSION_MAPPING = +EXTENSION_MAPPING = no_extension=md # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable @@ -445,13 +445,13 @@ INTERNAL_DOCS = NO # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. -CASE_SENSE_NAMES = NO +CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. -HIDE_SCOPE_NAMES = YES +HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation @@ -544,7 +544,8 @@ GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. ENABLED_SECTIONS = @@ -571,7 +572,8 @@ SHOW_USED_FILES = YES SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES @@ -601,7 +603,8 @@ LAYOUT_FILE = # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. CITE_BIB_FILES = @@ -665,7 +668,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = @abs_top_srcdir@/xkbcommon +INPUT = @abs_top_srcdir@/xkbcommon @abs_top_srcdir@/README # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is @@ -683,7 +686,7 @@ INPUT_ENCODING = UTF-8 # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl -FILE_PATTERNS = +FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. @@ -732,7 +735,7 @@ EXAMPLE_PATH = # and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = * +EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude @@ -752,14 +755,17 @@ IMAGE_PATH = # by executing (via popen()) the command <filter> <input-file>, where <filter> # is the value of the INPUT_FILTER tag, and <input-file> is the name of an # input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. @@ -780,6 +786,13 @@ FILTER_SOURCE_FILES = NO FILTER_SOURCE_PATTERNS = +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +#USE_MDFILE_AS_MAINPAGE = + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- @@ -817,7 +830,8 @@ REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. +# link to the source code. +# Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES @@ -882,7 +896,7 @@ HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen +# for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify @@ -1109,7 +1123,7 @@ QHP_SECT_FILTER_ATTRS = QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help +# will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of @@ -1188,13 +1202,21 @@ FORMULA_TRANSPARENT = YES USE_MATHJAX = NO +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +#MATHJAX_FORMAT = HTML-CSS + # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. However, it is strongly recommended to install a local +# installing MathJax. +# However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1215,15 +1237,55 @@ MATHJAX_EXTENSIONS = SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. SERVER_BASED_SEARCH = NO +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +#EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +#SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +#SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +#EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +#EXTRA_SEARCH_MAPPINGS = + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- @@ -1459,8 +1521,10 @@ GENERATE_PERLMOD = NO PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. @@ -1546,9 +1610,11 @@ SKIP_FUNCTION_MACROS = YES # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: -# TAGFILES = file1 file2 ... +# +# TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... +# +# TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which diff --git a/src/context.c b/src/context.c index a846b8f..8d56487 100644 --- a/src/context.c +++ b/src/context.c @@ -44,17 +44,18 @@ struct xkb_context { int log_verbosity; void *user_data; + struct xkb_rule_names names_dflt; + darray(char *) includes; darray(char *) failed_includes; - /* xkbcomp needs to assign sequential IDs to XkbFile's it creates. */ - unsigned file_id; - struct atom_table *atom_table; /* Buffer for the *Text() functions. */ - char text_buffer[1024]; + char text_buffer[2048]; size_t text_next; + + unsigned int use_environment_names : 1; }; /** @@ -183,12 +184,6 @@ xkb_context_failed_include_path_get(struct xkb_context *ctx, return darray_item(ctx->failed_includes, idx); } -unsigned -xkb_context_take_file_id(struct xkb_context *ctx) -{ - return ctx->file_id++; -} - /** * Take a new reference on the context. */ @@ -280,6 +275,14 @@ log_verbosity(const char *verbosity) { return 0; } +#ifndef DEFAULT_XKB_VARIANT +#define DEFAULT_XKB_VARIANT NULL +#endif + +#ifndef DEFAULT_XKB_OPTIONS +#define DEFAULT_XKB_OPTIONS NULL +#endif + /** * Create a new context. */ @@ -314,6 +317,8 @@ xkb_context_new(enum xkb_context_flags flags) return NULL; } + ctx->use_environment_names = !(flags & XKB_CONTEXT_NO_ENVIRONMENT_NAMES); + ctx->atom_table = atom_table_new(); if (!ctx->atom_table) { xkb_context_unref(ctx); @@ -427,3 +432,61 @@ xkb_context_get_buffer(struct xkb_context *ctx, size_t size) return rtrn; } + +const char * +xkb_context_get_default_rules(struct xkb_context *ctx) +{ + const char *env = NULL; + + if (ctx->use_environment_names) + env = getenv("XKB_DEFAULT_RULES"); + + return env ? env : DEFAULT_XKB_RULES; +} + +const char * +xkb_context_get_default_model(struct xkb_context *ctx) +{ + const char *env = NULL; + + if (ctx->use_environment_names) + env = getenv("XKB_DEFAULT_MODEL"); + + return env ? env : DEFAULT_XKB_MODEL; +} + +const char * +xkb_context_get_default_layout(struct xkb_context *ctx) +{ + const char *env = NULL; + + if (ctx->use_environment_names) + env = getenv("XKB_DEFAULT_LAYOUT"); + + return env ? env : DEFAULT_XKB_LAYOUT; +} + +const char * +xkb_context_get_default_variant(struct xkb_context *ctx) +{ + const char *env = NULL; + const char *layout = getenv("XKB_DEFAULT_VARIANT"); + + /* We don't want to inherit the variant if they haven't also set a + * layout, since they're so closely paired. */ + if (layout && ctx->use_environment_names) + env = getenv("XKB_DEFAULT_VARIANT"); + + return env ? env : DEFAULT_XKB_VARIANT; +} + +const char * +xkb_context_get_default_options(struct xkb_context *ctx) +{ + const char *env = NULL; + + if (ctx->use_environment_names) + env = getenv("XKB_DEFAULT_OPTIONS"); + + return env ? env : DEFAULT_XKB_OPTIONS; +} diff --git a/src/context.h b/src/context.h index 16bd321..7c061a0 100644 --- a/src/context.h +++ b/src/context.h @@ -28,9 +28,6 @@ #include "atom.h" -unsigned -xkb_context_take_file_id(struct xkb_context *ctx); - unsigned int xkb_context_num_failed_include_paths(struct xkb_context *ctx); @@ -80,6 +77,21 @@ xkb_log(struct xkb_context *ctx, enum xkb_log_level level, xkb_log_cond_level((ctx), (level), __VA_ARGS__); \ } while (0) +const char * +xkb_context_get_default_rules(struct xkb_context *ctx); + +const char * +xkb_context_get_default_model(struct xkb_context *ctx); + +const char * +xkb_context_get_default_layout(struct xkb_context *ctx); + +const char * +xkb_context_get_default_variant(struct xkb_context *ctx); + +const char * +xkb_context_get_default_options(struct xkb_context *ctx); + /* * The format is not part of the argument list in order to avoid the * "ISO C99 requires rest arguments to be used" warning when only the @@ -99,4 +111,14 @@ xkb_log(struct xkb_context *ctx, enum xkb_log_level level, #define log_vrb(ctx, vrb, ...) \ xkb_log_cond_verbosity((ctx), XKB_LOG_LEVEL_WARNING, (vrb), __VA_ARGS__) +/* + * Variants which are prefixed by the name of the function they're + * called from. + * Here we must have the silly 1 variant. + */ +#define log_err_func(ctx, fmt, ...) \ + log_err(ctx, "%s: " fmt, __func__, __VA_ARGS__) +#define log_err_func1(ctx, fmt) \ + log_err(ctx, "%s: " fmt, __func__) + #endif diff --git a/src/darray.h b/src/darray.h index 569576e..0cf3747 100644 --- a/src/darray.h +++ b/src/darray.h @@ -218,12 +218,6 @@ typedef darray (unsigned long) darray_ulong; darray_prepend_items(arr, __src, sizeof(__src) / sizeof(*__src)); \ } while (0) -#define darray_appends(arr, ...) \ - darray_appends_t(arr, typeof((*(arr).item)), __VA_ARGS__) - -#define darray_prepends(arr, ...) \ - darray_prepends_t(arr, typeof((*(arr).item)), __VA_ARGS__) - /*** Removal ***/ /* Warning: Do not call darray_pop on an empty darray. */ diff --git a/src/keymap.c b/src/keymap.c index 87694cf..3df183a 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -53,7 +53,7 @@ #include "keymap.h" #include "text.h" -struct xkb_keymap * +static struct xkb_keymap * xkb_keymap_new(struct xkb_context *ctx, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags) @@ -102,15 +102,15 @@ xkb_keymap_unref(struct xkb_keymap *keymap) free(keymap->keys); } for (i = 0; i < keymap->num_types; i++) { - free(keymap->types[i].map); + free(keymap->types[i].entries); free(keymap->types[i].level_names); } free(keymap->types); darray_free(keymap->sym_interprets); - darray_free(keymap->key_aliases); + free(keymap->key_aliases); free(keymap->group_names); darray_free(keymap->mods); - darray_free(keymap->indicators); + darray_free(keymap->leds); free(keymap->keycodes_section_name); free(keymap->symbols_section_name); free(keymap->types_section_name); @@ -119,6 +119,200 @@ xkb_keymap_unref(struct xkb_keymap *keymap) free(keymap); } +static const struct xkb_keymap_format_ops * +get_keymap_format_ops(enum xkb_keymap_format format) +{ + static const struct xkb_keymap_format_ops *keymap_format_ops[] = { + [XKB_KEYMAP_FORMAT_TEXT_V1] = &text_v1_keymap_format_ops, + }; + + if ((int) format < 0 || (int) format >= ARRAY_SIZE(keymap_format_ops)) + return NULL; + + return keymap_format_ops[format]; +} + +XKB_EXPORT struct xkb_keymap * +xkb_keymap_new_from_names(struct xkb_context *ctx, + const struct xkb_rule_names *rmlvo_in, + enum xkb_keymap_compile_flags flags) +{ + struct xkb_keymap *keymap; + struct xkb_rule_names rmlvo; + const enum xkb_keymap_format format = XKB_KEYMAP_FORMAT_TEXT_V1; + const struct xkb_keymap_format_ops *ops; + + ops = get_keymap_format_ops(format); + if (!ops || !ops->keymap_new_from_names) { + log_err_func(ctx, "unsupported keymap format: %d\n", format); + return NULL; + } + + if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) { + log_err_func(ctx, "unrecognized flags: %#x\n", flags); + return NULL; + } + + if (rmlvo_in) + rmlvo = *rmlvo_in; + else + memset(&rmlvo, 0, sizeof(rmlvo)); + + if (isempty(rmlvo.rules)) + rmlvo.rules = xkb_context_get_default_rules(ctx); + if (isempty(rmlvo.model)) + rmlvo.model = xkb_context_get_default_model(ctx); + /* Layout and variant are tied together, so don't try to use one from + * the caller and one from the environment. */ + if (isempty(rmlvo.layout)) { + rmlvo.layout = xkb_context_get_default_layout(ctx); + rmlvo.variant = xkb_context_get_default_variant(ctx); + } + /* Options can be empty, so respect that if passed in. */ + if (rmlvo.options == NULL) + rmlvo.options = xkb_context_get_default_options(ctx); + + keymap = xkb_keymap_new(ctx, format, flags); + if (!keymap) + return NULL; + + if (!ops->keymap_new_from_names(keymap, &rmlvo)) { + xkb_keymap_unref(keymap); + return NULL; + } + + return keymap; +} + +XKB_EXPORT struct xkb_keymap * +xkb_keymap_new_from_string(struct xkb_context *ctx, + const char *string, + enum xkb_keymap_format format, + enum xkb_keymap_compile_flags flags) +{ + struct xkb_keymap *keymap; + const struct xkb_keymap_format_ops *ops; + + ops = get_keymap_format_ops(format); + if (!ops || !ops->keymap_new_from_string) { + log_err_func(ctx, "unsupported keymap format: %d\n", format); + return NULL; + } + + if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) { + log_err_func(ctx, "unrecognized flags: %#x\n", flags); + return NULL; + } + + if (!string) { + log_err_func1(ctx, "no string specified\n"); + return NULL; + } + + keymap = xkb_keymap_new(ctx, format, flags); + if (!keymap) + return NULL; + + if (!ops->keymap_new_from_string(keymap, string)) { + xkb_keymap_unref(keymap); + return NULL; + } + + return keymap; +} + +XKB_EXPORT struct xkb_keymap * +xkb_keymap_new_from_buffer(struct xkb_context *ctx, + const char *buffer, size_t length, + enum xkb_keymap_format format, + enum xkb_keymap_compile_flags flags) +{ + struct xkb_keymap *keymap; + const struct xkb_keymap_format_ops *ops; + + ops = get_keymap_format_ops(format); + if (!ops || !ops->keymap_new_from_string) { + log_err_func(ctx, "unsupported keymap format: %d\n", format); + return NULL; + } + + if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) { + log_err_func(ctx, "unrecognized flags: %#x\n", flags); + return NULL; + } + + if (!buffer) { + log_err_func1(ctx, "no buffer specified\n"); + return NULL; + } + + keymap = xkb_keymap_new(ctx, format, flags); + if (!keymap) + return NULL; + + if (!ops->keymap_new_from_buffer(keymap, buffer, length)) { + xkb_keymap_unref(keymap); + return NULL; + } + + return keymap; +} + +XKB_EXPORT struct xkb_keymap * +xkb_keymap_new_from_file(struct xkb_context *ctx, + FILE *file, + enum xkb_keymap_format format, + enum xkb_keymap_compile_flags flags) +{ + struct xkb_keymap *keymap; + const struct xkb_keymap_format_ops *ops; + + ops = get_keymap_format_ops(format); + if (!ops || !ops->keymap_new_from_file) { + log_err_func(ctx, "unsupported keymap format: %d\n", format); + return NULL; + } + + if (flags & ~(XKB_MAP_COMPILE_PLACEHOLDER)) { + log_err_func(ctx, "unrecognized flags: %#x\n", flags); + return NULL; + } + + if (!file) { + log_err_func1(ctx, "no file specified\n"); + return NULL; + } + + keymap = xkb_keymap_new(ctx, format, flags); + if (!keymap) + return NULL; + + if (!ops->keymap_new_from_file(keymap, file)) { + xkb_keymap_unref(keymap); + return NULL; + } + + return keymap; +} + +XKB_EXPORT char * +xkb_keymap_get_as_string(struct xkb_keymap *keymap, + enum xkb_keymap_format format) +{ + const struct xkb_keymap_format_ops *ops; + + if (format == XKB_KEYMAP_USE_ORIGINAL_FORMAT) + format = keymap->format; + + ops = get_keymap_format_ops(format); + if (!ops || !ops->keymap_get_as_string) { + log_err_func(keymap->ctx, "unsupported keymap format: %d\n", format); + return NULL; + } + + return ops->keymap_get_as_string(keymap); +} + /** * Returns the total number of modifiers active in the keymap. */ @@ -242,7 +436,7 @@ xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc, XKB_EXPORT xkb_led_index_t xkb_keymap_num_leds(struct xkb_keymap *keymap) { - return darray_size(keymap->indicators); + return darray_size(keymap->leds); } /** @@ -251,11 +445,10 @@ xkb_keymap_num_leds(struct xkb_keymap *keymap) XKB_EXPORT const char * xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx) { - if (idx >= darray_size(keymap->indicators)) + if (idx >= darray_size(keymap->leds)) return NULL; - return xkb_atom_text(keymap->ctx, - darray_item(keymap->indicators, idx).name); + return xkb_atom_text(keymap->ctx, darray_item(keymap->leds, idx).name); } /** @@ -266,12 +459,12 @@ xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name) { xkb_atom_t atom = xkb_atom_lookup(keymap->ctx, name); xkb_led_index_t i; - const struct xkb_indicator_map *led; + const struct xkb_led *led; if (atom == XKB_ATOM_NONE) return XKB_LED_INVALID; - darray_enumerate(i, led, keymap->indicators) + darray_enumerate(i, led, keymap->leds) if (led->name == atom) return i; @@ -332,3 +525,31 @@ xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc) return key->repeats; } + +struct xkb_key * +XkbKeyByName(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases) +{ + struct xkb_key *key; + + xkb_foreach_key(key, keymap) + if (key->name == name) + return key; + + if (use_aliases) { + xkb_atom_t new_name = XkbResolveKeyAlias(keymap, name); + if (new_name != XKB_ATOM_NONE) + return XkbKeyByName(keymap, new_name, false); + } + + return NULL; +} + +xkb_atom_t +XkbResolveKeyAlias(struct xkb_keymap *keymap, xkb_atom_t name) +{ + for (unsigned i = 0; i < keymap->num_key_aliases; i++) + if (keymap->key_aliases[i].alias == name) + return keymap->key_aliases[i].real; + + return XKB_ATOM_NONE; +} diff --git a/src/keymap.h b/src/keymap.h index cb035b0..c6b884d 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -78,8 +78,8 @@ * Dan Nicholson <dbn.lists@gmail.com> */ -#ifndef MAP_H -#define MAP_H +#ifndef KEYMAP_H +#define KEYMAP_H /* Don't use compat names in internal code. */ #define _XKBCOMMON_COMPAT_H @@ -256,19 +256,19 @@ union xkb_action { struct xkb_private_action priv; }; -struct xkb_kt_map_entry { +struct xkb_key_type_entry { xkb_level_index_t level; struct xkb_mods mods; struct xkb_mods preserve; }; struct xkb_key_type { + xkb_atom_t name; struct xkb_mods mods; xkb_level_index_t num_levels; - struct xkb_kt_map_entry *map; - unsigned int num_entries; - xkb_atom_t name; xkb_atom_t *level_names; + unsigned int num_entries; + struct xkb_key_type_entry *entries; }; struct xkb_sym_interpret { @@ -281,7 +281,7 @@ struct xkb_sym_interpret { bool repeat; }; -struct xkb_indicator_map { +struct xkb_led { xkb_atom_t name; enum xkb_state_component which_groups; xkb_layout_mask_t groups; @@ -380,7 +380,8 @@ struct xkb_keymap { struct xkb_key *keys; /* aliases in no particular order */ - darray(struct xkb_key_alias) key_aliases; + unsigned int num_key_aliases; + struct xkb_key_alias *key_aliases; struct xkb_key_type *types; unsigned int num_types; @@ -395,7 +396,7 @@ struct xkb_keymap { xkb_layout_index_t num_group_names; xkb_atom_t *group_names; - darray(struct xkb_indicator_map) indicators; + darray(struct xkb_led) leds; char *keycodes_section_name; char *symbols_section_name; @@ -403,6 +404,11 @@ struct xkb_keymap { char *compat_section_name; }; +#define xkb_foreach_key(iter, keymap) \ + for (iter = keymap->keys + keymap->min_key_code; \ + iter <= keymap->keys + keymap->max_key_code; \ + iter++) + static inline const struct xkb_key * XkbKey(struct xkb_keymap *keymap, xkb_keycode_t kc) { @@ -411,21 +417,17 @@ XkbKey(struct xkb_keymap *keymap, xkb_keycode_t kc) return &keymap->keys[kc]; } -#define xkb_foreach_key(iter, keymap) \ - for (iter = keymap->keys + keymap->min_key_code; \ - iter <= keymap->keys + keymap->max_key_code; \ - iter++) - static inline xkb_level_index_t XkbKeyGroupWidth(const struct xkb_key *key, xkb_layout_index_t layout) { return key->groups[layout].type->num_levels; } -struct xkb_keymap * -xkb_keymap_new(struct xkb_context *ctx, - enum xkb_keymap_format format, - enum xkb_keymap_compile_flags); +struct xkb_key * +XkbKeyByName(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases); + +xkb_atom_t +XkbResolveKeyAlias(struct xkb_keymap *keymap, xkb_atom_t name); xkb_layout_index_t wrap_group_into_range(int32_t group, @@ -433,4 +435,17 @@ wrap_group_into_range(int32_t group, enum xkb_range_exceed_type out_of_range_group_action, xkb_layout_index_t out_of_range_group_number); +struct xkb_keymap_format_ops { + bool (*keymap_new_from_names)(struct xkb_keymap *keymap, + const struct xkb_rule_names *names); + bool (*keymap_new_from_string)(struct xkb_keymap *keymap, + const char *string); + bool (*keymap_new_from_buffer)(struct xkb_keymap *keymap, + const char *buffer, size_t length); + bool (*keymap_new_from_file)(struct xkb_keymap *keymap, FILE *file); + char *(*keymap_get_as_string)(struct xkb_keymap *keymap); +}; + +extern const struct xkb_keymap_format_ops text_v1_keymap_format_ops; + #endif diff --git a/src/keysym.c b/src/keysym.c index f80a1ed..1e92a4a 100644 --- a/src/keysym.c +++ b/src/keysym.c @@ -85,9 +85,11 @@ xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size) if (entry) return snprintf(buffer, size, "%s", entry->name); - if (ks >= 0x01000100 && ks <= 0x0110ffff) - /* Unnamed Unicode codepoint. */ - return snprintf(buffer, size, "U%lx", ks & 0xffffffUL); + /* Unnamed Unicode codepoint. */ + if (ks >= 0x01000100 && ks <= 0x0110ffff) { + const int width = (ks & 0xff0000UL) ? 8 : 4; + return snprintf(buffer, size, "U%0*lX", width, ks & 0xffffffUL); + } /* Unnamed, non-Unicode, symbol (shouldn't generally happen). */ return snprintf(buffer, size, "0x%08x", ks); diff --git a/src/list.h b/src/list.h deleted file mode 100644 index c15a78b..0000000 --- a/src/list.h +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * Copyright © 2010 Francisco Jerez <currojerez@riseup.net> - * - * 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. - * - */ - -#ifndef LIST_H -#define LIST_H - -/** - * @file Classic doubly-link circular list implementation. - * For real usage examples of the linked list, see the file test/list.c - * - * Example: - * We need to keep a list of struct foo in the parent struct bar, i.e. what - * we want is something like this. - * - * struct bar { - * ... - * struct foo *list_of_foos; -----> struct foo {}, struct foo {}, struct foo{} - * ... - * } - * - * We need one list head in bar and a list element in all list_of_foos (both are of - * data type 'struct list'). - * - * struct bar { - * ... - * struct list list_of_foos; - * ... - * } - * - * struct foo { - * ... - * struct list entry; - * ... - * } - * - * Now we initialize the list head: - * - * struct bar bar; - * ... - * list_init(&bar.list_of_foos); - * - * Then we create the first element and add it to this list: - * - * struct foo *foo = malloc(...); - * .... - * list_add(&foo->entry, &bar.list_of_foos); - * - * Repeat the above for each element you want to add to the list. Deleting - * works with the element itself. - * list_del(&foo->entry); - * free(foo); - * - * Note: calling list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty - * list again. - * - * Looping through the list requires a 'struct foo' as iterator and the - * name of the field the subnodes use. - * - * struct foo *iterator; - * list_foreach(iterator, &bar.list_of_foos, entry) { - * if (iterator->something == ...) - * ... - * } - * - * Note: You must not call list_del() on the iterator if you continue the - * loop. You need to run the safe for-each loop instead: - * - * struct foo *iterator, *next; - * list_foreach_safe(iterator, next, &bar.list_of_foos, entry) { - * if (...) - * list_del(&iterator->entry); - * } - * - */ - -/** - * The linkage struct for list nodes. This struct must be part of your - * to-be-linked struct. struct list is required for both the head of the - * list and for each list node. - * - * Position and name of the struct list field is irrelevant. - * There are no requirements that elements of a list are of the same type. - * There are no requirements for a list head, any struct list can be a list - * head. - */ -struct list { - struct list *next, *prev; -}; - -/** - * Initialize the list as an empty list. - * - * Example: - * list_init(&bar->list_of_foos); - * - * @param The list to initialized. - */ -static void -list_init(struct list *list) -{ - list->next = list->prev = list; -} - -static inline void -__list_add(struct list *entry, - struct list *prev, struct list *next) -{ - next->prev = entry; - entry->next = next; - entry->prev = prev; - prev->next = entry; -} - -/** - * Insert a new element after the given list head. The new element does not - * need to be initialised as empty list. - * The list changes from: - * head → some element → ... - * to - * head → new element → older element → ... - * - * Example: - * struct foo *newfoo = malloc(...); - * list_add(&newfoo->entry, &bar->list_of_foos); - * - * @param entry The new element to prepend to the list. - * @param head The existing list. - */ -static inline void -list_add(struct list *entry, struct list *head) -{ - __list_add(entry, head, head->next); -} - -/** - * Append a new element to the end of the list given with this list head. - * - * The list changes from: - * head → some element → ... → lastelement - * to - * head → some element → ... → lastelement → new element - * - * Example: - * struct foo *newfoo = malloc(...); - * list_append(&newfoo->entry, &bar->list_of_foos); - * - * @param entry The new element to prepend to the list. - * @param head The existing list. - */ -static inline void -list_append(struct list *entry, struct list *head) -{ - __list_add(entry, head->prev, head); -} - -static inline void -__list_del(struct list *prev, struct list *next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * Remove the element from the list it is in. Using this function will reset - * the pointers to/from this element so it is removed from the list. It does - * NOT free the element itself or manipulate it otherwise. - * - * Using list_del on a pure list head (like in the example at the top of - * this file) will NOT remove the first element from - * the list but rather reset the list as empty list. - * - * Example: - * list_del(&foo->entry); - * - * @param entry The element to remove. - */ -static inline void -list_del(struct list *entry) -{ - __list_del(entry->prev, entry->next); - list_init(entry); -} - -/** - * Check if the list is empty. - * - * Example: - * list_empty(&bar->list_of_foos); - * - * @return True if the list contains one or more elements or False otherwise. - */ -static inline bool -list_empty(struct list *head) -{ - return head->next == head; -} - -/** - * Replace a list element by another one. This can also be used to replace - * the head of an existing list by another list head. - * - * Example: - * list_replace(&object_foo->entry, &object_bar->entry); - * list_replace(&from->list_head, &into->list_head); - * - * @param old The element being replaced. - * @param new The element to replace @old with. - */ -static inline void -list_replace(struct list *old, struct list *new) -{ - new->next = old->next; - new->next->prev = new; - new->prev = old->prev; - new->prev->next = new; -} - -/** - * Returns a pointer to the container of this list element. - * - * Example: - * struct foo* f; - * f = container_of(&foo->entry, struct foo, entry); - * assert(f == foo); - * - * @param ptr Pointer to the struct list. - * @param type Data type of the list element. - * @param member Member name of the struct list field in the list element. - * @return A pointer to the data struct containing the list head. - */ -#ifndef container_of -#define container_of(ptr, type, member) \ - (type *)((char *)(ptr) - (char *) &((type *)0)->member) -#endif - -/** - * Alias of container_of - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * Retrieve the first list entry for the given list pointer. - * - * Example: - * struct foo *first; - * first = list_first_entry(&bar->list_of_foos, struct foo, list_of_foos); - * - * @param ptr The list head - * @param type Data type of the list element to retrieve - * @param member Member name of the struct list field in the list element. - * @return A pointer to the first list element. - */ -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) - -/** - * Retrieve the last list entry for the given listpointer. - * - * Example: - * struct foo *first; - * first = list_last_entry(&bar->list_of_foos, struct foo, list_of_foos); - * - * @param ptr The list head - * @param type Data type of the list element to retrieve - * @param member Member name of the struct list field in the list element. - * @return A pointer to the last list element. - */ -#define list_last_entry(ptr, type, member) \ - list_entry((ptr)->prev, type, member) - -#define __container_of(ptr, sample, member) \ - (void *)((char *)(ptr) \ - - offsetof(__typeof(*sample), member)) -/** - * Loop through the list given by head and set pos to struct in the list. - * - * Example: - * struct foo *iterator; - * list_foreach(iterator, &bar->list_of_foos, entry) { - * [modify iterator] - * } - * - * This macro is not safe for node deletion. Use list_foreach_safe - * instead. - * - * @param pos Iterator variable of the type of the list elements. - * @param head List head - * @param member Member name of the struct list in the list elements. - * - */ -#define list_foreach(pos, head, member) \ - for (pos = __container_of((head)->next, pos, member); \ - &pos->member != (head); \ - pos = __container_of(pos->member.next, pos, member)) - -/** - * Loop through the list, keeping a backup pointer to the element. This - * macro allows for the deletion of a list element while looping through the - * list. - * - * See list_foreach for more details. - */ -#define list_foreach_safe(pos, tmp, head, member) \ - for (pos = __container_of((head)->next, pos, member), \ - tmp = __container_of(pos->member.next, pos, member); \ - &pos->member != (head); \ - pos = tmp, tmp = __container_of(pos->member.next, tmp, member)) - -/* NULL-Terminated List Interface - * - * The interface below does _not_ use the struct list as described above. - * It is mainly for legacy structures that cannot easily be switched to - * struct list. - * - * This interface is for structs like - * struct foo { - * [...] - * struct foo *next; - * [...] - * }; - * - * The position and field name of "next" are arbitrary. - */ - -/** - * Init the element as null-terminated list. - * - * Example: - * struct foo *list = malloc(); - * nt_list_init(list, next); - * - * @param list The list element that will be the start of the list - * @param member Member name of the field pointing to next struct - */ -#define nt_list_init(_list, _member) \ - (_list)->_member = NULL - -/** - * Returns the next element in the list or NULL on termination. - * - * Example: - * struct foo *element = list; - * while ((element = nt_list_next(element, next)) { } - * - * This macro is not safe for node deletion. Use list_foreach_safe - * instead. - * - * @param list The list or current element. - * @param member Member name of the field pointing to next struct. - */ -#define nt_list_next(_list, _member) \ - (_list)->_member - -/** - * Iterate through each element in the list. - * - * Example: - * struct foo *iterator; - * nt_list_foreach(iterator, list, next) { - * [modify iterator] - * } - * - * @param entry Assigned to the current list element - * @param list The list to iterate through. - * @param member Member name of the field pointing to next struct. - */ -#define nt_list_foreach(_entry, _list, _member) \ - for (_entry = _list; _entry; _entry = (_entry)->_member) - -/** - * Iterate through each element in the list, keeping a backup pointer to the - * element. This macro allows for the deletion of a list element while - * looping through the list. - * - * See nt_list_foreach for more details. - * - * @param entry Assigned to the current list element - * @param tmp The pointer to the next element - * @param list The list to iterate through. - * @param member Member name of the field pointing to next struct. - */ -#define nt_list_foreach_safe(_entry, _tmp, _list, _member) \ - for (_entry = _list, _tmp = (_entry) ? (_entry)->_member : NULL;\ - _entry; \ - _entry = _tmp, _tmp = (_tmp) ? (_tmp)->_member: NULL) - -/** - * Append the element to the end of the list. This macro may be used to - * merge two lists. - * - * Example: - * struct foo *elem = malloc(...); - * nt_list_init(elem, next) - * nt_list_append(elem, list, struct foo, next); - * - * Resulting list order: - * list_item_0 -> list_item_1 -> ... -> elem_item_0 -> elem_item_1 ... - * - * @param entry An entry (or list) to append to the list - * @param list The list to append to. This list must be a valid list, not - * NULL. - * @param type The list type - * @param member Member name of the field pointing to next struct - */ -#define nt_list_append(_entry, _list, _type, _member) \ - do { \ - _type *__iterator = _list; \ - while (__iterator->_member) { __iterator = __iterator->_member;}\ - __iterator->_member = _entry; \ - } while (0) - -/** - * Insert the element at the next position in the list. This macro may be - * used to insert a list into a list. - * - * struct foo *elem = malloc(...); - * nt_list_init(elem, next) - * nt_list_insert(elem, list, struct foo, next); - * - * Resulting list order: - * list_item_0 -> elem_item_0 -> elem_item_1 ... -> list_item_1 -> ... - * - * @param entry An entry (or list) to append to the list - * @param list The list to insert to. This list must be a valid list, not - * NULL. - * @param type The list type - * @param member Member name of the field pointing to next struct - */ -#define nt_list_insert(_entry, _list, _type, _member) \ - do { \ - nt_list_append((_list)->_member, _entry, _type, _member); \ - (_list)->_member = _entry; \ - } while (0) - -/** - * Delete the entry from the list by iterating through the list and - * removing any reference from the list to the entry. - * - * Example: - * struct foo *elem = <assign to right element> - * nt_list_del(elem, list, struct foo, next); - * - * @param entry The entry to delete from the list. entry is always - * re-initialized as a null-terminated list. - * @param list The list containing the entry, set to the new list without - * the removed entry. - * @param type The list type - * @param member Member name of the field pointing to the next entry - */ -#define nt_list_del(_entry, _list, _type, _member) \ - do { \ - _type *__e = _entry; \ - if (__e == NULL || _list == NULL) break; \ - if ((_list) == __e) { \ - _list = __e->_member; \ - } else { \ - _type *__prev = _list; \ - while (__prev->_member && __prev->_member != __e) \ - __prev = nt_list_next(__prev, _member); \ - if (__prev->_member) \ - __prev->_member = __e->_member; \ - } \ - nt_list_init(__e, _member); \ - } while(0) - -#endif diff --git a/src/state.c b/src/state.c index 8659d13..ac4576f 100644 --- a/src/state.c +++ b/src/state.c @@ -65,10 +65,10 @@ struct xkb_filter { union xkb_action action; const struct xkb_key *key; uint32_t priv; - int (*func)(struct xkb_state *state, - struct xkb_filter *filter, - const struct xkb_key *key, - enum xkb_key_direction direction); + bool (*func)(struct xkb_state *state, + struct xkb_filter *filter, + const struct xkb_key *key, + enum xkb_key_direction direction); int refcnt; }; @@ -114,7 +114,7 @@ struct xkb_state { struct xkb_keymap *keymap; }; -static const struct xkb_kt_map_entry * +static const struct xkb_key_type_entry * get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key, xkb_layout_index_t group) { @@ -122,9 +122,18 @@ get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key, xkb_mod_mask_t active_mods = state->components.mods & type->mods.mask; unsigned int i; - for (i = 0; i < type->num_entries; i++) - if (type->map[i].mods.mask == active_mods) - return &type->map[i]; + for (i = 0; i < type->num_entries; i++) { + /* + * If the virtual modifiers are not bound to anything, we're + * supposed to skip the entry (xserver does this with cached + * entry->active field). + */ + if (!type->entries[i].mods.mask) + continue; + + if (type->entries[i].mods.mask == active_mods) + return &type->entries[i]; + } return NULL; } @@ -138,7 +147,7 @@ xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t kc, xkb_layout_index_t layout) { const struct xkb_key *key = XkbKey(state->keymap, kc); - const struct xkb_kt_map_entry *entry; + const struct xkb_key_type_entry *entry; if (!key || layout >= key->num_groups) return XKB_LEVEL_INVALID; @@ -247,7 +256,7 @@ xkb_filter_new(struct xkb_state *state) /***====================================================================***/ -static int +static bool xkb_filter_group_set_func(struct xkb_state *state, struct xkb_filter *filter, const struct xkb_key *key, @@ -255,15 +264,15 @@ xkb_filter_group_set_func(struct xkb_state *state, { if (key != filter->key) { filter->action.group.flags &= ~ACTION_LOCK_CLEAR; - return 1; + return true; } if (direction == XKB_KEY_DOWN) { filter->refcnt++; - return 0; + return false; } else if (--filter->refcnt > 0) { - return 0; + return false; } state->components.base_group = filter->priv; @@ -272,7 +281,7 @@ xkb_filter_group_set_func(struct xkb_state *state, state->components.locked_group = 0; filter->func = NULL; - return 1; + return true; } static void @@ -285,24 +294,24 @@ xkb_filter_group_set_new(struct xkb_state *state, struct xkb_filter *filter) state->components.base_group += filter->action.group.group; } -static int +static bool xkb_filter_group_lock_func(struct xkb_state *state, struct xkb_filter *filter, const struct xkb_key *key, enum xkb_key_direction direction) { if (key != filter->key) - return 1; + return true; if (direction == XKB_KEY_DOWN) { filter->refcnt++; - return 0; + return false; } if (--filter->refcnt > 0) - return 0; + return false; filter->func = NULL; - return 1; + return true; } static void @@ -314,7 +323,7 @@ xkb_filter_group_lock_new(struct xkb_state *state, struct xkb_filter *filter) state->components.locked_group += filter->action.group.group; } -static int +static bool xkb_filter_mod_set_func(struct xkb_state *state, struct xkb_filter *filter, const struct xkb_key *key, @@ -322,15 +331,15 @@ xkb_filter_mod_set_func(struct xkb_state *state, { if (key != filter->key) { filter->action.mods.flags &= ~ACTION_LOCK_CLEAR; - return 1; + return true; } if (direction == XKB_KEY_DOWN) { filter->refcnt++; - return 0; + return false; } else if (--filter->refcnt > 0) { - return 0; + return false; } state->clear_mods = filter->action.mods.mods.mask; @@ -338,7 +347,7 @@ xkb_filter_mod_set_func(struct xkb_state *state, state->components.locked_mods &= ~filter->action.mods.mods.mask; filter->func = NULL; - return 1; + return true; } static void @@ -347,28 +356,28 @@ xkb_filter_mod_set_new(struct xkb_state *state, struct xkb_filter *filter) state->set_mods = filter->action.mods.mods.mask; } -static int +static bool xkb_filter_mod_lock_func(struct xkb_state *state, struct xkb_filter *filter, const struct xkb_key *key, enum xkb_key_direction direction) { if (key != filter->key) - return 1; + return true; if (direction == XKB_KEY_DOWN) { filter->refcnt++; - return 0; + return false; } if (--filter->refcnt > 0) - return 0; + return false; state->clear_mods |= filter->action.mods.mods.mask; if (!(filter->action.mods.flags & ACTION_LOCK_NO_UNLOCK)) state->components.locked_mods &= ~filter->priv; filter->func = NULL; - return 1; + return true; } static void @@ -405,7 +414,7 @@ xkb_action_breaks_latch(const union xkb_action *action) } } -static int +static bool xkb_filter_mod_latch_func(struct xkb_state *state, struct xkb_filter *filter, const struct xkb_key *key, @@ -436,14 +445,14 @@ xkb_filter_mod_latch_func(struct xkb_state *state, filter->key = key; state->components.latched_mods &= ~filter->action.mods.mods.mask; /* XXX beep beep! */ - return 0; + return false; } else if (xkb_action_breaks_latch(action)) { /* XXX: This may be totally broken, we might need to break the * latch in the next run after this press? */ state->components.latched_mods &= ~filter->action.mods.mods.mask; filter->func = NULL; - return 1; + return true; } } else if (direction == XKB_KEY_UP && key == filter->key) { @@ -483,7 +492,7 @@ xkb_filter_mod_latch_func(struct xkb_state *state, filter->priv = latch; - return 1; + return true; } static void @@ -495,8 +504,8 @@ xkb_filter_mod_latch_new(struct xkb_state *state, struct xkb_filter *filter) static const struct { void (*new)(struct xkb_state *state, struct xkb_filter *filter); - int (*func)(struct xkb_state *state, struct xkb_filter *filter, - const struct xkb_key *key, enum xkb_key_direction direction); + bool (*func)(struct xkb_state *state, struct xkb_filter *filter, + const struct xkb_key *key, enum xkb_key_direction direction); } filter_action_funcs[_ACTION_TYPE_NUM_ENTRIES] = { [ACTION_TYPE_MOD_SET] = { xkb_filter_mod_set_new, xkb_filter_mod_set_func }, @@ -522,14 +531,14 @@ xkb_filter_apply_all(struct xkb_state *state, { struct xkb_filter *filter; const union xkb_action *action; - int send = 1; + bool send = true; /* First run through all the currently active filters and see if any of * them have claimed this event. */ darray_foreach(filter, state->filters) { if (!filter->func) continue; - send &= filter->func(state, filter, key, direction); + send = filter->func(state, filter, key, direction) && send; } if (!send || direction == XKB_KEY_UP) @@ -605,39 +614,39 @@ xkb_state_get_keymap(struct xkb_state *state) static void xkb_state_led_update_all(struct xkb_state *state) { - xkb_led_index_t led; - const struct xkb_indicator_map *map; + xkb_led_index_t idx; + const struct xkb_led *led; state->components.leds = 0; - darray_enumerate(led, map, state->keymap->indicators) { + darray_enumerate(idx, led, state->keymap->leds) { xkb_mod_mask_t mod_mask = 0; xkb_layout_mask_t group_mask = 0; - if (map->which_mods & XKB_STATE_MODS_EFFECTIVE) + if (led->which_mods & XKB_STATE_MODS_EFFECTIVE) mod_mask |= state->components.mods; - if (map->which_mods & XKB_STATE_MODS_DEPRESSED) + if (led->which_mods & XKB_STATE_MODS_DEPRESSED) mod_mask |= state->components.base_mods; - if (map->which_mods & XKB_STATE_MODS_LATCHED) + if (led->which_mods & XKB_STATE_MODS_LATCHED) mod_mask |= state->components.latched_mods; - if (map->which_mods & XKB_STATE_MODS_LOCKED) + if (led->which_mods & XKB_STATE_MODS_LOCKED) mod_mask |= state->components.locked_mods; - if (map->mods.mask & mod_mask) - state->components.leds |= (1 << led); + if (led->mods.mask & mod_mask) + state->components.leds |= (1 << idx); - if (map->which_groups & XKB_STATE_LAYOUT_EFFECTIVE) + if (led->which_groups & XKB_STATE_LAYOUT_EFFECTIVE) group_mask |= (1 << state->components.group); - if (map->which_groups & XKB_STATE_LAYOUT_DEPRESSED) + if (led->which_groups & XKB_STATE_LAYOUT_DEPRESSED) group_mask |= (1 << state->components.base_group); - if (map->which_groups & XKB_STATE_LAYOUT_LATCHED) + if (led->which_groups & XKB_STATE_LAYOUT_LATCHED) group_mask |= (1 << state->components.latched_group); - if (map->which_groups & XKB_STATE_LAYOUT_LOCKED) + if (led->which_groups & XKB_STATE_LAYOUT_LOCKED) group_mask |= (1 << state->components.locked_group); - if (map->groups & group_mask) - state->components.leds |= (1 << led); + if (led->groups & group_mask) + state->components.leds |= (1 << idx); - if (map->ctrls & state->keymap->enabled_ctrls) - state->components.leds |= (1 << led); + if (led->ctrls & state->keymap->enabled_ctrls) + state->components.leds |= (1 << idx); } } @@ -649,20 +658,22 @@ static void xkb_state_update_derived(struct xkb_state *state) { state->components.mods = (state->components.base_mods | - state->components.latched_mods | - state->components.locked_mods); + state->components.latched_mods | + state->components.locked_mods); /* TODO: Use groups_wrap control instead of always RANGE_WRAP. */ - state->components.locked_group = wrap_group_into_range(state->components.locked_group, - state->keymap->num_groups, - RANGE_WRAP, 0); + state->components.locked_group = + wrap_group_into_range(state->components.locked_group, + state->keymap->num_groups, + RANGE_WRAP, 0); - state->components.group = wrap_group_into_range(state->components.base_group + - state->components.latched_group + - state->components.locked_group, - state->keymap->num_groups, - RANGE_WRAP, 0); + state->components.group = + wrap_group_into_range(state->components.base_group + + state->components.latched_group + + state->components.locked_group, + state->keymap->num_groups, + RANGE_WRAP, 0); xkb_state_led_update_all(state); } @@ -1050,8 +1061,8 @@ xkb_state_layout_name_is_active(struct xkb_state *state, const char *name, XKB_EXPORT int xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx) { - if (idx >= darray_size(state->keymap->indicators) || - darray_item(state->keymap->indicators, idx).name == XKB_ATOM_NONE) + if (idx >= darray_size(state->keymap->leds) || + darray_item(state->keymap->leds, idx).name == XKB_ATOM_NONE) return -1; return !!(state->components.leds & (1 << idx)); @@ -1074,7 +1085,7 @@ xkb_state_led_name_is_active(struct xkb_state *state, const char *name) static xkb_mod_mask_t key_get_consumed(struct xkb_state *state, const struct xkb_key *key) { - const struct xkb_kt_map_entry *entry; + const struct xkb_key_type_entry *entry; xkb_layout_index_t group; group = xkb_state_key_get_layout(state, key->keycode); @@ -1096,7 +1107,7 @@ key_get_consumed(struct xkb_state *state, const struct xkb_key *key) * modifiers, e.g. when implementing hot keys or accelerators. * * See also, for example: - * - XkbTranslateKeyCode(3), mod_rtrn retrun value, from libX11. + * - XkbTranslateKeyCode(3), mod_rtrn return value, from libX11. * - gdk_keymap_translate_keyboard_state, consumed_modifiers return value, * from gtk+. */ @@ -31,12 +31,10 @@ bool LookupString(const LookupEntry tab[], const char *string, unsigned int *value_rtrn) { - const LookupEntry *entry; - if (!string) return false; - for (entry = tab; entry->name; entry++) { + for (const LookupEntry *entry = tab; entry->name; entry++) { if (istreq(entry->name, string)) { *value_rtrn = entry->value; return true; @@ -49,9 +47,7 @@ LookupString(const LookupEntry tab[], const char *string, const char * LookupValue(const LookupEntry tab[], unsigned int value) { - const LookupEntry *entry; - - for (entry = tab; entry->name; entry++) + for (const LookupEntry *entry = tab; entry->name; entry++) if (entry->value == value) return entry->name; @@ -80,78 +76,78 @@ const LookupEntry ctrlMaskNames[] = { }; const LookupEntry modComponentMaskNames[] = { - {"base", XKB_STATE_MODS_DEPRESSED}, - {"latched", XKB_STATE_MODS_LATCHED}, - {"locked", XKB_STATE_MODS_LOCKED}, - {"effective", XKB_STATE_MODS_EFFECTIVE}, - {"compat", XKB_STATE_MODS_EFFECTIVE}, - {"any", XKB_STATE_MODS_EFFECTIVE}, - {"none", 0}, - {NULL, 0} + { "base", XKB_STATE_MODS_DEPRESSED }, + { "latched", XKB_STATE_MODS_LATCHED }, + { "locked", XKB_STATE_MODS_LOCKED }, + { "effective", XKB_STATE_MODS_EFFECTIVE }, + { "compat", XKB_STATE_MODS_EFFECTIVE }, + { "any", XKB_STATE_MODS_EFFECTIVE }, + { "none", 0 }, + { NULL, 0 } }; const LookupEntry groupComponentMaskNames[] = { - {"base", XKB_STATE_LAYOUT_DEPRESSED}, - {"latched", XKB_STATE_LAYOUT_LATCHED}, - {"locked", XKB_STATE_LAYOUT_LOCKED}, - {"effective", XKB_STATE_LAYOUT_EFFECTIVE}, - {"any", XKB_STATE_LAYOUT_EFFECTIVE}, - {"none", 0}, - {NULL, 0} + { "base", XKB_STATE_LAYOUT_DEPRESSED }, + { "latched", XKB_STATE_LAYOUT_LATCHED }, + { "locked", XKB_STATE_LAYOUT_LOCKED }, + { "effective", XKB_STATE_LAYOUT_EFFECTIVE }, + { "any", XKB_STATE_LAYOUT_EFFECTIVE }, + { "none", 0 }, + { NULL, 0 } }; const LookupEntry groupMaskNames[] = { - {"group1", 0x01}, - {"group2", 0x02}, - {"group3", 0x04}, - {"group4", 0x08}, - {"group5", 0x10}, - {"group6", 0x20}, - {"group7", 0x40}, - {"group8", 0x80}, - {"none", 0x00}, - {"all", 0xff}, - {NULL, 0} + { "Group1", 0x01 }, + { "Group2", 0x02 }, + { "Group3", 0x04 }, + { "Group4", 0x08 }, + { "Group5", 0x10 }, + { "Group6", 0x20 }, + { "Group7", 0x40 }, + { "Group8", 0x80 }, + { "none", 0x00 }, + { "all", 0xff }, + { NULL, 0 } }; const LookupEntry groupNames[] = { - {"group1", 1}, - {"group2", 2}, - {"group3", 3}, - {"group4", 4}, - {"group5", 5}, - {"group6", 6}, - {"group7", 7}, - {"group8", 8}, - {NULL, 0} + { "Group1", 1 }, + { "Group2", 2 }, + { "Group3", 3 }, + { "Group4", 4 }, + { "Group5", 5 }, + { "Group6", 6 }, + { "Group7", 7 }, + { "Group8", 8 }, + { NULL, 0 } }; const LookupEntry levelNames[] = { - { "level1", 1 }, - { "level2", 2 }, - { "level3", 3 }, - { "level4", 4 }, - { "level5", 5 }, - { "level6", 6 }, - { "level7", 7 }, - { "level8", 8 }, + { "Level1", 1 }, + { "Level2", 2 }, + { "Level3", 3 }, + { "Level4", 4 }, + { "Level5", 5 }, + { "Level6", 6 }, + { "Level7", 7 }, + { "Level8", 8 }, { NULL, 0 } }; const LookupEntry buttonNames[] = { - { "button1", 1 }, - { "button2", 2 }, - { "button3", 3 }, - { "button4", 4 }, - { "button5", 5 }, + { "Button1", 1 }, + { "Button2", 2 }, + { "Button3", 3 }, + { "Button4", 4 }, + { "Button5", 5 }, { "default", 0 }, { NULL, 0 } }; const LookupEntry useModMapValueNames[] = { - { "levelone", 1 }, - { "level1", 1 }, - { "anylevel", 0 }, + { "LevelOne", 1 }, + { "Level1", 1 }, + { "AnyLevel", 0 }, { "any", 0 }, { NULL, 0 } }; @@ -211,48 +207,6 @@ const LookupEntry symInterpretMatchMaskNames[] = { }; const char * -ModMaskText(const struct xkb_keymap *keymap, xkb_mod_mask_t mask) -{ - xkb_mod_index_t i; - size_t len; - ssize_t rem; - char *str; - char buf[1024]; - const struct xkb_mod *mod; - - if (mask == 0) - return "none"; - - if (mask == MOD_REAL_MASK_ALL) - return "all"; - - str = buf; - buf[0] = '\0'; - rem = sizeof(buf); - darray_enumerate(i, mod, keymap->mods) { - if (!(mask & (1 << i))) - continue; - - len = snprintf(str, rem, "%s%s", - (str != buf) ? "+" : "", - xkb_atom_text(keymap->ctx, mod->name)); - rem -= len; - str += len; - - if (rem <= 1) - break; - } - str = buf; - - len = strlen(str); - if (len >= sizeof(buf)) - len = sizeof(buf) - 1; - - return strcpy(xkb_context_get_buffer(keymap->ctx, len + 1), str); - -} - -const char * ModIndexText(const struct xkb_keymap *keymap, xkb_mod_index_t ndx) { if (ndx == XKB_MOD_INVALID) @@ -309,49 +263,72 @@ SIMatchText(enum xkb_match_operation type) return LookupValue(symInterpretMatchMaskNames, type); } -#define GET_TEXT_BUF_SIZE 512 +const char * +ModMaskText(const struct xkb_keymap *keymap, xkb_mod_mask_t mask) +{ + char buf[1024]; + size_t pos = 0; + xkb_mod_index_t i; + const struct xkb_mod *mod; + + if (mask == 0) + return "none"; + + if (mask == MOD_REAL_MASK_ALL) + return "all"; -#define append_get_text(...) do { \ - int _size = snprintf(ret, GET_TEXT_BUF_SIZE, __VA_ARGS__); \ - if (_size >= GET_TEXT_BUF_SIZE) \ - return NULL; \ -} while (0) + darray_enumerate(i, mod, keymap->mods) { + int ret; + + if (!(mask & (1 << i))) + continue; + + ret = snprintf(buf + pos, sizeof(buf) - pos, "%s%s", + pos == 0 ? "" : "+", + xkb_atom_text(keymap->ctx, mod->name)); + if (ret <= 0 || pos + ret >= sizeof(buf)) + break; + else + pos += ret; + } + + return strcpy(xkb_context_get_buffer(keymap->ctx, pos + 1), buf); +} const char * -IndicatorStateText(struct xkb_context *ctx, enum xkb_state_component mask) +LedStateMaskText(struct xkb_context *ctx, enum xkb_state_component mask) { - unsigned int i; - char *ret; + char buf[1024]; + size_t pos = 0; if (mask == 0) return "0"; - ret = xkb_context_get_buffer(ctx, GET_TEXT_BUF_SIZE); - ret[0] = '\0'; - - for (i = 0; mask; i++) { - const char *name; + for (unsigned i = 0; mask; i++) { + int ret; if (!(mask & (1 << i))) continue; mask &= ~(1 << i); - name = LookupValue(modComponentMaskNames, 1 << i); - if (ret[0] != '\0') - append_get_text("%s+%s", ret, name); + ret = snprintf(buf + pos, sizeof(buf) - pos, "%s%s", + pos == 0 ? "" : "+", + LookupValue(modComponentMaskNames, 1 << i)); + if (ret <= 0 || pos + ret >= sizeof(buf)) + break; else - append_get_text("%s", name); + pos += ret; } - return ret; + return strcpy(xkb_context_get_buffer(ctx, pos + 1), buf); } const char * ControlMaskText(struct xkb_context *ctx, enum xkb_action_controls mask) { - unsigned int i; - char *ret; + char buf[1024]; + size_t pos = 0; if (mask == 0) return "none"; @@ -359,23 +336,22 @@ ControlMaskText(struct xkb_context *ctx, enum xkb_action_controls mask) if (mask == CONTROL_ALL) return "all"; - ret = xkb_context_get_buffer(ctx, GET_TEXT_BUF_SIZE); - ret[0] = '\0'; - - for (i = 0; mask; i++) { - const char *name; + for (unsigned i = 0; mask; i++) { + int ret; if (!(mask & (1 << i))) continue; mask &= ~(1 << i); - name = LookupValue(ctrlMaskNames, 1 << i); - if (ret[0] != '\0') - append_get_text("%s+%s", ret, name); + ret = snprintf(buf + pos, sizeof(buf) - pos, "%s%s", + pos == 0 ? "" : "+", + LookupValue(ctrlMaskNames, 1 << i)); + if (ret <= 0 || pos + ret >= sizeof(buf)) + break; else - append_get_text("%s", name); + pos += ret; } - return ret; + return strcpy(xkb_context_get_buffer(ctx, pos + 1), buf); } @@ -70,7 +70,7 @@ const char * SIMatchText(enum xkb_match_operation type); const char * -IndicatorStateText(struct xkb_context *ctx, enum xkb_state_component mask); +LedStateMaskText(struct xkb_context *ctx, enum xkb_state_component mask); const char * ControlMaskText(struct xkb_context *ctx, enum xkb_action_controls mask); diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index d0e18dd..88323f9 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -55,7 +55,6 @@ #include "text.h" #include "expr.h" #include "action.h" -#include "keycodes.h" static const ExprDef constTrue = { .common = { .type = STMT_EXPR, .next = NULL }, @@ -237,7 +236,7 @@ HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action, static bool CheckLatchLockFlags(struct xkb_keymap *keymap, enum xkb_action_type action, - enum action_field field, const ExprDef * value, + enum action_field field, const ExprDef *value, enum xkb_action_flags *flags_inout) { enum xkb_action_flags tmp; @@ -752,7 +751,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, * It's possible for someone to write something like this: * actions = [ Private(type=3,data[0]=1,data[1]=3,data[2]=3) ] * where the type refers to some existing action type, e.g. LockMods. - * This assumes that this action's struct is layed out in memory + * This assumes that this action's struct is laid out in memory * exactly as described in the XKB specification and libraries. * We, however, have changed these structs in various ways, so this * assumption is no longer true. Since this is a lousy "feature", we @@ -860,7 +859,7 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, { ExprDef *arg; const char *str; - unsigned hndlrType; + unsigned handler_type; if (def->op != EXPR_ACTION_DECL) { log_err(keymap->ctx, "Expected an action definition, found %s\n", @@ -869,7 +868,7 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, } str = xkb_atom_text(keymap->ctx, def->value.action.name); - if (!stringToAction(str, &hndlrType)) { + if (!stringToAction(str, &handler_type)) { log_err(keymap->ctx, "Unknown action %s\n", str); return false; } @@ -879,7 +878,7 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, * statements such as: * latchMods.clearLocks = True; */ - *action = info->actions[hndlrType]; + *action = info->actions[handler_type]; /* * Now change the action properties as specified for this @@ -923,8 +922,8 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, return false; } - if (!handleAction[hndlrType](keymap, action, fieldNdx, arrayRtrn, - value)) + if (!handleAction[handler_type](keymap, action, fieldNdx, arrayRtrn, + value)) return false; } diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index ad249ad..c9b7cb0 100644 --- a/src/xkbcomp/ast-build.c +++ b/src/xkbcomp/ast-build.c @@ -56,17 +56,6 @@ #include "parser-priv.h" #include "include.h" -ATTR_MALLOC static void * -malloc_or_die(size_t size) -{ - void *p = malloc(size); - if (!p) { - fprintf(stderr, "Out of memory\n"); - exit(1); - } - return p; -} - ParseCommon * AppendStmt(ParseCommon *to, ParseCommon *append) { @@ -84,14 +73,15 @@ AppendStmt(ParseCommon *to, ParseCommon *append) ExprDef * ExprCreate(enum expr_op_type op, enum expr_value_type type) { - ExprDef *expr; - - expr = malloc_or_die(sizeof(*expr)); + ExprDef *expr = malloc(sizeof(*expr)); + if (!expr) + return NULL; expr->common.type = STMT_EXPR; expr->common.next = NULL; expr->op = op; expr->value_type = type; + return expr; } @@ -99,23 +89,25 @@ ExprDef * ExprCreateUnary(enum expr_op_type op, enum expr_value_type type, ExprDef *child) { - ExprDef *expr; - expr = malloc_or_die(sizeof(*expr)); + ExprDef *expr = malloc(sizeof(*expr)); + if (!expr) + return NULL; expr->common.type = STMT_EXPR; expr->common.next = NULL; expr->op = op; expr->value_type = type; expr->value.child = child; + return expr; } ExprDef * ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right) { - ExprDef *expr; - - expr = malloc_or_die(sizeof(*expr)); + ExprDef *expr = malloc(sizeof(*expr)); + if (!expr) + return NULL; expr->common.type = STMT_EXPR; expr->common.next = NULL; @@ -129,61 +121,67 @@ ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right) expr->value_type = EXPR_TYPE_UNKNOWN; expr->value.binary.left = left; expr->value.binary.right = right; + return expr; } KeycodeDef * KeycodeCreate(xkb_atom_t name, int64_t value) { - KeycodeDef *def; - - def = malloc_or_die(sizeof(*def)); + KeycodeDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_KEYCODE; def->common.next = NULL; def->name = name; def->value = value; + return def; } KeyAliasDef * KeyAliasCreate(xkb_atom_t alias, xkb_atom_t real) { - KeyAliasDef *def; - - def = malloc_or_die(sizeof(*def)); + KeyAliasDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_ALIAS; def->common.next = NULL; def->alias = alias; def->real = real; + return def; } VModDef * -VModCreate(xkb_atom_t name, ExprDef * value) +VModCreate(xkb_atom_t name, ExprDef *value) { - VModDef *def; - - def = malloc_or_die(sizeof(*def)); + VModDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_VMOD; def->common.next = NULL; def->name = name; def->value = value; + return def; } VarDef * -VarCreate(ExprDef * name, ExprDef * value) +VarCreate(ExprDef *name, ExprDef *value) { - VarDef *def; - def = malloc_or_die(sizeof(*def)); + VarDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_VAR; def->common.next = NULL; def->name = name; def->value = value; + return def; } @@ -191,131 +189,142 @@ VarDef * BoolVarCreate(xkb_atom_t nameToken, unsigned set) { ExprDef *name, *value; + VarDef *def; name = ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN); name->value.str = nameToken; value = ExprCreate(EXPR_VALUE, EXPR_TYPE_BOOLEAN); value->value.uval = set; - return VarCreate(name, value); + def = VarCreate(name, value); + + return def; } InterpDef * -InterpCreate(char *sym, ExprDef * match) +InterpCreate(char *sym, ExprDef *match) { - InterpDef *def; - - def = malloc_or_die(sizeof(*def)); + InterpDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_INTERP; def->common.next = NULL; def->sym = sym; def->match = match; + return def; } KeyTypeDef * -KeyTypeCreate(xkb_atom_t name, VarDef * body) +KeyTypeCreate(xkb_atom_t name, VarDef *body) { - KeyTypeDef *def; - - def = malloc_or_die(sizeof(*def)); + KeyTypeDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_TYPE; def->common.next = NULL; def->merge = MERGE_DEFAULT; def->name = name; def->body = body; + return def; } SymbolsDef * SymbolsCreate(xkb_atom_t keyName, ExprDef *symbols) { - SymbolsDef *def; - - def = malloc_or_die(sizeof(*def)); + SymbolsDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_SYMBOLS; def->common.next = NULL; def->merge = MERGE_DEFAULT; def->keyName = keyName; def->symbols = symbols; + return def; } GroupCompatDef * -GroupCompatCreate(int group, ExprDef * val) +GroupCompatCreate(int group, ExprDef *val) { - GroupCompatDef *def; - - def = malloc_or_die(sizeof(*def)); + GroupCompatDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_GROUP_COMPAT; def->common.next = NULL; def->merge = MERGE_DEFAULT; def->group = group; def->def = val; + return def; } ModMapDef * -ModMapCreate(uint32_t modifier, ExprDef * keys) +ModMapCreate(uint32_t modifier, ExprDef *keys) { - ModMapDef *def; - - def = malloc_or_die(sizeof(*def)); + ModMapDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; def->common.type = STMT_MODMAP; def->common.next = NULL; def->merge = MERGE_DEFAULT; def->modifier = modifier; def->keys = keys; + return def; } -IndicatorMapDef * -IndicatorMapCreate(xkb_atom_t name, VarDef * body) +LedMapDef * +LedMapCreate(xkb_atom_t name, VarDef *body) { - IndicatorMapDef *def; - - def = malloc_or_die(sizeof(*def)); + LedMapDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; - def->common.type = STMT_INDICATOR_MAP; + def->common.type = STMT_LED_MAP; def->common.next = NULL; def->merge = MERGE_DEFAULT; def->name = name; def->body = body; + return def; } -IndicatorNameDef * -IndicatorNameCreate(int ndx, ExprDef * name, bool virtual) +LedNameDef * +LedNameCreate(int ndx, ExprDef *name, bool virtual) { - IndicatorNameDef *def; - - def = malloc_or_die(sizeof(*def)); + LedNameDef *def = malloc(sizeof(*def)); + if (!def) + return NULL; - def->common.type = STMT_INDICATOR_NAME; + def->common.type = STMT_LED_NAME; def->common.next = NULL; def->merge = MERGE_DEFAULT; def->ndx = ndx; def->name = name; def->virtual = virtual; + return def; } ExprDef * -ActionCreate(xkb_atom_t name, ExprDef * args) +ActionCreate(xkb_atom_t name, ExprDef *args) { - ExprDef *act; - - act = malloc_or_die(sizeof(*act)); + ExprDef *act = malloc(sizeof(*act)); + if (!act) + return NULL; act->common.type = STMT_EXPR; act->common.next = NULL; act->op = EXPR_ACTION_DECL; act->value.action.name = name; act->value.action.args = args; + return act; } @@ -351,7 +360,7 @@ CreateMultiKeysymList(ExprDef *list) } ExprDef * -AppendKeysymList(ExprDef * list, char *sym) +AppendKeysymList(ExprDef *list, char *sym) { size_t nSyms = darray_size(list->value.list.syms); @@ -363,7 +372,7 @@ AppendKeysymList(ExprDef * list, char *sym) } ExprDef * -AppendMultiKeysymList(ExprDef * list, ExprDef * append) +AppendMultiKeysymList(ExprDef *list, ExprDef *append) { size_t nSyms = darray_size(list->value.list.syms); size_t numEntries = darray_size(append->value.list.syms); @@ -455,25 +464,25 @@ err: return NULL; } -/* - * All latin-1 alphanumerics, plus parens, slash, minus, underscore and - * wildcards. - */ -static const unsigned char componentSpecLegal[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83, - 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff -}; - static void -EnsureSafeMapName(char *name) -{ +EscapeMapName(char *name) +{ + /* + * All latin-1 alphanumerics, plus parens, slash, minus, underscore and + * wildcards. + */ + static const unsigned char legal[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83, + 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff + }; + if (!name) return; - while (*name != '\0') { - if ((componentSpecLegal[(*name) / 8] & (1 << ((*name) % 8))) == 0) + while (*name) { + if (!(legal[*name / 8] & (1 << (*name % 8)))) *name = '_'; name++; } @@ -489,44 +498,52 @@ XkbFileCreate(struct xkb_context *ctx, enum xkb_file_type type, char *name, if (!file) return NULL; - EnsureSafeMapName(name); + EscapeMapName(name); file->file_type = type; file->topName = strdup_safe(name); file->name = name; file->defs = defs; - file->id = xkb_context_take_file_id(ctx); file->flags = flags; + return file; } XkbFile * XkbFileFromComponents(struct xkb_context *ctx, - struct xkb_component_names *kkctgs) -{ - IncludeStmt *inc; - XkbFile *keycodes, *types, *compat, *symbols; + const struct xkb_component_names *kkctgs) +{ + char *const components[] = { + kkctgs->keycodes, kkctgs->types, + kkctgs->compat, kkctgs->symbols, + }; + enum xkb_file_type type; + IncludeStmt *include = NULL; + XkbFile *file = NULL; + ParseCommon *defs = NULL; + + for (type = FIRST_KEYMAP_FILE_TYPE; type <= LAST_KEYMAP_FILE_TYPE; type++) { + include = IncludeCreate(ctx, components[type], MERGE_DEFAULT); + if (!include) + goto err; - inc = IncludeCreate(ctx, kkctgs->keycodes, MERGE_DEFAULT); - keycodes = XkbFileCreate(ctx, FILE_TYPE_KEYCODES, NULL, - (ParseCommon *) inc, 0); + file = XkbFileCreate(ctx, type, NULL, &include->common, 0); + if (!file) { + FreeInclude(include); + goto err; + } - inc = IncludeCreate(ctx, kkctgs->types, MERGE_DEFAULT); - types = XkbFileCreate(ctx, FILE_TYPE_TYPES, NULL, - (ParseCommon *) inc, 0); - AppendStmt(&keycodes->common, &types->common); + defs = AppendStmt(defs, &file->common); + } - inc = IncludeCreate(ctx, kkctgs->compat, MERGE_DEFAULT); - compat = XkbFileCreate(ctx, FILE_TYPE_COMPAT, NULL, - (ParseCommon *) inc, 0); - AppendStmt(&keycodes->common, &compat->common); + file = XkbFileCreate(ctx, FILE_TYPE_KEYMAP, NULL, defs, 0); + if (!file) + goto err; - inc = IncludeCreate(ctx, kkctgs->symbols, MERGE_DEFAULT); - symbols = XkbFileCreate(ctx, FILE_TYPE_SYMBOLS, NULL, - (ParseCommon *) inc, 0); - AppendStmt(&keycodes->common, &symbols->common); + return file; - return XkbFileCreate(ctx, FILE_TYPE_KEYMAP, NULL, - &keycodes->common, 0); +err: + FreeXkbFile((XkbFile *) defs); + return NULL; } static void @@ -639,10 +656,10 @@ FreeStmt(ParseCommon *stmt) case STMT_GROUP_COMPAT: FreeStmt(&u.groupCompat->def->common); break; - case STMT_INDICATOR_MAP: + case STMT_LED_MAP: FreeStmt(&u.ledMap->body->common); break; - case STMT_INDICATOR_NAME: + case STMT_LED_NAME: FreeStmt(&u.ledName->name->common); break; default: @@ -692,6 +709,7 @@ static const char *xkb_file_type_strings[_FILE_TYPE_NUM_ENTRIES] = { [FILE_TYPE_TYPES] = "xkb_types", [FILE_TYPE_COMPAT] = "xkb_compatibility", [FILE_TYPE_SYMBOLS] = "xkb_symbols", + [FILE_TYPE_GEOMETRY] = "xkb_geometry", [FILE_TYPE_KEYMAP] = "xkb_keymap", [FILE_TYPE_RULES] = "rules", }; @@ -717,8 +735,8 @@ static const char *stmt_type_strings[_STMT_NUM_VALUES] = { [STMT_SYMBOLS] = "key symbols definition", [STMT_MODMAP] = "modifier map declaration", [STMT_GROUP_COMPAT] = "group declaration", - [STMT_INDICATOR_MAP] = "indicator map declaration", - [STMT_INDICATOR_NAME] = "indicator name declaration", + [STMT_LED_MAP] = "indicator map declaration", + [STMT_LED_NAME] = "indicator name declaration", }; const char * diff --git a/src/xkbcomp/ast-build.h b/src/xkbcomp/ast-build.h index b600389..0ecd124 100644 --- a/src/xkbcomp/ast-build.h +++ b/src/xkbcomp/ast-build.h @@ -70,11 +70,11 @@ GroupCompatCreate(int group, ExprDef *def); ModMapDef * ModMapCreate(uint32_t modifier, ExprDef *keys); -IndicatorMapDef * -IndicatorMapCreate(xkb_atom_t name, VarDef *body); +LedMapDef * +LedMapCreate(xkb_atom_t name, VarDef *body); -IndicatorNameDef * -IndicatorNameCreate(int ndx, ExprDef *name, bool virtual); +LedNameDef * +LedNameCreate(int ndx, ExprDef *name, bool virtual); ExprDef * ActionCreate(xkb_atom_t name, ExprDef *args); diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h index 1e267ed..c430a77 100644 --- a/src/xkbcomp/ast.h +++ b/src/xkbcomp/ast.h @@ -85,8 +85,8 @@ enum stmt_type { STMT_SYMBOLS, STMT_MODMAP, STMT_GROUP_COMPAT, - STMT_INDICATOR_MAP, - STMT_INDICATOR_NAME, + STMT_LED_MAP, + STMT_LED_NAME, _STMT_NUM_VALUES }; @@ -263,14 +263,14 @@ typedef struct { int ndx; ExprDef *name; bool virtual; -} IndicatorNameDef; +} LedNameDef; typedef struct { ParseCommon common; enum merge_mode merge; xkb_atom_t name; VarDef *body; -} IndicatorMapDef; +} LedMapDef; enum xkb_map_flags { MAP_IS_DEFAULT = (1 << 0), @@ -289,7 +289,6 @@ typedef struct { char *topName; char *name; ParseCommon *defs; - int id; enum xkb_map_flags flags; } XkbFile; diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index ddd7583..5682895 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -129,7 +129,7 @@ * * When set to 'level1', the interpret will only match levels which are * the first level of the first group of the keys. This can be useful in - * conjuction with e.g. a virtualModifier statement. + * conjunction with e.g. a virtualModifier statement. * * - action statement: * action = LockMods(modifiers=NumLock); @@ -149,19 +149,19 @@ * * Set whether the key should repeat or not. Must be a boolean value. * - * Indicator map statements + * Led map statements * ------------------------ * Statements of the form: * indicator "Shift Lock" { ... } * - * This statement specifies the behavior and binding of the indicator - * with the given name ("Shift Lock" above). The name should have been - * declared previously in the xkb_keycodes section (see Indicator name - * statement), and given an index there. If it wasn't, it is created + * This statement specifies the behavior and binding of the LED (a.k.a + * indicator) with the given name ("Shift Lock" above). The name should + * have been declared previously in the xkb_keycodes section (see Led + * name statement), and given an index there. If it wasn't, it is created * with the next free index. * The body of the statement describes the conditions of the keyboard - * state which will cause the indicator to be lit. It may include the - * following statements: + * state which will cause the LED to be lit. It may include the following + * statements: * * - modifiers statment: * modifiers = ScrollLock; @@ -186,8 +186,8 @@ * modifiers = NumLock; * whichModState = Locked; * }; - * Whenever the NumLock modifier is locked, the Num Lock indicator - * will light up. + * Whenever the NumLock modifier is locked, the Num Lock LED will light + * up. * * - groups statment: * groups = All - group1; @@ -222,7 +222,7 @@ * After all of the xkb_compat sections have been compiled, the following * members of struct xkb_keymap are finalized: * darray(struct xkb_sym_interpret) sym_interprets; - * darray(struct xkb_indicator_map) indicators; + * darray(struct xkb_led) leds; * char *compat_section_name; * TODO: virtual modifiers. */ @@ -236,7 +236,6 @@ enum si_field { typedef struct { enum si_field defined; - unsigned file_id; enum merge_mode merge; struct xkb_sym_interpret interp; @@ -250,20 +249,18 @@ enum led_field { typedef struct { enum led_field defined; - unsigned file_id; enum merge_mode merge; - struct xkb_indicator_map im; -} LEDInfo; + struct xkb_led led; +} LedInfo; typedef struct { char *name; - unsigned file_id; int errorCount; - SymInterpInfo dflt; + SymInterpInfo default_interp; darray(SymInterpInfo) interps; - LEDInfo ledDflt; - darray(LEDInfo) leds; + LedInfo default_led; + darray(LedInfo) leds; ActionsInfo *actions; struct xkb_keymap *keymap; } CompatInfo; @@ -273,7 +270,7 @@ siText(SymInterpInfo *si, CompatInfo *info) { char *buf = xkb_context_get_buffer(info->keymap->ctx, 128); - if (si == &info->dflt) + if (si == &info->default_interp) return "default"; snprintf(buf, 128, "%s+%s(%s)", @@ -287,7 +284,7 @@ siText(SymInterpInfo *si, CompatInfo *info) static inline bool ReportSINotArray(CompatInfo *info, SymInterpInfo *si, const char *field) { - return ReportNotArray(info->keymap, "symbol interpretation", field, + return ReportNotArray(info->keymap->ctx, "symbol interpretation", field, siText(si, info)); } @@ -300,35 +297,31 @@ ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field, } static inline bool -ReportIndicatorBadType(CompatInfo *info, LEDInfo *led, - const char *field, const char *wanted) +ReportLedBadType(CompatInfo *info, LedInfo *ledi, const char *field, + const char *wanted) { return ReportBadType(info->keymap->ctx, "indicator map", field, - xkb_atom_text(info->keymap->ctx, led->im.name), + xkb_atom_text(info->keymap->ctx, ledi->led.name), wanted); } static inline bool -ReportIndicatorNotArray(CompatInfo *info, LEDInfo *led, - const char *field) +ReportLedNotArray(CompatInfo *info, LedInfo *ledi, const char *field) { - return ReportNotArray(info->keymap, "indicator map", field, - xkb_atom_text(info->keymap->ctx, led->im.name)); + return ReportNotArray(info->keymap->ctx, "indicator map", field, + xkb_atom_text(info->keymap->ctx, ledi->led.name)); } static void -InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, unsigned file_id, +InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, ActionsInfo *actions) { memset(info, 0, sizeof(*info)); info->keymap = keymap; - info->file_id = file_id; info->actions = actions; - info->dflt.file_id = file_id; - info->dflt.merge = MERGE_OVERRIDE; - info->dflt.interp.virtual_mod = XKB_MOD_INVALID; - info->ledDflt.file_id = file_id; - info->ledDflt.merge = MERGE_OVERRIDE; + info->default_interp.merge = MERGE_OVERRIDE; + info->default_interp.interp.virtual_mod = XKB_MOD_INVALID; + info->default_led.merge = MERGE_OVERRIDE; } static void @@ -372,16 +365,13 @@ UseNewInterpField(enum si_field field, SymInterpInfo *old, SymInterpInfo *new, } static bool -AddInterp(CompatInfo *info, SymInterpInfo *new) +AddInterp(CompatInfo *info, SymInterpInfo *new, bool same_file) { - enum si_field collide = 0; - SymInterpInfo *old; - - old = FindMatchingInterp(info, new); + SymInterpInfo *old = FindMatchingInterp(info, new); if (old) { - int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); - bool report = ((old->file_id == new->file_id && verbosity > 0) || - verbosity > 9); + const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const bool report = (same_file && verbosity > 0) || verbosity > 9; + enum si_field collide = 0; if (new->merge == MERGE_REPLACE) { if (report) @@ -429,7 +419,6 @@ AddInterp(CompatInfo *info, SymInterpInfo *new) return true; } - /***====================================================================***/ static bool @@ -469,7 +458,7 @@ ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn, /***====================================================================***/ static bool -UseNewLEDField(enum led_field field, LEDInfo *old, LEDInfo *new, +UseNewLEDField(enum led_field field, LedInfo *old, LedInfo *new, bool report, enum led_field *collide) { if (!(old->defined & field)) @@ -487,54 +476,50 @@ UseNewLEDField(enum led_field field, LEDInfo *old, LEDInfo *new, } static bool -AddIndicatorMap(CompatInfo *info, LEDInfo *new) +AddLedMap(CompatInfo *info, LedInfo *new, bool same_file) { - LEDInfo *old; + LedInfo *old; enum led_field collide; struct xkb_context *ctx = info->keymap->ctx; - int verbosity = xkb_context_get_log_verbosity(ctx); + const int verbosity = xkb_context_get_log_verbosity(ctx); + const bool report = (same_file && verbosity > 0) || verbosity > 9; darray_foreach(old, info->leds) { - bool report; - - if (old->im.name != new->im.name) + if (old->led.name != new->led.name) continue; - if (old->im.mods.mods == new->im.mods.mods && - old->im.groups == new->im.groups && - old->im.ctrls == new->im.ctrls && - old->im.which_mods == new->im.which_mods && - old->im.which_groups == new->im.which_groups) { + if (old->led.mods.mods == new->led.mods.mods && + old->led.groups == new->led.groups && + old->led.ctrls == new->led.ctrls && + old->led.which_mods == new->led.which_mods && + old->led.which_groups == new->led.which_groups) { old->defined |= new->defined; return true; } - report = ((old->file_id == new->file_id && verbosity > 0) || - verbosity > 9); - if (new->merge == MERGE_REPLACE) { if (report) log_warn(info->keymap->ctx, "Map for indicator %s redefined; " "Earlier definition ignored\n", - xkb_atom_text(ctx, old->im.name)); + xkb_atom_text(ctx, old->led.name)); *old = *new; return true; } collide = 0; if (UseNewLEDField(LED_FIELD_MODS, old, new, report, &collide)) { - old->im.which_mods = new->im.which_mods; - old->im.mods = new->im.mods; + old->led.which_mods = new->led.which_mods; + old->led.mods = new->led.mods; old->defined |= LED_FIELD_MODS; } if (UseNewLEDField(LED_FIELD_GROUPS, old, new, report, &collide)) { - old->im.which_groups = new->im.which_groups; - old->im.groups = new->im.groups; + old->led.which_groups = new->led.which_groups; + old->led.groups = new->led.groups; old->defined |= LED_FIELD_GROUPS; } if (UseNewLEDField(LED_FIELD_CTRLS, old, new, report, &collide)) { - old->im.ctrls = new->im.ctrls; + old->led.ctrls = new->led.ctrls; old->defined |= LED_FIELD_CTRLS; } @@ -542,7 +527,7 @@ AddIndicatorMap(CompatInfo *info, LEDInfo *new) log_warn(info->keymap->ctx, "Map for indicator %s redefined; " "Using %s definition for duplicate fields\n", - xkb_atom_text(ctx, old->im.name), + xkb_atom_text(ctx, old->led.name), (new->merge == MERGE_AUGMENT ? "first" : "last")); } @@ -558,7 +543,7 @@ MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, enum merge_mode merge) { SymInterpInfo *si; - LEDInfo *led; + LedInfo *ledi; if (from->errorCount > 0) { into->errorCount += from->errorCount; @@ -572,13 +557,13 @@ MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, darray_foreach(si, from->interps) { si->merge = (merge == MERGE_DEFAULT ? si->merge : merge); - if (!AddInterp(into, si)) + if (!AddInterp(into, si, false)) into->errorCount++; } - darray_foreach(led, from->leds) { - led->merge = (merge == MERGE_DEFAULT ? led->merge : merge); - if (!AddIndicatorMap(into, led)) + darray_foreach(ledi, from->leds) { + ledi->merge = (merge == MERGE_DEFAULT ? ledi->merge : merge); + if (!AddLedMap(into, ledi, false)) into->errorCount++; } } @@ -587,44 +572,40 @@ static void HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge); static bool -HandleIncludeCompatMap(CompatInfo *info, IncludeStmt *stmt) +HandleIncludeCompatMap(CompatInfo *info, IncludeStmt *include) { - enum merge_mode merge = MERGE_DEFAULT; - XkbFile *rtrn; - CompatInfo included, next_incl; - - InitCompatInfo(&included, info->keymap, info->file_id, info->actions); - if (stmt->stmt) { - free(included.name); - included.name = stmt->stmt; - stmt->stmt = NULL; - } + CompatInfo included; + + InitCompatInfo(&included, info->keymap, info->actions); + included.name = include->stmt; + include->stmt = NULL; - for (; stmt; stmt = stmt->next_incl) { - if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_COMPAT, - &rtrn, &merge)) { + for (IncludeStmt *stmt = include; stmt; stmt = stmt->next_incl) { + CompatInfo next_incl; + XkbFile *file; + + file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_COMPAT); + if (!file) { info->errorCount += 10; ClearCompatInfo(&included); return false; } - InitCompatInfo(&next_incl, info->keymap, rtrn->id, info->actions); - next_incl.file_id = rtrn->id; - next_incl.dflt = info->dflt; - next_incl.dflt.file_id = rtrn->id; - next_incl.dflt.merge = merge; - next_incl.ledDflt.file_id = rtrn->id; - next_incl.ledDflt.merge = merge; + InitCompatInfo(&next_incl, info->keymap, info->actions); + next_incl.default_interp = info->default_interp; + next_incl.default_interp.merge = stmt->merge; + next_incl.default_led = info->default_led; + next_incl.default_led.merge = stmt->merge; - HandleCompatMapFile(&next_incl, rtrn, MERGE_OVERRIDE); + HandleCompatMapFile(&next_incl, file, MERGE_OVERRIDE); - MergeIncludedCompatMaps(&included, &next_incl, merge); + MergeIncludedCompatMaps(&included, &next_incl, stmt->merge); ClearCompatInfo(&next_incl); - FreeXkbFile(rtrn); + FreeXkbFile(file); } - MergeIncludedCompatMaps(info, &included, merge); + MergeIncludedCompatMaps(info, &included, include->merge); ClearCompatInfo(&included); return (info->errorCount == 0); @@ -689,7 +670,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, si->defined |= SI_FIELD_LEVEL_ONE_ONLY; } else { - return ReportBadField(keymap, "symbol interpretation", field, + return ReportBadField(keymap->ctx, "symbol interpretation", field, siText(si, info)); } @@ -697,45 +678,44 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, } static bool -SetIndicatorMapField(CompatInfo *info, LEDInfo *led, - const char *field, ExprDef *arrayNdx, ExprDef *value) +SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, + ExprDef *arrayNdx, ExprDef *value) { bool ok = true; struct xkb_keymap *keymap = info->keymap; if (istreq(field, "modifiers") || istreq(field, "mods")) { if (arrayNdx) - return ReportIndicatorNotArray(info, led, field); + return ReportLedNotArray(info, ledi, field); - if (!ExprResolveModMask(keymap, value, MOD_BOTH, &led->im.mods.mods)) - return ReportIndicatorBadType(info, led, field, "modifier mask"); + if (!ExprResolveModMask(keymap, value, MOD_BOTH, &ledi->led.mods.mods)) + return ReportLedBadType(info, ledi, field, "modifier mask"); - led->defined |= LED_FIELD_MODS; + ledi->defined |= LED_FIELD_MODS; } else if (istreq(field, "groups")) { unsigned int mask; if (arrayNdx) - return ReportIndicatorNotArray(info, led, field); + return ReportLedNotArray(info, ledi, field); if (!ExprResolveMask(keymap->ctx, value, &mask, groupMaskNames)) - return ReportIndicatorBadType(info, led, field, "group mask"); + return ReportLedBadType(info, ledi, field, "group mask"); - led->im.groups = mask; - led->defined |= LED_FIELD_GROUPS; + ledi->led.groups = mask; + ledi->defined |= LED_FIELD_GROUPS; } else if (istreq(field, "controls") || istreq(field, "ctrls")) { unsigned int mask; if (arrayNdx) - return ReportIndicatorNotArray(info, led, field); + return ReportLedNotArray(info, ledi, field); if (!ExprResolveMask(keymap->ctx, value, &mask, ctrlMaskNames)) - return ReportIndicatorBadType(info, led, field, - "controls mask"); + return ReportLedBadType(info, ledi, field, "controls mask"); - led->im.ctrls = mask; - led->defined |= LED_FIELD_CTRLS; + ledi->led.ctrls = mask; + ledi->defined |= LED_FIELD_CTRLS; } else if (istreq(field, "allowexplicit")) { log_dbg(info->keymap->ctx, @@ -747,27 +727,27 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led, unsigned int mask; if (arrayNdx) - return ReportIndicatorNotArray(info, led, field); + return ReportLedNotArray(info, ledi, field); if (!ExprResolveMask(keymap->ctx, value, &mask, modComponentMaskNames)) - return ReportIndicatorBadType(info, led, field, - "mask of modifier state components"); + return ReportLedBadType(info, ledi, field, + "mask of modifier state components"); - led->im.which_mods = mask; + ledi->led.which_mods = mask; } else if (istreq(field, "whichgroupstate")) { unsigned mask; if (arrayNdx) - return ReportIndicatorNotArray(info, led, field); + return ReportLedNotArray(info, ledi, field); if (!ExprResolveMask(keymap->ctx, value, &mask, groupComponentMaskNames)) - return ReportIndicatorBadType(info, led, field, - "mask of group state components"); + return ReportLedBadType(info, ledi, field, + "mask of group state components"); - led->im.which_groups = mask; + ledi->led.which_groups = mask; } else if (istreq(field, "driveskbd") || istreq(field, "driveskeyboard") || @@ -789,7 +769,7 @@ SetIndicatorMapField(CompatInfo *info, LEDInfo *led, log_err(info->keymap->ctx, "Unknown field %s in map for %s indicator; " "Definition ignored\n", - field, xkb_atom_text(keymap->ctx, led->im.name)); + field, xkb_atom_text(keymap->ctx, ledi->led.name)); ok = false; } @@ -806,10 +786,11 @@ HandleGlobalVar(CompatInfo *info, VarDef *stmt) if (!ExprResolveLhs(info->keymap->ctx, stmt->name, &elem, &field, &ndx)) ret = false; else if (elem && istreq(elem, "interpret")) - ret = SetInterpField(info, &info->dflt, field, ndx, stmt->value); + ret = SetInterpField(info, &info->default_interp, field, ndx, + stmt->value); else if (elem && istreq(elem, "indicator")) - ret = SetIndicatorMapField(info, &info->ledDflt, field, ndx, - stmt->value); + ret = SetLedMapField(info, &info->default_led, field, ndx, + stmt->value); else ret = SetActionField(info->keymap, elem, field, ndx, stmt->value, info->actions); @@ -857,7 +838,7 @@ HandleInterpDef(CompatInfo *info, InterpDef *def, enum merge_mode merge) return false; } - si = info->dflt; + si = info->default_interp; si.merge = merge = (def->merge == MERGE_DEFAULT ? merge : def->merge); if (!LookupKeysym(def->sym, &si.interp.sym)) { @@ -876,7 +857,7 @@ HandleInterpDef(CompatInfo *info, InterpDef *def, enum merge_mode merge) return false; } - if (!AddInterp(info, &si)) { + if (!AddInterp(info, &si, true)) { info->errorCount++; return false; } @@ -885,19 +866,18 @@ HandleInterpDef(CompatInfo *info, InterpDef *def, enum merge_mode merge) } static bool -HandleIndicatorMapDef(CompatInfo *info, IndicatorMapDef *def, - enum merge_mode merge) +HandleLedMapDef(CompatInfo *info, LedMapDef *def, enum merge_mode merge) { - LEDInfo led; + LedInfo ledi; VarDef *var; bool ok; if (def->merge != MERGE_DEFAULT) merge = def->merge; - led = info->ledDflt; - led.merge = merge; - led.im.name = def->name; + ledi = info->default_led; + ledi.merge = merge; + ledi.led.name = def->name; ok = true; for (var = def->body; var != NULL; var = (VarDef *) var->common.next) { @@ -916,13 +896,12 @@ HandleIndicatorMapDef(CompatInfo *info, IndicatorMapDef *def, ok = false; } else { - ok = SetIndicatorMapField(info, &led, field, arrayNdx, - var->value) && ok; + ok = SetLedMapField(info, &ledi, field, arrayNdx, var->value) && ok; } } if (ok) - return AddIndicatorMap(info, &led); + return AddLedMap(info, &ledi, true); return false; } @@ -931,14 +910,13 @@ static void HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge) { bool ok; - ParseCommon *stmt; merge = (merge == MERGE_DEFAULT ? MERGE_AUGMENT : merge); free(info->name); info->name = strdup_safe(file->name); - for (stmt = file->defs; stmt; stmt = stmt->next) { + for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) { switch (stmt->type) { case STMT_INCLUDE: ok = HandleIncludeCompatMap(info, (IncludeStmt *) stmt); @@ -952,8 +930,8 @@ HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge) "Ignored\n"); ok = true; break; - case STMT_INDICATOR_MAP: - ok = HandleIndicatorMapDef(info, (IndicatorMapDef *) stmt, merge); + case STMT_LED_MAP: + ok = HandleLedMapDef(info, (LedMapDef *) stmt, merge); break; case STMT_VAR: ok = HandleGlobalVar(info, (VarDef *) stmt); @@ -992,54 +970,54 @@ CopyInterps(CompatInfo *info, bool needSymbol, enum xkb_match_operation pred) } static void -CopyIndicatorMapDefs(CompatInfo *info) +CopyLedMapDefs(CompatInfo *info) { - LEDInfo *led; + LedInfo *ledi; xkb_led_index_t i; - struct xkb_indicator_map *im; + struct xkb_led *led; struct xkb_keymap *keymap = info->keymap; - darray_foreach(led, info->leds) { + darray_foreach(ledi, info->leds) { /* - * Find the indicator with the given name, if it was already - * declared in keycodes. + * Find the LED with the given name, if it was already declared + * in keycodes. */ - darray_enumerate(i, im, keymap->indicators) - if (im->name == led->im.name) + darray_enumerate(i, led, keymap->leds) + if (led->name == ledi->led.name) break; /* Not previously declared; create it with next free index. */ - if (i >= darray_size(keymap->indicators)) { + if (i >= darray_size(keymap->leds)) { log_dbg(keymap->ctx, "Indicator name \"%s\" was not declared in the keycodes section; " "Adding new indicator\n", - xkb_atom_text(keymap->ctx, led->im.name)); + xkb_atom_text(keymap->ctx, ledi->led.name)); - darray_enumerate(i, im, keymap->indicators) - if (im->name == XKB_ATOM_NONE) + darray_enumerate(i, led, keymap->leds) + if (led->name == XKB_ATOM_NONE) break; - if (i >= darray_size(keymap->indicators)) { + if (i >= darray_size(keymap->leds)) { /* Not place to put it; ignore. */ if (i >= XKB_MAX_LEDS) { log_err(keymap->ctx, "Too many indicators (maximum is %d); " "Indicator name \"%s\" ignored\n", XKB_MAX_LEDS, - xkb_atom_text(keymap->ctx, led->im.name)); + xkb_atom_text(keymap->ctx, ledi->led.name)); continue; } - /* Add a new indicator. */ - darray_resize(keymap->indicators, i + 1); - im = &darray_item(keymap->indicators, i); + /* Add a new LED. */ + darray_resize(keymap->leds, i + 1); + led = &darray_item(keymap->leds, i); } } - *im = led->im; - if (im->groups != 0 && im->which_groups == 0) - im->which_groups = XKB_STATE_LAYOUT_EFFECTIVE; - if (im->mods.mods != 0 && im->which_mods == 0) - im->which_mods = XKB_STATE_MODS_EFFECTIVE; + *led = ledi->led; + if (led->groups != 0 && led->which_groups == 0) + led->which_groups = XKB_STATE_LAYOUT_EFFECTIVE; + if (led->mods.mods != 0 && led->which_mods == 0) + led->which_mods = XKB_STATE_MODS_EFFECTIVE; } } @@ -1062,7 +1040,7 @@ CopyCompatToKeymap(struct xkb_keymap *keymap, CompatInfo *info) CopyInterps(info, false, MATCH_ANY_OR_NONE); } - CopyIndicatorMapDefs(info); + CopyLedMapDefs(info); return true; } @@ -1078,9 +1056,9 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, if (!actions) return false; - InitCompatInfo(&info, keymap, file->id, actions); - info.dflt.merge = merge; - info.ledDflt.merge = merge; + InitCompatInfo(&info, keymap, actions); + info.default_interp.merge = merge; + info.default_led.merge = merge; HandleCompatMapFile(&info, file, merge); if (info.errorCount != 0) diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c index b94ffd0..b4a4014 100644 --- a/src/xkbcomp/include.c +++ b/src/xkbcomp/include.c @@ -172,8 +172,6 @@ ParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn, return true; } -/***====================================================================***/ - static const char *xkb_file_type_include_dirs[_FILE_TYPE_NUM_ENTRIES] = { [FILE_TYPE_KEYCODES] = "keycodes", [FILE_TYPE_TYPES] = "types", @@ -195,19 +193,6 @@ DirectoryForInclude(enum xkb_file_type type) return xkb_file_type_include_dirs[type]; } -/***====================================================================***/ - -/** - * Search for the given file name in the include directories. - * - * @param ctx the XKB ctx containing the include paths - * @param type one of FILE_TYPE_TYPES, FILE_TYPE_COMPAT, ..., or - * FILE_TYPE_KEYMAP or FILE_TYPE_RULES - * @param pathRtrn is set to the full path of the file if found. - * - * @return an FD to the file or NULL. If NULL is returned, the value of - * pathRtrn is undefined. - */ FILE * FindFileInXkbPath(struct xkb_context *ctx, const char *name, enum xkb_file_type type, char **pathRtrn) @@ -265,24 +250,9 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name, return file; } -/** - * Open the file given in the include statement and parse it's content. - * If the statement defines a specific map to use, this map is returned in - * file_rtrn. Otherwise, the default map is returned. - * - * @param ctx The ctx containing include paths - * @param stmt The include statement, specifying the file name to look for. - * @param file_type Type of file (FILE_TYPE_KEYCODES, etc.) - * @param file_rtrn Returns the key map to be used. - * @param merge_rtrn Always returns stmt->merge. - * - * @return true on success or false otherwise. - */ -bool -ProcessIncludeFile(struct xkb_context *ctx, - IncludeStmt * stmt, - enum xkb_file_type file_type, - XkbFile ** file_rtrn, enum merge_mode *merge_rtrn) +XkbFile * +ProcessIncludeFile(struct xkb_context *ctx, IncludeStmt *stmt, + enum xkb_file_type file_type) { FILE *file; XkbFile *xkb_file; @@ -292,6 +262,7 @@ ProcessIncludeFile(struct xkb_context *ctx, return false; xkb_file = XkbParseFile(ctx, file, stmt->file, stmt->map); + fclose(file); if (!xkb_file) { if (stmt->map) log_err(ctx, "Couldn't process include statement for '%s(%s)'\n", @@ -299,10 +270,8 @@ ProcessIncludeFile(struct xkb_context *ctx, else log_err(ctx, "Couldn't process include statement for '%s'\n", stmt->file); - fclose(file); - return false; + return NULL; } - fclose(file); if (xkb_file->file_type != file_type) { log_err(ctx, @@ -310,12 +279,11 @@ ProcessIncludeFile(struct xkb_context *ctx, "Include file \"%s\" ignored\n", xkb_file_type_to_string(file_type), xkb_file_type_to_string(xkb_file->file_type), stmt->file); - return false; + FreeXkbFile(xkb_file); + return NULL; } /* FIXME: we have to check recursive includes here (or somewhere) */ - *file_rtrn = xkb_file; - *merge_rtrn = stmt->merge; - return true; + return xkb_file; } diff --git a/src/xkbcomp/include.h b/src/xkbcomp/include.h index 9ba0b55..03e76ed 100644 --- a/src/xkbcomp/include.h +++ b/src/xkbcomp/include.h @@ -35,9 +35,8 @@ FILE * FindFileInXkbPath(struct xkb_context *ctx, const char *name, enum xkb_file_type type, char **pathRtrn); -bool +XkbFile * ProcessIncludeFile(struct xkb_context *ctx, IncludeStmt *stmt, - enum xkb_file_type file_type, XkbFile **file_rtrn, - enum merge_mode *merge_rtrn); + enum xkb_file_type file_type); #endif diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index c05f799..edc54c9 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -27,7 +27,6 @@ #include "xkbcomp-priv.h" #include "text.h" #include "expr.h" -#include "keycodes.h" #include "include.h" /* @@ -74,16 +73,15 @@ * Allows to refer to a previously defined key (here <COMP>) by another * name (here <MENU>). Conflicts are handled similarly. * - * Indicator name statements + * LED name statements * ------------------------- * Statements of the form: * indicator 1 = "Caps Lock"; * indicator 2 = "Num Lock"; * indicator 3 = "Scroll Lock"; * - * Assigns a name the indicator (i.e. keyboard LED) with the given index. - * The amount of possible indicators is predetermined (XKB_NUM_INDICATORS). - * The indicator may be referred by this name later in the compat section + * Assigns a name to the keyboard LED (a.k.a indicator) with the given index. + * The led may be referred by this name later in the compat section * and by the user. * * Effect on the keymap @@ -92,10 +90,11 @@ * following members of struct xkb_keymap are finalized: * xkb_keycode_t min_key_code; * xkb_keycode_t max_key_code; - * darray(struct xkb_key_alias) key_aliases; + * unsigned int num_aliases; + * struct xkb_key_alias *key_aliases; * char *keycodes_section_name; - * The 'name' field of indicators declared in xkb_keycodes: - * darray(struct xkb_indicator_map) indicators; + * The 'name' field of leds declared in xkb_keycodes: + * darray(struct xkb_led) leds; * Further, the array of keys: * struct xkb_key *keys; * had been resized to its final size (i.e. all of the xkb_key objects are @@ -105,61 +104,53 @@ typedef struct { enum merge_mode merge; - unsigned file_id; xkb_atom_t alias; xkb_atom_t real; } AliasInfo; typedef struct { - unsigned int file_id; - xkb_atom_t name; -} KeyNameInfo; - -typedef struct { enum merge_mode merge; - unsigned file_id; xkb_atom_t name; -} IndicatorNameInfo; +} LedNameInfo; typedef struct { - char *name; /* e.g. evdev+aliases(qwerty) */ + char *name; int errorCount; - unsigned file_id; - enum merge_mode merge; xkb_keycode_t min_key_code; xkb_keycode_t max_key_code; - darray(KeyNameInfo) key_names; - darray(IndicatorNameInfo) indicator_names; + darray(xkb_atom_t) key_names; + darray(LedNameInfo) led_names; darray(AliasInfo) aliases; struct xkb_context *ctx; } KeyNamesInfo; +/***====================================================================***/ + static void -InitAliasInfo(AliasInfo *info, enum merge_mode merge, unsigned file_id, +InitAliasInfo(AliasInfo *info, enum merge_mode merge, xkb_atom_t alias, xkb_atom_t real) { memset(info, 0, sizeof(*info)); info->merge = merge; - info->file_id = file_id; info->alias = alias; info->real = real; } -static IndicatorNameInfo * -FindIndicatorByName(KeyNamesInfo *info, xkb_atom_t name, - xkb_led_index_t *idx_out) +static LedNameInfo * +FindLedByName(KeyNamesInfo *info, xkb_atom_t name, + xkb_led_index_t *idx_out) { - IndicatorNameInfo *led; + LedNameInfo *ledi; xkb_led_index_t idx; - darray_enumerate(idx, led, info->indicator_names) { - if (led->name == name) { + darray_enumerate(idx, ledi, info->led_names) { + if (ledi->name == name) { *idx_out = idx; - return led; + return ledi; } } @@ -167,22 +158,18 @@ FindIndicatorByName(KeyNamesInfo *info, xkb_atom_t name, } static bool -AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge, - IndicatorNameInfo *new, xkb_led_index_t new_idx) +AddLedName(KeyNamesInfo *info, enum merge_mode merge, bool same_file, + LedNameInfo *new, xkb_led_index_t new_idx) { xkb_led_index_t old_idx; - IndicatorNameInfo *old; - bool replace; - int verbosity = xkb_context_get_log_verbosity(info->ctx); - - replace = (merge == MERGE_REPLACE || merge == MERGE_OVERRIDE); + LedNameInfo *old; + const int verbosity = xkb_context_get_log_verbosity(info->ctx); + const bool report = (same_file && verbosity > 0) || verbosity > 9; + const bool replace = (merge == MERGE_REPLACE || merge == MERGE_OVERRIDE); - /* Inidicator with the same name already exists. */ - old = FindIndicatorByName(info, new->name, &old_idx); + /* LED with the same name already exists. */ + old = FindLedByName(info, new->name, &old_idx); if (old) { - bool report = ((old->file_id == new->file_id && verbosity > 0) || - verbosity > 9); - if (old_idx == new_idx) { log_warn(info->ctx, "Multiple indicators named \"%s\"; " @@ -194,8 +181,8 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge, if (report) { xkb_led_index_t use = (replace ? new_idx + 1 : old_idx + 1); xkb_led_index_t ignore = (replace ? old_idx + 1 : new_idx + 1); - log_warn(info->ctx, "Multiple indicators named %s; " - "Using %d, ignoring %d\n", + log_warn(info->ctx, + "Multiple indicators named %s; Using %d, ignoring %d\n", xkb_atom_text(info->ctx, new->name), use, ignore); } @@ -205,20 +192,15 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge, return true; } - if (new_idx >= darray_size(info->indicator_names)) - darray_resize0(info->indicator_names, new_idx + 1); + if (new_idx >= darray_size(info->led_names)) + darray_resize0(info->led_names, new_idx + 1); - /* Inidicator with the same index already exists. */ - old = &darray_item(info->indicator_names, new_idx); + /* LED with the same index already exists. */ + old = &darray_item(info->led_names, new_idx); if (old->name != XKB_ATOM_NONE) { - bool report = ((old->file_id == new->file_id && verbosity > 0) || - verbosity > 9); - - /* Same name case already handled above. */ - if (report) { - xkb_atom_t use = (replace ? new->name : old->name); - xkb_atom_t ignore = (replace ? old->name : new->name); + const xkb_atom_t use = (replace ? new->name : old->name); + const xkb_atom_t ignore = (replace ? old->name : new->name); log_warn(info->ctx, "Multiple names for indicator %d; " "Using %s, ignoring %s\n", new_idx + 1, xkb_atom_text(info->ctx, use), @@ -231,7 +213,7 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge, return true; } - darray_item(info->indicator_names, new_idx) = *new; + darray_item(info->led_names, new_idx) = *new; return true; } @@ -241,27 +223,24 @@ ClearKeyNamesInfo(KeyNamesInfo *info) free(info->name); darray_free(info->key_names); darray_free(info->aliases); - darray_free(info->indicator_names); + darray_free(info->led_names); } static void -InitKeyNamesInfo(KeyNamesInfo *info, struct xkb_context *ctx, - unsigned file_id) +InitKeyNamesInfo(KeyNamesInfo *info, struct xkb_context *ctx) { memset(info, 0, sizeof(*info)); info->ctx = ctx; - info->merge = MERGE_DEFAULT; - info->file_id = file_id; info->min_key_code = XKB_KEYCODE_MAX; } static xkb_keycode_t -FindKeyByName(KeyNamesInfo * info, xkb_atom_t name) +FindKeyByName(KeyNamesInfo *info, xkb_atom_t name) { xkb_keycode_t i; for (i = info->min_key_code; i <= info->max_key_code; i++) - if (darray_item(info->key_names, i).name == name) + if (darray_item(info->key_names, i) == name) return i; return XKB_KEYCODE_INVALID; @@ -269,11 +248,13 @@ FindKeyByName(KeyNamesInfo * info, xkb_atom_t name) static bool AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, xkb_atom_t name, - enum merge_mode merge, unsigned file_id, bool report) + enum merge_mode merge, bool same_file, bool report) { - KeyNameInfo *namei; - xkb_keycode_t old; - int verbosity = xkb_context_get_log_verbosity(info->ctx); + xkb_atom_t old_name; + xkb_keycode_t old_kc; + const int verbosity = xkb_context_get_log_verbosity(info->ctx); + + report = report && ((same_file && verbosity > 0) || verbosity > 7); if (kc >= darray_size(info->key_names)) darray_resize0(info->key_names, kc + 1); @@ -281,20 +262,17 @@ AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, xkb_atom_t name, info->min_key_code = MIN(info->min_key_code, kc); info->max_key_code = MAX(info->max_key_code, kc); - namei = &darray_item(info->key_names, kc); - - report = report && ((verbosity > 0 && file_id == namei->file_id) || - verbosity > 7); - - if (namei->name != 0) { - const char *lname = KeyNameText(info->ctx, namei->name); + /* There's already a key with this keycode. */ + old_name = darray_item(info->key_names, kc); + if (old_name != XKB_ATOM_NONE) { + const char *lname = KeyNameText(info->ctx, old_name); const char *kname = KeyNameText(info->ctx, name); - if (namei->name == name) { + if (old_name == name) { if (report) log_warn(info->ctx, "Multiple identical key name definitions; " - "Later occurences of \"%s = %d\" ignored\n", + "Later occurrences of \"%s = %d\" ignored\n", lname, kc); return true; } @@ -310,80 +288,44 @@ AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, xkb_atom_t name, log_warn(info->ctx, "Multiple names for keycode %d; " "Using %s, ignoring %s\n", kc, kname, lname); - namei->name = 0; - namei->file_id = 0; + darray_item(info->key_names, kc) = XKB_ATOM_NONE; } } - old = FindKeyByName(info, name); - if (old != XKB_KEYCODE_INVALID && old != kc) { + /* There's already a key with this name. */ + old_kc = FindKeyByName(info, name); + if (old_kc != XKB_KEYCODE_INVALID && old_kc != kc) { const char *kname = KeyNameText(info->ctx, name); if (merge == MERGE_OVERRIDE) { - darray_item(info->key_names, old).name = 0; - darray_item(info->key_names, old).file_id = 0; + darray_item(info->key_names, old_kc) = XKB_ATOM_NONE; if (report) log_warn(info->ctx, "Key name %s assigned to multiple keys; " - "Using %d, ignoring %d\n", kname, kc, old); + "Using %d, ignoring %d\n", kname, kc, old_kc); } else { if (report) log_vrb(info->ctx, 3, "Key name %s assigned to multiple keys; " - "Using %d, ignoring %d\n", kname, old, kc); + "Using %d, ignoring %d\n", kname, old_kc, kc); return true; } } - namei->name = name; - namei->file_id = file_id; + darray_item(info->key_names, kc) = name; return true; } /***====================================================================***/ static int -HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge, - unsigned file_id); - -static bool -MergeAliases(KeyNamesInfo *into, KeyNamesInfo *from, enum merge_mode merge) -{ - AliasInfo *alias; - KeyAliasDef def; - - if (darray_empty(from->aliases)) - return true; - - if (darray_empty(into->aliases)) { - into->aliases = from->aliases; - darray_init(from->aliases); - return true; - } - - memset(&def, 0, sizeof(def)); - - darray_foreach(alias, from->aliases) { - def.merge = (merge == MERGE_DEFAULT) ? alias->merge : merge; - def.alias = alias->alias; - def.real = alias->real; - - if (!HandleAliasDef(into, &def, def.merge, alias->file_id)) - return false; - } - - return true; -} +HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge); static void MergeIncludedKeycodes(KeyNamesInfo *into, KeyNamesInfo *from, enum merge_mode merge) { - xkb_keycode_t i; - xkb_led_index_t idx; - IndicatorNameInfo *led; - if (from->errorCount > 0) { into->errorCount += from->errorCount; return; @@ -394,67 +336,101 @@ MergeIncludedKeycodes(KeyNamesInfo *into, KeyNamesInfo *from, from->name = NULL; } - if (darray_size(into->key_names) < darray_size(from->key_names)) - darray_resize0(into->key_names, darray_size(from->key_names)); + /* Merge key names. */ + if (darray_empty(into->key_names)) { + into->key_names = from->key_names; + darray_init(from->key_names); + into->min_key_code = from->min_key_code; + into->max_key_code = from->max_key_code; + } + else { + if (darray_size(into->key_names) < darray_size(from->key_names)) + darray_resize0(into->key_names, darray_size(from->key_names)); - for (i = from->min_key_code; i <= from->max_key_code; i++) { - xkb_atom_t name = darray_item(from->key_names, i).name; - if (name == XKB_ATOM_NONE) - continue; + for (unsigned i = from->min_key_code; i <= from->max_key_code; i++) { + xkb_atom_t name = darray_item(from->key_names, i); + if (name == XKB_ATOM_NONE) + continue; - if (!AddKeyName(into, i, name, merge, from->file_id, false)) - into->errorCount++; + if (!AddKeyName(into, i, name, merge, true, false)) + into->errorCount++; + } } - darray_enumerate(idx, led, from->indicator_names) { - if (led->name == XKB_ATOM_NONE) - continue; + /* Merge key aliases. */ + if (darray_empty(into->aliases)) { + into->aliases = from->aliases; + darray_init(from->aliases); + } + else { + AliasInfo *alias; + + darray_foreach(alias, from->aliases) { + KeyAliasDef def; + + def.merge = (merge == MERGE_DEFAULT ? alias->merge : merge); + def.alias = alias->alias; + def.real = alias->real; - led->merge = (merge == MERGE_DEFAULT ? led->merge : merge); - if (!AddIndicatorName(into, led->merge, led, idx)) - into->errorCount++; + if (!HandleAliasDef(into, &def, def.merge)) + into->errorCount++; + } + } + + /* Merge LED names. */ + if (darray_empty(into->led_names)) { + into->led_names = from->led_names; + darray_init(from->led_names); } + else { + xkb_led_index_t idx; + LedNameInfo *ledi; - if (!MergeAliases(into, from, merge)) - into->errorCount++; + darray_enumerate(idx, ledi, from->led_names) { + if (ledi->name == XKB_ATOM_NONE) + continue; + + ledi->merge = (merge == MERGE_DEFAULT ? ledi->merge : merge); + if (!AddLedName(into, ledi->merge, false, ledi, idx)) + into->errorCount++; + } + } } static void HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge); static bool -HandleIncludeKeycodes(KeyNamesInfo *info, IncludeStmt *stmt) +HandleIncludeKeycodes(KeyNamesInfo *info, IncludeStmt *include) { - enum merge_mode merge = MERGE_DEFAULT; - XkbFile *rtrn; - KeyNamesInfo included, next_incl; - - InitKeyNamesInfo(&included, info->ctx, info->file_id); - if (stmt->stmt) { - free(included.name); - included.name = stmt->stmt; - stmt->stmt = NULL; - } + KeyNamesInfo included; - for (; stmt; stmt = stmt->next_incl) { - if (!ProcessIncludeFile(info->ctx, stmt, FILE_TYPE_KEYCODES, - &rtrn, &merge)) { + InitKeyNamesInfo(&included, info->ctx); + included.name = include->stmt; + include->stmt = NULL; + + for (IncludeStmt *stmt = include; stmt; stmt = stmt->next_incl) { + KeyNamesInfo next_incl; + XkbFile *file; + + file = ProcessIncludeFile(info->ctx, stmt, FILE_TYPE_KEYCODES); + if (!file) { info->errorCount += 10; ClearKeyNamesInfo(&included); return false; } - InitKeyNamesInfo(&next_incl, info->ctx, rtrn->id); + InitKeyNamesInfo(&next_incl, info->ctx); - HandleKeycodesFile(&next_incl, rtrn, MERGE_OVERRIDE); + HandleKeycodesFile(&next_incl, file, MERGE_OVERRIDE); - MergeIncludedKeycodes(&included, &next_incl, merge); + MergeIncludedKeycodes(&included, &next_incl, stmt->merge); ClearKeyNamesInfo(&next_incl); - FreeXkbFile(rtrn); + FreeXkbFile(file); } - MergeIncludedKeycodes(info, &included, merge); + MergeIncludedKeycodes(info, &included, include->merge); ClearKeyNamesInfo(&included); return (info->errorCount == 0); @@ -477,59 +453,45 @@ HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge) return false; } - return AddKeyName(info, stmt->value, stmt->name, merge, - info->file_id, true); + return AddKeyName(info, stmt->value, stmt->name, merge, false, true); } -static void -HandleAliasCollision(KeyNamesInfo *info, AliasInfo *old, AliasInfo *new) +static int +HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge) { - int verbosity = xkb_context_get_log_verbosity(info->ctx); - bool report = ((new->file_id == old->file_id && verbosity > 0) || - verbosity > 9); - - if (new->real == old->real) { - if (report) - log_warn(info->ctx, "Alias of %s for %s declared more than once; " - "First definition ignored\n", - KeyNameText(info->ctx, new->alias), - KeyNameText(info->ctx, new->real)); - } - else { - xkb_atom_t use, ignore; - - use = (new->merge == MERGE_AUGMENT ? old->real : new->real); - ignore = (new->merge == MERGE_AUGMENT ? new->real : old->real); - - if (report) - log_warn(info->ctx, "Multiple definitions for alias %s; " - "Using %s, ignoring %s\n", - KeyNameText(info->ctx, old->alias), - KeyNameText(info->ctx, use), - KeyNameText(info->ctx, ignore)); + AliasInfo *old, new; + + darray_foreach(old, info->aliases) { + if (old->alias == def->alias) { + if (def->real == old->real) { + log_vrb(info->ctx, 1, + "Alias of %s for %s declared more than once; " + "First definition ignored\n", + KeyNameText(info->ctx, def->alias), + KeyNameText(info->ctx, def->real)); + } + else { + xkb_atom_t use, ignore; + + use = (merge == MERGE_AUGMENT ? old->real : def->real); + ignore = (merge == MERGE_AUGMENT ? def->real : old->real); - old->real = use; - } - - old->file_id = new->file_id; - old->merge = new->merge; -} + log_warn(info->ctx, + "Multiple definitions for alias %s; " + "Using %s, ignoring %s\n", + KeyNameText(info->ctx, old->alias), + KeyNameText(info->ctx, use), + KeyNameText(info->ctx, ignore)); -static int -HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge, - unsigned file_id) -{ - AliasInfo *alias, new; + old->real = use; + } - darray_foreach(alias, info->aliases) { - if (alias->alias == def->alias) { - InitAliasInfo(&new, merge, file_id, def->alias, def->real); - HandleAliasCollision(info, alias, &new); + old->merge = merge; return true; } } - InitAliasInfo(&new, merge, file_id, def->alias, def->real); + InitAliasInfo(&new, merge, def->alias, def->real); darray_append(info->aliases, new); return true; } @@ -551,7 +513,7 @@ HandleKeyNameVar(KeyNamesInfo *info, VarDef *stmt) if (!istreq(field, "minimum") && !istreq(field, "maximum")) { log_err(info->ctx, "Unknown field encountered; " - "Assigment to field %s ignored\n", field); + "Assignment to field %s ignored\n", field); return false; } @@ -560,10 +522,10 @@ HandleKeyNameVar(KeyNamesInfo *info, VarDef *stmt) } static int -HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def, - enum merge_mode merge) +HandleLedNameDef(KeyNamesInfo *info, LedNameDef *def, + enum merge_mode merge) { - IndicatorNameInfo ii; + LedNameInfo ledi; xkb_atom_t name; if (def->ndx < 1 || def->ndx > XKB_MAX_LEDS) { @@ -578,26 +540,23 @@ HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def, char buf[20]; snprintf(buf, sizeof(buf), "%d", def->ndx); info->errorCount++; - return ReportBadType(info->ctx, "indicator", "name", buf, - "string"); + return ReportBadType(info->ctx, "indicator", "name", buf, "string"); } - ii.merge = info->merge; - ii.file_id = info->file_id; - ii.name = name; - return AddIndicatorName(info, merge, &ii, def->ndx - 1); + ledi.merge = merge; + ledi.name = name; + return AddLedName(info, merge, true, &ledi, def->ndx - 1); } static void HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge) { - ParseCommon *stmt; bool ok; free(info->name); info->name = strdup_safe(file->name); - for (stmt = file->defs; stmt; stmt = stmt->next) { + for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) { switch (stmt->type) { case STMT_INCLUDE: ok = HandleIncludeKeycodes(info, (IncludeStmt *) stmt); @@ -606,15 +565,13 @@ HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge) ok = HandleKeycodeDef(info, (KeycodeDef *) stmt, merge); break; case STMT_ALIAS: - ok = HandleAliasDef(info, (KeyAliasDef *) stmt, merge, - info->file_id); + ok = HandleAliasDef(info, (KeyAliasDef *) stmt, merge); break; case STMT_VAR: ok = HandleKeyNameVar(info, (VarDef *) stmt); break; - case STMT_INDICATOR_NAME: - ok = HandleIndicatorNameDef(info, (IndicatorNameDef *) stmt, - merge); + case STMT_LED_NAME: + ok = HandleLedNameDef(info, (LedNameDef *) stmt, merge); break; default: log_err(info->ctx, @@ -635,101 +592,89 @@ HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge) } } -static void -ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap) +/***====================================================================***/ + +static bool +CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) { - struct xkb_key *key; - struct xkb_key_alias *a, new; + xkb_keycode_t kc; + xkb_led_index_t idx; + LedNameInfo *ledi; AliasInfo *alias; + unsigned i; + + keymap->keycodes_section_name = strdup_safe(info->name); + + keymap->min_key_code = info->min_key_code; + keymap->max_key_code = info->max_key_code; + + /* Copy key names. */ + keymap->keys = calloc(info->max_key_code + 1, sizeof(*keymap->keys)); + for (kc = info->min_key_code; kc <= info->max_key_code; kc++) { + keymap->keys[kc].keycode = kc; + keymap->keys[kc].name = darray_item(info->key_names, kc); + } + /* + * Do some sanity checking on the aliases. We can't do it before + * because keys and their aliases may be added out-of-order. + */ + keymap->num_key_aliases = 0; darray_foreach(alias, info->aliases) { /* Check that ->real is a key. */ - key = FindNamedKey(keymap, alias->real, false); - if (!key) { + if (!XkbKeyByName(keymap, alias->real, false)) { log_vrb(info->ctx, 5, "Attempt to alias %s to non-existent key %s; Ignored\n", KeyNameText(info->ctx, alias->alias), KeyNameText(info->ctx, alias->real)); + alias->real = XKB_ATOM_NONE; continue; } /* Check that ->alias is not a key. */ - key = FindNamedKey(keymap, alias->alias, false); - if (key) { + if (XkbKeyByName(keymap, alias->alias, false)) { log_vrb(info->ctx, 5, "Attempt to create alias with the name of a real key; " "Alias \"%s = %s\" ignored\n", KeyNameText(info->ctx, alias->alias), KeyNameText(info->ctx, alias->real)); + alias->real = XKB_ATOM_NONE; continue; } - /* Check that ->alias in not already an alias, and if so handle it. */ - darray_foreach(a, keymap->key_aliases) { - AliasInfo old_alias; - - if (a->alias != alias->alias) - continue; - - InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real); - HandleAliasCollision(info, &old_alias, alias); - a->alias = old_alias.alias; - a->real = old_alias.real; - alias->alias = 0; - } - if (alias->alias == 0) - continue; - - /* Add the alias. */ - new.alias = alias->alias; - new.real = alias->real; - darray_append(keymap->key_aliases, new); + keymap->num_key_aliases++; } - darray_free(info->aliases); -} - -static bool -CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) -{ - xkb_keycode_t kc; - xkb_led_index_t idx; - IndicatorNameInfo *led; - - keymap->keys = calloc(info->max_key_code + 1, sizeof(*keymap->keys)); - if (!keymap->keys) - return false; - - keymap->min_key_code = info->min_key_code; - keymap->max_key_code = info->max_key_code; - - for (kc = info->min_key_code; kc <= info->max_key_code; kc++) { - keymap->keys[kc].keycode = kc; - keymap->keys[kc].name = darray_item(info->key_names, kc).name; - } - - keymap->keycodes_section_name = strdup_safe(info->name); - - darray_resize0(keymap->indicators, darray_size(info->indicator_names)); - darray_enumerate(idx, led, info->indicator_names) { - if (led->name == XKB_ATOM_NONE) - continue; - - darray_item(keymap->indicators, idx).name = led->name; + /* Copy key aliases. */ + keymap->key_aliases = calloc(keymap->num_key_aliases, + sizeof(*keymap->key_aliases)); + i = 0; + darray_foreach(alias, info->aliases) { + if (alias->real != XKB_ATOM_NONE) { + keymap->key_aliases[i].alias = alias->alias; + keymap->key_aliases[i].real = alias->real; + i++; + } } - ApplyAliases(info, keymap); + /* Copy LED names. */ + darray_resize0(keymap->leds, darray_size(info->led_names)); + darray_enumerate(idx, ledi, info->led_names) + if (ledi->name != XKB_ATOM_NONE) + darray_item(keymap->leds, idx).name = ledi->name; return true; } +/***====================================================================***/ + bool CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { KeyNamesInfo info; - InitKeyNamesInfo(&info, keymap->ctx, file->id); + InitKeyNamesInfo(&info, keymap->ctx); HandleKeycodesFile(&info, file, merge); if (info.errorCount != 0) @@ -745,37 +690,3 @@ err_info: ClearKeyNamesInfo(&info); return false; } - -struct xkb_key * -FindNamedKey(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases) -{ - struct xkb_key *key; - - xkb_foreach_key(key, keymap) - if (key->name == name) - return key; - - if (use_aliases) { - xkb_atom_t new_name; - if (FindKeyNameForAlias(keymap, name, &new_name)) - return FindNamedKey(keymap, new_name, false); - } - - return NULL; -} - -bool -FindKeyNameForAlias(struct xkb_keymap *keymap, xkb_atom_t name, - xkb_atom_t *real_name) -{ - struct xkb_key_alias *a; - - darray_foreach(a, keymap->key_aliases) { - if (name == a->alias) { - *real_name = a->real; - return true; - } - } - - return false; -} diff --git a/src/xkbcomp/keycodes.h b/src/xkbcomp/keycodes.h deleted file mode 100644 index 395478b..0000000 --- a/src/xkbcomp/keycodes.h +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************ - * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. - * - * 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 Silicon Graphics not be - * used in advertising or publicity pertaining to distribution - * of the software without specific prior written permission. - * Silicon Graphics makes no representation about the suitability - * of this software for any purpose. It is provided "as is" - * without any express or implied warranty. - * - * SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS 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. - * - ********************************************************/ - -#ifndef XKBCOMP_KEYCODES_H -#define XKBCOMP_KEYCODES_H - -struct xkb_key * -FindNamedKey(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases); - -bool -FindKeyNameForAlias(struct xkb_keymap *keymap, xkb_atom_t name, - xkb_atom_t *real_name); - -#endif diff --git a/src/keymap-dump.c b/src/xkbcomp/keymap-dump.c index 5bf0774..034a8c1 100644 --- a/src/keymap-dump.c +++ b/src/xkbcomp/keymap-dump.c @@ -49,14 +49,10 @@ * Author: Daniel Stone <daniel@fooishbar.org> */ -#include "keymap.h" +#include "xkbcomp-priv.h" #include "text.h" -#define VMOD_HIDE_VALUE 0 -#define VMOD_SHOW_VALUE 1 -#define VMOD_COMMENT_VALUE 2 - -#define BUF_CHUNK_SIZE 4096 +#define BUF_CHUNK_SIZE 4096 struct buf { char *buf; @@ -135,7 +131,7 @@ write_vmods(struct xkb_keymap *keymap, struct buf *buf) continue; if (num_vmods == 0) - write_buf(buf, "\t\tvirtual_modifiers "); + write_buf(buf, "\tvirtual_modifiers "); else write_buf(buf, ","); write_buf(buf, "%s", xkb_atom_text(keymap->ctx, mod->name)); @@ -151,67 +147,62 @@ write_vmods(struct xkb_keymap *keymap, struct buf *buf) static bool write_keycodes(struct xkb_keymap *keymap, struct buf *buf) { - struct xkb_key *key; - struct xkb_key_alias *alias; - xkb_led_index_t i; - const struct xkb_indicator_map *im; + const struct xkb_key *key; + xkb_led_index_t idx; + const struct xkb_led *led; if (keymap->keycodes_section_name) - write_buf(buf, "\txkb_keycodes \"%s\" {\n", + write_buf(buf, "xkb_keycodes \"%s\" {\n", keymap->keycodes_section_name); else - write_buf(buf, "\txkb_keycodes {\n"); + write_buf(buf, "xkb_keycodes {\n"); xkb_foreach_key(key, keymap) { if (key->name == XKB_ATOM_NONE) continue; - write_buf(buf, "\t\t%-20s = %d;\n", + write_buf(buf, "\t%-20s = %d;\n", KeyNameText(keymap->ctx, key->name), key->keycode); } - darray_enumerate(i, im, keymap->indicators) - if (im->name != XKB_ATOM_NONE) - write_buf(buf, "\t\tindicator %d = \"%s\";\n", - i + 1, xkb_atom_text(keymap->ctx, im->name)); + darray_enumerate(idx, led, keymap->leds) + if (led->name != XKB_ATOM_NONE) + write_buf(buf, "\tindicator %d = \"%s\";\n", + idx + 1, xkb_atom_text(keymap->ctx, led->name)); - darray_foreach(alias, keymap->key_aliases) - write_buf(buf, "\t\talias %-14s = %s;\n", - KeyNameText(keymap->ctx, alias->alias), - KeyNameText(keymap->ctx, alias->real)); + for (unsigned i = 0; i < keymap->num_key_aliases; i++) + write_buf(buf, "\talias %-14s = %s;\n", + KeyNameText(keymap->ctx, keymap->key_aliases[i].alias), + KeyNameText(keymap->ctx, keymap->key_aliases[i].real)); - write_buf(buf, "\t};\n\n"); + write_buf(buf, "};\n\n"); return true; } static bool write_types(struct xkb_keymap *keymap, struct buf *buf) { - unsigned int i, j; - xkb_level_index_t n; - struct xkb_key_type *type; - struct xkb_kt_map_entry *entry; - if (keymap->types_section_name) - write_buf(buf, "\txkb_types \"%s\" {\n\n", + write_buf(buf, "xkb_types \"%s\" {\n", keymap->types_section_name); else - write_buf(buf, "\txkb_types {\n\n"); + write_buf(buf, "xkb_types {\n"); write_vmods(keymap, buf); - for (i = 0; i < keymap->num_types; i++) { - type = &keymap->types[i]; + for (unsigned i = 0; i < keymap->num_types; i++) { + const struct xkb_key_type *type = &keymap->types[i]; - write_buf(buf, "\t\ttype \"%s\" {\n", + write_buf(buf, "\ttype \"%s\" {\n", xkb_atom_text(keymap->ctx, type->name)); - write_buf(buf, "\t\t\tmodifiers= %s;\n", + + write_buf(buf, "\t\tmodifiers= %s;\n", ModMaskText(keymap, type->mods.mods)); - for (j = 0; j < type->num_entries; j++) { + for (unsigned j = 0; j < type->num_entries; j++) { const char *str; - entry = &type->map[j]; + const struct xkb_key_type_entry *entry = &type->entries[j]; /* * Printing level 1 entries is redundant, it's the default, @@ -221,63 +212,57 @@ write_types(struct xkb_keymap *keymap, struct buf *buf) continue; str = ModMaskText(keymap, entry->mods.mods); - write_buf(buf, "\t\t\tmap[%s]= Level%d;\n", + write_buf(buf, "\t\tmap[%s]= Level%d;\n", str, entry->level + 1); - if (entry->preserve.mods == 0) - continue; - - write_buf(buf, "\t\t\tpreserve[%s]= ", str); - write_buf(buf, "%s;\n", - ModMaskText(keymap, entry->preserve.mods)); + if (entry->preserve.mods) + write_buf(buf, "\t\tpreserve[%s]= %s;\n", + str, ModMaskText(keymap, entry->preserve.mods)); } - if (type->level_names) { - for (n = 0; n < type->num_levels; n++) { - if (!type->level_names[n]) - continue; - write_buf(buf, "\t\t\tlevel_name[Level%d]= \"%s\";\n", n + 1, + for (xkb_level_index_t n = 0; n < type->num_levels; n++) + if (type->level_names[n]) + write_buf(buf, "\t\tlevel_name[Level%d]= \"%s\";\n", n + 1, xkb_atom_text(keymap->ctx, type->level_names[n])); - } - } - write_buf(buf, "\t\t};\n"); + + write_buf(buf, "\t};\n"); } - write_buf(buf, "\t};\n\n"); + write_buf(buf, "};\n\n"); return true; } static bool -write_indicator_map(struct xkb_keymap *keymap, struct buf *buf, - const struct xkb_indicator_map *led) +write_led_map(struct xkb_keymap *keymap, struct buf *buf, + const struct xkb_led *led) { - write_buf(buf, "\t\tindicator \"%s\" {\n", + write_buf(buf, "\tindicator \"%s\" {\n", xkb_atom_text(keymap->ctx, led->name)); if (led->which_groups) { if (led->which_groups != XKB_STATE_LAYOUT_EFFECTIVE) { - write_buf(buf, "\t\t\twhichGroupState= %s;\n", - IndicatorStateText(keymap->ctx, led->which_groups)); + write_buf(buf, "\t\twhichGroupState= %s;\n", + LedStateMaskText(keymap->ctx, led->which_groups)); } - write_buf(buf, "\t\t\tgroups= 0x%02x;\n", + write_buf(buf, "\t\tgroups= 0x%02x;\n", led->groups); } if (led->which_mods) { if (led->which_mods != XKB_STATE_MODS_EFFECTIVE) { - write_buf(buf, "\t\t\twhichModState= %s;\n", - IndicatorStateText(keymap->ctx, led->which_mods)); + write_buf(buf, "\t\twhichModState= %s;\n", + LedStateMaskText(keymap->ctx, led->which_mods)); } - write_buf(buf, "\t\t\tmodifiers= %s;\n", + write_buf(buf, "\t\tmodifiers= %s;\n", ModMaskText(keymap, led->mods.mods)); } if (led->ctrls) { - write_buf(buf, "\t\t\tcontrols= %s;\n", + write_buf(buf, "\t\tcontrols= %s;\n", ControlMaskText(keymap->ctx, led->ctrls)); } - write_buf(buf, "\t\t};\n"); + write_buf(buf, "\t};\n"); return true; } @@ -424,221 +409,216 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, static bool write_compat(struct xkb_keymap *keymap, struct buf *buf) { - struct xkb_sym_interpret *interp; - const struct xkb_indicator_map *led; + const struct xkb_sym_interpret *si; + const struct xkb_led *led; if (keymap->compat_section_name) - write_buf(buf, "\txkb_compatibility \"%s\" {\n\n", + write_buf(buf, "xkb_compatibility \"%s\" {\n", keymap->compat_section_name); else - write_buf(buf, "\txkb_compatibility {\n\n"); + write_buf(buf, "xkb_compatibility {\n"); write_vmods(keymap, buf); - write_buf(buf, "\t\tinterpret.useModMapMods= AnyLevel;\n"); - write_buf(buf, "\t\tinterpret.repeat= False;\n"); + write_buf(buf, "\tinterpret.useModMapMods= AnyLevel;\n"); + write_buf(buf, "\tinterpret.repeat= False;\n"); - darray_foreach(interp, keymap->sym_interprets) { - char keysym_name[64]; + darray_foreach(si, keymap->sym_interprets) { + write_buf(buf, "\tinterpret %s+%s(%s) {\n", + si->sym ? KeysymText(keymap->ctx, si->sym) : "Any", + SIMatchText(si->match), + ModMaskText(keymap, si->mods)); - if (interp->sym == XKB_KEY_NoSymbol) - sprintf(keysym_name, "Any"); - else - xkb_keysym_get_name(interp->sym, keysym_name, sizeof(keysym_name)); - - write_buf(buf, "\t\tinterpret %s+%s(%s) {\n", - keysym_name, - SIMatchText(interp->match), - ModMaskText(keymap, interp->mods)); + if (si->virtual_mod != XKB_MOD_INVALID) + write_buf(buf, "\t\tvirtualModifier= %s;\n", + ModIndexText(keymap, si->virtual_mod)); - if (interp->virtual_mod != XKB_MOD_INVALID) - write_buf(buf, "\t\t\tvirtualModifier= %s;\n", - ModIndexText(keymap, interp->virtual_mod)); + if (si->level_one_only) + write_buf(buf, "\t\tuseModMapMods=level1;\n"); - if (interp->level_one_only) - write_buf(buf, "\t\t\tuseModMapMods=level1;\n"); - if (interp->repeat) - write_buf(buf, "\t\t\trepeat= True;\n"); + if (si->repeat) + write_buf(buf, "\t\trepeat= True;\n"); - write_action(keymap, buf, &interp->action, "\t\t\taction= ", ";\n"); - write_buf(buf, "\t\t};\n"); + write_action(keymap, buf, &si->action, "\t\taction= ", ";\n"); + write_buf(buf, "\t};\n"); } - darray_foreach(led, keymap->indicators) + darray_foreach(led, keymap->leds) if (led->which_groups || led->groups || led->which_mods || led->mods.mods || led->ctrls) - write_indicator_map(keymap, buf, led); + write_led_map(keymap, buf, led); - write_buf(buf, "\t};\n\n"); + write_buf(buf, "};\n\n"); return true; } static bool write_keysyms(struct xkb_keymap *keymap, struct buf *buf, - struct xkb_key *key, xkb_layout_index_t group) + const struct xkb_key *key, xkb_layout_index_t group) { - const xkb_keysym_t *syms; - int num_syms; - xkb_level_index_t level; -#define OUT_BUF_LEN 128 - char out_buf[OUT_BUF_LEN]; + for (xkb_level_index_t level = 0; level < XkbKeyGroupWidth(key, group); + level++) { + const xkb_keysym_t *syms; + int num_syms; - for (level = 0; level < XkbKeyGroupWidth(key, group); level++) { if (level != 0) write_buf(buf, ", "); + num_syms = xkb_keymap_key_get_syms_by_level(keymap, key->keycode, group, level, &syms); if (num_syms == 0) { write_buf(buf, "%15s", "NoSymbol"); } else if (num_syms == 1) { - xkb_keysym_get_name(syms[0], out_buf, OUT_BUF_LEN); - write_buf(buf, "%15s", out_buf); + write_buf(buf, "%15s", KeysymText(keymap->ctx, syms[0])); } else { - int s; write_buf(buf, "{ "); - for (s = 0; s < num_syms; s++) { + for (int s = 0; s < num_syms; s++) { if (s != 0) write_buf(buf, ", "); - xkb_keysym_get_name(syms[s], out_buf, OUT_BUF_LEN); - write_buf(buf, "%s", out_buf); + write_buf(buf, "%s", KeysymText(keymap->ctx, syms[s])); } write_buf(buf, " }"); } } -#undef OUT_BUF_LEN return true; } static bool -write_symbols(struct xkb_keymap *keymap, struct buf *buf) +write_key(struct xkb_keymap *keymap, struct buf *buf, + const struct xkb_key *key) { - struct xkb_key *key; xkb_layout_index_t group; - bool showActions; + bool simple = true; + bool explicit_types = false; + bool multi_type = false; + bool show_actions; - if (keymap->symbols_section_name) - write_buf(buf, "\txkb_symbols \"%s\" {\n\n", - keymap->symbols_section_name); - else - write_buf(buf, "\txkb_symbols {\n\n"); + write_buf(buf, "\tkey %-20s {", KeyNameText(keymap->ctx, key->name)); - for (group = 0; group < keymap->num_group_names; group++) - if (keymap->group_names[group]) - write_buf(buf, - "\t\tname[group%d]=\"%s\";\n", group + 1, - xkb_atom_text(keymap->ctx, keymap->group_names[group])); - if (group > 0) - write_buf(buf, "\n"); + for (group = 0; group < key->num_groups; group++) { + if (key->groups[group].explicit_type) + explicit_types = true; - xkb_foreach_key(key, keymap) { - bool simple = true; - bool explicit_types = false; - bool multi_type = false; - - if (key->num_groups == 0) - continue; - - write_buf(buf, "\t\tkey %-20s {", KeyNameText(keymap->ctx, key->name)); - - for (group = 0; group < key->num_groups; group++) { - if (key->groups[group].explicit_type) - explicit_types = true; - - if (group != 0 && key->groups[group].type != key->groups[0].type) - multi_type = true; - } + if (group != 0 && key->groups[group].type != key->groups[0].type) + multi_type = true; + } - if (explicit_types) { - const struct xkb_key_type *type; - simple = false; + if (explicit_types) { + const struct xkb_key_type *type; + simple = false; - if (multi_type) { - for (group = 0; group < key->num_groups; group++) { - if (!key->groups[group].explicit_type) - continue; + if (multi_type) { + for (group = 0; group < key->num_groups; group++) { + if (!key->groups[group].explicit_type) + continue; - type = key->groups[group].type; - write_buf(buf, "\n\t\t\ttype[group%u]= \"%s\",", - group + 1, - xkb_atom_text(keymap->ctx, type->name)); - } - } - else { - type = key->groups[0].type; - write_buf(buf, "\n\t\t\ttype= \"%s\",", - xkb_atom_text(keymap->ctx, type->name)); + type = key->groups[group].type; + write_buf(buf, "\n\t\ttype[group%u]= \"%s\",", + group + 1, + xkb_atom_text(keymap->ctx, type->name)); } } - - if (key->explicit & EXPLICIT_REPEAT) { - if (key->repeats) - write_buf(buf, "\n\t\t\trepeat= Yes,"); - else - write_buf(buf, "\n\t\t\trepeat= No,"); - simple = false; + else { + type = key->groups[0].type; + write_buf(buf, "\n\t\ttype= \"%s\",", + xkb_atom_text(keymap->ctx, type->name)); } + } - if (key->vmodmap && (key->explicit & EXPLICIT_VMODMAP)) - write_buf(buf, "\n\t\t\tvirtualMods= %s,", - ModMaskText(keymap, key->vmodmap)); + if (key->explicit & EXPLICIT_REPEAT) { + if (key->repeats) + write_buf(buf, "\n\t\trepeat= Yes,"); + else + write_buf(buf, "\n\t\trepeat= No,"); + simple = false; + } - switch (key->out_of_range_group_action) { - case RANGE_SATURATE: - write_buf(buf, "\n\t\t\tgroupsClamp,"); - break; + if (key->vmodmap && (key->explicit & EXPLICIT_VMODMAP)) + write_buf(buf, "\n\t\tvirtualMods= %s,", + ModMaskText(keymap, key->vmodmap)); - case RANGE_REDIRECT: - write_buf(buf, "\n\t\t\tgroupsRedirect= Group%u,", - key->out_of_range_group_number + 1); - break; + switch (key->out_of_range_group_action) { + case RANGE_SATURATE: + write_buf(buf, "\n\t\tgroupsClamp,"); + break; - default: - break; - } + case RANGE_REDIRECT: + write_buf(buf, "\n\t\tgroupsRedirect= Group%u,", + key->out_of_range_group_number + 1); + break; - showActions = !!(key->explicit & EXPLICIT_INTERP); + default: + break; + } - if (key->num_groups > 1 || showActions) - simple = false; + show_actions = !!(key->explicit & EXPLICIT_INTERP); - if (simple) { - write_buf(buf, "\t[ "); - if (!write_keysyms(keymap, buf, key, 0)) - return false; - write_buf(buf, " ] };\n"); - } - else { - xkb_level_index_t level; + if (key->num_groups > 1 || show_actions) + simple = false; - for (group = 0; group < key->num_groups; group++) { - if (group != 0) - write_buf(buf, ","); - write_buf(buf, "\n\t\t\tsymbols[Group%u]= [ ", group + 1); - if (!write_keysyms(keymap, buf, key, group)) - return false; - write_buf(buf, " ]"); - if (showActions) { - write_buf(buf, ",\n\t\t\tactions[Group%u]= [ ", - group + 1); - for (level = 0; - level < XkbKeyGroupWidth(key, group); level++) { - if (level != 0) - write_buf(buf, ", "); - write_action(keymap, buf, - &key->groups[group].levels[level].action, - NULL, NULL); - } - write_buf(buf, " ]"); + if (simple) { + write_buf(buf, "\t[ "); + if (!write_keysyms(keymap, buf, key, 0)) + return false; + write_buf(buf, " ] };\n"); + } + else { + xkb_level_index_t level; + + for (group = 0; group < key->num_groups; group++) { + if (group != 0) + write_buf(buf, ","); + write_buf(buf, "\n\t\tsymbols[Group%u]= [ ", group + 1); + if (!write_keysyms(keymap, buf, key, group)) + return false; + write_buf(buf, " ]"); + if (show_actions) { + write_buf(buf, ",\n\t\tactions[Group%u]= [ ", group + 1); + for (level = 0; + level < XkbKeyGroupWidth(key, group); level++) { + if (level != 0) + write_buf(buf, ", "); + write_action(keymap, buf, + &key->groups[group].levels[level].action, + NULL, NULL); } + write_buf(buf, " ]"); } - write_buf(buf, "\n\t\t};\n"); } + write_buf(buf, "\n\t};\n"); } + return true; +} + +static bool +write_symbols(struct xkb_keymap *keymap, struct buf *buf) +{ + const struct xkb_key *key; + xkb_layout_index_t group; + + if (keymap->symbols_section_name) + write_buf(buf, "xkb_symbols \"%s\" {\n", + keymap->symbols_section_name); + else + write_buf(buf, "xkb_symbols {\n"); + + for (group = 0; group < keymap->num_group_names; group++) + if (keymap->group_names[group]) + write_buf(buf, + "\tname[group%d]=\"%s\";\n", group + 1, + xkb_atom_text(keymap->ctx, keymap->group_names[group])); + if (group > 0) + write_buf(buf, "\n"); + + xkb_foreach_key(key, keymap) + if (key->num_groups > 0) + write_key(keymap, buf, key); + xkb_foreach_key(key, keymap) { xkb_mod_index_t i; const struct xkb_mod *mod; @@ -646,43 +626,37 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) if (key->modmap == 0) continue; - darray_enumerate(i, mod, keymap->mods) { - if (!(key->modmap & (1 << i))) - continue; - - write_buf(buf, "\t\tmodifier_map %s { %s };\n", - xkb_atom_text(keymap->ctx, mod->name), - KeyNameText(keymap->ctx, key->name)); - } + darray_enumerate(i, mod, keymap->mods) + if (key->modmap & (1 << i)) + write_buf(buf, "\tmodifier_map %s { %s };\n", + xkb_atom_text(keymap->ctx, mod->name), + KeyNameText(keymap->ctx, key->name)); } - write_buf(buf, "\t};\n\n"); + write_buf(buf, "};\n\n"); return true; } -XKB_EXPORT char * -xkb_keymap_get_as_string(struct xkb_keymap *keymap, - enum xkb_keymap_format format) +static bool +write_keymap(struct xkb_keymap *keymap, struct buf *buf) { - bool ok; - struct buf buf = { NULL, 0, 0 }; + return (check_write_buf(buf, "xkb_keymap {\n") && + write_keycodes(keymap, buf) && + write_types(keymap, buf) && + write_compat(keymap, buf) && + write_symbols(keymap, buf) && + check_write_buf(buf, "};\n")); +} - if (format == XKB_KEYMAP_USE_ORIGINAL_FORMAT) - format = keymap->format; +char * +text_v1_keymap_get_as_string(struct xkb_keymap *keymap) +{ + struct buf buf = { NULL, 0, 0 }; - if (format != XKB_KEYMAP_FORMAT_TEXT_V1) { - log_err(keymap->ctx, - "Trying to get a keymap as a string in an unsupported format (%d)\n", - format); + if (!write_keymap(keymap, &buf)) { + free(buf.buf); return NULL; } - ok = (check_write_buf(&buf, "xkb_keymap {\n") && - write_keycodes(keymap, &buf) && - write_types(keymap, &buf) && - write_compat(keymap, &buf) && - write_symbols(keymap, &buf) && - check_write_buf(&buf, "};\n")); - - return (ok ? buf.buf : NULL); + return buf.buf; } diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index a3503b8..bed3930 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -95,7 +95,7 @@ FindInterpForKey(struct xkb_keymap *keymap, const struct xkb_key *key, */ darray_foreach(interp, keymap->sym_interprets) { xkb_mod_mask_t mods; - bool found; + bool found = false; if ((num_syms > 1 || interp->sym != syms[0]) && interp->sym != XKB_KEY_NoSymbol) @@ -180,7 +180,7 @@ static bool UpdateDerivedKeymapFields(struct xkb_keymap *keymap) { struct xkb_mod *mod; - struct xkb_indicator_map *im; + struct xkb_led *led; unsigned int i, j; struct xkb_key *key; @@ -201,8 +201,8 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap) ComputeEffectiveMask(keymap, &keymap->types[i].mods); for (j = 0; j < keymap->types[i].num_entries; j++) { - ComputeEffectiveMask(keymap, &keymap->types[i].map[j].mods); - ComputeEffectiveMask(keymap, &keymap->types[i].map[j].preserve); + ComputeEffectiveMask(keymap, &keymap->types[i].entries[j].mods); + ComputeEffectiveMask(keymap, &keymap->types[i].entries[j].preserve); } } @@ -213,9 +213,9 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap) UpdateActionMods(keymap, &key->groups[i].levels[j].action, key->modmap); - /* Update vmod -> indicator maps. */ - darray_foreach(im, keymap->indicators) - ComputeEffectiveMask(keymap, &im->mods); + /* Update vmod -> led maps. */ + darray_foreach(led, keymap->leds) + ComputeEffectiveMask(keymap, &led->mods); /* Find maximum number of groups out of all keys in the keymap. */ xkb_foreach_key(key, keymap) @@ -233,7 +233,7 @@ UpdateBuiltinKeymapFields(struct xkb_keymap *keymap) * Add predefined (AKA real, core, X11) modifiers. * The order is important! */ - darray_appends(keymap->mods, + darray_appends_t(keymap->mods, struct xkb_mod, { .name = xkb_atom_intern(ctx, "Shift"), .type = MOD_REAL }, { .name = xkb_atom_intern(ctx, "Lock"), .type = MOD_REAL }, { .name = xkb_atom_intern(ctx, "Control"), .type = MOD_REAL }, diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index 5d10a4b..90ac75e 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -142,8 +142,8 @@ _xkbcommon_error(struct YYLTYPE *loc, struct parser_param *param, const char *ms SymbolsDef *syms; ModMapDef *modMask; GroupCompatDef *groupCompat; - IndicatorMapDef *ledMap; - IndicatorNameDef *ledName; + LedMapDef *ledMap; + LedNameDef *ledName; KeycodeDef *keyCode; KeyAliasDef *keyAlias; void *geom; @@ -171,8 +171,8 @@ _xkbcommon_error(struct YYLTYPE *loc, struct parser_param *param, const char *ms %type <syms> SymbolsDecl %type <modMask> ModMapDecl %type <groupCompat> GroupCompatDecl -%type <ledMap> IndicatorMapDecl -%type <ledName> IndicatorNameDecl +%type <ledMap> LedMapDecl +%type <ledName> LedNameDecl %type <keyCode> KeyNameDecl %type <keyAlias> KeyAliasDecl %type <geom> ShapeDecl SectionDecl SectionBody SectionBodyItem RowBody RowBodyItem @@ -315,12 +315,12 @@ Decl : OptMergeMode VarDecl $2->merge = $1; $$ = &$2->common; } - | OptMergeMode IndicatorMapDecl + | OptMergeMode LedMapDecl { $2->merge = $1; $$ = &$2->common; } - | OptMergeMode IndicatorNameDecl + | OptMergeMode LedNameDecl { $2->merge = $1; $$ = &$2->common; @@ -425,14 +425,14 @@ ModMapDecl : MODIFIER_MAP Ident OBRACE ExprList CBRACE SEMI { $$ = ModMapCreate($2, $4); } ; -IndicatorMapDecl: INDICATOR String OBRACE VarDeclList CBRACE SEMI - { $$ = IndicatorMapCreate($2, $4); } +LedMapDecl: INDICATOR String OBRACE VarDeclList CBRACE SEMI + { $$ = LedMapCreate($2, $4); } ; -IndicatorNameDecl: INDICATOR Integer EQUALS Expr SEMI - { $$ = IndicatorNameCreate($2, $4, false); } +LedNameDecl: INDICATOR Integer EQUALS Expr SEMI + { $$ = LedNameCreate($2, $4, false); } | VIRTUAL INDICATOR Integer EQUALS Expr SEMI - { $$ = IndicatorNameCreate($3, $5, true); } + { $$ = LedNameCreate($3, $5, true); } ; ShapeDecl : SHAPE String OBRACE OutlineList CBRACE SEMI @@ -455,7 +455,7 @@ SectionBodyItem : ROW OBRACE RowBody CBRACE SEMI { FreeStmt(&$1->common); $$ = NULL; } | DoodadDecl { $$ = NULL; } - | IndicatorMapDecl + | LedMapDecl { FreeStmt(&$1->common); $$ = NULL; } | OverlayDecl { $$ = NULL; } @@ -544,7 +544,7 @@ Element : ACTION_TOK | INDICATOR { $$ = xkb_atom_intern(param->ctx, "indicator"); } | SHAPE - { $$ = xkb_atom_intern(param->ctx, "shape"); } + { $$ = XKB_ATOM_NONE; } | ROW { $$ = XKB_ATOM_NONE; } | SECTION diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c index 1653f42..3f71760 100644 --- a/src/xkbcomp/rules.c +++ b/src/xkbcomp/rules.c @@ -213,35 +213,26 @@ scanner_init(struct scanner *s, struct xkb_context *ctx, static char peek(struct scanner *s) { - return s->s[s->pos]; + return s->pos < s->len ? s->s[s->pos] : '\0'; } static bool eof(struct scanner *s) { - return s->s[s->pos] == '\0' || s->pos >= s->len; + return peek(s) == '\0'; } static bool eol(struct scanner *s) { - return s->s[s->pos] == '\n'; + return peek(s) == '\n'; } -/* - * Use the check_nl variant when the current char might be a new line; - * just an optimization. - */ static char next(struct scanner *s) { - s->column++; - return s->s[s->pos++]; -} - -static char -next_check_nl(struct scanner *s) -{ + if (eof(s)) + return '\0'; if (eol(s)) { s->line++; s->column = 1; @@ -264,6 +255,8 @@ chr(struct scanner *s, char ch) static bool str(struct scanner *s, const char *string, size_t len) { + if (s->len - s->pos < len) + return false; if (strncasecmp(s->s + s->pos, string, len) != 0) return false; s->pos += len; s->column += len; @@ -286,7 +279,7 @@ skip_more_whitespace_and_comments: /* New line. */ if (eol(s)) { - while (eol(s)) next_check_nl(s); + while (eol(s)) next(s); return TOK_END_OF_LINE; } @@ -297,7 +290,7 @@ skip_more_whitespace_and_comments: "illegal new line escape; must appear at end of line"); return TOK_ERROR; } - next_check_nl(s); + next(s); goto skip_more_whitespace_and_comments; } @@ -555,6 +548,7 @@ static int extract_layout_index(const char *s, size_t max_len, xkb_layout_index_t *out) { /* This function is pretty stupid, but works for now. */ + *out = XKB_LAYOUT_INVALID; if (max_len < 3) return -1; if (s[0] != '[' || !isdigit(s[1]) || s[2] != ']') diff --git a/src/xkbcomp/scanner.l b/src/xkbcomp/scanner.l index 5ccf3e9..f30462d 100644 --- a/src/xkbcomp/scanner.l +++ b/src/xkbcomp/scanner.l @@ -267,6 +267,38 @@ XkbParseString(struct xkb_context *ctx, const char *string, return xkb_file; } +/* + * yy_scan_buffer() requires the last two bytes of \buf to be 0. These two bytes + * are not scanned. Other zero bytes in the buffer are scanned normally, though. + * Due to these terminating zeroes, \length must be greater than 2. + * Furthermore, the buffer must be writable and you cannot make any assumptions + * about it after the scanner finished. + * All this must be guaranteed by the caller of this function! + */ +XkbFile * +XkbParseBuffer(struct xkb_context *ctx, char *buf, size_t length, + const char *file_name) +{ + yyscan_t scanner; + struct scanner_extra extra; + YY_BUFFER_STATE state; + XkbFile *xkb_file; + + if (!init_scanner(&scanner, &extra, ctx, file_name)) + return NULL; + + xkb_file = NULL; + state = yy_scan_buffer(buf, length, scanner); + if (state) { + xkb_file = parse(ctx, scanner, NULL); + yy_delete_buffer(state, scanner); + } + + clear_scanner(scanner); + + return xkb_file; +} + XkbFile * XkbParseFile(struct xkb_context *ctx, FILE *file, const char *file_name, const char *map) diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 6f87a7b..a2970f5 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -56,7 +56,6 @@ #include "expr.h" #include "action.h" #include "vmod.h" -#include "keycodes.h" #include "include.h" #include "keysym.h" @@ -74,7 +73,7 @@ enum group_field { enum key_field { KEY_FIELD_REPEAT = (1 << 0), - KEY_FIELD_TYPE_DFLT = (1 << 1), + KEY_FIELD_DEFAULT_TYPE = (1 << 1), KEY_FIELD_GROUPINFO = (1 << 2), KEY_FIELD_VMODMAP = (1 << 3), }; @@ -87,7 +86,6 @@ typedef struct { typedef struct { enum key_field defined; - unsigned file_id; enum merge_mode merge; xkb_atom_t name; @@ -96,7 +94,7 @@ typedef struct { enum key_repeat repeat; xkb_mod_mask_t vmodmap; - xkb_atom_t dfltType; + xkb_atom_t default_type; enum xkb_range_exceed_type out_of_range_group_action; xkb_layout_index_t out_of_range_group_number; @@ -141,10 +139,9 @@ CopyGroupInfo(GroupInfo *to, const GroupInfo *from) } static void -InitKeyInfo(struct xkb_context *ctx, KeyInfo *keyi, unsigned file_id) +InitKeyInfo(struct xkb_context *ctx, KeyInfo *keyi) { memset(keyi, 0, sizeof(*keyi)); - keyi->file_id = file_id; keyi->merge = MERGE_OVERRIDE; keyi->name = xkb_atom_intern(ctx, "*"); keyi->out_of_range_group_action = RANGE_WRAP; @@ -174,11 +171,10 @@ typedef struct { typedef struct { char *name; /* e.g. pc+us+inet(evdev) */ int errorCount; - unsigned file_id; enum merge_mode merge; xkb_layout_index_t explicit_group; darray(KeyInfo) keys; - KeyInfo dflt; + KeyInfo default_key; ActionsInfo *actions; darray(xkb_atom_t) group_names; darray(ModMapEntry) modMaps; @@ -188,19 +184,18 @@ typedef struct { static void InitSymbolsInfo(SymbolsInfo *info, struct xkb_keymap *keymap, - unsigned file_id, ActionsInfo *actions) + ActionsInfo *actions) { memset(info, 0, sizeof(*info)); info->keymap = keymap; - info->file_id = file_id; info->merge = MERGE_OVERRIDE; - InitKeyInfo(keymap->ctx, &info->dflt, file_id); + InitKeyInfo(keymap->ctx, &info->default_key); info->actions = actions; info->explicit_group = XKB_LAYOUT_INVALID; } static void -ClearSymbolsInfo(SymbolsInfo * info) +ClearSymbolsInfo(SymbolsInfo *info) { KeyInfo *keyi; free(info->name); @@ -209,7 +204,7 @@ ClearSymbolsInfo(SymbolsInfo * info) darray_free(info->keys); darray_free(info->group_names); darray_free(info->modMaps); - ClearKeyInfo(&info->dflt); + ClearKeyInfo(&info->default_key); } static const char * @@ -349,27 +344,23 @@ UseNewKeyField(enum key_field field, enum key_field old, enum key_field new, } static bool -MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from) +MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from, bool same_file) { xkb_layout_index_t i; xkb_layout_index_t groups_in_both; enum key_field collide = 0; - bool clobber, report; - int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const bool clobber = (from->merge != MERGE_AUGMENT); + const bool report = (same_file && verbosity > 0) || verbosity > 9; if (from->merge == MERGE_REPLACE) { ClearKeyInfo(into); *into = *from; - InitKeyInfo(info->keymap->ctx, from, info->file_id); + InitKeyInfo(info->keymap->ctx, from); return true; } - clobber = (from->merge != MERGE_AUGMENT); - report = (verbosity > 9 || - (into->file_id == from->file_id && verbosity > 0)); - - groups_in_both = MIN(darray_size(into->groups), - darray_size(from->groups)); + groups_in_both = MIN(darray_size(into->groups), darray_size(from->groups)); for (i = 0; i < groups_in_both; i++) MergeGroups(info, &darray_item(into->groups, i), @@ -391,10 +382,10 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from) into->repeat = from->repeat; into->defined |= KEY_FIELD_REPEAT; } - if (UseNewKeyField(KEY_FIELD_TYPE_DFLT, into->defined, from->defined, + if (UseNewKeyField(KEY_FIELD_DEFAULT_TYPE, into->defined, from->defined, clobber, report, &collide)) { - into->dfltType = from->dfltType; - into->defined |= KEY_FIELD_TYPE_DFLT; + into->default_type = from->default_type; + into->defined |= KEY_FIELD_DEFAULT_TYPE; } if (UseNewKeyField(KEY_FIELD_GROUPINFO, into->defined, from->defined, clobber, report, &collide)) { @@ -411,12 +402,12 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from) (clobber ? "first" : "last")); ClearKeyInfo(from); - InitKeyInfo(info->keymap->ctx, from, info->file_id); + InitKeyInfo(info->keymap->ctx, from); return true; } static bool -AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi) +AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi, bool same_file) { xkb_atom_t real_name; KeyInfo *iter; @@ -427,15 +418,16 @@ AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi) * following loop) is enough, and we won't get multiple KeyInfo's * for the same key because of aliases. */ - if (FindKeyNameForAlias(info->keymap, keyi->name, &real_name)) + real_name = XkbResolveKeyAlias(info->keymap, keyi->name); + if (real_name != XKB_ATOM_NONE) keyi->name = real_name; darray_foreach(iter, info->keys) if (iter->name == keyi->name) - return MergeKeys(info, iter, keyi); + return MergeKeys(info, iter, keyi, same_file); darray_append(info->keys, *keyi); - InitKeyInfo(info->keymap->ctx, keyi, info->file_id); + InitKeyInfo(info->keymap->ctx, keyi); return true; } @@ -520,8 +512,8 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, darray_append(into->group_names, *group_name); darray_foreach(keyi, from->keys) { - merge = (merge == MERGE_DEFAULT ? keyi->merge : merge); - if (!AddKeySymbols(into, keyi)) + keyi->merge = (merge == MERGE_DEFAULT ? keyi->merge : merge); + if (!AddKeySymbols(into, keyi, false)) into->errorCount++; } @@ -536,29 +528,26 @@ static void HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge); static bool -HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *stmt) +HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include) { - enum merge_mode merge = MERGE_DEFAULT; - XkbFile *rtrn; - SymbolsInfo included, next_incl; + SymbolsInfo included; - InitSymbolsInfo(&included, info->keymap, info->file_id, info->actions); - if (stmt->stmt) { - free(included.name); - included.name = stmt->stmt; - stmt->stmt = NULL; - } + InitSymbolsInfo(&included, info->keymap, info->actions); + included.name = include->stmt; + include->stmt = NULL; - for (; stmt; stmt = stmt->next_incl) { - if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS, - &rtrn, &merge)) { + for (IncludeStmt *stmt = include; stmt; stmt = stmt->next_incl) { + SymbolsInfo next_incl; + XkbFile *file; + + file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS); + if (!file) { info->errorCount += 10; ClearSymbolsInfo(&included); return false; } - InitSymbolsInfo(&next_incl, info->keymap, rtrn->id, info->actions); - next_incl.merge = next_incl.dflt.merge = MERGE_OVERRIDE; + InitSymbolsInfo(&next_incl, info->keymap, info->actions); if (stmt->modifier) { next_incl.explicit_group = atoi(stmt->modifier) - 1; if (next_incl.explicit_group >= XKB_MAX_GROUPS) { @@ -573,15 +562,15 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *stmt) next_incl.explicit_group = info->explicit_group; } - HandleSymbolsFile(&next_incl, rtrn, MERGE_OVERRIDE); + HandleSymbolsFile(&next_incl, file, MERGE_OVERRIDE); - MergeIncludedSymbols(&included, &next_incl, merge); + MergeIncludedSymbols(&included, &next_incl, stmt->merge); ClearSymbolsInfo(&next_incl); - FreeXkbFile(rtrn); + FreeXkbFile(file); } - MergeIncludedSymbols(info, &included, merge); + MergeIncludedSymbols(info, &included, include->merge); ClearSymbolsInfo(&included); return (info->errorCount == 0); @@ -841,8 +830,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, "Ignoring illegal type definition\n"); if (arrayNdx == NULL) { - keyi->dfltType = val; - keyi->defined |= KEY_FIELD_TYPE_DFLT; + keyi->default_type = val; + keyi->defined |= KEY_FIELD_DEFAULT_TYPE; } else if (!ExprResolveGroup(ctx, arrayNdx, &ndx)) { log_err(ctx, @@ -988,7 +977,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, static int SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value) { - xkb_layout_index_t grp, grp_to_use; + xkb_layout_index_t group, group_to_use; xkb_atom_t name; if (!arrayNdx) { @@ -998,7 +987,7 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value) return false; } - if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, &grp)) { + if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, &group)) { log_err(info->keymap->ctx, "Illegal index in group name definition; " "Definition with non-integer array index ignored\n"); @@ -1008,30 +997,30 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value) if (!ExprResolveString(info->keymap->ctx, value, &name)) { log_err(info->keymap->ctx, "Group name must be a string; " - "Illegal name for group %d ignored\n", grp); + "Illegal name for group %d ignored\n", group); return false; } - grp_to_use = XKB_LAYOUT_INVALID; if (info->explicit_group == XKB_LAYOUT_INVALID) { - grp_to_use = grp - 1; + group_to_use = group - 1; } - else if (grp - 1 == 0) { - grp_to_use = info->explicit_group; + else if (group - 1 == 0) { + group_to_use = info->explicit_group; } else { log_warn(info->keymap->ctx, "An explicit group was specified for the '%s' map, " "but it provides a name for a group other than Group1 (%d); " "Ignoring group name '%s'\n", - info->name, grp, + info->name, group, xkb_atom_text(info->keymap->ctx, name)); return false; } - if (grp_to_use >= darray_size(info->group_names)) - darray_resize0(info->group_names, grp_to_use + 1); - darray_item(info->group_names, grp_to_use) = name; + if (group_to_use >= darray_size(info->group_names)) + darray_resize0(info->group_names, group_to_use + 1); + darray_item(info->group_names, group_to_use) = name; + return true; } @@ -1046,7 +1035,7 @@ HandleGlobalVar(SymbolsInfo *info, VarDef *stmt) &arrayNdx) == 0) return 0; /* internal error, already reported */ if (elem && istreq(elem, "key")) { - ret = SetSymbolsField(info, &info->dflt, field, arrayNdx, + ret = SetSymbolsField(info, &info->default_key, field, arrayNdx, stmt->value); } else if (!elem && (istreq(field, "name") || @@ -1160,12 +1149,12 @@ HandleSymbolsDef(SymbolsInfo *info, SymbolsDef *stmt) KeyInfo keyi; xkb_layout_index_t i; - keyi = info->dflt; + keyi = info->default_key; darray_init(keyi.groups); - darray_copy(keyi.groups, info->dflt.groups); + darray_copy(keyi.groups, info->default_key.groups); for (i = 0; i < darray_size(keyi.groups); i++) CopyGroupInfo(&darray_item(keyi.groups, i), - &darray_item(info->dflt.groups, i)); + &darray_item(info->default_key.groups, i)); keyi.merge = stmt->merge; keyi.name = stmt->keyName; @@ -1179,7 +1168,7 @@ HandleSymbolsDef(SymbolsInfo *info, SymbolsDef *stmt) return false; } - if (!AddKeySymbols(info, &keyi)) { + if (!AddKeySymbols(info, &keyi, true)) { info->errorCount++; return false; } @@ -1236,13 +1225,11 @@ static void HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge) { bool ok; - ParseCommon *stmt; free(info->name); info->name = strdup_safe(file->name); - stmt = file->defs; - for (stmt = file->defs; stmt; stmt = stmt->next) { + for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) { switch (stmt->type) { case STMT_INCLUDE: ok = HandleIncludeSymbols(info, (IncludeStmt *) stmt); @@ -1400,8 +1387,8 @@ FindTypeForGroup(struct xkb_keymap *keymap, KeyInfo *keyi, *explicit_type = true; if (type_name == XKB_ATOM_NONE) { - if (keyi->dfltType != XKB_ATOM_NONE) { - type_name = keyi->dfltType; + if (keyi->default_type != XKB_ATOM_NONE) { + type_name = keyi->default_type; } else { type_name = FindAutomaticType(keymap->ctx, groupi); @@ -1455,7 +1442,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi) * The name is guaranteed to be real and not an alias (see * AddKeySymbols), so 'false' is safe here. */ - key = FindNamedKey(keymap, keyi->name, false); + key = XkbKeyByName(keymap, keyi->name, false); if (!key) { log_vrb(info->keymap->ctx, 5, "Key %s not found in keycodes; Symbols ignored\n", @@ -1552,7 +1539,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry) struct xkb_keymap *keymap = info->keymap; if (!entry->haveSymbol) { - key = FindNamedKey(keymap, entry->u.keyName, true); + key = XkbKeyByName(keymap, entry->u.keyName, true); if (!key) { log_vrb(info->keymap->ctx, 5, "Key %s not found in keycodes; " @@ -1626,8 +1613,8 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, if (!actions) return false; - InitSymbolsInfo(&info, keymap, file->id, actions); - info.dflt.merge = merge; + InitSymbolsInfo(&info, keymap, actions); + info.default_key.merge = merge; HandleSymbolsFile(&info, file, merge); diff --git a/src/xkbcomp/types.c b/src/xkbcomp/types.c index 6518482..1eb1b73 100644 --- a/src/xkbcomp/types.c +++ b/src/xkbcomp/types.c @@ -144,20 +144,18 @@ enum type_field { typedef struct { enum type_field defined; - unsigned file_id; enum merge_mode merge; xkb_atom_t name; xkb_mod_mask_t mods; xkb_level_index_t num_levels; - darray(struct xkb_kt_map_entry) entries; + darray(struct xkb_key_type_entry) entries; darray(xkb_atom_t) level_names; } KeyTypeInfo; typedef struct { char *name; int errorCount; - unsigned file_id; darray(KeyTypeInfo) types; struct xkb_keymap *keymap; @@ -166,7 +164,7 @@ typedef struct { /***====================================================================***/ static inline const char * -MapEntryTxt(KeyTypesInfo *info, struct xkb_kt_map_entry *entry) +MapEntryTxt(KeyTypesInfo *info, struct xkb_key_type_entry *entry) { return ModMaskText(info->keymap, entry->mods.mods); } @@ -187,7 +185,7 @@ static inline bool ReportTypeShouldBeArray(KeyTypesInfo *info, KeyTypeInfo *type, const char *field) { - return ReportShouldBeArray(info->keymap, "key type", field, + return ReportShouldBeArray(info->keymap->ctx, "key type", field, TypeTxt(info, type)); } @@ -212,12 +210,10 @@ ReportTypeBadWidth(KeyTypesInfo *info, const char *type, int has, int needs) /***====================================================================***/ static void -InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap, - unsigned file_id) +InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap) { memset(info, 0, sizeof(*info)); info->keymap = keymap; - info->file_id = file_id; } static void @@ -247,16 +243,15 @@ FindMatchingKeyType(KeyTypesInfo *info, xkb_atom_t name) } static bool -AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new) +AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new, bool same_file) { KeyTypeInfo *old; - int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); old = FindMatchingKeyType(info, new->name); if (old) { if (new->merge == MERGE_REPLACE || new->merge == MERGE_OVERRIDE) { - if ((old->file_id == new->file_id && verbosity > 0) || - verbosity > 9) { + if ((same_file && verbosity > 0) || verbosity > 9) { log_warn(info->keymap->ctx, "Multiple definitions of the %s key type; " "Earlier definition ignored\n", @@ -270,7 +265,7 @@ AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new) return true; } - if (old->file_id == new->file_id) + if (same_file) log_vrb(info->keymap->ctx, 4, "Multiple definitions of the %s key type; " "Later definition ignored\n", @@ -280,7 +275,6 @@ AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new) return true; } - new->file_id = info->file_id; darray_append(info->types, *new); return true; } @@ -305,7 +299,7 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from, darray_foreach(type, from->types) { type->merge = (merge == MERGE_DEFAULT ? type->merge : merge); - if (!AddKeyType(into, type)) + if (!AddKeyType(into, type, false)) into->errorCount++; } } @@ -314,38 +308,36 @@ static void HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge); static bool -HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *stmt) +HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *include) { - enum merge_mode merge = MERGE_DEFAULT; - XkbFile *rtrn; - KeyTypesInfo included, next_incl; - - InitKeyTypesInfo(&included, info->keymap, info->file_id); - if (stmt->stmt) { - free(included.name); - included.name = stmt->stmt; - stmt->stmt = NULL; - } + KeyTypesInfo included; + + InitKeyTypesInfo(&included, info->keymap); + included.name = include->stmt; + include->stmt = NULL; + + for (IncludeStmt *stmt = include; stmt; stmt = stmt->next_incl) { + KeyTypesInfo next_incl; + XkbFile *file; - for (; stmt; stmt = stmt->next_incl) { - if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_TYPES, - &rtrn, &merge)) { + file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_TYPES); + if (!file) { info->errorCount += 10; ClearKeyTypesInfo(&included); return false; } - InitKeyTypesInfo(&next_incl, info->keymap, rtrn->id); + InitKeyTypesInfo(&next_incl, info->keymap); - HandleKeyTypesFile(&next_incl, rtrn, merge); + HandleKeyTypesFile(&next_incl, file, stmt->merge); - MergeIncludedKeyTypes(&included, &next_incl, merge); + MergeIncludedKeyTypes(&included, &next_incl, stmt->merge); ClearKeyTypesInfo(&next_incl); - FreeXkbFile(rtrn); + FreeXkbFile(file); } - MergeIncludedKeyTypes(info, &included, merge); + MergeIncludedKeyTypes(info, &included, include->merge); ClearKeyTypesInfo(&included); return (info->errorCount == 0); @@ -387,10 +379,10 @@ SetModifiers(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, /***====================================================================***/ -static struct xkb_kt_map_entry * +static struct xkb_key_type_entry * FindMatchingMapEntry(KeyTypeInfo *type, xkb_mod_mask_t mods) { - struct xkb_kt_map_entry *entry; + struct xkb_key_type_entry *entry; darray_foreach(entry, type->entries) if (entry->mods.mods == mods) @@ -401,9 +393,9 @@ FindMatchingMapEntry(KeyTypeInfo *type, xkb_mod_mask_t mods) static bool AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, - struct xkb_kt_map_entry *new, bool clobber, bool report) + struct xkb_key_type_entry *new, bool clobber, bool report) { - struct xkb_kt_map_entry * old; + struct xkb_key_type_entry *old; old = FindMatchingMapEntry(type, new->mods.mods); if (old) { @@ -417,7 +409,7 @@ AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, } else { log_vrb(info->keymap->ctx, 10, - "Multiple occurences of map[%s]= %d in %s; Ignored\n", + "Multiple occurrences of map[%s]= %d in %s; Ignored\n", MapEntryTxt(info, new), new->level + 1, TypeTxt(info, type)); return true; @@ -443,7 +435,7 @@ static bool SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, ExprDef *value) { - struct xkb_kt_map_entry entry; + struct xkb_key_type_entry entry; if (arrayNdx == NULL) return ReportTypeShouldBeArray(info, type, "map entry"); @@ -479,8 +471,8 @@ static bool AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type, xkb_mod_mask_t mods, xkb_mod_mask_t preserve_mods) { - struct xkb_kt_map_entry *entry; - struct xkb_kt_map_entry new; + struct xkb_key_type_entry *entry; + struct xkb_key_type_entry new; darray_foreach(entry, type->entries) { if (entry->mods.mods != mods) @@ -518,7 +510,7 @@ AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type, /* * Map does not exist, i.e. preserve[] came before map[]. * Create a map with the specified mask mapping to Level1. The level - * may be overriden later with an explicit map[] statement. + * may be overridden later with an explicit map[] statement. */ new.level = 0; new.mods.mods = mods; @@ -712,7 +704,6 @@ HandleKeyTypeDef(KeyTypesInfo *info, KeyTypeDef *def, enum merge_mode merge) { KeyTypeInfo type = { .defined = 0, - .file_id = info->file_id, .merge = (def->merge == MERGE_DEFAULT ? merge : def->merge), .name = def->name, .mods = 0, @@ -726,7 +717,7 @@ HandleKeyTypeDef(KeyTypesInfo *info, KeyTypeDef *def, enum merge_mode merge) return false; } - if (!AddKeyType(info, &type)) { + if (!AddKeyType(info, &type, true)) { info->errorCount++; return false; } @@ -738,17 +729,16 @@ static void HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge) { bool ok; - ParseCommon *stmt; free(info->name); info->name = strdup_safe(file->name); - for (stmt = file->defs; stmt; stmt = stmt->next) { + for (ParseCommon *stmt = file->defs; stmt; stmt = stmt->next) { switch (stmt->type) { case STMT_INCLUDE: ok = HandleIncludeKeyTypes(info, (IncludeStmt *) stmt); break; - case STMT_TYPE: /* e.g. type "ONE_LEVEL" */ + case STMT_TYPE: ok = HandleKeyTypeDef(info, (KeyTypeDef *) stmt, merge); break; case STMT_VAR: @@ -757,7 +747,7 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge) "Statement ignored\n"); ok = true; break; - case STMT_VMOD: /* virtual_modifiers NumLock, ... */ + case STMT_VMOD: ok = HandleVModDef(info->keymap, (VModDef *) stmt); break; default: @@ -779,63 +769,62 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge) } } -static void -CopyDefToKeyType(KeyTypeInfo *def, struct xkb_key_type *type) -{ - type->mods.mods = def->mods; - type->num_levels = def->num_levels; - type->map = darray_mem(def->entries, 0); - type->num_entries = darray_size(def->entries); - darray_init(def->entries); - type->name = def->name; - type->level_names = darray_mem(def->level_names, 0); - darray_init(def->level_names); -} +/***====================================================================***/ static bool CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info) { - unsigned int i; - unsigned int num_types; + keymap->types_section_name = strdup_safe(info->name); - num_types = darray_size(info->types) ? darray_size(info->types) : 1; - keymap->types = calloc(num_types, sizeof(*keymap->types)); - if (!keymap->types) - return false; + keymap->num_types = darray_size(info->types); + if (keymap->num_types == 0) + keymap->num_types = 1; - keymap->num_types = num_types; + keymap->types = calloc(keymap->num_types, sizeof(*keymap->types)); /* * If no types were specified, a default unnamed one-level type is * used for all keys. */ if (darray_empty(info->types)) { - KeyTypeInfo dflt = { - .name = xkb_atom_intern(keymap->ctx, "default"), - .mods = 0, - .num_levels = 1, - .entries = darray_new(), - .level_names = darray_new(), - }; - - CopyDefToKeyType(&dflt, &keymap->types[0]); - } else { - for (i = 0; i < num_types; i++) - CopyDefToKeyType(&darray_item(info->types, i), &keymap->types[i]); + struct xkb_key_type *type = &keymap->types[0]; + + type->mods.mods = 0; + type->num_levels = 1; + type->entries = NULL; + type->num_entries = 0; + type->name = xkb_atom_intern(keymap->ctx, "default"); + type->level_names = NULL; + + return true; } - keymap->types_section_name = strdup_safe(info->name); + for (unsigned i = 0; i < keymap->num_types; i++) { + KeyTypeInfo *def = &darray_item(info->types, i); + struct xkb_key_type *type = &keymap->types[i]; + + type->mods.mods = def->mods; + type->num_levels = def->num_levels; + type->entries = darray_mem(def->entries, 0); + type->num_entries = darray_size(def->entries); + darray_init(def->entries); + type->name = def->name; + type->level_names = darray_mem(def->level_names, 0); + darray_init(def->level_names); + } return true; } +/***====================================================================***/ + bool CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { KeyTypesInfo info; - InitKeyTypesInfo(&info, keymap, file->id); + InitKeyTypesInfo(&info, keymap); HandleKeyTypesFile(&info, file, merge); if (info.errorCount != 0) diff --git a/src/xkbcomp/xkbcomp-priv.h b/src/xkbcomp/xkbcomp-priv.h index b2b40fd..4d421b5 100644 --- a/src/xkbcomp/xkbcomp-priv.h +++ b/src/xkbcomp/xkbcomp-priv.h @@ -37,6 +37,9 @@ struct xkb_component_names { char *symbols; }; +char * +text_v1_keymap_get_as_string(struct xkb_keymap *keymap); + XkbFile * XkbParseFile(struct xkb_context *ctx, FILE *file, const char *file_name, const char *map); @@ -45,12 +48,16 @@ XkbFile * XkbParseString(struct xkb_context *ctx, const char *string, const char *file_name); +XkbFile * +XkbParseBuffer(struct xkb_context *ctx, char *buf, size_t length, + const char *file_name); + void FreeXkbFile(XkbFile *file); XkbFile * XkbFileFromComponents(struct xkb_context *ctx, - struct xkb_component_names *kkctgs); + const struct xkb_component_names *kkctgs); bool CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, @@ -78,10 +85,10 @@ LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn); /***====================================================================***/ static inline bool -ReportNotArray(struct xkb_keymap *keymap, const char *type, const char *field, +ReportNotArray(struct xkb_context *ctx, const char *type, const char *field, const char *name) { - log_err(keymap->ctx, + log_err(ctx, "The %s %s field is not an array; " "Ignoring illegal assignment in %s\n", type, field, name); @@ -89,10 +96,10 @@ ReportNotArray(struct xkb_keymap *keymap, const char *type, const char *field, } static inline bool -ReportShouldBeArray(struct xkb_keymap *keymap, const char *type, +ReportShouldBeArray(struct xkb_context *ctx, const char *type, const char *field, const char *name) { - log_err(keymap->ctx, + log_err(ctx, "Missing subscript for %s %s; " "Ignoring illegal assignment in %s\n", type, field, name); @@ -110,10 +117,10 @@ ReportBadType(struct xkb_context *ctx, const char *type, const char *field, } static inline bool -ReportBadField(struct xkb_keymap *keymap, const char *type, const char *field, +ReportBadField(struct xkb_context *ctx, const char *type, const char *field, const char *name) { - log_err(keymap->ctx, + log_err(ctx, "Unknown %s field %s in %s; " "Ignoring assignment to unknown field in %s\n", type, field, name, name); diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c index 5025dc6..b9a1b5f 100644 --- a/src/xkbcomp/xkbcomp.c +++ b/src/xkbcomp/xkbcomp.c @@ -30,77 +30,55 @@ #include "xkbcomp-priv.h" #include "rules.h" -static struct xkb_keymap * -compile_keymap_file(struct xkb_context *ctx, XkbFile *file, - enum xkb_keymap_format format, - enum xkb_keymap_compile_flags flags) +static bool +compile_keymap_file(struct xkb_keymap *keymap, XkbFile *file) { - struct xkb_keymap *keymap; - - keymap = xkb_keymap_new(ctx, format, flags); - if (!keymap) - goto err; - if (file->file_type != FILE_TYPE_KEYMAP) { - log_err(ctx, "Cannot compile a %s file alone into a keymap\n", + log_err(keymap->ctx, + "Cannot compile a %s file alone into a keymap\n", xkb_file_type_to_string(file->file_type)); - goto err; + return false; } if (!CompileKeymap(file, keymap, MERGE_OVERRIDE)) { - log_err(ctx, "Failed to compile keymap\n"); - goto err; + log_err(keymap->ctx, + "Failed to compile keymap\n"); + return false; } - return keymap; - -err: - xkb_keymap_unref(keymap); - return NULL; + return true; } -XKB_EXPORT struct xkb_keymap * -xkb_keymap_new_from_names(struct xkb_context *ctx, - const struct xkb_rule_names *rmlvo_in, - enum xkb_keymap_compile_flags flags) +static bool +text_v1_keymap_new_from_names(struct xkb_keymap *keymap, + const struct xkb_rule_names *rmlvo) { bool ok; struct xkb_component_names kccgst; - struct xkb_rule_names rmlvo = *rmlvo_in; XkbFile *file; - struct xkb_keymap *keymap; - - if (isempty(rmlvo.rules)) - rmlvo.rules = DEFAULT_XKB_RULES; - if (isempty(rmlvo.model)) - rmlvo.model = DEFAULT_XKB_MODEL; - if (isempty(rmlvo.layout)) - rmlvo.layout = DEFAULT_XKB_LAYOUT; - log_dbg(ctx, + log_dbg(keymap->ctx, "Compiling from RMLVO: rules '%s', model '%s', layout '%s', " "variant '%s', options '%s'\n", - strnull(rmlvo.rules), strnull(rmlvo.model), - strnull(rmlvo.layout), strnull(rmlvo.variant), - strnull(rmlvo.options)); + rmlvo->rules, rmlvo->model, rmlvo->layout, rmlvo->variant, + rmlvo->options); - ok = xkb_components_from_rules(ctx, &rmlvo, &kccgst); + ok = xkb_components_from_rules(keymap->ctx, rmlvo, &kccgst); if (!ok) { - log_err(ctx, + log_err(keymap->ctx, "Couldn't look up rules '%s', model '%s', layout '%s', " "variant '%s', options '%s'\n", - strnull(rmlvo.rules), strnull(rmlvo.model), - strnull(rmlvo.layout), strnull(rmlvo.variant), - strnull(rmlvo.options)); - return NULL; + rmlvo->rules, rmlvo->model, rmlvo->layout, rmlvo->variant, + rmlvo->options); + return false; } - log_dbg(ctx, + log_dbg(keymap->ctx, "Compiling from KcCGST: keycodes '%s', types '%s', " "compat '%s', symbols '%s'\n", kccgst.keycodes, kccgst.types, kccgst.compat, kccgst.symbols); - file = XkbFileFromComponents(ctx, &kccgst); + file = XkbFileFromComponents(keymap->ctx, &kccgst); free(kccgst.keycodes); free(kccgst.types); @@ -108,72 +86,86 @@ xkb_keymap_new_from_names(struct xkb_context *ctx, free(kccgst.symbols); if (!file) { - log_err(ctx, + log_err(keymap->ctx, "Failed to generate parsed XKB file from components\n"); - return NULL; + return false; } - keymap = compile_keymap_file(ctx, file, XKB_KEYMAP_FORMAT_TEXT_V1, flags); + ok = compile_keymap_file(keymap, file); FreeXkbFile(file); - return keymap; + return ok; } -XKB_EXPORT struct xkb_keymap * -xkb_keymap_new_from_string(struct xkb_context *ctx, - const char *string, - enum xkb_keymap_format format, - enum xkb_keymap_compile_flags flags) +static bool +text_v1_keymap_new_from_string(struct xkb_keymap *keymap, const char *string) { - XkbFile *file; - struct xkb_keymap *keymap; - - if (format != XKB_KEYMAP_FORMAT_TEXT_V1) { - log_err(ctx, "Unsupported keymap format %d\n", format); - return NULL; - } - - if (!string) { - log_err(ctx, "No string specified to generate XKB keymap\n"); - return NULL; - } + bool ok; + XkbFile *xkb_file; - file = XkbParseString(ctx, string, "input"); - if (!file) { - log_err(ctx, "Failed to parse input xkb file\n"); + xkb_file = XkbParseString(keymap->ctx, string, "(input string)"); + if (!xkb_file) { + log_err(keymap->ctx, "Failed to parse input xkb string\n"); return NULL; } - keymap = compile_keymap_file(ctx, file, format, flags); - FreeXkbFile(file); - return keymap; + ok = compile_keymap_file(keymap, xkb_file); + FreeXkbFile(xkb_file); + return ok; } -XKB_EXPORT struct xkb_keymap * -xkb_keymap_new_from_file(struct xkb_context *ctx, - FILE *file, - enum xkb_keymap_format format, - enum xkb_keymap_compile_flags flags) +static bool +text_v1_keymap_new_from_buffer(struct xkb_keymap *keymap, + const char *buffer, size_t length) { + bool ok; XkbFile *xkb_file; - struct xkb_keymap *keymap; + char *buf; - if (format != XKB_KEYMAP_FORMAT_TEXT_V1) { - log_err(ctx, "Unsupported keymap format %d\n", format); + buf = malloc(length + 2); + if (!buf) { + log_err(keymap->ctx, "Cannot allocate memory for keymap\n"); return NULL; } - if (!file) { - log_err(ctx, "No file specified to generate XKB keymap\n"); + /* yy_scan_buffer requires two terminating zero bytes */ + memcpy(buf, buffer, length); + buf[length] = 0; + buf[length + 1] = 0; + + xkb_file = XkbParseBuffer(keymap->ctx, buf, length + 2, "input"); + if (!xkb_file) { + log_err(keymap->ctx, "Failed to parse input xkb file\n"); + free(buf); return NULL; } - xkb_file = XkbParseFile(ctx, file, "(unknown file)", NULL); + ok = compile_keymap_file(keymap, xkb_file); + FreeXkbFile(xkb_file); + free(buf); + return ok; +} + +static bool +text_v1_keymap_new_from_file(struct xkb_keymap *keymap, FILE *file) +{ + bool ok; + XkbFile *xkb_file; + + xkb_file = XkbParseFile(keymap->ctx, file, "(unknown file)", NULL); if (!xkb_file) { - log_err(ctx, "Failed to parse input xkb file\n"); - return NULL; + log_err(keymap->ctx, "Failed to parse input xkb file\n"); + return false; } - keymap = compile_keymap_file(ctx, xkb_file, format, flags); + ok = compile_keymap_file(keymap, xkb_file); FreeXkbFile(xkb_file); - return keymap; + return ok; } + +const struct xkb_keymap_format_ops text_v1_keymap_format_ops = { + .keymap_new_from_names = text_v1_keymap_new_from_names, + .keymap_new_from_string = text_v1_keymap_new_from_string, + .keymap_new_from_buffer = text_v1_keymap_new_from_buffer, + .keymap_new_from_file = text_v1_keymap_new_from_file, + .keymap_get_as_string = text_v1_keymap_get_as_string, +}; diff --git a/test/.gitignore b/test/.gitignore index 5a0b89f..d4bb051 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -7,6 +7,7 @@ state context rules-file stringcomp +buffercomp keyseq log interactive diff --git a/test/bench-key-proc.c b/test/bench-key-proc.c index 1144048..e345092 100644 --- a/test/bench-key-proc.c +++ b/test/bench-key-proc.c @@ -23,7 +23,6 @@ #include <stdlib.h> #include <time.h> -#include <linux/input.h> #include "test.h" @@ -59,7 +58,7 @@ main(void) struct xkb_state *state; struct timespec start, stop, elapsed; - ctx = test_get_context(); + ctx = test_get_context(0); assert(ctx); keymap = test_compile_rules(ctx, "evdev", "pc104", "us,ru,il,de", diff --git a/test/buffercomp.c b/test/buffercomp.c new file mode 100644 index 0000000..5cc1dbc --- /dev/null +++ b/test/buffercomp.c @@ -0,0 +1,90 @@ +/* + * Copyright © 2009 Dan Nicholson + * + * 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. + */ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> + +#include "test.h" + +#define DATA_PATH "keymaps/stringcomp.data" + +int +main(int argc, char *argv[]) +{ + struct xkb_context *ctx = test_get_context(0); + struct xkb_keymap *keymap; + char *original, *dump; + + assert(ctx); + + /* Load in a prebuilt keymap, make sure we can compile it from memory, + * then compare it to make sure we get the same result when dumping it + * to a string. */ + original = test_read_file(DATA_PATH); + assert(original); + + keymap = test_compile_buffer(ctx, original, strlen(original)); + assert(keymap); + + dump = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_USE_ORIGINAL_FORMAT); + assert(dump); + + if (!streq(original, dump)) { + fprintf(stderr, + "round-trip test failed: dumped map differs from original\n"); + fprintf(stderr, "path to original file: %s\n", + test_get_path(DATA_PATH)); + fprintf(stderr, "length: dumped %lu, original %lu\n", + (unsigned long) strlen(dump), + (unsigned long) strlen(original)); + fprintf(stderr, "dumped map:\n"); + fprintf(stderr, "%s\n", dump); + fflush(stderr); + assert(0); + } + + free(original); + free(dump); + xkb_keymap_unref(keymap); + + /* Make sure we can't (falsely claim to) compile an empty string. */ + keymap = test_compile_buffer(ctx, "", 0); + assert(!keymap); + + /* Make sure we can recompile our output for a normal keymap from rules. */ + keymap = test_compile_rules(ctx, NULL, NULL, + "ru,ca,de,us", ",multix,neo,intl", NULL); + assert(keymap); + dump = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_USE_ORIGINAL_FORMAT); + assert(dump); + xkb_keymap_unref(keymap); + keymap = test_compile_buffer(ctx, dump, strlen(dump)); + assert(keymap); + xkb_keymap_unref(keymap); + free(dump); + + xkb_context_unref(ctx); + + return 0; +} diff --git a/test/common.c b/test/common.c index f960501..7b4ee00 100644 --- a/test/common.c +++ b/test/common.c @@ -38,6 +38,106 @@ #include "test.h" +/* + * Test a sequence of keysyms, resulting from a sequence of key presses, + * against the keysyms they're supposed to generate. + * + * - Each test runs with a clean state. + * - Each line in the test is made up of: + * + A keycode, given as a KEY_* from linux/input.h. + * + A direction - DOWN for press, UP for release, BOTH for + * immediate press + release, REPEAT to just get the syms. + * + A sequence of keysyms that should result from this keypress. + * + * The vararg format is: + * <KEY_*> <DOWN | UP | BOTH> <XKB_KEY_* (zero or more)> <NEXT | FINISH> + * + * See below for examples. + */ +int +test_key_seq_va(struct xkb_keymap *keymap, va_list ap) +{ + struct xkb_state *state; + + xkb_keycode_t kc; + int op; + xkb_keysym_t keysym; + + const xkb_keysym_t *syms; + unsigned int nsyms, i; + char ksbuf[64]; + + fprintf(stderr, "----\n"); + + state = xkb_state_new(keymap); + assert(state); + + for (;;) { + kc = va_arg(ap, int) + EVDEV_OFFSET; + op = va_arg(ap, int); + + nsyms = xkb_state_key_get_syms(state, kc, &syms); + fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, kc); + + if (op == DOWN || op == BOTH) + xkb_state_update_key(state, kc, XKB_KEY_DOWN); + if (op == UP || op == BOTH) + xkb_state_update_key(state, kc, XKB_KEY_UP); + + for (i = 0; i < nsyms; i++) { + keysym = va_arg(ap, int); + xkb_keysym_get_name(syms[i], ksbuf, sizeof(ksbuf)); + fprintf(stderr, "%s%s", (i != 0) ? ", " : "", ksbuf); + + if (keysym == FINISH || keysym == NEXT) { + xkb_keysym_get_name(syms[i], ksbuf, sizeof(ksbuf)); + fprintf(stderr, "Did not expect keysym: %s.\n", ksbuf); + goto fail; + } + + if (keysym != syms[i]) { + xkb_keysym_get_name(keysym, ksbuf, sizeof(ksbuf)); + fprintf(stderr, "Expected keysym: %s. ", ksbuf);; + xkb_keysym_get_name(syms[i], ksbuf, sizeof(ksbuf)); + fprintf(stderr, "Got keysym: %s.\n", ksbuf);; + goto fail; + } + } + + fprintf(stderr, "]\n"); + + keysym = va_arg(ap, int); + if (keysym == NEXT) + continue; + if (keysym == FINISH) + break; + + xkb_keysym_get_name(keysym, ksbuf, sizeof(ksbuf)); + fprintf(stderr, "Expected keysym: %s. Didn't get it.\n", ksbuf); + goto fail; + } + + xkb_state_unref(state); + return 1; + +fail: + xkb_state_unref(state); + return 0; +} + +int +test_key_seq(struct xkb_keymap *keymap, ...) +{ + va_list ap; + int ret; + + va_start(ap, keymap); + ret = test_key_seq_va(keymap, ap); + va_end(ap); + + return ret; +} + const char * test_get_path(const char *path_rel) { @@ -91,10 +191,24 @@ test_read_file(const char *path_rel) } struct xkb_context * -test_get_context(void) +test_get_context(enum test_context_flags test_flags) { - struct xkb_context *ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES); + enum xkb_context_flags ctx_flags; + struct xkb_context *ctx; + + ctx_flags = XKB_CONTEXT_NO_DEFAULT_INCLUDES; + if (test_flags & CONTEXT_ALLOW_ENVIRONMENT_NAMES) { + unsetenv("XKB_DEFAULT_RULES"); + unsetenv("XKB_DEFAULT_MODEL"); + unsetenv("XKB_DEFAULT_LAYOUT"); + unsetenv("XKB_DEFAULT_VARIANT"); + unsetenv("XKB_DEFAULT_OPTIONS"); + } + else { + ctx_flags |= XKB_CONTEXT_NO_ENVIRONMENT_NAMES; + } + ctx = xkb_context_new(ctx_flags); if (!ctx) return NULL; @@ -147,20 +261,39 @@ test_compile_string(struct xkb_context *context, const char *string) } struct xkb_keymap * +test_compile_buffer(struct xkb_context *context, const char *buf, size_t len) +{ + struct xkb_keymap *keymap; + + keymap = xkb_keymap_new_from_buffer(context, buf, len, + XKB_KEYMAP_FORMAT_TEXT_V1, 0); + if (!keymap) { + fprintf(stderr, "Failed to compile keymap from memory buffer\n"); + return NULL; + } + + return keymap; +} + +struct xkb_keymap * test_compile_rules(struct xkb_context *context, const char *rules, const char *model, const char *layout, const char *variant, const char *options) { struct xkb_keymap *keymap; struct xkb_rule_names rmlvo = { - .rules = rules, - .model = model, - .layout = layout, - .variant = variant, - .options = options + .rules = isempty(rules) ? NULL : rules, + .model = isempty(model) ? NULL : model, + .layout = isempty(layout) ? NULL : layout, + .variant = isempty(variant) ? NULL : variant, + .options = isempty(options) ? NULL : options }; - keymap = xkb_keymap_new_from_names(context, &rmlvo, 0); + if (!rules && !model && !layout && !variant && !options) + keymap = xkb_keymap_new_from_names(context, NULL, 0); + else + keymap = xkb_keymap_new_from_names(context, &rmlvo, 0); + if (!keymap) { fprintf(stderr, "Failed to compile RMLVO: '%s', '%s', '%s', '%s', '%s'\n", diff --git a/test/context.c b/test/context.c index e151dd0..63813f1 100644 --- a/test/context.c +++ b/test/context.c @@ -29,7 +29,7 @@ int main(void) { - struct xkb_context *context = test_get_context(); + struct xkb_context *context = test_get_context(0); assert(context); diff --git a/test/data/compat/default b/test/data/compat/default deleted file mode 100644 index 4c4461f..0000000 --- a/test/data/compat/default +++ /dev/null @@ -1,12 +0,0 @@ -default xkb_compatibility "default" { - include "basic" - augment "mousekeys" - augment "accessx(basic)" - augment "misc" - augment "iso9995" - augment "level5" -// ??should be changed/renamed/removed -// augment "xfree86" - augment "japan" - augment "caps(caps_lock)" -}; diff --git a/test/data/compat/iso9995 b/test/data/compat/iso9995 index eee104d..76188d1 100644 --- a/test/data/compat/iso9995 +++ b/test/data/compat/iso9995 @@ -9,10 +9,6 @@ default partial xkb_compatibility "default" { latchMods.clearLocks= True; latchMods.latchToLock= True; - interpret ISO_Lock+Any { - action= ISOLock(affect= all,modifiers=modMapMods); - }; - interpret ISO_Level2_Latch+Shift { useModMapMods= level1; action= LatchMods(modifiers=Shift); diff --git a/test/data/keymaps/stringcomp.data b/test/data/keymaps/stringcomp.data index 449b06b..7d21eb5 100644 --- a/test/data/keymaps/stringcomp.data +++ b/test/data/keymaps/stringcomp.data @@ -1,1921 +1,1918 @@ xkb_keymap { - xkb_keycodes "evdev_aliases(qwerty)" { - <ESC> = 9; - <AE01> = 10; - <AE02> = 11; - <AE03> = 12; - <AE04> = 13; - <AE05> = 14; - <AE06> = 15; - <AE07> = 16; - <AE08> = 17; - <AE09> = 18; - <AE10> = 19; - <AE11> = 20; - <AE12> = 21; - <BKSP> = 22; - <TAB> = 23; - <AD01> = 24; - <AD02> = 25; - <AD03> = 26; - <AD04> = 27; - <AD05> = 28; - <AD06> = 29; - <AD07> = 30; - <AD08> = 31; - <AD09> = 32; - <AD10> = 33; - <AD11> = 34; - <AD12> = 35; - <RTRN> = 36; - <LCTL> = 37; - <AC01> = 38; - <AC02> = 39; - <AC03> = 40; - <AC04> = 41; - <AC05> = 42; - <AC06> = 43; - <AC07> = 44; - <AC08> = 45; - <AC09> = 46; - <AC10> = 47; - <AC11> = 48; - <TLDE> = 49; - <LFSH> = 50; - <BKSL> = 51; - <AB01> = 52; - <AB02> = 53; - <AB03> = 54; - <AB04> = 55; - <AB05> = 56; - <AB06> = 57; - <AB07> = 58; - <AB08> = 59; - <AB09> = 60; - <AB10> = 61; - <RTSH> = 62; - <KPMU> = 63; - <LALT> = 64; - <SPCE> = 65; - <CAPS> = 66; - <FK01> = 67; - <FK02> = 68; - <FK03> = 69; - <FK04> = 70; - <FK05> = 71; - <FK06> = 72; - <FK07> = 73; - <FK08> = 74; - <FK09> = 75; - <FK10> = 76; - <NMLK> = 77; - <SCLK> = 78; - <KP7> = 79; - <KP8> = 80; - <KP9> = 81; - <KPSU> = 82; - <KP4> = 83; - <KP5> = 84; - <KP6> = 85; - <KPAD> = 86; - <KP1> = 87; - <KP2> = 88; - <KP3> = 89; - <KP0> = 90; - <KPDL> = 91; - <LVL3> = 92; - <LSGT> = 94; - <FK11> = 95; - <FK12> = 96; - <AB11> = 97; - <KATA> = 98; - <HIRA> = 99; - <HENK> = 100; - <HKTG> = 101; - <MUHE> = 102; - <JPCM> = 103; - <KPEN> = 104; - <RCTL> = 105; - <KPDV> = 106; - <PRSC> = 107; - <RALT> = 108; - <LNFD> = 109; - <HOME> = 110; - <UP> = 111; - <PGUP> = 112; - <LEFT> = 113; - <RGHT> = 114; - <END> = 115; - <DOWN> = 116; - <PGDN> = 117; - <INS> = 118; - <DELE> = 119; - <I120> = 120; - <MUTE> = 121; - <VOL-> = 122; - <VOL+> = 123; - <POWR> = 124; - <KPEQ> = 125; - <I126> = 126; - <PAUS> = 127; - <I128> = 128; - <I129> = 129; - <HNGL> = 130; - <HJCV> = 131; - <AE13> = 132; - <LWIN> = 133; - <RWIN> = 134; - <COMP> = 135; - <STOP> = 136; - <AGAI> = 137; - <PROP> = 138; - <UNDO> = 139; - <FRNT> = 140; - <COPY> = 141; - <OPEN> = 142; - <PAST> = 143; - <FIND> = 144; - <CUT> = 145; - <HELP> = 146; - <I147> = 147; - <I148> = 148; - <I149> = 149; - <I150> = 150; - <I151> = 151; - <I152> = 152; - <I153> = 153; - <I154> = 154; - <I155> = 155; - <I156> = 156; - <I157> = 157; - <I158> = 158; - <I159> = 159; - <I160> = 160; - <I161> = 161; - <I162> = 162; - <I163> = 163; - <I164> = 164; - <I165> = 165; - <I166> = 166; - <I167> = 167; - <I168> = 168; - <I169> = 169; - <I170> = 170; - <I171> = 171; - <I172> = 172; - <I173> = 173; - <I174> = 174; - <I175> = 175; - <I176> = 176; - <I177> = 177; - <I178> = 178; - <I179> = 179; - <I180> = 180; - <I181> = 181; - <I182> = 182; - <I183> = 183; - <I184> = 184; - <I185> = 185; - <I186> = 186; - <I187> = 187; - <I188> = 188; - <I189> = 189; - <I190> = 190; - <FK13> = 191; - <FK14> = 192; - <FK15> = 193; - <FK16> = 194; - <FK17> = 195; - <FK18> = 196; - <FK19> = 197; - <FK20> = 198; - <FK21> = 199; - <FK22> = 200; - <FK23> = 201; - <FK24> = 202; - <MDSW> = 203; - <ALT> = 204; - <META> = 205; - <SUPR> = 206; - <HYPR> = 207; - <I208> = 208; - <I209> = 209; - <I210> = 210; - <I211> = 211; - <I212> = 212; - <I213> = 213; - <I214> = 214; - <I215> = 215; - <I216> = 216; - <I217> = 217; - <I218> = 218; - <I219> = 219; - <I220> = 220; - <I221> = 221; - <I222> = 222; - <I223> = 223; - <I224> = 224; - <I225> = 225; - <I226> = 226; - <I227> = 227; - <I228> = 228; - <I229> = 229; - <I230> = 230; - <I231> = 231; - <I232> = 232; - <I233> = 233; - <I234> = 234; - <I235> = 235; - <I236> = 236; - <I237> = 237; - <I238> = 238; - <I239> = 239; - <I240> = 240; - <I241> = 241; - <I242> = 242; - <I243> = 243; - <I244> = 244; - <I245> = 245; - <I246> = 246; - <I247> = 247; - <I248> = 248; - <I249> = 249; - <I250> = 250; - <I251> = 251; - <I252> = 252; - <I253> = 253; - indicator 1 = "Caps Lock"; - indicator 2 = "Num Lock"; - indicator 3 = "Scroll Lock"; - indicator 4 = "Compose"; - indicator 5 = "Kana"; - indicator 6 = "Sleep"; - indicator 7 = "Suspend"; - indicator 8 = "Mute"; - indicator 9 = "Misc"; - indicator 10 = "Mail"; - indicator 11 = "Charging"; - indicator 12 = "Shift Lock"; - indicator 13 = "Group 2"; - indicator 14 = "Mouse Keys"; - alias <AC12> = <BKSL>; - alias <MENU> = <COMP>; - alias <HZTG> = <TLDE>; - alias <LMTA> = <LWIN>; - alias <RMTA> = <RWIN>; - alias <ALGR> = <RALT>; - alias <KPPT> = <I129>; - alias <LatQ> = <AD01>; - alias <LatW> = <AD02>; - alias <LatE> = <AD03>; - alias <LatR> = <AD04>; - alias <LatT> = <AD05>; - alias <LatY> = <AD06>; - alias <LatU> = <AD07>; - alias <LatI> = <AD08>; - alias <LatO> = <AD09>; - alias <LatP> = <AD10>; - alias <LatA> = <AC01>; - alias <LatS> = <AC02>; - alias <LatD> = <AC03>; - alias <LatF> = <AC04>; - alias <LatG> = <AC05>; - alias <LatH> = <AC06>; - alias <LatJ> = <AC07>; - alias <LatK> = <AC08>; - alias <LatL> = <AC09>; - alias <LatZ> = <AB01>; - alias <LatX> = <AB02>; - alias <LatC> = <AB03>; - alias <LatV> = <AB04>; - alias <LatB> = <AB05>; - alias <LatN> = <AB06>; - alias <LatM> = <AB07>; - }; - - xkb_types "complete" { +xkb_keycodes "evdev_aliases(qwerty)" { + <ESC> = 9; + <AE01> = 10; + <AE02> = 11; + <AE03> = 12; + <AE04> = 13; + <AE05> = 14; + <AE06> = 15; + <AE07> = 16; + <AE08> = 17; + <AE09> = 18; + <AE10> = 19; + <AE11> = 20; + <AE12> = 21; + <BKSP> = 22; + <TAB> = 23; + <AD01> = 24; + <AD02> = 25; + <AD03> = 26; + <AD04> = 27; + <AD05> = 28; + <AD06> = 29; + <AD07> = 30; + <AD08> = 31; + <AD09> = 32; + <AD10> = 33; + <AD11> = 34; + <AD12> = 35; + <RTRN> = 36; + <LCTL> = 37; + <AC01> = 38; + <AC02> = 39; + <AC03> = 40; + <AC04> = 41; + <AC05> = 42; + <AC06> = 43; + <AC07> = 44; + <AC08> = 45; + <AC09> = 46; + <AC10> = 47; + <AC11> = 48; + <TLDE> = 49; + <LFSH> = 50; + <BKSL> = 51; + <AB01> = 52; + <AB02> = 53; + <AB03> = 54; + <AB04> = 55; + <AB05> = 56; + <AB06> = 57; + <AB07> = 58; + <AB08> = 59; + <AB09> = 60; + <AB10> = 61; + <RTSH> = 62; + <KPMU> = 63; + <LALT> = 64; + <SPCE> = 65; + <CAPS> = 66; + <FK01> = 67; + <FK02> = 68; + <FK03> = 69; + <FK04> = 70; + <FK05> = 71; + <FK06> = 72; + <FK07> = 73; + <FK08> = 74; + <FK09> = 75; + <FK10> = 76; + <NMLK> = 77; + <SCLK> = 78; + <KP7> = 79; + <KP8> = 80; + <KP9> = 81; + <KPSU> = 82; + <KP4> = 83; + <KP5> = 84; + <KP6> = 85; + <KPAD> = 86; + <KP1> = 87; + <KP2> = 88; + <KP3> = 89; + <KP0> = 90; + <KPDL> = 91; + <LVL3> = 92; + <LSGT> = 94; + <FK11> = 95; + <FK12> = 96; + <AB11> = 97; + <KATA> = 98; + <HIRA> = 99; + <HENK> = 100; + <HKTG> = 101; + <MUHE> = 102; + <JPCM> = 103; + <KPEN> = 104; + <RCTL> = 105; + <KPDV> = 106; + <PRSC> = 107; + <RALT> = 108; + <LNFD> = 109; + <HOME> = 110; + <UP> = 111; + <PGUP> = 112; + <LEFT> = 113; + <RGHT> = 114; + <END> = 115; + <DOWN> = 116; + <PGDN> = 117; + <INS> = 118; + <DELE> = 119; + <I120> = 120; + <MUTE> = 121; + <VOL-> = 122; + <VOL+> = 123; + <POWR> = 124; + <KPEQ> = 125; + <I126> = 126; + <PAUS> = 127; + <I128> = 128; + <I129> = 129; + <HNGL> = 130; + <HJCV> = 131; + <AE13> = 132; + <LWIN> = 133; + <RWIN> = 134; + <COMP> = 135; + <STOP> = 136; + <AGAI> = 137; + <PROP> = 138; + <UNDO> = 139; + <FRNT> = 140; + <COPY> = 141; + <OPEN> = 142; + <PAST> = 143; + <FIND> = 144; + <CUT> = 145; + <HELP> = 146; + <I147> = 147; + <I148> = 148; + <I149> = 149; + <I150> = 150; + <I151> = 151; + <I152> = 152; + <I153> = 153; + <I154> = 154; + <I155> = 155; + <I156> = 156; + <I157> = 157; + <I158> = 158; + <I159> = 159; + <I160> = 160; + <I161> = 161; + <I162> = 162; + <I163> = 163; + <I164> = 164; + <I165> = 165; + <I166> = 166; + <I167> = 167; + <I168> = 168; + <I169> = 169; + <I170> = 170; + <I171> = 171; + <I172> = 172; + <I173> = 173; + <I174> = 174; + <I175> = 175; + <I176> = 176; + <I177> = 177; + <I178> = 178; + <I179> = 179; + <I180> = 180; + <I181> = 181; + <I182> = 182; + <I183> = 183; + <I184> = 184; + <I185> = 185; + <I186> = 186; + <I187> = 187; + <I188> = 188; + <I189> = 189; + <I190> = 190; + <FK13> = 191; + <FK14> = 192; + <FK15> = 193; + <FK16> = 194; + <FK17> = 195; + <FK18> = 196; + <FK19> = 197; + <FK20> = 198; + <FK21> = 199; + <FK22> = 200; + <FK23> = 201; + <FK24> = 202; + <MDSW> = 203; + <ALT> = 204; + <META> = 205; + <SUPR> = 206; + <HYPR> = 207; + <I208> = 208; + <I209> = 209; + <I210> = 210; + <I211> = 211; + <I212> = 212; + <I213> = 213; + <I214> = 214; + <I215> = 215; + <I216> = 216; + <I217> = 217; + <I218> = 218; + <I219> = 219; + <I220> = 220; + <I221> = 221; + <I222> = 222; + <I223> = 223; + <I224> = 224; + <I225> = 225; + <I226> = 226; + <I227> = 227; + <I228> = 228; + <I229> = 229; + <I230> = 230; + <I231> = 231; + <I232> = 232; + <I233> = 233; + <I234> = 234; + <I235> = 235; + <I236> = 236; + <I237> = 237; + <I238> = 238; + <I239> = 239; + <I240> = 240; + <I241> = 241; + <I242> = 242; + <I243> = 243; + <I244> = 244; + <I245> = 245; + <I246> = 246; + <I247> = 247; + <I248> = 248; + <I249> = 249; + <I250> = 250; + <I251> = 251; + <I252> = 252; + <I253> = 253; + indicator 1 = "Caps Lock"; + indicator 2 = "Num Lock"; + indicator 3 = "Scroll Lock"; + indicator 4 = "Compose"; + indicator 5 = "Kana"; + indicator 6 = "Sleep"; + indicator 7 = "Suspend"; + indicator 8 = "Mute"; + indicator 9 = "Misc"; + indicator 10 = "Mail"; + indicator 11 = "Charging"; + indicator 12 = "Shift Lock"; + indicator 13 = "Group 2"; + indicator 14 = "Mouse Keys"; + alias <AC12> = <BKSL>; + alias <MENU> = <COMP>; + alias <HZTG> = <TLDE>; + alias <LMTA> = <LWIN>; + alias <RMTA> = <RWIN>; + alias <ALGR> = <RALT>; + alias <KPPT> = <I129>; + alias <LatQ> = <AD01>; + alias <LatW> = <AD02>; + alias <LatE> = <AD03>; + alias <LatR> = <AD04>; + alias <LatT> = <AD05>; + alias <LatY> = <AD06>; + alias <LatU> = <AD07>; + alias <LatI> = <AD08>; + alias <LatO> = <AD09>; + alias <LatP> = <AD10>; + alias <LatA> = <AC01>; + alias <LatS> = <AC02>; + alias <LatD> = <AC03>; + alias <LatF> = <AC04>; + alias <LatG> = <AC05>; + alias <LatH> = <AC06>; + alias <LatJ> = <AC07>; + alias <LatK> = <AC08>; + alias <LatL> = <AC09>; + alias <LatZ> = <AB01>; + alias <LatX> = <AB02>; + alias <LatC> = <AB03>; + alias <LatV> = <AB04>; + alias <LatB> = <AB05>; + alias <LatN> = <AB06>; + alias <LatM> = <AB07>; +}; - virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; +xkb_types "complete" { + virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; - type "ONE_LEVEL" { - modifiers= none; - level_name[Level1]= "Any"; - }; - type "TWO_LEVEL" { - modifiers= Shift; - map[Shift]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - }; - type "ALPHABETIC" { - modifiers= Shift+Lock; - map[Shift]= Level2; - map[Lock]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Caps"; - }; - type "SHIFT+ALT" { - modifiers= Shift+Alt; - map[Shift+Alt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift+Alt"; - }; - type "PC_CONTROL_LEVEL2" { - modifiers= Control; - map[Control]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Control"; - }; - type "PC_LCONTROL_LEVEL2" { - modifiers= LControl; - map[LControl]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "LControl"; - }; - type "PC_RCONTROL_LEVEL2" { - modifiers= RControl; - map[RControl]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "RControl"; - }; - type "PC_ALT_LEVEL2" { - modifiers= Alt; - map[Alt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Alt"; - }; - type "PC_LALT_LEVEL2" { - modifiers= LAlt; - map[LAlt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "LAlt"; - }; - type "PC_RALT_LEVEL2" { - modifiers= RAlt; - map[RAlt]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "RAlt"; - }; - type "CTRL+ALT" { - modifiers= Shift+Control+Alt+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Control+Alt]= Level5; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "Ctrl+Alt"; - }; - type "LOCAL_EIGHT_LEVEL" { - modifiers= Shift+Lock+Control+LevelThree; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+Lock+LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level4; - map[Control]= Level5; - map[Shift+Lock+Control]= Level5; - map[Shift+Control]= Level6; - map[Lock+Control]= Level6; - map[Control+LevelThree]= Level7; - map[Shift+Lock+Control+LevelThree]= Level7; - map[Shift+Control+LevelThree]= Level8; - map[Lock+Control+LevelThree]= Level8; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Level3"; - level_name[Level4]= "Shift Level3"; - level_name[Level5]= "Ctrl"; - level_name[Level6]= "Shift Ctrl"; - level_name[Level7]= "Level3 Ctrl"; - level_name[Level8]= "Shift Level3 Ctrl"; - }; - type "THREE_LEVEL" { - modifiers= Shift+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Level3"; - }; - type "EIGHT_LEVEL" { - modifiers= Shift+LevelThree+LevelFive; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "EIGHT_LEVEL_ALPHABETIC" { - modifiers= Shift+Lock+LevelThree+LevelFive; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level4; - map[Shift+Lock+LevelThree]= Level3; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - map[Lock+LevelFive]= Level6; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - map[Lock+LevelThree+LevelFive]= Level8; - map[Shift+Lock+LevelThree+LevelFive]= Level7; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "EIGHT_LEVEL_SEMIALPHABETIC" { - modifiers= Shift+Lock+LevelThree+LevelFive; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level3; - preserve[Lock+LevelThree]= Lock; - map[Shift+Lock+LevelThree]= Level4; - preserve[Shift+Lock+LevelThree]= Lock; - map[LevelFive]= Level5; - map[Shift+LevelFive]= Level6; - map[Lock+LevelFive]= Level6; - preserve[Lock+LevelFive]= Lock; - map[LevelThree+LevelFive]= Level7; - map[Shift+LevelThree+LevelFive]= Level8; - map[Lock+LevelThree+LevelFive]= Level7; - preserve[Lock+LevelThree+LevelFive]= Lock; - map[Shift+Lock+LevelThree+LevelFive]= Level8; - preserve[Shift+Lock+LevelThree+LevelFive]= Lock; - map[Shift+Lock+LevelFive]= Level1; - preserve[Shift+Lock+LevelFive]= Lock; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "X"; - level_name[Level6]= "X Shift"; - level_name[Level7]= "X Alt Base"; - level_name[Level8]= "X Shift Alt"; - }; - type "FOUR_LEVEL" { - modifiers= Shift+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_ALPHABETIC" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level4; - map[Shift+Lock+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_SEMIALPHABETIC" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[Lock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level3; - preserve[Lock+LevelThree]= Lock; - map[Shift+Lock+LevelThree]= Level4; - preserve[Shift+Lock+LevelThree]= Lock; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_MIXED_KEYPAD" { - modifiers= Shift+NumLock+LevelThree; - map[NumLock]= Level2; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[NumLock+LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Shift+NumLock+LevelThree]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Number"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - }; - type "FOUR_LEVEL_X" { - modifiers= Shift+Control+Alt+LevelThree; - map[LevelThree]= Level2; - map[Shift+LevelThree]= Level3; - map[Control+Alt]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Alt Base"; - level_name[Level3]= "Shift Alt"; - level_name[Level4]= "Ctrl+Alt"; - }; - type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[Lock]= Level4; - preserve[Lock]= Lock; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock+LevelThree]= Level3; - preserve[Lock+LevelThree]= Lock; - map[Shift+Lock+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "AltGr Base"; - level_name[Level4]= "Shift AltGr"; - }; - type "FOUR_LEVEL_PLUS_LOCK" { - modifiers= Shift+Lock+LevelThree; - map[Shift]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[Lock]= Level5; - map[Shift+Lock]= Level2; - map[Lock+LevelThree]= Level3; - map[Shift+Lock+LevelThree]= Level4; - level_name[Level1]= "Base"; - level_name[Level2]= "Shift"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Shift Alt"; - level_name[Level5]= "Lock"; - }; - type "KEYPAD" { - modifiers= Shift+NumLock; - map[Shift]= Level2; - map[NumLock]= Level2; - level_name[Level1]= "Base"; - level_name[Level2]= "Number"; - }; - type "FOUR_LEVEL_KEYPAD" { - modifiers= Shift+NumLock+LevelThree; - map[Shift]= Level2; - map[NumLock]= Level2; - map[LevelThree]= Level3; - map[Shift+LevelThree]= Level4; - map[NumLock+LevelThree]= Level4; - map[Shift+NumLock+LevelThree]= Level3; - level_name[Level1]= "Base"; - level_name[Level2]= "Number"; - level_name[Level3]= "Alt Base"; - level_name[Level4]= "Alt Number"; - }; + type "ONE_LEVEL" { + modifiers= none; + level_name[Level1]= "Any"; }; + type "TWO_LEVEL" { + modifiers= Shift; + map[Shift]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + }; + type "ALPHABETIC" { + modifiers= Shift+Lock; + map[Shift]= Level2; + map[Lock]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Caps"; + }; + type "SHIFT+ALT" { + modifiers= Shift+Alt; + map[Shift+Alt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift+Alt"; + }; + type "PC_CONTROL_LEVEL2" { + modifiers= Control; + map[Control]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Control"; + }; + type "PC_LCONTROL_LEVEL2" { + modifiers= LControl; + map[LControl]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "LControl"; + }; + type "PC_RCONTROL_LEVEL2" { + modifiers= RControl; + map[RControl]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "RControl"; + }; + type "PC_ALT_LEVEL2" { + modifiers= Alt; + map[Alt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Alt"; + }; + type "PC_LALT_LEVEL2" { + modifiers= LAlt; + map[LAlt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "LAlt"; + }; + type "PC_RALT_LEVEL2" { + modifiers= RAlt; + map[RAlt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "RAlt"; + }; + type "CTRL+ALT" { + modifiers= Shift+Control+Alt+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Control+Alt]= Level5; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "Ctrl+Alt"; + }; + type "LOCAL_EIGHT_LEVEL" { + modifiers= Shift+Lock+Control+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+Lock+LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Control]= Level5; + map[Shift+Lock+Control]= Level5; + map[Shift+Control]= Level6; + map[Lock+Control]= Level6; + map[Control+LevelThree]= Level7; + map[Shift+Lock+Control+LevelThree]= Level7; + map[Shift+Control+LevelThree]= Level8; + map[Lock+Control+LevelThree]= Level8; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Level3"; + level_name[Level4]= "Shift Level3"; + level_name[Level5]= "Ctrl"; + level_name[Level6]= "Shift Ctrl"; + level_name[Level7]= "Level3 Ctrl"; + level_name[Level8]= "Shift Level3 Ctrl"; + }; + type "THREE_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Level3"; + }; + type "EIGHT_LEVEL" { + modifiers= Shift+LevelThree+LevelFive; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "EIGHT_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Shift+Lock+LevelThree]= Level3; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[Lock+LevelFive]= Level6; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + map[Lock+LevelThree+LevelFive]= Level8; + map[Shift+Lock+LevelThree+LevelFive]= Level7; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "EIGHT_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level4; + preserve[Shift+Lock+LevelThree]= Lock; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[Lock+LevelFive]= Level6; + preserve[Lock+LevelFive]= Lock; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + map[Lock+LevelThree+LevelFive]= Level7; + preserve[Lock+LevelThree+LevelFive]= Lock; + map[Shift+Lock+LevelThree+LevelFive]= Level8; + preserve[Shift+Lock+LevelThree+LevelFive]= Lock; + map[Shift+Lock+LevelFive]= Level1; + preserve[Shift+Lock+LevelFive]= Lock; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "FOUR_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Shift+Lock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level4; + preserve[Shift+Lock+LevelThree]= Lock; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_MIXED_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[NumLock]= Level2; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[NumLock+LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Shift+NumLock+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_X" { + modifiers= Shift+Control+Alt+LevelThree; + map[LevelThree]= Level2; + map[Shift+LevelThree]= Level3; + map[Control+Alt]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Alt Base"; + level_name[Level3]= "Shift Alt"; + level_name[Level4]= "Ctrl+Alt"; + }; + type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level4; + preserve[Lock]= Lock; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "AltGr Base"; + level_name[Level4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_PLUS_LOCK" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock]= Level5; + map[Shift+Lock]= Level2; + map[Lock+LevelThree]= Level3; + map[Shift+Lock+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "Lock"; + }; + type "KEYPAD" { + modifiers= Shift+NumLock; + map[Shift]= Level2; + map[NumLock]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + }; + type "FOUR_LEVEL_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift]= Level2; + map[NumLock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[NumLock+LevelThree]= Level4; + map[Shift+NumLock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Alt Number"; + }; +}; - xkb_compatibility "complete_caps(caps_lock)_4_misc(assign_shift_left_action)_4_level5(level5_lock)_4" { - - virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; +xkb_compatibility "complete_caps(caps_lock)_4_misc(assign_shift_left_action)_4_level5(level5_lock)_4" { + virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; - interpret.useModMapMods= AnyLevel; - interpret.repeat= False; - interpret ISO_Level2_Latch+Exactly(Shift) { - useModMapMods=level1; - action= LatchMods(modifiers=Shift,clearLocks,latchToLock); - }; - interpret Shift_Lock+AnyOf(Shift+Lock) { - action= LockMods(modifiers=Shift); - }; - interpret Num_Lock+AnyOf(all) { - virtualModifier= NumLock; - action= LockMods(modifiers=NumLock); - }; - interpret ISO_Lock+AnyOf(all) { - action= NoAction(); - }; - interpret ISO_Level3_Shift+AnyOf(all) { - virtualModifier= LevelThree; - useModMapMods=level1; - action= SetMods(modifiers=LevelThree,clearLocks); - }; - interpret ISO_Level3_Latch+AnyOf(all) { - virtualModifier= LevelThree; - useModMapMods=level1; - action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); - }; - interpret ISO_Level3_Lock+AnyOf(all) { - virtualModifier= LevelThree; - useModMapMods=level1; - action= LockMods(modifiers=LevelThree); - }; - interpret Alt_L+AnyOf(all) { - virtualModifier= Alt; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Alt_R+AnyOf(all) { - virtualModifier= Alt; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Meta_L+AnyOf(all) { - virtualModifier= Meta; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Meta_R+AnyOf(all) { - virtualModifier= Meta; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Super_L+AnyOf(all) { - virtualModifier= Super; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Super_R+AnyOf(all) { - virtualModifier= Super; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Hyper_L+AnyOf(all) { - virtualModifier= Hyper; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Hyper_R+AnyOf(all) { - virtualModifier= Hyper; - action= SetMods(modifiers=modMapMods,clearLocks); - }; - interpret Scroll_Lock+AnyOf(all) { - virtualModifier= ScrollLock; - action= LockMods(modifiers=modMapMods); - }; - interpret ISO_Level5_Shift+AnyOf(all) { - virtualModifier= LevelFive; - useModMapMods=level1; - action= SetMods(modifiers=LevelFive,clearLocks); - }; - interpret ISO_Level5_Latch+AnyOf(all) { - virtualModifier= LevelFive; - action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); - }; - interpret ISO_Level5_Lock+AnyOf(all) { - virtualModifier= LevelFive; - action= LockMods(modifiers=LevelFive); - }; - interpret Mode_switch+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= SetGroup(group=+1); - }; - interpret ISO_Level3_Shift+AnyOfOrNone(all) { - action= SetMods(modifiers=LevelThree,clearLocks); - }; - interpret ISO_Level3_Latch+AnyOfOrNone(all) { - action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); - }; - interpret ISO_Level3_Lock+AnyOfOrNone(all) { - action= LockMods(modifiers=LevelThree); - }; - interpret ISO_Group_Latch+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= LatchGroup(group=2); - }; - interpret ISO_Next_Group+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= LockGroup(group=+1); - }; - interpret ISO_Prev_Group+AnyOfOrNone(all) { - virtualModifier= AltGr; - useModMapMods=level1; - action= LockGroup(group=-1); - }; - interpret ISO_First_Group+AnyOfOrNone(all) { - action= LockGroup(group=1); - }; - interpret ISO_Last_Group+AnyOfOrNone(all) { - action= LockGroup(group=2); - }; - interpret KP_1+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+1); - }; - interpret KP_End+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+1); - }; - interpret KP_2+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=+1); - }; - interpret KP_Down+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=+1); - }; - interpret KP_3+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+1); - }; - interpret KP_Next+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+1); - }; - interpret KP_4+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+0); - }; - interpret KP_Left+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+0); - }; - interpret KP_6+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+0); - }; - interpret KP_Right+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+0); - }; - interpret KP_7+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=-1); - }; - interpret KP_Home+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=-1); - }; - interpret KP_8+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=-1); - }; - interpret KP_Up+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+0,y=-1); - }; - interpret KP_9+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=-1); - }; - interpret KP_Prior+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=-1); - }; - interpret KP_5+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default); - }; - interpret KP_Begin+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default); - }; - interpret KP_F2+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=1); - }; - interpret KP_Divide+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=1); - }; - interpret KP_F3+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=2); - }; - interpret KP_Multiply+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=2); - }; - interpret KP_F4+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=3); - }; - interpret KP_Subtract+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=3); - }; - interpret KP_Separator+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default,count=2); - }; - interpret KP_Add+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default,count=2); - }; - interpret KP_0+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=lock); - }; - interpret KP_Insert+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=lock); - }; - interpret KP_Decimal+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=unlock); - }; - interpret KP_Delete+AnyOfOrNone(all) { - repeat= True; - action= LockPtrBtn(button=default,affect=unlock); - }; - interpret F25+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=1); - }; - interpret F26+AnyOfOrNone(all) { - repeat= True; - action= SetPtrDflt(affect=button,button=2); - }; - interpret F27+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=-1); - }; - interpret F29+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=-1); - }; - interpret F31+AnyOfOrNone(all) { - repeat= True; - action= PtrBtn(button=default); - }; - interpret F33+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=-1,y=+1); - }; - interpret F35+AnyOfOrNone(all) { - repeat= True; - action= MovePtr(x=+1,y=+1); - }; - interpret Pointer_Button_Dflt+AnyOfOrNone(all) { - action= PtrBtn(button=default); - }; - interpret Pointer_Button1+AnyOfOrNone(all) { - action= PtrBtn(button=1); - }; - interpret Pointer_Button2+AnyOfOrNone(all) { - action= PtrBtn(button=2); - }; - interpret Pointer_Button3+AnyOfOrNone(all) { - action= PtrBtn(button=3); - }; - interpret Pointer_DblClick_Dflt+AnyOfOrNone(all) { - action= PtrBtn(button=default,count=2); - }; - interpret Pointer_DblClick1+AnyOfOrNone(all) { - action= PtrBtn(button=1,count=2); - }; - interpret Pointer_DblClick2+AnyOfOrNone(all) { - action= PtrBtn(button=2,count=2); - }; - interpret Pointer_DblClick3+AnyOfOrNone(all) { - action= PtrBtn(button=3,count=2); - }; - interpret Pointer_Drag_Dflt+AnyOfOrNone(all) { - action= LockPtrBtn(button=default,affect=both); - }; - interpret Pointer_Drag1+AnyOfOrNone(all) { - action= LockPtrBtn(button=1,affect=both); - }; - interpret Pointer_Drag2+AnyOfOrNone(all) { - action= LockPtrBtn(button=2,affect=both); - }; - interpret Pointer_Drag3+AnyOfOrNone(all) { - action= LockPtrBtn(button=3,affect=both); - }; - interpret Pointer_EnableKeys+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeys); - }; - interpret Pointer_Accelerate+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeysAccel); - }; - interpret Pointer_DfltBtnNext+AnyOfOrNone(all) { - action= SetPtrDflt(affect=button,button=+1); - }; - interpret Pointer_DfltBtnPrev+AnyOfOrNone(all) { - action= SetPtrDflt(affect=button,button=-1); - }; - interpret AccessX_Enable+AnyOfOrNone(all) { - action= LockControls(controls=AccessXKeys); - }; - interpret AccessX_Feedback_Enable+AnyOfOrNone(all) { - action= LockControls(controls=AccessXFeedback); - }; - interpret RepeatKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=RepeatKeys); - }; - interpret SlowKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=SlowKeys); - }; - interpret BounceKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=BounceKeys); - }; - interpret StickyKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=StickyKeys); - }; - interpret MouseKeys_Enable+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeys); - }; - interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) { - action= LockControls(controls=MouseKeysAccel); - }; - interpret Overlay1_Enable+AnyOfOrNone(all) { - action= LockControls(controls=none); - }; - interpret Overlay2_Enable+AnyOfOrNone(all) { - action= LockControls(controls=none); - }; - interpret AudibleBell_Enable+AnyOfOrNone(all) { - action= LockControls(controls=AudibleBell); - }; - interpret Terminate_Server+AnyOfOrNone(all) { - action= Terminate(); - }; - interpret Alt_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Alt,clearLocks); - }; - interpret Alt_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Alt,clearLocks); - }; - interpret Meta_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Meta,clearLocks); - }; - interpret Meta_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Meta,clearLocks); - }; - interpret Super_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Super,clearLocks); - }; - interpret Super_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Super,clearLocks); - }; - interpret Hyper_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Hyper,clearLocks); - }; - interpret Hyper_R+AnyOfOrNone(all) { - action= SetMods(modifiers=Hyper,clearLocks); - }; - interpret Shift_L+AnyOfOrNone(all) { - action= SetMods(modifiers=Shift); - }; - interpret XF86Switch_VT_1+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=1,!same); - }; - interpret XF86Switch_VT_2+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=2,!same); - }; - interpret XF86Switch_VT_3+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=3,!same); - }; - interpret XF86Switch_VT_4+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=4,!same); - }; - interpret XF86Switch_VT_5+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=5,!same); - }; - interpret XF86Switch_VT_6+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=6,!same); - }; - interpret XF86Switch_VT_7+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=7,!same); - }; - interpret XF86Switch_VT_8+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=8,!same); - }; - interpret XF86Switch_VT_9+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=9,!same); - }; - interpret XF86Switch_VT_10+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=10,!same); - }; - interpret XF86Switch_VT_11+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=11,!same); - }; - interpret XF86Switch_VT_12+AnyOfOrNone(all) { - repeat= True; - action= SwitchScreen(screen=12,!same); - }; - interpret XF86LogGrabInfo+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x47,data[3]=0x72,data[4]=0x62,data[5]=0x73,data[6]=0x00); - }; - interpret XF86LogWindowTree+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x57,data[3]=0x69,data[4]=0x6e,data[5]=0x73,data[6]=0x00); - }; - interpret XF86Next_VMode+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x2b,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); - }; - interpret XF86Prev_VMode+AnyOfOrNone(all) { - repeat= True; - action= Private(type=0x86,data[0]=0x2d,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); - }; - interpret ISO_Level5_Shift+AnyOfOrNone(all) { - action= SetMods(modifiers=LevelFive,clearLocks); - }; - interpret ISO_Level5_Latch+AnyOfOrNone(all) { - action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); - }; - interpret ISO_Level5_Lock+AnyOfOrNone(all) { - action= LockMods(modifiers=NumLock); - }; - interpret Caps_Lock+AnyOfOrNone(all) { - action= LockMods(modifiers=Lock); - }; - interpret Any+Exactly(Lock) { - action= LockMods(modifiers=Lock); - }; - interpret Any+AnyOf(all) { - action= SetMods(modifiers=modMapMods,clearLocks); - }; - indicator "Caps Lock" { - whichModState= locked; - modifiers= Lock; - }; - indicator "Num Lock" { - whichModState= locked; - modifiers= NumLock; - }; - indicator "Scroll Lock" { - whichModState= locked; - modifiers= ScrollLock; - }; - indicator "Shift Lock" { - whichModState= locked; - modifiers= Shift; - }; - indicator "Group 2" { - groups= 0xfe; - }; - indicator "Mouse Keys" { - controls= MouseKeys; - }; + interpret.useModMapMods= AnyLevel; + interpret.repeat= False; + interpret ISO_Level2_Latch+Exactly(Shift) { + useModMapMods=level1; + action= LatchMods(modifiers=Shift,clearLocks,latchToLock); }; + interpret Shift_Lock+AnyOf(Shift+Lock) { + action= LockMods(modifiers=Shift); + }; + interpret Num_Lock+AnyOf(all) { + virtualModifier= NumLock; + action= LockMods(modifiers=NumLock); + }; + interpret ISO_Lock+AnyOf(all) { + action= NoAction(); + }; + interpret ISO_Level3_Shift+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LockMods(modifiers=LevelThree); + }; + interpret Alt_L+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Alt_R+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_L+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_R+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_L+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_R+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_L+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_R+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Scroll_Lock+AnyOf(all) { + virtualModifier= ScrollLock; + action= LockMods(modifiers=modMapMods); + }; + interpret ISO_Level5_Shift+AnyOf(all) { + virtualModifier= LevelFive; + useModMapMods=level1; + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOf(all) { + virtualModifier= LevelFive; + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOf(all) { + virtualModifier= LevelFive; + action= LockMods(modifiers=LevelFive); + }; + interpret Mode_switch+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= SetGroup(group=+1); + }; + interpret ISO_Level3_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelThree); + }; + interpret ISO_Group_Latch+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LatchGroup(group=2); + }; + interpret ISO_Next_Group+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LockGroup(group=+1); + }; + interpret ISO_Prev_Group+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LockGroup(group=-1); + }; + interpret ISO_First_Group+AnyOfOrNone(all) { + action= LockGroup(group=1); + }; + interpret ISO_Last_Group+AnyOfOrNone(all) { + action= LockGroup(group=2); + }; + interpret KP_1+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret KP_End+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret KP_2+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=+1); + }; + interpret KP_Down+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=+1); + }; + interpret KP_3+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret KP_Next+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret KP_4+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+0); + }; + interpret KP_Left+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+0); + }; + interpret KP_6+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+0); + }; + interpret KP_Right+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+0); + }; + interpret KP_7+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret KP_Home+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret KP_8+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=-1); + }; + interpret KP_Up+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=-1); + }; + interpret KP_9+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret KP_Prior+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret KP_5+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret KP_Begin+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret KP_F2+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret KP_Divide+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret KP_F3+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret KP_Multiply+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret KP_F4+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=3); + }; + interpret KP_Subtract+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=3); + }; + interpret KP_Separator+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default,count=2); + }; + interpret KP_Add+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default,count=2); + }; + interpret KP_0+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=lock); + }; + interpret KP_Insert+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=lock); + }; + interpret KP_Decimal+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=unlock); + }; + interpret KP_Delete+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=unlock); + }; + interpret F25+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret F26+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret F27+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret F29+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret F31+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret F33+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret F35+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret Pointer_Button_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default); + }; + interpret Pointer_Button1+AnyOfOrNone(all) { + action= PtrBtn(button=1); + }; + interpret Pointer_Button2+AnyOfOrNone(all) { + action= PtrBtn(button=2); + }; + interpret Pointer_Button3+AnyOfOrNone(all) { + action= PtrBtn(button=3); + }; + interpret Pointer_DblClick_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default,count=2); + }; + interpret Pointer_DblClick1+AnyOfOrNone(all) { + action= PtrBtn(button=1,count=2); + }; + interpret Pointer_DblClick2+AnyOfOrNone(all) { + action= PtrBtn(button=2,count=2); + }; + interpret Pointer_DblClick3+AnyOfOrNone(all) { + action= PtrBtn(button=3,count=2); + }; + interpret Pointer_Drag_Dflt+AnyOfOrNone(all) { + action= LockPtrBtn(button=default,affect=both); + }; + interpret Pointer_Drag1+AnyOfOrNone(all) { + action= LockPtrBtn(button=1,affect=both); + }; + interpret Pointer_Drag2+AnyOfOrNone(all) { + action= LockPtrBtn(button=2,affect=both); + }; + interpret Pointer_Drag3+AnyOfOrNone(all) { + action= LockPtrBtn(button=3,affect=both); + }; + interpret Pointer_EnableKeys+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret Pointer_Accelerate+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Pointer_DfltBtnNext+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=+1); + }; + interpret Pointer_DfltBtnPrev+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=-1); + }; + interpret AccessX_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXKeys); + }; + interpret AccessX_Feedback_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXFeedback); + }; + interpret RepeatKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=RepeatKeys); + }; + interpret SlowKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=SlowKeys); + }; + interpret BounceKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=BounceKeys); + }; + interpret StickyKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=StickyKeys); + }; + interpret MouseKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Overlay1_Enable+AnyOfOrNone(all) { + action= LockControls(controls=none); + }; + interpret Overlay2_Enable+AnyOfOrNone(all) { + action= LockControls(controls=none); + }; + interpret AudibleBell_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AudibleBell); + }; + interpret Terminate_Server+AnyOfOrNone(all) { + action= Terminate(); + }; + interpret Alt_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Alt_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Meta_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Meta_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Super_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Super_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Hyper_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Hyper_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Shift_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Shift); + }; + interpret XF86Switch_VT_1+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=1,!same); + }; + interpret XF86Switch_VT_2+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=2,!same); + }; + interpret XF86Switch_VT_3+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=3,!same); + }; + interpret XF86Switch_VT_4+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=4,!same); + }; + interpret XF86Switch_VT_5+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=5,!same); + }; + interpret XF86Switch_VT_6+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=6,!same); + }; + interpret XF86Switch_VT_7+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=7,!same); + }; + interpret XF86Switch_VT_8+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=8,!same); + }; + interpret XF86Switch_VT_9+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=9,!same); + }; + interpret XF86Switch_VT_10+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=10,!same); + }; + interpret XF86Switch_VT_11+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=11,!same); + }; + interpret XF86Switch_VT_12+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=12,!same); + }; + interpret XF86LogGrabInfo+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x47,data[3]=0x72,data[4]=0x62,data[5]=0x73,data[6]=0x00); + }; + interpret XF86LogWindowTree+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x57,data[3]=0x69,data[4]=0x6e,data[5]=0x73,data[6]=0x00); + }; + interpret XF86Next_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2b,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret XF86Prev_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2d,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret ISO_Level5_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=NumLock); + }; + interpret Caps_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=Lock); + }; + interpret Any+Exactly(Lock) { + action= LockMods(modifiers=Lock); + }; + interpret Any+AnyOf(all) { + action= SetMods(modifiers=modMapMods,clearLocks); + }; + indicator "Caps Lock" { + whichModState= locked; + modifiers= Lock; + }; + indicator "Num Lock" { + whichModState= locked; + modifiers= NumLock; + }; + indicator "Scroll Lock" { + whichModState= locked; + modifiers= ScrollLock; + }; + indicator "Shift Lock" { + whichModState= locked; + modifiers= Shift; + }; + indicator "Group 2" { + groups= 0xfe; + }; + indicator "Mouse Keys" { + controls= MouseKeys; + }; +}; - xkb_symbols "pc_us_ru_2_ca(multix)_3_de(neo)_4_inet(evdev)" { - - name[group1]="English (US)"; - name[group2]="Russian"; - name[group3]="Canadian Multilingual"; - name[group4]="German (Neo 2)"; +xkb_symbols "pc_us_ru_2_ca(multix)_3_de(neo)_4_inet(evdev)" { + name[group1]="English (US)"; + name[group2]="Russian"; + name[group3]="Canadian Multilingual"; + name[group4]="German (Neo 2)"; - key <ESC> { [ Escape ] }; - key <AE01> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 1, exclam ], - symbols[Group2]= [ 1, exclam ], - symbols[Group3]= [ 1, exclam, plusminus, NoSymbol, onesuperior, exclamdown, NoSymbol, NoSymbol ], - symbols[Group4]= [ 1, degree, onesuperior, onesubscript, ordfeminine, NoSymbol, notsign, NoSymbol ] - }; - key <AE02> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 2, at ], - symbols[Group2]= [ 2, quotedbl ], - symbols[Group3]= [ 2, at, at, NoSymbol, twosuperior, NoSymbol, NoSymbol, NoSymbol ], - symbols[Group4]= [ 2, section, twosuperior, twosubscript, masculine, NoSymbol, logicalor, NoSymbol ] - }; - key <AE03> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 3, numbersign ], - symbols[Group2]= [ 3, numerosign ], - symbols[Group3]= [ 3, numbersign, sterling, NoSymbol, threesuperior, sterling, NoSymbol, NoSymbol ], - symbols[Group4]= [ 3, U2113, threesuperior, threesubscript, numerosign, NoSymbol, logicaland, NoSymbol ] - }; - key <AE04> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 4, dollar ], - symbols[Group2]= [ 4, semicolon ], - symbols[Group3]= [ 4, dollar, cent, NoSymbol, onequarter, currency, NoSymbol, NoSymbol ], - symbols[Group4]= [ 4, guillemotright, U203a, femalesymbol, NoSymbol, NoSymbol, U22a5, NoSymbol ] - }; - key <AE05> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 5, percent ], - symbols[Group2]= [ 5, percent ], - symbols[Group3]= [ 5, percent, currency, NoSymbol, onehalf, threeeighths, NoSymbol, NoSymbol ], - symbols[Group4]= [ 5, guillemotleft, U2039, malesymbol, periodcentered, NoSymbol, U2221, NoSymbol ] - }; - key <AE06> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ { H, E, L, L, O }, asciicircum ], - symbols[Group2]= [ 6, colon ], - symbols[Group3]= [ 6, question, notsign, NoSymbol, threequarters, fiveeighths, NoSymbol, NoSymbol ], - symbols[Group4]= [ 6, dollar, cent, U26a5, sterling, NoSymbol, U2225, NoSymbol ] - }; - key <AE07> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ { Y, E, S, space, T, H, I, S, space, I, S, space, D, O, G }, ampersand ], - symbols[Group2]= [ 7, question ], - symbols[Group3]= [ 7, ampersand, braceleft, NoSymbol, NoSymbol, seveneighths, NoSymbol, NoSymbol ], - symbols[Group4]= [ 7, EuroSign, yen, U3f0, currency, NoSymbol, rightarrow, NoSymbol ] - }; - key <AE08> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 8, asterisk ], - symbols[Group2]= [ 8, asterisk ], - symbols[Group3]= [ 8, asterisk, braceright, NoSymbol, NoSymbol, trademark, NoSymbol, NoSymbol ], - symbols[Group4]= [ 8, doublelowquotemark, singlelowquotemark, U27e8, Tab, ISO_Left_Tab, U221e, NoSymbol ] - }; - key <AE09> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 9, parenleft ], - symbols[Group2]= [ 9, parenleft ], - symbols[Group3]= [ 9, parenleft, bracketleft, NoSymbol, NoSymbol, plusminus, NoSymbol, NoSymbol ], - symbols[Group4]= [ 9, leftdoublequotemark, leftsinglequotemark, U27e9, KP_Divide, KP_Divide, variation, NoSymbol ] - }; - key <AE10> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ 0, parenright ], - symbols[Group2]= [ 0, parenright ], - symbols[Group3]= [ 0, parenright, bracketright, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol ], - symbols[Group4]= [ 0, rightdoublequotemark, rightsinglequotemark, zerosubscript, KP_Multiply, KP_Multiply, emptyset, NoSymbol ] - }; - key <AE11> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ minus, underscore ], - symbols[Group2]= [ minus, underscore ], - symbols[Group3]= [ minus, underscore, onehalf, NoSymbol, NoSymbol, questiondown, NoSymbol, NoSymbol ], - symbols[Group4]= [ minus, emdash, NoSymbol, U2011, KP_Subtract, KP_Subtract, hyphen, NoSymbol ] - }; - key <AE12> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ equal, plus ], - symbols[Group2]= [ equal, plus ], - symbols[Group3]= [ equal, plus, notsign, NoSymbol, dead_cedilla, dead_ogonek, NoSymbol, NoSymbol ], - symbols[Group4]= [ dead_grave, dead_cedilla, dead_abovering, dead_abovereversedcomma, dead_diaeresis, NoSymbol, dead_macron, NoSymbol ] - }; - key <BKSP> { [ BackSpace, BackSpace ] }; - key <TAB> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ Tab, ISO_Left_Tab ], - symbols[Group2]= [ Tab, ISO_Left_Tab ], - symbols[Group3]= [ Tab, ISO_Left_Tab ], - symbols[Group4]= [ Tab, ISO_Left_Tab, Multi_key, ISO_Level5_Lock, NoSymbol, NoSymbol, NoSymbol, ISO_Level5_Lock ] - }; - key <AD01> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ q, Q ], - symbols[Group2]= [ Cyrillic_shorti, Cyrillic_SHORTI ], - symbols[Group3]= [ q, Q, NoSymbol, NoSymbol, NoSymbol, Greek_OMEGA, NoSymbol, NoSymbol ], - symbols[Group4]= [ x, X, ellipsis, Greek_xi, Prior, Prior, Greek_XI, NoSymbol ] - }; - key <AD02> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ w, W ], - symbols[Group2]= [ Cyrillic_tse, Cyrillic_TSE ], - symbols[Group3]= [ w, W, NoSymbol, NoSymbol, lstroke, Lstroke, NoSymbol, NoSymbol ], - symbols[Group4]= [ v, V, underscore, NoSymbol, BackSpace, BackSpace, radical, NoSymbol ] - }; - key <AD03> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ e, E ], - symbols[Group2]= [ Cyrillic_u, Cyrillic_U ], - symbols[Group3]= [ e, E, NoSymbol, NoSymbol, oe, OE, NoSymbol, NoSymbol ], - symbols[Group4]= [ l, L, bracketleft, Greek_lamda, Up, Up, Greek_LAMDA, NoSymbol ] - }; - key <AD04> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ r, R ], - symbols[Group2]= [ Cyrillic_ka, Cyrillic_KA ], - symbols[Group3]= [ r, R, NoSymbol, NoSymbol, paragraph, registered, NoSymbol, NoSymbol ], - symbols[Group4]= [ c, C, bracketright, Greek_chi, Delete, Delete, U2102, NoSymbol ] - }; - key <AD05> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ t, T ], - symbols[Group2]= [ Cyrillic_ie, Cyrillic_IE ], - symbols[Group3]= [ t, T, NoSymbol, NoSymbol, tslash, Tslash, NoSymbol, NoSymbol ], - symbols[Group4]= [ w, W, asciicircum, Greek_omega, Next, Next, Greek_OMEGA, NoSymbol ] - }; - key <AD06> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ y, Y ], - symbols[Group2]= [ Cyrillic_en, Cyrillic_EN ], - symbols[Group3]= [ y, Y, NoSymbol, NoSymbol, leftarrow, yen, NoSymbol, NoSymbol ], - symbols[Group4]= [ k, K, exclam, Greek_kappa, exclamdown, NoSymbol, multiply, NoSymbol ] - }; - key <AD07> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ u, U ], - symbols[Group2]= [ Cyrillic_ghe, Cyrillic_GHE ], - symbols[Group3]= [ u, U, NoSymbol, NoSymbol, downarrow, uparrow, NoSymbol, NoSymbol ], - symbols[Group4]= [ h, H, less, Greek_psi, KP_7, KP_7, Greek_PSI, NoSymbol ] - }; - key <AD08> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ i, I ], - symbols[Group2]= [ Cyrillic_sha, Cyrillic_SHA ], - symbols[Group3]= [ i, I, NoSymbol, NoSymbol, rightarrow, idotless, NoSymbol, NoSymbol ], - symbols[Group4]= [ g, G, greater, Greek_gamma, KP_8, KP_8, Greek_GAMMA, NoSymbol ] - }; - key <AD09> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ o, O ], - symbols[Group2]= [ Cyrillic_shcha, Cyrillic_SHCHA ], - symbols[Group3]= [ o, O, section, NoSymbol, oslash, Oslash, NoSymbol, NoSymbol ], - symbols[Group4]= [ f, F, equal, Greek_phi, KP_9, KP_9, Greek_PHI, NoSymbol ] - }; - key <AD10> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ p, P ], - symbols[Group2]= [ Cyrillic_ze, Cyrillic_ZE ], - symbols[Group3]= [ p, P, paragraph, NoSymbol, thorn, THORN, NoSymbol, NoSymbol ], - symbols[Group4]= [ q, Q, ampersand, U3d5, KP_Add, KP_Add, U211a, NoSymbol ] - }; - key <AD11> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ bracketleft, braceleft ], - symbols[Group2]= [ Cyrillic_ha, Cyrillic_HA ], - symbols[Group3]= [ dead_circumflex, dead_diaeresis, dead_grave, NoSymbol, NoSymbol, dead_abovering, NoSymbol, NoSymbol ], - symbols[Group4]= [ ssharp, U1e9e, U17f, Greek_finalsmallsigma, U2212, NoSymbol, jot, NoSymbol ] - }; - key <AD12> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ bracketright, braceright ], - symbols[Group2]= [ Cyrillic_hardsign, Cyrillic_HARDSIGN ], - symbols[Group3]= [ ccedilla, Ccedilla, asciitilde, NoSymbol, dead_tilde, dead_macron, NoSymbol, NoSymbol ], - symbols[Group4]= [ dead_acute, dead_tilde, dead_stroke, dead_abovecomma, dead_doubleacute, NoSymbol, dead_breve, NoSymbol ] - }; - key <RTRN> { [ Return ] }; - key <LCTL> { [ Control_L ] }; - key <AC01> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ a, A ], - symbols[Group2]= [ Cyrillic_ef, Cyrillic_EF ], - symbols[Group3]= [ a, A, NoSymbol, NoSymbol, ae, AE, NoSymbol, NoSymbol ], - symbols[Group4]= [ u, U, backslash, NoSymbol, Home, Home, includedin, NoSymbol ] - }; - key <AC02> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ s, S ], - symbols[Group2]= [ Cyrillic_yeru, Cyrillic_YERU ], - symbols[Group3]= [ s, S, NoSymbol, NoSymbol, ssharp, section, NoSymbol, NoSymbol ], - symbols[Group4]= [ i, I, slash, Greek_iota, Left, Left, integral, NoSymbol ] - }; - key <AC03> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ d, D ], - symbols[Group2]= [ Cyrillic_ve, Cyrillic_VE ], - symbols[Group3]= [ d, D, NoSymbol, NoSymbol, eth, ETH, NoSymbol, NoSymbol ], - symbols[Group4]= [ a, A, braceleft, Greek_alpha, Down, Down, U2200, NoSymbol ] - }; - key <AC04> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ f, F ], - symbols[Group2]= [ Cyrillic_a, Cyrillic_A ], - symbols[Group3]= [ f, F, NoSymbol, NoSymbol, NoSymbol, ordfeminine, NoSymbol, NoSymbol ], - symbols[Group4]= [ e, E, braceright, Greek_epsilon, Right, Right, U2203, NoSymbol ] - }; - key <AC05> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ g, G ], - symbols[Group2]= [ Cyrillic_pe, Cyrillic_PE ], - symbols[Group3]= [ g, G, NoSymbol, NoSymbol, eng, ENG, NoSymbol, NoSymbol ], - symbols[Group4]= [ o, O, asterisk, Greek_omicron, End, End, elementof, NoSymbol ] - }; - key <AC06> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ h, H ], - symbols[Group2]= [ Cyrillic_er, Cyrillic_ER ], - symbols[Group3]= [ h, H, NoSymbol, NoSymbol, hstroke, Hstroke, NoSymbol, NoSymbol ], - symbols[Group4]= [ s, S, question, Greek_sigma, questiondown, NoSymbol, Greek_SIGMA, NoSymbol ] - }; - key <AC07> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ j, J ], - symbols[Group2]= [ Cyrillic_o, Cyrillic_O ], - symbols[Group3]= [ j, J, NoSymbol, NoSymbol, U133, U132, NoSymbol, NoSymbol ], - symbols[Group4]= [ n, N, parenleft, Greek_nu, KP_4, KP_4, U2115, NoSymbol ] - }; - key <AC08> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ k, K ], - symbols[Group2]= [ Cyrillic_el, Cyrillic_EL ], - symbols[Group3]= [ k, K, NoSymbol, NoSymbol, kra, NoSymbol, NoSymbol, NoSymbol ], - symbols[Group4]= [ r, R, parenright, Greek_rho, KP_5, KP_5, U211d, NoSymbol ] - }; - key <AC09> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ l, L ], - symbols[Group2]= [ Cyrillic_de, Cyrillic_DE ], - symbols[Group3]= [ l, L, NoSymbol, NoSymbol, U140, U13f, NoSymbol, NoSymbol ], - symbols[Group4]= [ t, T, minus, Greek_tau, KP_6, KP_6, partialderivative, NoSymbol ] - }; - key <AC10> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ semicolon, colon ], - symbols[Group2]= [ Cyrillic_zhe, Cyrillic_ZHE ], - symbols[Group3]= [ semicolon, colon, degree, NoSymbol, dead_acute, dead_doubleacute, NoSymbol, NoSymbol ], - symbols[Group4]= [ d, D, colon, Greek_delta, KP_Separator, comma, Greek_DELTA, NoSymbol ] - }; - key <AC11> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ apostrophe, quotedbl ], - symbols[Group2]= [ Cyrillic_e, Cyrillic_E ], - symbols[Group3]= [ egrave, Egrave, braceleft, NoSymbol, NoSymbol, dead_caron, NoSymbol, NoSymbol ], - symbols[Group4]= [ y, Y, at, Greek_upsilon, period, KP_Decimal, nabla, NoSymbol ] - }; - key <TLDE> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ grave, asciitilde ], - symbols[Group2]= [ Cyrillic_io, Cyrillic_IO ], - symbols[Group3]= [ slash, backslash, bar, NoSymbol, NoSymbol, hyphen, NoSymbol, NoSymbol ], - symbols[Group4]= [ dead_circumflex, dead_caron, U21bb, U2de, dead_abovedot, Pointer_EnableKeys, dead_belowdot, NoSymbol ] - }; - key <LFSH> { - type[group4]= "TWO_LEVEL", - symbols[Group1]= [ Shift_L ], - symbols[Group2]= [ Shift_L ], - symbols[Group3]= [ Shift_L ], - symbols[Group4]= [ Shift_L, Caps_Lock ] - }; - key <BKSL> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "ONE_LEVEL", - symbols[Group1]= [ backslash, bar ], - symbols[Group2]= [ backslash, slash ], - symbols[Group3]= [ agrave, Agrave, braceright, NoSymbol, NoSymbol, dead_breve, NoSymbol, NoSymbol ], - symbols[Group4]= [ ISO_Level3_Shift ] - }; - key <AB01> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "FOUR_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ z, Z ], - symbols[Group2]= [ Cyrillic_ya, Cyrillic_YA ], - symbols[Group3]= [ z, Z, guillemotleft, NoSymbol ], - symbols[Group4]= [ udiaeresis, Udiaeresis, numbersign, NoSymbol, Escape, Escape, union, NoSymbol ] - }; - key <AB02> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "FOUR_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ x, X ], - symbols[Group2]= [ Cyrillic_che, Cyrillic_CHE ], - symbols[Group3]= [ x, X, guillemotright, NoSymbol ], - symbols[Group4]= [ odiaeresis, Odiaeresis, dollar, U3f5, Tab, Tab, intersection, NoSymbol ] - }; - key <AB03> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ c, C ], - symbols[Group2]= [ Cyrillic_es, Cyrillic_ES ], - symbols[Group3]= [ c, C, NoSymbol, NoSymbol, cent, copyright, NoSymbol, NoSymbol ], - symbols[Group4]= [ adiaeresis, Adiaeresis, bar, Greek_eta, Insert, Insert, U2135, NoSymbol ] - }; - key <AB04> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ v, V ], - symbols[Group2]= [ Cyrillic_em, Cyrillic_EM ], - symbols[Group3]= [ v, V, NoSymbol, NoSymbol, leftdoublequotemark, leftsinglequotemark, NoSymbol, NoSymbol ], - symbols[Group4]= [ p, P, asciitilde, Greek_pi, Return, Return, Greek_PI, NoSymbol ] - }; - key <AB05> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ b, B ], - symbols[Group2]= [ Cyrillic_i, Cyrillic_I ], - symbols[Group3]= [ b, B, NoSymbol, NoSymbol, rightdoublequotemark, rightsinglequotemark, NoSymbol, NoSymbol ], - symbols[Group4]= [ z, Z, grave, Greek_zeta, Undo, Undo, U2124, NoSymbol ] - }; - key <AB06> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ n, N ], - symbols[Group2]= [ Cyrillic_te, Cyrillic_TE ], - symbols[Group3]= [ n, N, NoSymbol, NoSymbol, U149, U266a, NoSymbol, NoSymbol ], - symbols[Group4]= [ b, B, plus, Greek_beta, colon, NoSymbol, U21d0, NoSymbol ] - }; - key <AB07> { - type[group1]= "ALPHABETIC", - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ m, M ], - symbols[Group2]= [ Cyrillic_softsign, Cyrillic_SOFTSIGN ], - symbols[Group3]= [ m, M, mu, NoSymbol, mu, masculine, NoSymbol, NoSymbol ], - symbols[Group4]= [ m, M, percent, Greek_mu, KP_1, KP_1, ifonlyif, NoSymbol ] - }; - key <AB08> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ comma, less ], - symbols[Group2]= [ Cyrillic_be, Cyrillic_BE ], - symbols[Group3]= [ comma, apostrophe, less, NoSymbol, Greek_horizbar, multiply, NoSymbol, NoSymbol ], - symbols[Group4]= [ comma, endash, quotedbl, U3f1, KP_2, KP_2, U21d2, NoSymbol ] - }; - key <AB09> { - type[group2]= "ALPHABETIC", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ period, greater ], - symbols[Group2]= [ Cyrillic_yu, Cyrillic_YU ], - symbols[Group3]= [ period, quotedbl, greater, NoSymbol, periodcentered, division, NoSymbol, NoSymbol ], - symbols[Group4]= [ period, enfilledcircbullet, apostrophe, U3d1, KP_3, KP_3, U21a6, NoSymbol ] - }; - key <AB10> { - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", - symbols[Group1]= [ slash, question ], - symbols[Group2]= [ period, comma ], - symbols[Group3]= [ eacute, Eacute, dead_acute, NoSymbol, NoSymbol, dead_abovedot, NoSymbol, NoSymbol ], - symbols[Group4]= [ j, J, semicolon, Greek_theta, semicolon, NoSymbol, Greek_THETA, NoSymbol ] - }; - key <RTSH> { - type[group4]= "TWO_LEVEL", - symbols[Group1]= [ Shift_R ], - symbols[Group2]= [ Shift_R ], - symbols[Group3]= [ Shift_R ], - symbols[Group4]= [ Shift_R, Caps_Lock ] - }; - key <KPMU> { - type[group1]= "CTRL+ALT", - type[group2]= "CTRL+ALT", - type[group3]= "CTRL+ALT", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ], - symbols[Group2]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ], - symbols[Group3]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ], - symbols[Group4]= [ KP_Multiply, KP_Multiply, U2219, U2299, multiply, NoSymbol, U2297, NoSymbol ] - }; - key <LALT> { [ Alt_L, Meta_L ] }; - key <SPCE> { - type[group3]= "FOUR_LEVEL", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ space ], - symbols[Group2]= [ space ], - symbols[Group3]= [ space, space, nobreakspace, NoSymbol ], - symbols[Group4]= [ space, space, space, nobreakspace, KP_0, KP_0, U202f, NoSymbol ] - }; - key <CAPS> { - type= "ONE_LEVEL", - symbols[Group1]= [ Caps_Lock ], - symbols[Group2]= [ Caps_Lock ], - symbols[Group3]= [ Caps_Lock ], - symbols[Group4]= [ ISO_Level3_Shift ] - }; - key <FK01> { - type= "CTRL+ALT", - symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] - }; - key <FK02> { - type= "CTRL+ALT", - symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] - }; - key <FK03> { - type= "CTRL+ALT", - symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] - }; - key <FK04> { - type= "CTRL+ALT", - symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] - }; - key <FK05> { - type= "CTRL+ALT", - symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] - }; - key <FK06> { - type= "CTRL+ALT", - symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] - }; - key <FK07> { - type= "CTRL+ALT", - symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] - }; - key <FK08> { - type= "CTRL+ALT", - symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] - }; - key <FK09> { - type= "CTRL+ALT", - symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] - }; - key <FK10> { - type= "CTRL+ALT", - symbols[Group1]= [ F10, F10, F10, F10, XF86Switch_VT_10 ] - }; - key <NMLK> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ Num_Lock ], - symbols[Group2]= [ Num_Lock ], - symbols[Group3]= [ Num_Lock ], - symbols[Group4]= [ Tab, ISO_Left_Tab, equal, approxeq, notequal, Pointer_EnableKeys, identical, NoSymbol ] - }; - key <SCLK> { [ Scroll_Lock ] }; - key <KP7> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Home, KP_7 ], - symbols[Group2]= [ KP_Home, KP_7 ], - symbols[Group3]= [ KP_Home, KP_7 ], - symbols[Group4]= [ KP_7, U2714, U2195, U226a, KP_Home, KP_Home, upstile, NoSymbol ] - }; - key <KP8> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Up, KP_8 ], - symbols[Group2]= [ KP_Up, KP_8 ], - symbols[Group3]= [ KP_Up, KP_8 ], - symbols[Group4]= [ KP_8, U2718, uparrow, intersection, KP_Up, KP_Up, U22c2, NoSymbol ] - }; - key <KP9> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Prior, KP_9 ], - symbols[Group2]= [ KP_Prior, KP_9 ], - symbols[Group3]= [ KP_Prior, KP_9 ], - symbols[Group4]= [ KP_9, dagger, U20d7, U226b, KP_Prior, KP_Prior, U2309, NoSymbol ] - }; - key <KPSU> { - type[group1]= "CTRL+ALT", - type[group2]= "CTRL+ALT", - type[group3]= "CTRL+ALT", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ], - symbols[Group2]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ], - symbols[Group3]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ], - symbols[Group4]= [ KP_Subtract, KP_Subtract, U2212, U2296, U2216, NoSymbol, U2238, NoSymbol ] - }; - key <KP4> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Left, KP_4 ], - symbols[Group2]= [ KP_Left, KP_4 ], - symbols[Group3]= [ KP_Left, KP_4 ], - symbols[Group4]= [ KP_4, club, leftarrow, includedin, KP_Left, KP_Left, U2286, NoSymbol ] - }; - key <KP5> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Begin, KP_5 ], - symbols[Group2]= [ KP_Begin, KP_5 ], - symbols[Group3]= [ KP_Begin, KP_5 ], - symbols[Group4]= [ KP_5, EuroSign, colon, U22b6, KP_Begin, KP_Begin, U22b7, NoSymbol ] - }; - key <KP6> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Right, KP_6 ], - symbols[Group2]= [ KP_Right, KP_6 ], - symbols[Group3]= [ KP_Right, KP_6 ], - symbols[Group4]= [ KP_6, U2023, rightarrow, includes, KP_Right, KP_Right, U2287, NoSymbol ] - }; - key <KPAD> { - type[group1]= "CTRL+ALT", - type[group2]= "CTRL+ALT", - type[group3]= "CTRL+ALT", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ], - symbols[Group2]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ], - symbols[Group3]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ], - symbols[Group4]= [ KP_Add, KP_Add, plusminus, U2295, U2213, NoSymbol, U2214, NoSymbol ] - }; - key <KP1> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_End, KP_1 ], - symbols[Group2]= [ KP_End, KP_1 ], - symbols[Group3]= [ KP_End, KP_1 ], - symbols[Group4]= [ KP_1, diamond, U2194, lessthanequal, KP_End, KP_End, downstile, NoSymbol ] - }; - key <KP2> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Down, KP_2 ], - symbols[Group2]= [ KP_Down, KP_2 ], - symbols[Group3]= [ KP_Down, KP_2 ], - symbols[Group4]= [ KP_2, heart, downarrow, union, KP_Down, KP_Down, U22c3, NoSymbol ] - }; - key <KP3> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Next, KP_3 ], - symbols[Group2]= [ KP_Next, KP_3 ], - symbols[Group3]= [ KP_Next, KP_3 ], - symbols[Group4]= [ KP_3, U2660, U21cc, greaterthanequal, KP_Next, KP_Next, U230b, NoSymbol ] - }; - key <KP0> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Insert, KP_0 ], - symbols[Group2]= [ KP_Insert, KP_0 ], - symbols[Group3]= [ KP_Insert, KP_0 ], - symbols[Group4]= [ KP_0, U2423, percent, U2030, KP_Insert, KP_Insert, U25a1, NoSymbol ] - }; - key <KPDL> { - type[group2]= "KEYPAD", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Delete, KP_Decimal ], - symbols[Group2]= [ KP_Delete, KP_Separator ], - symbols[Group3]= [ KP_Delete, KP_Decimal ], - symbols[Group4]= [ KP_Separator, period, comma, minutes, KP_Delete, KP_Delete, seconds, NoSymbol ] - }; - key <LVL3> { [ ISO_Level3_Shift ] }; - key <LSGT> { - type[group1]= "FOUR_LEVEL", - type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", - type[group4]= "ONE_LEVEL", - symbols[Group1]= [ less, greater, bar, brokenbar ], - symbols[Group2]= [ slash, bar ], - symbols[Group3]= [ ugrave, Ugrave, degree, NoSymbol, NoSymbol, brokenbar, NoSymbol, NoSymbol ], - symbols[Group4]= [ ISO_Level5_Shift ] - }; - key <FK11> { - type= "CTRL+ALT", - symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] - }; - key <FK12> { - type= "CTRL+ALT", - symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] - }; - key <KATA> { [ Katakana ] }; - key <HIRA> { [ Hiragana ] }; - key <HENK> { [ Henkan_Mode ] }; - key <HKTG> { [ Hiragana_Katakana ] }; - key <MUHE> { [ Muhenkan ] }; - key <KPEN> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Enter ], - symbols[Group2]= [ KP_Enter ], - symbols[Group3]= [ KP_Enter ], - symbols[Group4]= [ KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, NoSymbol ] - }; - key <RCTL> { - type= "ONE_LEVEL", - symbols[Group1]= [ Control_R ], - symbols[Group2]= [ Control_R ], - symbols[Group3]= [ ISO_Level5_Shift ] - }; - key <KPDV> { - type[group1]= "CTRL+ALT", - type[group2]= "CTRL+ALT", - type[group3]= "CTRL+ALT", - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ], - symbols[Group2]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ], - symbols[Group3]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ], - symbols[Group4]= [ KP_Divide, KP_Divide, division, U2300, U2215, NoSymbol, U2223, NoSymbol ] - }; - key <PRSC> { - type= "PC_ALT_LEVEL2", - symbols[Group1]= [ Print, Sys_Req ] - }; - key <RALT> { - type[group1]= "TWO_LEVEL", - type[group2]= "TWO_LEVEL", - type[group3]= "ONE_LEVEL", - type[group4]= "ONE_LEVEL", - symbols[Group1]= [ Alt_R, Meta_R ], - symbols[Group2]= [ Alt_R, Meta_R ], - symbols[Group3]= [ ISO_Level3_Shift ], - symbols[Group4]= [ ISO_Level5_Shift ] - }; - key <LNFD> { [ Linefeed ] }; - key <HOME> { [ Home ] }; - key <UP> { [ Up ] }; - key <PGUP> { [ Prior ] }; - key <LEFT> { [ Left ] }; - key <RGHT> { [ Right ] }; - key <END> { [ End ] }; - key <DOWN> { [ Down ] }; - key <PGDN> { [ Next ] }; - key <INS> { [ Insert ] }; - key <DELE> { [ Delete ] }; - key <MUTE> { [ XF86AudioMute ] }; - key <VOL-> { [ XF86AudioLowerVolume ] }; - key <VOL+> { [ XF86AudioRaiseVolume ] }; - key <POWR> { [ XF86PowerOff ] }; - key <KPEQ> { - type[group4]= "EIGHT_LEVEL", - symbols[Group1]= [ KP_Equal ], - symbols[Group2]= [ KP_Equal ], - symbols[Group3]= [ KP_Equal ], - symbols[Group4]= [ KP_Equal, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol ] - }; - key <I126> { [ plusminus ] }; - key <PAUS> { - type= "PC_CONTROL_LEVEL2", - symbols[Group1]= [ Pause, Break ] - }; - key <I128> { [ XF86LaunchA ] }; - key <I129> { [ KP_Decimal, KP_Decimal ] }; - key <HNGL> { [ Hangul ] }; - key <HJCV> { [ Hangul_Hanja ] }; - key <LWIN> { [ Super_L ] }; - key <RWIN> { [ Super_R ] }; - key <COMP> { [ Menu ] }; - key <STOP> { [ Cancel ] }; - key <AGAI> { [ Redo ] }; - key <PROP> { [ SunProps ] }; - key <UNDO> { [ Undo ] }; - key <FRNT> { [ SunFront ] }; - key <COPY> { [ XF86Copy ] }; - key <OPEN> { [ SunOpen ] }; - key <PAST> { [ XF86Paste ] }; - key <FIND> { [ Find ] }; - key <CUT> { [ XF86Cut ] }; - key <HELP> { [ Help ] }; - key <I147> { [ XF86MenuKB ] }; - key <I148> { [ XF86Calculator ] }; - key <I150> { [ XF86Sleep ] }; - key <I151> { [ XF86WakeUp ] }; - key <I152> { [ XF86Explorer ] }; - key <I153> { [ XF86Send ] }; - key <I155> { [ XF86Xfer ] }; - key <I156> { [ XF86Launch1 ] }; - key <I157> { [ XF86Launch2 ] }; - key <I158> { [ XF86WWW ] }; - key <I159> { [ XF86DOS ] }; - key <I160> { [ XF86ScreenSaver ] }; - key <I162> { [ XF86RotateWindows ] }; - key <I163> { [ XF86Mail ] }; - key <I164> { [ XF86Favorites ] }; - key <I165> { [ XF86MyComputer ] }; - key <I166> { [ XF86Back ] }; - key <I167> { [ XF86Forward ] }; - key <I169> { [ XF86Eject ] }; - key <I170> { [ XF86Eject, XF86Eject ] }; - key <I171> { [ XF86AudioNext ] }; - key <I172> { [ XF86AudioPlay, XF86AudioPause ] }; - key <I173> { [ XF86AudioPrev ] }; - key <I174> { [ XF86AudioStop, XF86Eject ] }; - key <I175> { [ XF86AudioRecord ] }; - key <I176> { [ XF86AudioRewind ] }; - key <I177> { [ XF86Phone ] }; - key <I179> { [ XF86Tools ] }; - key <I180> { [ XF86HomePage ] }; - key <I181> { [ XF86Reload ] }; - key <I182> { [ XF86Close ] }; - key <I185> { [ XF86ScrollUp ] }; - key <I186> { [ XF86ScrollDown ] }; - key <I187> { [ parenleft ] }; - key <I188> { [ parenright ] }; - key <I189> { [ XF86New ] }; - key <I190> { [ Redo ] }; - key <FK13> { [ XF86Tools ] }; - key <FK14> { [ XF86Launch5 ] }; - key <FK15> { [ XF86Launch6 ] }; - key <FK16> { [ XF86Launch7 ] }; - key <FK17> { [ XF86Launch8 ] }; - key <FK18> { [ XF86Launch9 ] }; - key <FK21> { [ XF86TouchpadToggle ] }; - key <FK22> { [ XF86TouchpadOn ] }; - key <FK23> { [ XF86TouchpadOff ] }; - key <MDSW> { [ Mode_switch ] }; - key <ALT> { [ NoSymbol, Alt_L ] }; - key <META> { [ NoSymbol, Meta_L ] }; - key <SUPR> { [ NoSymbol, Super_L ] }; - key <HYPR> { [ NoSymbol, Hyper_L ] }; - key <I208> { [ XF86AudioPlay ] }; - key <I209> { [ XF86AudioPause ] }; - key <I210> { [ XF86Launch3 ] }; - key <I211> { [ XF86Launch4 ] }; - key <I212> { [ XF86LaunchB ] }; - key <I213> { [ XF86Suspend ] }; - key <I214> { [ XF86Close ] }; - key <I215> { [ XF86AudioPlay ] }; - key <I216> { [ XF86AudioForward ] }; - key <I218> { [ Print ] }; - key <I220> { [ XF86WebCam ] }; - key <I223> { [ XF86Mail ] }; - key <I224> { [ XF86Messenger ] }; - key <I225> { [ XF86Search ] }; - key <I226> { [ XF86Go ] }; - key <I227> { [ XF86Finance ] }; - key <I228> { [ XF86Game ] }; - key <I229> { [ XF86Shop ] }; - key <I231> { [ Cancel ] }; - key <I232> { [ XF86MonBrightnessDown ] }; - key <I233> { [ XF86MonBrightnessUp ] }; - key <I234> { [ XF86AudioMedia ] }; - key <I235> { [ XF86Display ] }; - key <I236> { [ XF86KbdLightOnOff ] }; - key <I237> { [ XF86KbdBrightnessDown ] }; - key <I238> { [ XF86KbdBrightnessUp ] }; - key <I239> { [ XF86Send ] }; - key <I240> { [ XF86Reply ] }; - key <I241> { [ XF86MailForward ] }; - key <I242> { [ XF86Save ] }; - key <I243> { [ XF86Documents ] }; - key <I244> { [ XF86Battery ] }; - key <I245> { [ XF86Bluetooth ] }; - key <I246> { [ XF86WLAN ] }; - modifier_map Control { <LCTL> }; - modifier_map Shift { <LFSH> }; - modifier_map Shift { <RTSH> }; - modifier_map Mod1 { <LALT> }; - modifier_map Lock { <CAPS> }; - modifier_map Mod2 { <NMLK> }; - modifier_map Mod5 { <LVL3> }; - modifier_map Mod3 { <RCTL> }; - modifier_map Mod1 { <RALT> }; - modifier_map Mod4 { <LWIN> }; - modifier_map Mod4 { <RWIN> }; - modifier_map Mod5 { <MDSW> }; - modifier_map Mod1 { <META> }; - modifier_map Mod4 { <SUPR> }; - modifier_map Mod4 { <HYPR> }; + key <ESC> { [ Escape ] }; + key <AE01> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 1, exclam ], + symbols[Group2]= [ 1, exclam ], + symbols[Group3]= [ 1, exclam, plusminus, NoSymbol, onesuperior, exclamdown, NoSymbol, NoSymbol ], + symbols[Group4]= [ 1, degree, onesuperior, onesubscript, ordfeminine, NoSymbol, notsign, NoSymbol ] + }; + key <AE02> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 2, at ], + symbols[Group2]= [ 2, quotedbl ], + symbols[Group3]= [ 2, at, at, NoSymbol, twosuperior, NoSymbol, NoSymbol, NoSymbol ], + symbols[Group4]= [ 2, section, twosuperior, twosubscript, masculine, NoSymbol, logicalor, NoSymbol ] + }; + key <AE03> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 3, numbersign ], + symbols[Group2]= [ 3, numerosign ], + symbols[Group3]= [ 3, numbersign, sterling, NoSymbol, threesuperior, sterling, NoSymbol, NoSymbol ], + symbols[Group4]= [ 3, U2113, threesuperior, threesubscript, numerosign, NoSymbol, logicaland, NoSymbol ] + }; + key <AE04> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 4, dollar ], + symbols[Group2]= [ 4, semicolon ], + symbols[Group3]= [ 4, dollar, cent, NoSymbol, onequarter, currency, NoSymbol, NoSymbol ], + symbols[Group4]= [ 4, guillemotright, U203A, femalesymbol, NoSymbol, NoSymbol, U22A5, NoSymbol ] + }; + key <AE05> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 5, percent ], + symbols[Group2]= [ 5, percent ], + symbols[Group3]= [ 5, percent, currency, NoSymbol, onehalf, threeeighths, NoSymbol, NoSymbol ], + symbols[Group4]= [ 5, guillemotleft, U2039, malesymbol, periodcentered, NoSymbol, U2221, NoSymbol ] + }; + key <AE06> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ { H, E, L, L, O }, asciicircum ], + symbols[Group2]= [ 6, colon ], + symbols[Group3]= [ 6, question, notsign, NoSymbol, threequarters, fiveeighths, NoSymbol, NoSymbol ], + symbols[Group4]= [ 6, dollar, cent, U26A5, sterling, NoSymbol, U2225, NoSymbol ] + }; + key <AE07> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ { Y, E, S, space, T, H, I, S, space, I, S, space, D, O, G }, ampersand ], + symbols[Group2]= [ 7, question ], + symbols[Group3]= [ 7, ampersand, braceleft, NoSymbol, NoSymbol, seveneighths, NoSymbol, NoSymbol ], + symbols[Group4]= [ 7, EuroSign, yen, U03F0, currency, NoSymbol, rightarrow, NoSymbol ] + }; + key <AE08> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 8, asterisk ], + symbols[Group2]= [ 8, asterisk ], + symbols[Group3]= [ 8, asterisk, braceright, NoSymbol, NoSymbol, trademark, NoSymbol, NoSymbol ], + symbols[Group4]= [ 8, doublelowquotemark, singlelowquotemark, U27E8, Tab, ISO_Left_Tab, U221E, NoSymbol ] + }; + key <AE09> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 9, parenleft ], + symbols[Group2]= [ 9, parenleft ], + symbols[Group3]= [ 9, parenleft, bracketleft, NoSymbol, NoSymbol, plusminus, NoSymbol, NoSymbol ], + symbols[Group4]= [ 9, leftdoublequotemark, leftsinglequotemark, U27E9, KP_Divide, KP_Divide, variation, NoSymbol ] + }; + key <AE10> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ 0, parenright ], + symbols[Group2]= [ 0, parenright ], + symbols[Group3]= [ 0, parenright, bracketright, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol ], + symbols[Group4]= [ 0, rightdoublequotemark, rightsinglequotemark, zerosubscript, KP_Multiply, KP_Multiply, emptyset, NoSymbol ] + }; + key <AE11> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ minus, underscore ], + symbols[Group2]= [ minus, underscore ], + symbols[Group3]= [ minus, underscore, onehalf, NoSymbol, NoSymbol, questiondown, NoSymbol, NoSymbol ], + symbols[Group4]= [ minus, emdash, NoSymbol, U2011, KP_Subtract, KP_Subtract, hyphen, NoSymbol ] + }; + key <AE12> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ equal, plus ], + symbols[Group2]= [ equal, plus ], + symbols[Group3]= [ equal, plus, notsign, NoSymbol, dead_cedilla, dead_ogonek, NoSymbol, NoSymbol ], + symbols[Group4]= [ dead_grave, dead_cedilla, dead_abovering, dead_abovereversedcomma, dead_diaeresis, NoSymbol, dead_macron, NoSymbol ] + }; + key <BKSP> { [ BackSpace, BackSpace ] }; + key <TAB> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ Tab, ISO_Left_Tab ], + symbols[Group2]= [ Tab, ISO_Left_Tab ], + symbols[Group3]= [ Tab, ISO_Left_Tab ], + symbols[Group4]= [ Tab, ISO_Left_Tab, Multi_key, ISO_Level5_Lock, NoSymbol, NoSymbol, NoSymbol, ISO_Level5_Lock ] + }; + key <AD01> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ q, Q ], + symbols[Group2]= [ Cyrillic_shorti, Cyrillic_SHORTI ], + symbols[Group3]= [ q, Q, NoSymbol, NoSymbol, NoSymbol, Greek_OMEGA, NoSymbol, NoSymbol ], + symbols[Group4]= [ x, X, ellipsis, Greek_xi, Prior, Prior, Greek_XI, NoSymbol ] + }; + key <AD02> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ w, W ], + symbols[Group2]= [ Cyrillic_tse, Cyrillic_TSE ], + symbols[Group3]= [ w, W, NoSymbol, NoSymbol, lstroke, Lstroke, NoSymbol, NoSymbol ], + symbols[Group4]= [ v, V, underscore, NoSymbol, BackSpace, BackSpace, radical, NoSymbol ] + }; + key <AD03> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ e, E ], + symbols[Group2]= [ Cyrillic_u, Cyrillic_U ], + symbols[Group3]= [ e, E, NoSymbol, NoSymbol, oe, OE, NoSymbol, NoSymbol ], + symbols[Group4]= [ l, L, bracketleft, Greek_lamda, Up, Up, Greek_LAMDA, NoSymbol ] + }; + key <AD04> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ r, R ], + symbols[Group2]= [ Cyrillic_ka, Cyrillic_KA ], + symbols[Group3]= [ r, R, NoSymbol, NoSymbol, paragraph, registered, NoSymbol, NoSymbol ], + symbols[Group4]= [ c, C, bracketright, Greek_chi, Delete, Delete, U2102, NoSymbol ] + }; + key <AD05> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ t, T ], + symbols[Group2]= [ Cyrillic_ie, Cyrillic_IE ], + symbols[Group3]= [ t, T, NoSymbol, NoSymbol, tslash, Tslash, NoSymbol, NoSymbol ], + symbols[Group4]= [ w, W, asciicircum, Greek_omega, Next, Next, Greek_OMEGA, NoSymbol ] + }; + key <AD06> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ y, Y ], + symbols[Group2]= [ Cyrillic_en, Cyrillic_EN ], + symbols[Group3]= [ y, Y, NoSymbol, NoSymbol, leftarrow, yen, NoSymbol, NoSymbol ], + symbols[Group4]= [ k, K, exclam, Greek_kappa, exclamdown, NoSymbol, multiply, NoSymbol ] + }; + key <AD07> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ u, U ], + symbols[Group2]= [ Cyrillic_ghe, Cyrillic_GHE ], + symbols[Group3]= [ u, U, NoSymbol, NoSymbol, downarrow, uparrow, NoSymbol, NoSymbol ], + symbols[Group4]= [ h, H, less, Greek_psi, KP_7, KP_7, Greek_PSI, NoSymbol ] + }; + key <AD08> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ i, I ], + symbols[Group2]= [ Cyrillic_sha, Cyrillic_SHA ], + symbols[Group3]= [ i, I, NoSymbol, NoSymbol, rightarrow, idotless, NoSymbol, NoSymbol ], + symbols[Group4]= [ g, G, greater, Greek_gamma, KP_8, KP_8, Greek_GAMMA, NoSymbol ] + }; + key <AD09> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ o, O ], + symbols[Group2]= [ Cyrillic_shcha, Cyrillic_SHCHA ], + symbols[Group3]= [ o, O, section, NoSymbol, oslash, Oslash, NoSymbol, NoSymbol ], + symbols[Group4]= [ f, F, equal, Greek_phi, KP_9, KP_9, Greek_PHI, NoSymbol ] + }; + key <AD10> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ p, P ], + symbols[Group2]= [ Cyrillic_ze, Cyrillic_ZE ], + symbols[Group3]= [ p, P, paragraph, NoSymbol, thorn, THORN, NoSymbol, NoSymbol ], + symbols[Group4]= [ q, Q, ampersand, U03D5, KP_Add, KP_Add, U211A, NoSymbol ] + }; + key <AD11> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ bracketleft, braceleft ], + symbols[Group2]= [ Cyrillic_ha, Cyrillic_HA ], + symbols[Group3]= [ dead_circumflex, dead_diaeresis, dead_grave, NoSymbol, NoSymbol, dead_abovering, NoSymbol, NoSymbol ], + symbols[Group4]= [ ssharp, U1E9E, U017F, Greek_finalsmallsigma, U2212, NoSymbol, jot, NoSymbol ] + }; + key <AD12> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ bracketright, braceright ], + symbols[Group2]= [ Cyrillic_hardsign, Cyrillic_HARDSIGN ], + symbols[Group3]= [ ccedilla, Ccedilla, asciitilde, NoSymbol, dead_tilde, dead_macron, NoSymbol, NoSymbol ], + symbols[Group4]= [ dead_acute, dead_tilde, dead_stroke, dead_abovecomma, dead_doubleacute, NoSymbol, dead_breve, NoSymbol ] + }; + key <RTRN> { [ Return ] }; + key <LCTL> { [ Control_L ] }; + key <AC01> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ a, A ], + symbols[Group2]= [ Cyrillic_ef, Cyrillic_EF ], + symbols[Group3]= [ a, A, NoSymbol, NoSymbol, ae, AE, NoSymbol, NoSymbol ], + symbols[Group4]= [ u, U, backslash, NoSymbol, Home, Home, includedin, NoSymbol ] + }; + key <AC02> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ s, S ], + symbols[Group2]= [ Cyrillic_yeru, Cyrillic_YERU ], + symbols[Group3]= [ s, S, NoSymbol, NoSymbol, ssharp, section, NoSymbol, NoSymbol ], + symbols[Group4]= [ i, I, slash, Greek_iota, Left, Left, integral, NoSymbol ] }; + key <AC03> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ d, D ], + symbols[Group2]= [ Cyrillic_ve, Cyrillic_VE ], + symbols[Group3]= [ d, D, NoSymbol, NoSymbol, eth, ETH, NoSymbol, NoSymbol ], + symbols[Group4]= [ a, A, braceleft, Greek_alpha, Down, Down, U2200, NoSymbol ] + }; + key <AC04> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ f, F ], + symbols[Group2]= [ Cyrillic_a, Cyrillic_A ], + symbols[Group3]= [ f, F, NoSymbol, NoSymbol, NoSymbol, ordfeminine, NoSymbol, NoSymbol ], + symbols[Group4]= [ e, E, braceright, Greek_epsilon, Right, Right, U2203, NoSymbol ] + }; + key <AC05> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ g, G ], + symbols[Group2]= [ Cyrillic_pe, Cyrillic_PE ], + symbols[Group3]= [ g, G, NoSymbol, NoSymbol, eng, ENG, NoSymbol, NoSymbol ], + symbols[Group4]= [ o, O, asterisk, Greek_omicron, End, End, elementof, NoSymbol ] + }; + key <AC06> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ h, H ], + symbols[Group2]= [ Cyrillic_er, Cyrillic_ER ], + symbols[Group3]= [ h, H, NoSymbol, NoSymbol, hstroke, Hstroke, NoSymbol, NoSymbol ], + symbols[Group4]= [ s, S, question, Greek_sigma, questiondown, NoSymbol, Greek_SIGMA, NoSymbol ] + }; + key <AC07> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ j, J ], + symbols[Group2]= [ Cyrillic_o, Cyrillic_O ], + symbols[Group3]= [ j, J, NoSymbol, NoSymbol, U0133, U0132, NoSymbol, NoSymbol ], + symbols[Group4]= [ n, N, parenleft, Greek_nu, KP_4, KP_4, U2115, NoSymbol ] + }; + key <AC08> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ k, K ], + symbols[Group2]= [ Cyrillic_el, Cyrillic_EL ], + symbols[Group3]= [ k, K, NoSymbol, NoSymbol, kra, NoSymbol, NoSymbol, NoSymbol ], + symbols[Group4]= [ r, R, parenright, Greek_rho, KP_5, KP_5, U211D, NoSymbol ] + }; + key <AC09> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ l, L ], + symbols[Group2]= [ Cyrillic_de, Cyrillic_DE ], + symbols[Group3]= [ l, L, NoSymbol, NoSymbol, U0140, U013F, NoSymbol, NoSymbol ], + symbols[Group4]= [ t, T, minus, Greek_tau, KP_6, KP_6, partialderivative, NoSymbol ] + }; + key <AC10> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ semicolon, colon ], + symbols[Group2]= [ Cyrillic_zhe, Cyrillic_ZHE ], + symbols[Group3]= [ semicolon, colon, degree, NoSymbol, dead_acute, dead_doubleacute, NoSymbol, NoSymbol ], + symbols[Group4]= [ d, D, colon, Greek_delta, KP_Separator, comma, Greek_DELTA, NoSymbol ] + }; + key <AC11> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ apostrophe, quotedbl ], + symbols[Group2]= [ Cyrillic_e, Cyrillic_E ], + symbols[Group3]= [ egrave, Egrave, braceleft, NoSymbol, NoSymbol, dead_caron, NoSymbol, NoSymbol ], + symbols[Group4]= [ y, Y, at, Greek_upsilon, period, KP_Decimal, nabla, NoSymbol ] + }; + key <TLDE> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ grave, asciitilde ], + symbols[Group2]= [ Cyrillic_io, Cyrillic_IO ], + symbols[Group3]= [ slash, backslash, bar, NoSymbol, NoSymbol, hyphen, NoSymbol, NoSymbol ], + symbols[Group4]= [ dead_circumflex, dead_caron, U21BB, U02DE, dead_abovedot, Pointer_EnableKeys, dead_belowdot, NoSymbol ] + }; + key <LFSH> { + type[group4]= "TWO_LEVEL", + symbols[Group1]= [ Shift_L ], + symbols[Group2]= [ Shift_L ], + symbols[Group3]= [ Shift_L ], + symbols[Group4]= [ Shift_L, Caps_Lock ] + }; + key <BKSL> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "ONE_LEVEL", + symbols[Group1]= [ backslash, bar ], + symbols[Group2]= [ backslash, slash ], + symbols[Group3]= [ agrave, Agrave, braceright, NoSymbol, NoSymbol, dead_breve, NoSymbol, NoSymbol ], + symbols[Group4]= [ ISO_Level3_Shift ] + }; + key <AB01> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "FOUR_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ z, Z ], + symbols[Group2]= [ Cyrillic_ya, Cyrillic_YA ], + symbols[Group3]= [ z, Z, guillemotleft, NoSymbol ], + symbols[Group4]= [ udiaeresis, Udiaeresis, numbersign, NoSymbol, Escape, Escape, union, NoSymbol ] + }; + key <AB02> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "FOUR_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ x, X ], + symbols[Group2]= [ Cyrillic_che, Cyrillic_CHE ], + symbols[Group3]= [ x, X, guillemotright, NoSymbol ], + symbols[Group4]= [ odiaeresis, Odiaeresis, dollar, U03F5, Tab, Tab, intersection, NoSymbol ] + }; + key <AB03> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ c, C ], + symbols[Group2]= [ Cyrillic_es, Cyrillic_ES ], + symbols[Group3]= [ c, C, NoSymbol, NoSymbol, cent, copyright, NoSymbol, NoSymbol ], + symbols[Group4]= [ adiaeresis, Adiaeresis, bar, Greek_eta, Insert, Insert, U2135, NoSymbol ] + }; + key <AB04> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ v, V ], + symbols[Group2]= [ Cyrillic_em, Cyrillic_EM ], + symbols[Group3]= [ v, V, NoSymbol, NoSymbol, leftdoublequotemark, leftsinglequotemark, NoSymbol, NoSymbol ], + symbols[Group4]= [ p, P, asciitilde, Greek_pi, Return, Return, Greek_PI, NoSymbol ] + }; + key <AB05> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ b, B ], + symbols[Group2]= [ Cyrillic_i, Cyrillic_I ], + symbols[Group3]= [ b, B, NoSymbol, NoSymbol, rightdoublequotemark, rightsinglequotemark, NoSymbol, NoSymbol ], + symbols[Group4]= [ z, Z, grave, Greek_zeta, Undo, Undo, U2124, NoSymbol ] + }; + key <AB06> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ n, N ], + symbols[Group2]= [ Cyrillic_te, Cyrillic_TE ], + symbols[Group3]= [ n, N, NoSymbol, NoSymbol, U0149, U266A, NoSymbol, NoSymbol ], + symbols[Group4]= [ b, B, plus, Greek_beta, colon, NoSymbol, U21D0, NoSymbol ] + }; + key <AB07> { + type[group1]= "ALPHABETIC", + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ m, M ], + symbols[Group2]= [ Cyrillic_softsign, Cyrillic_SOFTSIGN ], + symbols[Group3]= [ m, M, mu, NoSymbol, mu, masculine, NoSymbol, NoSymbol ], + symbols[Group4]= [ m, M, percent, Greek_mu, KP_1, KP_1, ifonlyif, NoSymbol ] + }; + key <AB08> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ comma, less ], + symbols[Group2]= [ Cyrillic_be, Cyrillic_BE ], + symbols[Group3]= [ comma, apostrophe, less, NoSymbol, Greek_horizbar, multiply, NoSymbol, NoSymbol ], + symbols[Group4]= [ comma, endash, quotedbl, U03F1, KP_2, KP_2, U21D2, NoSymbol ] + }; + key <AB09> { + type[group2]= "ALPHABETIC", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ period, greater ], + symbols[Group2]= [ Cyrillic_yu, Cyrillic_YU ], + symbols[Group3]= [ period, quotedbl, greater, NoSymbol, periodcentered, division, NoSymbol, NoSymbol ], + symbols[Group4]= [ period, enfilledcircbullet, apostrophe, U03D1, KP_3, KP_3, U21A6, NoSymbol ] + }; + key <AB10> { + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "EIGHT_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ slash, question ], + symbols[Group2]= [ period, comma ], + symbols[Group3]= [ eacute, Eacute, dead_acute, NoSymbol, NoSymbol, dead_abovedot, NoSymbol, NoSymbol ], + symbols[Group4]= [ j, J, semicolon, Greek_theta, semicolon, NoSymbol, Greek_THETA, NoSymbol ] + }; + key <RTSH> { + type[group4]= "TWO_LEVEL", + symbols[Group1]= [ Shift_R ], + symbols[Group2]= [ Shift_R ], + symbols[Group3]= [ Shift_R ], + symbols[Group4]= [ Shift_R, Caps_Lock ] + }; + key <KPMU> { + type[group1]= "CTRL+ALT", + type[group2]= "CTRL+ALT", + type[group3]= "CTRL+ALT", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ], + symbols[Group2]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ], + symbols[Group3]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ], + symbols[Group4]= [ KP_Multiply, KP_Multiply, U2219, U2299, multiply, NoSymbol, U2297, NoSymbol ] + }; + key <LALT> { [ Alt_L, Meta_L ] }; + key <SPCE> { + type[group3]= "FOUR_LEVEL", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ space ], + symbols[Group2]= [ space ], + symbols[Group3]= [ space, space, nobreakspace, NoSymbol ], + symbols[Group4]= [ space, space, space, nobreakspace, KP_0, KP_0, U202F, NoSymbol ] + }; + key <CAPS> { + type= "ONE_LEVEL", + symbols[Group1]= [ Caps_Lock ], + symbols[Group2]= [ Caps_Lock ], + symbols[Group3]= [ Caps_Lock ], + symbols[Group4]= [ ISO_Level3_Shift ] + }; + key <FK01> { + type= "CTRL+ALT", + symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] + }; + key <FK02> { + type= "CTRL+ALT", + symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] + }; + key <FK03> { + type= "CTRL+ALT", + symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] + }; + key <FK04> { + type= "CTRL+ALT", + symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] + }; + key <FK05> { + type= "CTRL+ALT", + symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] + }; + key <FK06> { + type= "CTRL+ALT", + symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] + }; + key <FK07> { + type= "CTRL+ALT", + symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] + }; + key <FK08> { + type= "CTRL+ALT", + symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] + }; + key <FK09> { + type= "CTRL+ALT", + symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] + }; + key <FK10> { + type= "CTRL+ALT", + symbols[Group1]= [ F10, F10, F10, F10, XF86Switch_VT_10 ] + }; + key <NMLK> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ Num_Lock ], + symbols[Group2]= [ Num_Lock ], + symbols[Group3]= [ Num_Lock ], + symbols[Group4]= [ Tab, ISO_Left_Tab, equal, approxeq, notequal, Pointer_EnableKeys, identical, NoSymbol ] + }; + key <SCLK> { [ Scroll_Lock ] }; + key <KP7> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Home, KP_7 ], + symbols[Group2]= [ KP_Home, KP_7 ], + symbols[Group3]= [ KP_Home, KP_7 ], + symbols[Group4]= [ KP_7, U2714, U2195, U226A, KP_Home, KP_Home, upstile, NoSymbol ] + }; + key <KP8> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Up, KP_8 ], + symbols[Group2]= [ KP_Up, KP_8 ], + symbols[Group3]= [ KP_Up, KP_8 ], + symbols[Group4]= [ KP_8, U2718, uparrow, intersection, KP_Up, KP_Up, U22C2, NoSymbol ] + }; + key <KP9> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Prior, KP_9 ], + symbols[Group2]= [ KP_Prior, KP_9 ], + symbols[Group3]= [ KP_Prior, KP_9 ], + symbols[Group4]= [ KP_9, dagger, U20D7, U226B, KP_Prior, KP_Prior, U2309, NoSymbol ] + }; + key <KPSU> { + type[group1]= "CTRL+ALT", + type[group2]= "CTRL+ALT", + type[group3]= "CTRL+ALT", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ], + symbols[Group2]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ], + symbols[Group3]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ], + symbols[Group4]= [ KP_Subtract, KP_Subtract, U2212, U2296, U2216, NoSymbol, U2238, NoSymbol ] + }; + key <KP4> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Left, KP_4 ], + symbols[Group2]= [ KP_Left, KP_4 ], + symbols[Group3]= [ KP_Left, KP_4 ], + symbols[Group4]= [ KP_4, club, leftarrow, includedin, KP_Left, KP_Left, U2286, NoSymbol ] + }; + key <KP5> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Begin, KP_5 ], + symbols[Group2]= [ KP_Begin, KP_5 ], + symbols[Group3]= [ KP_Begin, KP_5 ], + symbols[Group4]= [ KP_5, EuroSign, colon, U22B6, KP_Begin, KP_Begin, U22B7, NoSymbol ] + }; + key <KP6> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Right, KP_6 ], + symbols[Group2]= [ KP_Right, KP_6 ], + symbols[Group3]= [ KP_Right, KP_6 ], + symbols[Group4]= [ KP_6, U2023, rightarrow, includes, KP_Right, KP_Right, U2287, NoSymbol ] + }; + key <KPAD> { + type[group1]= "CTRL+ALT", + type[group2]= "CTRL+ALT", + type[group3]= "CTRL+ALT", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ], + symbols[Group2]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ], + symbols[Group3]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ], + symbols[Group4]= [ KP_Add, KP_Add, plusminus, U2295, U2213, NoSymbol, U2214, NoSymbol ] + }; + key <KP1> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_End, KP_1 ], + symbols[Group2]= [ KP_End, KP_1 ], + symbols[Group3]= [ KP_End, KP_1 ], + symbols[Group4]= [ KP_1, diamond, U2194, lessthanequal, KP_End, KP_End, downstile, NoSymbol ] + }; + key <KP2> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Down, KP_2 ], + symbols[Group2]= [ KP_Down, KP_2 ], + symbols[Group3]= [ KP_Down, KP_2 ], + symbols[Group4]= [ KP_2, heart, downarrow, union, KP_Down, KP_Down, U22C3, NoSymbol ] + }; + key <KP3> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Next, KP_3 ], + symbols[Group2]= [ KP_Next, KP_3 ], + symbols[Group3]= [ KP_Next, KP_3 ], + symbols[Group4]= [ KP_3, U2660, U21CC, greaterthanequal, KP_Next, KP_Next, U230B, NoSymbol ] + }; + key <KP0> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Insert, KP_0 ], + symbols[Group2]= [ KP_Insert, KP_0 ], + symbols[Group3]= [ KP_Insert, KP_0 ], + symbols[Group4]= [ KP_0, U2423, percent, U2030, KP_Insert, KP_Insert, U25A1, NoSymbol ] + }; + key <KPDL> { + type[group2]= "KEYPAD", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Delete, KP_Decimal ], + symbols[Group2]= [ KP_Delete, KP_Separator ], + symbols[Group3]= [ KP_Delete, KP_Decimal ], + symbols[Group4]= [ KP_Separator, period, comma, minutes, KP_Delete, KP_Delete, seconds, NoSymbol ] + }; + key <LVL3> { [ ISO_Level3_Shift ] }; + key <LSGT> { + type[group1]= "FOUR_LEVEL", + type[group3]= "EIGHT_LEVEL_SEMIALPHABETIC", + type[group4]= "ONE_LEVEL", + symbols[Group1]= [ less, greater, bar, brokenbar ], + symbols[Group2]= [ slash, bar ], + symbols[Group3]= [ ugrave, Ugrave, degree, NoSymbol, NoSymbol, brokenbar, NoSymbol, NoSymbol ], + symbols[Group4]= [ ISO_Level5_Shift ] + }; + key <FK11> { + type= "CTRL+ALT", + symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] + }; + key <FK12> { + type= "CTRL+ALT", + symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] + }; + key <KATA> { [ Katakana ] }; + key <HIRA> { [ Hiragana ] }; + key <HENK> { [ Henkan_Mode ] }; + key <HKTG> { [ Hiragana_Katakana ] }; + key <MUHE> { [ Muhenkan ] }; + key <KPEN> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Enter ], + symbols[Group2]= [ KP_Enter ], + symbols[Group3]= [ KP_Enter ], + symbols[Group4]= [ KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, KP_Enter, NoSymbol ] + }; + key <RCTL> { + type= "ONE_LEVEL", + symbols[Group1]= [ Control_R ], + symbols[Group2]= [ Control_R ], + symbols[Group3]= [ ISO_Level5_Shift ] + }; + key <KPDV> { + type[group1]= "CTRL+ALT", + type[group2]= "CTRL+ALT", + type[group3]= "CTRL+ALT", + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ], + symbols[Group2]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ], + symbols[Group3]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ], + symbols[Group4]= [ KP_Divide, KP_Divide, division, U2300, U2215, NoSymbol, U2223, NoSymbol ] + }; + key <PRSC> { + type= "PC_ALT_LEVEL2", + symbols[Group1]= [ Print, Sys_Req ] + }; + key <RALT> { + type[group1]= "TWO_LEVEL", + type[group2]= "TWO_LEVEL", + type[group3]= "ONE_LEVEL", + type[group4]= "ONE_LEVEL", + symbols[Group1]= [ Alt_R, Meta_R ], + symbols[Group2]= [ Alt_R, Meta_R ], + symbols[Group3]= [ ISO_Level3_Shift ], + symbols[Group4]= [ ISO_Level5_Shift ] + }; + key <LNFD> { [ Linefeed ] }; + key <HOME> { [ Home ] }; + key <UP> { [ Up ] }; + key <PGUP> { [ Prior ] }; + key <LEFT> { [ Left ] }; + key <RGHT> { [ Right ] }; + key <END> { [ End ] }; + key <DOWN> { [ Down ] }; + key <PGDN> { [ Next ] }; + key <INS> { [ Insert ] }; + key <DELE> { [ Delete ] }; + key <MUTE> { [ XF86AudioMute ] }; + key <VOL-> { [ XF86AudioLowerVolume ] }; + key <VOL+> { [ XF86AudioRaiseVolume ] }; + key <POWR> { [ XF86PowerOff ] }; + key <KPEQ> { + type[group4]= "EIGHT_LEVEL", + symbols[Group1]= [ KP_Equal ], + symbols[Group2]= [ KP_Equal ], + symbols[Group3]= [ KP_Equal ], + symbols[Group4]= [ KP_Equal, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol ] + }; + key <I126> { [ plusminus ] }; + key <PAUS> { + type= "PC_CONTROL_LEVEL2", + symbols[Group1]= [ Pause, Break ] + }; + key <I128> { [ XF86LaunchA ] }; + key <I129> { [ KP_Decimal, KP_Decimal ] }; + key <HNGL> { [ Hangul ] }; + key <HJCV> { [ Hangul_Hanja ] }; + key <LWIN> { [ Super_L ] }; + key <RWIN> { [ Super_R ] }; + key <COMP> { [ Menu ] }; + key <STOP> { [ Cancel ] }; + key <AGAI> { [ Redo ] }; + key <PROP> { [ SunProps ] }; + key <UNDO> { [ Undo ] }; + key <FRNT> { [ SunFront ] }; + key <COPY> { [ XF86Copy ] }; + key <OPEN> { [ SunOpen ] }; + key <PAST> { [ XF86Paste ] }; + key <FIND> { [ Find ] }; + key <CUT> { [ XF86Cut ] }; + key <HELP> { [ Help ] }; + key <I147> { [ XF86MenuKB ] }; + key <I148> { [ XF86Calculator ] }; + key <I150> { [ XF86Sleep ] }; + key <I151> { [ XF86WakeUp ] }; + key <I152> { [ XF86Explorer ] }; + key <I153> { [ XF86Send ] }; + key <I155> { [ XF86Xfer ] }; + key <I156> { [ XF86Launch1 ] }; + key <I157> { [ XF86Launch2 ] }; + key <I158> { [ XF86WWW ] }; + key <I159> { [ XF86DOS ] }; + key <I160> { [ XF86ScreenSaver ] }; + key <I162> { [ XF86RotateWindows ] }; + key <I163> { [ XF86Mail ] }; + key <I164> { [ XF86Favorites ] }; + key <I165> { [ XF86MyComputer ] }; + key <I166> { [ XF86Back ] }; + key <I167> { [ XF86Forward ] }; + key <I169> { [ XF86Eject ] }; + key <I170> { [ XF86Eject, XF86Eject ] }; + key <I171> { [ XF86AudioNext ] }; + key <I172> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I173> { [ XF86AudioPrev ] }; + key <I174> { [ XF86AudioStop, XF86Eject ] }; + key <I175> { [ XF86AudioRecord ] }; + key <I176> { [ XF86AudioRewind ] }; + key <I177> { [ XF86Phone ] }; + key <I179> { [ XF86Tools ] }; + key <I180> { [ XF86HomePage ] }; + key <I181> { [ XF86Reload ] }; + key <I182> { [ XF86Close ] }; + key <I185> { [ XF86ScrollUp ] }; + key <I186> { [ XF86ScrollDown ] }; + key <I187> { [ parenleft ] }; + key <I188> { [ parenright ] }; + key <I189> { [ XF86New ] }; + key <I190> { [ Redo ] }; + key <FK13> { [ XF86Tools ] }; + key <FK14> { [ XF86Launch5 ] }; + key <FK15> { [ XF86Launch6 ] }; + key <FK16> { [ XF86Launch7 ] }; + key <FK17> { [ XF86Launch8 ] }; + key <FK18> { [ XF86Launch9 ] }; + key <FK21> { [ XF86TouchpadToggle ] }; + key <FK22> { [ XF86TouchpadOn ] }; + key <FK23> { [ XF86TouchpadOff ] }; + key <MDSW> { [ Mode_switch ] }; + key <ALT> { [ NoSymbol, Alt_L ] }; + key <META> { [ NoSymbol, Meta_L ] }; + key <SUPR> { [ NoSymbol, Super_L ] }; + key <HYPR> { [ NoSymbol, Hyper_L ] }; + key <I208> { [ XF86AudioPlay ] }; + key <I209> { [ XF86AudioPause ] }; + key <I210> { [ XF86Launch3 ] }; + key <I211> { [ XF86Launch4 ] }; + key <I212> { [ XF86LaunchB ] }; + key <I213> { [ XF86Suspend ] }; + key <I214> { [ XF86Close ] }; + key <I215> { [ XF86AudioPlay ] }; + key <I216> { [ XF86AudioForward ] }; + key <I218> { [ Print ] }; + key <I220> { [ XF86WebCam ] }; + key <I223> { [ XF86Mail ] }; + key <I224> { [ XF86Messenger ] }; + key <I225> { [ XF86Search ] }; + key <I226> { [ XF86Go ] }; + key <I227> { [ XF86Finance ] }; + key <I228> { [ XF86Game ] }; + key <I229> { [ XF86Shop ] }; + key <I231> { [ Cancel ] }; + key <I232> { [ XF86MonBrightnessDown ] }; + key <I233> { [ XF86MonBrightnessUp ] }; + key <I234> { [ XF86AudioMedia ] }; + key <I235> { [ XF86Display ] }; + key <I236> { [ XF86KbdLightOnOff ] }; + key <I237> { [ XF86KbdBrightnessDown ] }; + key <I238> { [ XF86KbdBrightnessUp ] }; + key <I239> { [ XF86Send ] }; + key <I240> { [ XF86Reply ] }; + key <I241> { [ XF86MailForward ] }; + key <I242> { [ XF86Save ] }; + key <I243> { [ XF86Documents ] }; + key <I244> { [ XF86Battery ] }; + key <I245> { [ XF86Bluetooth ] }; + key <I246> { [ XF86WLAN ] }; + modifier_map Control { <LCTL> }; + modifier_map Shift { <LFSH> }; + modifier_map Shift { <RTSH> }; + modifier_map Mod1 { <LALT> }; + modifier_map Lock { <CAPS> }; + modifier_map Mod2 { <NMLK> }; + modifier_map Mod5 { <LVL3> }; + modifier_map Mod3 { <RCTL> }; + modifier_map Mod1 { <RALT> }; + modifier_map Mod4 { <LWIN> }; + modifier_map Mod4 { <RWIN> }; + modifier_map Mod5 { <MDSW> }; + modifier_map Mod1 { <META> }; + modifier_map Mod4 { <SUPR> }; + modifier_map Mod4 { <HYPR> }; +}; }; diff --git a/test/data/keymaps/unbound-vmod.xkb b/test/data/keymaps/unbound-vmod.xkb new file mode 100644 index 0000000..a1733c1 --- /dev/null +++ b/test/data/keymaps/unbound-vmod.xkb @@ -0,0 +1,1533 @@ +xkb_keymap { +xkb_keycodes "evdev+aliases(qwertz)" { + minimum = 8; + maximum = 255; + <ESC> = 9; + <AE01> = 10; + <AE02> = 11; + <AE03> = 12; + <AE04> = 13; + <AE05> = 14; + <AE06> = 15; + <AE07> = 16; + <AE08> = 17; + <AE09> = 18; + <AE10> = 19; + <AE11> = 20; + <AE12> = 21; + <BKSP> = 22; + <TAB> = 23; + <AD01> = 24; + <AD02> = 25; + <AD03> = 26; + <AD04> = 27; + <AD05> = 28; + <AD06> = 29; + <AD07> = 30; + <AD08> = 31; + <AD09> = 32; + <AD10> = 33; + <AD11> = 34; + <AD12> = 35; + <RTRN> = 36; + <LCTL> = 37; + <AC01> = 38; + <AC02> = 39; + <AC03> = 40; + <AC04> = 41; + <AC05> = 42; + <AC06> = 43; + <AC07> = 44; + <AC08> = 45; + <AC09> = 46; + <AC10> = 47; + <AC11> = 48; + <TLDE> = 49; + <LFSH> = 50; + <BKSL> = 51; + <AB01> = 52; + <AB02> = 53; + <AB03> = 54; + <AB04> = 55; + <AB05> = 56; + <AB06> = 57; + <AB07> = 58; + <AB08> = 59; + <AB09> = 60; + <AB10> = 61; + <RTSH> = 62; + <KPMU> = 63; + <LALT> = 64; + <SPCE> = 65; + <CAPS> = 66; + <FK01> = 67; + <FK02> = 68; + <FK03> = 69; + <FK04> = 70; + <FK05> = 71; + <FK06> = 72; + <FK07> = 73; + <FK08> = 74; + <FK09> = 75; + <FK10> = 76; + <NMLK> = 77; + <SCLK> = 78; + <KP7> = 79; + <KP8> = 80; + <KP9> = 81; + <KPSU> = 82; + <KP4> = 83; + <KP5> = 84; + <KP6> = 85; + <KPAD> = 86; + <KP1> = 87; + <KP2> = 88; + <KP3> = 89; + <KP0> = 90; + <KPDL> = 91; + <LVL3> = 92; + <LSGT> = 94; + <FK11> = 95; + <FK12> = 96; + <AB11> = 97; + <KATA> = 98; + <HIRA> = 99; + <HENK> = 100; + <HKTG> = 101; + <MUHE> = 102; + <JPCM> = 103; + <KPEN> = 104; + <RCTL> = 105; + <KPDV> = 106; + <PRSC> = 107; + <RALT> = 108; + <LNFD> = 109; + <HOME> = 110; + <UP> = 111; + <PGUP> = 112; + <LEFT> = 113; + <RGHT> = 114; + <END> = 115; + <DOWN> = 116; + <PGDN> = 117; + <INS> = 118; + <DELE> = 119; + <I120> = 120; + <MUTE> = 121; + <VOL-> = 122; + <VOL+> = 123; + <POWR> = 124; + <KPEQ> = 125; + <I126> = 126; + <PAUS> = 127; + <I128> = 128; + <I129> = 129; + <HNGL> = 130; + <HJCV> = 131; + <AE13> = 132; + <LWIN> = 133; + <RWIN> = 134; + <COMP> = 135; + <STOP> = 136; + <AGAI> = 137; + <PROP> = 138; + <UNDO> = 139; + <FRNT> = 140; + <COPY> = 141; + <OPEN> = 142; + <PAST> = 143; + <FIND> = 144; + <CUT> = 145; + <HELP> = 146; + <I147> = 147; + <I148> = 148; + <I149> = 149; + <I150> = 150; + <I151> = 151; + <I152> = 152; + <I153> = 153; + <I154> = 154; + <I155> = 155; + <I156> = 156; + <I157> = 157; + <I158> = 158; + <I159> = 159; + <I160> = 160; + <I161> = 161; + <I162> = 162; + <I163> = 163; + <I164> = 164; + <I165> = 165; + <I166> = 166; + <I167> = 167; + <I168> = 168; + <I169> = 169; + <I170> = 170; + <I171> = 171; + <I172> = 172; + <I173> = 173; + <I174> = 174; + <I175> = 175; + <I176> = 176; + <I177> = 177; + <I178> = 178; + <I179> = 179; + <I180> = 180; + <I181> = 181; + <I182> = 182; + <I183> = 183; + <I184> = 184; + <I185> = 185; + <I186> = 186; + <I187> = 187; + <I188> = 188; + <I189> = 189; + <I190> = 190; + <FK13> = 191; + <FK14> = 192; + <FK15> = 193; + <FK16> = 194; + <FK17> = 195; + <FK18> = 196; + <FK19> = 197; + <FK20> = 198; + <FK21> = 199; + <FK22> = 200; + <FK23> = 201; + <FK24> = 202; + <MDSW> = 203; + <ALT> = 204; + <META> = 205; + <SUPR> = 206; + <HYPR> = 207; + <I208> = 208; + <I209> = 209; + <I210> = 210; + <I211> = 211; + <I212> = 212; + <I213> = 213; + <I214> = 214; + <I215> = 215; + <I216> = 216; + <I217> = 217; + <I218> = 218; + <I219> = 219; + <I220> = 220; + <I221> = 221; + <I222> = 222; + <I223> = 223; + <I224> = 224; + <I225> = 225; + <I226> = 226; + <I227> = 227; + <I228> = 228; + <I229> = 229; + <I230> = 230; + <I231> = 231; + <I232> = 232; + <I233> = 233; + <I234> = 234; + <I235> = 235; + <I236> = 236; + <I237> = 237; + <I238> = 238; + <I239> = 239; + <I240> = 240; + <I241> = 241; + <I242> = 242; + <I243> = 243; + <I244> = 244; + <I245> = 245; + <I246> = 246; + <I247> = 247; + <I248> = 248; + <I249> = 249; + <I250> = 250; + <I251> = 251; + <I252> = 252; + <I253> = 253; + indicator 1 = "Caps Lock"; + indicator 2 = "Num Lock"; + indicator 3 = "Scroll Lock"; + indicator 4 = "Compose"; + indicator 5 = "Kana"; + indicator 6 = "Sleep"; + indicator 7 = "Suspend"; + indicator 8 = "Mute"; + indicator 9 = "Misc"; + indicator 10 = "Mail"; + indicator 11 = "Charging"; + virtual indicator 12 = "Shift Lock"; + virtual indicator 13 = "Group 2"; + virtual indicator 14 = "Mouse Keys"; + alias <AC12> = <BKSL>; + alias <MENU> = <COMP>; + alias <HZTG> = <TLDE>; + alias <LMTA> = <LWIN>; + alias <RMTA> = <RWIN>; + alias <ALGR> = <RALT>; + alias <KPPT> = <I129>; + alias <LatQ> = <AD01>; + alias <LatW> = <AD02>; + alias <LatE> = <AD03>; + alias <LatR> = <AD04>; + alias <LatT> = <AD05>; + alias <LatZ> = <AD06>; + alias <LatU> = <AD07>; + alias <LatI> = <AD08>; + alias <LatO> = <AD09>; + alias <LatP> = <AD10>; + alias <LatA> = <AC01>; + alias <LatS> = <AC02>; + alias <LatD> = <AC03>; + alias <LatF> = <AC04>; + alias <LatG> = <AC05>; + alias <LatH> = <AC06>; + alias <LatJ> = <AC07>; + alias <LatK> = <AC08>; + alias <LatL> = <AC09>; + alias <LatY> = <AB01>; + alias <LatX> = <AB02>; + alias <LatC> = <AB03>; + alias <LatV> = <AB04>; + alias <LatB> = <AB05>; + alias <LatN> = <AB06>; + alias <LatM> = <AB07>; +}; + +xkb_types "complete" { + + virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; + + type "ONE_LEVEL" { + modifiers= none; + level_name[Level1]= "Any"; + }; + type "TWO_LEVEL" { + modifiers= Shift; + map[Shift]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + }; + type "ALPHABETIC" { + modifiers= Shift+Lock; + map[Shift]= Level2; + map[Lock]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Caps"; + }; + type "KEYPAD" { + modifiers= Shift+NumLock; + map[Shift]= Level2; + map[NumLock]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + }; + type "SHIFT+ALT" { + modifiers= Shift+Alt; + map[Shift+Alt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift+Alt"; + }; + type "PC_CONTROL_LEVEL2" { + modifiers= Control; + map[Control]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Control"; + }; + type "PC_LCONTROL_LEVEL2" { + modifiers= LControl; + map[LControl]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "LControl"; + }; + type "PC_RCONTROL_LEVEL2" { + modifiers= RControl; + map[RControl]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "RControl"; + }; + type "PC_ALT_LEVEL2" { + modifiers= Alt; + map[Alt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Alt"; + }; + type "PC_LALT_LEVEL2" { + modifiers= LAlt; + map[LAlt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "LAlt"; + }; + type "PC_RALT_LEVEL2" { + modifiers= RAlt; + map[RAlt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "RAlt"; + }; + type "CTRL+ALT" { + modifiers= Shift+Control+Alt+LevelThree; + map[Shift]= Level2; + preserve[Shift]= Shift; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + preserve[Shift+LevelThree]= Shift; + map[Control+Alt]= Level5; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "Ctrl+Alt"; + }; + type "LOCAL_EIGHT_LEVEL" { + modifiers= Shift+Lock+Control+LevelThree; + map[Shift+Lock]= Level1; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+Lock+LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Control]= Level5; + map[Shift+Lock+Control]= Level5; + map[Shift+Control]= Level6; + map[Lock+Control]= Level6; + map[Control+LevelThree]= Level7; + map[Shift+Lock+Control+LevelThree]= Level7; + map[Shift+Control+LevelThree]= Level8; + map[Lock+Control+LevelThree]= Level8; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Level3"; + level_name[Level4]= "Shift Level3"; + level_name[Level5]= "Ctrl"; + level_name[Level6]= "Shift Ctrl"; + level_name[Level7]= "Level3 Ctrl"; + level_name[Level8]= "Shift Level3 Ctrl"; + }; + type "THREE_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Level3"; + }; + type "EIGHT_LEVEL" { + modifiers= Shift+LevelThree+LevelFive; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "EIGHT_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Shift+Lock+LevelThree]= Level3; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[Lock+LevelFive]= Level6; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + map[Lock+LevelThree+LevelFive]= Level8; + map[Shift+Lock+LevelThree+LevelFive]= Level7; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "EIGHT_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level4; + preserve[Shift+Lock+LevelThree]= Lock; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[Lock+LevelFive]= Level6; + preserve[Lock+LevelFive]= Lock; + map[Shift+Lock+LevelFive]= Level6; + preserve[Shift+Lock+LevelFive]= Lock; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + map[Lock+LevelThree+LevelFive]= Level7; + preserve[Lock+LevelThree+LevelFive]= Lock; + map[Shift+Lock+LevelThree+LevelFive]= Level8; + preserve[Shift+Lock+LevelThree+LevelFive]= Lock; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "FOUR_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Shift+Lock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level4; + preserve[Shift+Lock+LevelThree]= Lock; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_MIXED_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift+NumLock]= Level1; + map[NumLock]= Level2; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[NumLock+LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Shift+NumLock+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_X" { + modifiers= Shift+Control+Alt+LevelThree; + map[LevelThree]= Level2; + map[Shift+LevelThree]= Level3; + map[Control+Alt]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Alt Base"; + level_name[Level3]= "Shift Alt"; + level_name[Level4]= "Ctrl+Alt"; + }; + type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level4; + preserve[Lock]= Lock; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "AltGr Base"; + level_name[Level4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_PLUS_LOCK" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock]= Level5; + map[Shift+Lock]= Level2; + map[Lock+LevelThree]= Level3; + map[Shift+Lock+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "Lock"; + }; + type "FOUR_LEVEL_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift]= Level2; + map[NumLock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[NumLock+LevelThree]= Level4; + map[Shift+NumLock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Alt Number"; + }; +}; + +xkb_compatibility "complete" { + + virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; + + interpret.useModMapMods= AnyLevel; + interpret.repeat= False; + interpret.locking= False; + interpret ISO_Level2_Latch+Exactly(Shift) { + useModMapMods=level1; + action= LatchMods(modifiers=Shift,clearLocks,latchToLock); + }; + interpret Shift_Lock+AnyOf(Shift+Lock) { + action= LockMods(modifiers=Shift); + }; + interpret Num_Lock+AnyOf(all) { + virtualModifier= NumLock; + action= LockMods(modifiers=NumLock); + }; + interpret ISO_Level3_Shift+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LockMods(modifiers=LevelThree); + }; + interpret Alt_L+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Alt_R+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_L+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_R+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_L+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_R+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_L+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_R+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Scroll_Lock+AnyOf(all) { + virtualModifier= ScrollLock; + action= LockMods(modifiers=modMapMods); + }; + interpret ISO_Level5_Shift+AnyOf(all) { + virtualModifier= LevelFive; + useModMapMods=level1; + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOf(all) { + virtualModifier= LevelFive; + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOf(all) { + virtualModifier= LevelFive; + action= LockMods(modifiers=LevelFive); + }; + interpret Mode_switch+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= SetGroup(group=+1); + }; + interpret ISO_Level3_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelThree); + }; + interpret ISO_Group_Latch+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LatchGroup(group=2); + }; + interpret ISO_Next_Group+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LockGroup(group=+1); + }; + interpret ISO_Prev_Group+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LockGroup(group=-1); + }; + interpret ISO_First_Group+AnyOfOrNone(all) { + action= LockGroup(group=1); + }; + interpret ISO_Last_Group+AnyOfOrNone(all) { + action= LockGroup(group=2); + }; + interpret KP_1+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret KP_End+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret KP_2+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=+1); + }; + interpret KP_Down+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=+1); + }; + interpret KP_3+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret KP_Next+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret KP_4+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+0); + }; + interpret KP_Left+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+0); + }; + interpret KP_6+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+0); + }; + interpret KP_Right+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+0); + }; + interpret KP_7+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret KP_Home+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret KP_8+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=-1); + }; + interpret KP_Up+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+0,y=-1); + }; + interpret KP_9+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret KP_Prior+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret KP_5+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret KP_Begin+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret KP_F2+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret KP_Divide+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret KP_F3+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret KP_Multiply+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret KP_F4+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=3); + }; + interpret KP_Subtract+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=3); + }; + interpret KP_Separator+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default,count=2); + }; + interpret KP_Add+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default,count=2); + }; + interpret KP_0+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=lock); + }; + interpret KP_Insert+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=lock); + }; + interpret KP_Decimal+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=unlock); + }; + interpret KP_Delete+AnyOfOrNone(all) { + repeat= True; + action= LockPtrBtn(button=default,affect=unlock); + }; + interpret F25+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=1); + }; + interpret F26+AnyOfOrNone(all) { + repeat= True; + action= SetPtrDflt(affect=button,button=2); + }; + interpret F27+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=-1); + }; + interpret F29+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=-1); + }; + interpret F31+AnyOfOrNone(all) { + repeat= True; + action= PtrBtn(button=default); + }; + interpret F33+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=-1,y=+1); + }; + interpret F35+AnyOfOrNone(all) { + repeat= True; + action= MovePtr(x=+1,y=+1); + }; + interpret Pointer_Button_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default); + }; + interpret Pointer_Button1+AnyOfOrNone(all) { + action= PtrBtn(button=1); + }; + interpret Pointer_Button2+AnyOfOrNone(all) { + action= PtrBtn(button=2); + }; + interpret Pointer_Button3+AnyOfOrNone(all) { + action= PtrBtn(button=3); + }; + interpret Pointer_DblClick_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default,count=2); + }; + interpret Pointer_DblClick1+AnyOfOrNone(all) { + action= PtrBtn(button=1,count=2); + }; + interpret Pointer_DblClick2+AnyOfOrNone(all) { + action= PtrBtn(button=2,count=2); + }; + interpret Pointer_DblClick3+AnyOfOrNone(all) { + action= PtrBtn(button=3,count=2); + }; + interpret Pointer_Drag_Dflt+AnyOfOrNone(all) { + action= LockPtrBtn(button=default,affect=both); + }; + interpret Pointer_Drag1+AnyOfOrNone(all) { + action= LockPtrBtn(button=1,affect=both); + }; + interpret Pointer_Drag2+AnyOfOrNone(all) { + action= LockPtrBtn(button=2,affect=both); + }; + interpret Pointer_Drag3+AnyOfOrNone(all) { + action= LockPtrBtn(button=3,affect=both); + }; + interpret Pointer_EnableKeys+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret Pointer_Accelerate+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Pointer_DfltBtnNext+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=+1); + }; + interpret Pointer_DfltBtnPrev+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=-1); + }; + interpret AccessX_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXKeys); + }; + interpret AccessX_Feedback_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXFeedback); + }; + interpret RepeatKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=RepeatKeys); + }; + interpret SlowKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=SlowKeys); + }; + interpret BounceKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=BounceKeys); + }; + interpret StickyKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=StickyKeys); + }; + interpret MouseKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Overlay1_Enable+AnyOfOrNone(all) { + action= LockControls(controls=Overlay1); + }; + interpret Overlay2_Enable+AnyOfOrNone(all) { + action= LockControls(controls=Overlay2); + }; + interpret AudibleBell_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AudibleBell); + }; + interpret Terminate_Server+AnyOfOrNone(all) { + action= Terminate(); + }; + interpret Alt_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Alt_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Meta_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Meta_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Super_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Super_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Hyper_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Hyper_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Shift_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Shift,clearLocks); + }; + interpret XF86Switch_VT_1+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=1,!same); + }; + interpret XF86Switch_VT_2+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=2,!same); + }; + interpret XF86Switch_VT_3+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=3,!same); + }; + interpret XF86Switch_VT_4+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=4,!same); + }; + interpret XF86Switch_VT_5+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=5,!same); + }; + interpret XF86Switch_VT_6+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=6,!same); + }; + interpret XF86Switch_VT_7+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=7,!same); + }; + interpret XF86Switch_VT_8+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=8,!same); + }; + interpret XF86Switch_VT_9+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=9,!same); + }; + interpret XF86Switch_VT_10+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=10,!same); + }; + interpret XF86Switch_VT_11+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=11,!same); + }; + interpret XF86Switch_VT_12+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=12,!same); + }; + interpret XF86LogGrabInfo+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x47,data[3]=0x72,data[4]=0x62,data[5]=0x73,data[6]=0x00); + }; + interpret XF86LogWindowTree+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x57,data[3]=0x69,data[4]=0x6e,data[5]=0x73,data[6]=0x00); + }; + interpret XF86Next_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2b,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret XF86Prev_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2d,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret ISO_Level5_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelFive); + }; + interpret Caps_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=Lock); + }; + interpret Any+Exactly(Lock) { + action= LockMods(modifiers=Lock); + }; + interpret Any+AnyOf(all) { + action= SetMods(modifiers=modMapMods,clearLocks); + }; + group 2 = AltGr; + group 3 = AltGr; + group 4 = AltGr; + indicator "Caps Lock" { + !allowExplicit; + whichModState= locked; + modifiers= Lock; + }; + indicator "Num Lock" { + !allowExplicit; + whichModState= locked; + modifiers= NumLock; + }; + indicator "Scroll Lock" { + whichModState= locked; + modifiers= ScrollLock; + }; + indicator "Shift Lock" { + !allowExplicit; + whichModState= locked; + modifiers= Shift; + }; + indicator "Group 2" { + !allowExplicit; + groups= 0xfe; + }; + indicator "Mouse Keys" { + indicatorDrivesKeyboard; + controls= mouseKeys; + }; +}; + +xkb_symbols "pc+de+inet(evdev)+group(menu_toggle)+ctrl(nocaps)" { + + name[group1]="German"; + + key <ESC> { [ Escape ] }; + key <AE01> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 1, exclam, onesuperior, exclamdown ] + }; + key <AE02> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 2, quotedbl, twosuperior, oneeighth ] + }; + key <AE03> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 3, section, threesuperior, sterling ] + }; + key <AE04> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 4, dollar, onequarter, currency ] + }; + key <AE05> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 5, percent, onehalf, threeeighths ] + }; + key <AE06> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 6, ampersand, notsign, fiveeighths ] + }; + key <AE07> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 7, slash, braceleft, seveneighths ] + }; + key <AE08> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 8, parenleft, bracketleft, trademark ] + }; + key <AE09> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 9, parenright, bracketright, plusminus ] + }; + key <AE10> { + type= "FOUR_LEVEL", + symbols[Group1]= [ 0, equal, braceright, degree ] + }; + key <AE11> { + type= "FOUR_LEVEL_PLUS_LOCK", + symbols[Group1]= [ ssharp, question, backslash, questiondown, U1E9E ] + }; + key <AE12> { + type= "FOUR_LEVEL", + symbols[Group1]= [ dead_acute, dead_grave, dead_cedilla, dead_ogonek ] + }; + key <BKSP> { [ BackSpace, BackSpace ] }; + key <TAB> { [ Tab, ISO_Left_Tab ] }; + key <AD01> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ q, Q, at, Greek_OMEGA ] + }; + key <AD02> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ w, W, lstroke, Lstroke ] + }; + key <AD03> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ e, E, EuroSign, EuroSign ] + }; + key <AD04> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ r, R, paragraph, registered ] + }; + key <AD05> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ t, T, tslash, Tslash ] + }; + key <AD06> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ z, Z, leftarrow, yen ] + }; + key <AD07> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ u, U, downarrow, uparrow ] + }; + key <AD08> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ i, I, rightarrow, idotless ] + }; + key <AD09> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ o, O, oslash, Oslash ] + }; + key <AD10> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ p, P, thorn, THORN ] + }; + key <AD11> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ udiaeresis, Udiaeresis, dead_diaeresis, dead_abovering ] + }; + key <AD12> { + type= "FOUR_LEVEL", + symbols[Group1]= [ plus, asterisk, asciitilde, macron ] + }; + key <RTRN> { [ Return ] }; + key <LCTL> { [ Control_L ] }; + key <AC01> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ a, A, ae, AE ] + }; + key <AC02> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ s, S, U017F, U1E9E ] + }; + key <AC03> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ d, D, eth, ETH ] + }; + key <AC04> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ f, F, dstroke, ordfeminine ] + }; + key <AC05> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ g, G, eng, ENG ] + }; + key <AC06> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ h, H, hstroke, Hstroke ] + }; + key <AC07> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ j, J, dead_belowdot, dead_abovedot ] + }; + key <AC08> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ k, K, kra, ampersand ] + }; + key <AC09> { + type= "FOUR_LEVEL_ALPHABETIC", + symbols[Group1]= [ l, L, lstroke, Lstroke ] + }; + key <AC10> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ odiaeresis, Odiaeresis, dead_doubleacute, dead_belowdot ] + }; + key <AC11> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ adiaeresis, Adiaeresis, dead_circumflex, dead_caron ] + }; + key <TLDE> { + type= "FOUR_LEVEL", + symbols[Group1]= [ dead_circumflex, degree, U2032, U2033 ] + }; + key <LFSH> { [ Shift_L ] }; + key <BKSL> { + type= "FOUR_LEVEL", + symbols[Group1]= [ numbersign, apostrophe, rightsinglequotemark, dead_breve ] + }; + key <AB01> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ y, Y, guillemotright, U203A ] + }; + key <AB02> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ x, X, guillemotleft, U2039 ] + }; + key <AB03> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ c, C, cent, copyright ] + }; + key <AB04> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ v, V, doublelowquotemark, singlelowquotemark ] + }; + key <AB05> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ b, B, leftdoublequotemark, leftsinglequotemark ] + }; + key <AB06> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ n, N, rightdoublequotemark, rightsinglequotemark ] + }; + key <AB07> { + type= "FOUR_LEVEL_SEMIALPHABETIC", + symbols[Group1]= [ m, M, mu, masculine ] + }; + key <AB08> { + type= "FOUR_LEVEL", + symbols[Group1]= [ comma, semicolon, periodcentered, multiply ] + }; + key <AB09> { + type= "FOUR_LEVEL", + symbols[Group1]= [ period, colon, U2026, division ] + }; + key <AB10> { + type= "FOUR_LEVEL", + symbols[Group1]= [ minus, underscore, endash, emdash ] + }; + key <RTSH> { [ Shift_R ] }; + key <KPMU> { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Multiply, KP_Multiply, KP_Multiply, KP_Multiply, XF86ClearGrab ] + }; + key <LALT> { [ Alt_L, Meta_L ] }; + key <SPCE> { [ space ] }; + key <CAPS> { [ Control_L, Control_L ] }; + key <FK01> { + type= "CTRL+ALT", + symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] + }; + key <FK02> { + type= "CTRL+ALT", + symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] + }; + key <FK03> { + type= "CTRL+ALT", + symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] + }; + key <FK04> { + type= "CTRL+ALT", + symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] + }; + key <FK05> { + type= "CTRL+ALT", + symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] + }; + key <FK06> { + type= "CTRL+ALT", + symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] + }; + key <FK07> { + type= "CTRL+ALT", + symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] + }; + key <FK08> { + type= "CTRL+ALT", + symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] + }; + key <FK09> { + type= "CTRL+ALT", + symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] + }; + key <FK10> { + type= "CTRL+ALT", + symbols[Group1]= [ F10, F10, F10, F10, XF86Switch_VT_10 ] + }; + key <NMLK> { [ Num_Lock ] }; + key <SCLK> { [ Scroll_Lock ] }; + key <KP7> { [ KP_Home, KP_7 ] }; + key <KP8> { [ KP_Up, KP_8 ] }; + key <KP9> { [ KP_Prior, KP_9 ] }; + key <KPSU> { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Subtract, KP_Subtract, KP_Subtract, KP_Subtract, XF86Prev_VMode ] + }; + key <KP4> { [ KP_Left, KP_4 ] }; + key <KP5> { [ KP_Begin, KP_5 ] }; + key <KP6> { [ KP_Right, KP_6 ] }; + key <KPAD> { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Add, KP_Add, KP_Add, KP_Add, XF86Next_VMode ] + }; + key <KP1> { [ KP_End, KP_1 ] }; + key <KP2> { [ KP_Down, KP_2 ] }; + key <KP3> { [ KP_Next, KP_3 ] }; + key <KP0> { [ KP_Insert, KP_0 ] }; + key <KPDL> { + type= "KEYPAD", + symbols[Group1]= [ KP_Delete, KP_Separator ] + }; + key <LVL3> { + type= "ONE_LEVEL", + symbols[Group1]= [ ISO_Level3_Shift ], + actions[Group1]= [ SetMods(modifiers=LevelThree) ] + }; + key <LSGT> { + type= "FOUR_LEVEL", + symbols[Group1]= [ less, greater, bar, brokenbar ] + }; + key <FK11> { + type= "CTRL+ALT", + symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] + }; + key <FK12> { + type= "CTRL+ALT", + symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] + }; + key <KATA> { [ Katakana ] }; + key <HIRA> { [ Hiragana ] }; + key <HENK> { [ Henkan_Mode ] }; + key <HKTG> { [ Hiragana_Katakana ] }; + key <MUHE> { [ Muhenkan ] }; + key <KPEN> { [ KP_Enter ] }; + key <RCTL> { [ Control_R ] }; + key <KPDV> { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Divide, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ] + }; + key <PRSC> { + type= "PC_ALT_LEVEL2", + symbols[Group1]= [ Print, Sys_Req ] + }; + key <RALT> { + type= "ONE_LEVEL", + symbols[Group1]= [ ISO_Level3_Shift ] + }; + key <LNFD> { [ Linefeed ] }; + key <HOME> { [ Home ] }; + key <UP> { [ Up ] }; + key <PGUP> { [ Prior ] }; + key <LEFT> { [ Left ] }; + key <RGHT> { [ Right ] }; + key <END> { [ End ] }; + key <DOWN> { [ Down ] }; + key <PGDN> { [ Next ] }; + key <INS> { [ Insert ] }; + key <DELE> { [ Delete ] }; + key <MUTE> { [ XF86AudioMute ] }; + key <VOL-> { [ XF86AudioLowerVolume ] }; + key <VOL+> { [ XF86AudioRaiseVolume ] }; + key <POWR> { [ XF86PowerOff ] }; + key <KPEQ> { [ KP_Equal ] }; + key <I126> { [ plusminus ] }; + key <PAUS> { + type= "PC_CONTROL_LEVEL2", + symbols[Group1]= [ Pause, Break ] + }; + key <I128> { [ XF86LaunchA ] }; + key <I129> { [ KP_Decimal, KP_Decimal ] }; + key <HNGL> { [ Hangul ] }; + key <HJCV> { [ Hangul_Hanja ] }; + key <LWIN> { [ Super_L ] }; + key <RWIN> { [ Super_R ] }; + key <COMP> { [ ISO_Next_Group, Menu ] }; + key <STOP> { [ Cancel ] }; + key <AGAI> { [ Redo ] }; + key <PROP> { [ SunProps ] }; + key <UNDO> { [ Undo ] }; + key <FRNT> { [ SunFront ] }; + key <COPY> { [ XF86Copy ] }; + key <OPEN> { [ XF86Open ] }; + key <PAST> { [ XF86Paste ] }; + key <FIND> { [ Find ] }; + key <CUT> { [ XF86Cut ] }; + key <HELP> { [ Help ] }; + key <I147> { [ XF86MenuKB ] }; + key <I148> { [ XF86Calculator ] }; + key <I150> { [ XF86Sleep ] }; + key <I151> { [ XF86WakeUp ] }; + key <I152> { [ XF86Explorer ] }; + key <I153> { [ XF86Send ] }; + key <I155> { [ XF86Xfer ] }; + key <I156> { [ XF86Launch1 ] }; + key <I157> { [ XF86Launch2 ] }; + key <I158> { [ XF86WWW ] }; + key <I159> { [ XF86DOS ] }; + key <I160> { [ XF86ScreenSaver ] }; + key <I162> { [ XF86RotateWindows ] }; + key <I163> { [ XF86Mail ] }; + key <I164> { [ XF86Favorites ] }; + key <I165> { [ XF86MyComputer ] }; + key <I166> { [ XF86Back ] }; + key <I167> { [ XF86Forward ] }; + key <I169> { [ XF86Eject ] }; + key <I170> { [ XF86Eject, XF86Eject ] }; + key <I171> { [ XF86AudioNext ] }; + key <I172> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I173> { [ XF86AudioPrev ] }; + key <I174> { [ XF86AudioStop, XF86Eject ] }; + key <I175> { [ XF86AudioRecord ] }; + key <I176> { [ XF86AudioRewind ] }; + key <I177> { [ XF86Phone ] }; + key <I179> { [ XF86Tools ] }; + key <I180> { [ XF86HomePage ] }; + key <I181> { [ XF86Reload ] }; + key <I182> { [ XF86Close ] }; + key <I185> { [ XF86ScrollUp ] }; + key <I186> { [ XF86ScrollDown ] }; + key <I187> { [ parenleft ] }; + key <I188> { [ parenright ] }; + key <I189> { [ XF86New ] }; + key <I190> { [ Redo ] }; + key <FK13> { [ XF86Tools ] }; + key <FK14> { [ XF86Launch5 ] }; + key <FK15> { [ XF86Launch6 ] }; + key <FK16> { [ XF86Launch7 ] }; + key <FK17> { [ XF86Launch8 ] }; + key <FK18> { [ XF86Launch9 ] }; + key <FK21> { [ XF86TouchpadToggle ] }; + key <FK22> { [ XF86TouchpadOn ] }; + key <FK23> { [ XF86TouchpadOff ] }; + key <MDSW> { [ Mode_switch ] }; + key <ALT> { [ NoSymbol, Alt_L ] }; + key <META> { [ NoSymbol, Meta_L ] }; + key <SUPR> { [ NoSymbol, Super_L ] }; + key <HYPR> { [ NoSymbol, Hyper_L ] }; + key <I208> { [ XF86AudioPlay ] }; + key <I209> { [ XF86AudioPause ] }; + key <I210> { [ XF86Launch3 ] }; + key <I211> { [ XF86Launch4 ] }; + key <I212> { [ XF86LaunchB ] }; + key <I213> { [ XF86Suspend ] }; + key <I214> { [ XF86Close ] }; + key <I215> { [ XF86AudioPlay ] }; + key <I216> { [ XF86AudioForward ] }; + key <I218> { [ Print ] }; + key <I220> { [ XF86WebCam ] }; + key <I223> { [ XF86Mail ] }; + key <I224> { [ XF86Messenger ] }; + key <I225> { [ XF86Search ] }; + key <I226> { [ XF86Go ] }; + key <I227> { [ XF86Finance ] }; + key <I228> { [ XF86Game ] }; + key <I229> { [ XF86Shop ] }; + key <I231> { [ Cancel ] }; + key <I232> { [ XF86MonBrightnessDown ] }; + key <I233> { [ XF86MonBrightnessUp ] }; + key <I234> { [ XF86AudioMedia ] }; + key <I235> { [ XF86Display ] }; + key <I236> { [ XF86KbdLightOnOff ] }; + key <I237> { [ XF86KbdBrightnessDown ] }; + key <I238> { [ XF86KbdBrightnessUp ] }; + key <I239> { [ XF86Send ] }; + key <I240> { [ XF86Reply ] }; + key <I241> { [ XF86MailForward ] }; + key <I242> { [ XF86Save ] }; + key <I243> { [ XF86Documents ] }; + key <I244> { [ XF86Battery ] }; + key <I245> { [ XF86Bluetooth ] }; + key <I246> { [ XF86WLAN ] }; + modifier_map Control { <LCTL> }; + modifier_map Shift { <LFSH> }; + modifier_map Shift { <RTSH> }; + modifier_map Mod1 { <LALT> }; + modifier_map Control { <CAPS> }; + modifier_map Mod2 { <NMLK> }; + modifier_map Mod5 { <LVL3> }; + modifier_map Control { <RCTL> }; + modifier_map Mod4 { <LWIN> }; + modifier_map Mod4 { <RWIN> }; + modifier_map Mod5 { <MDSW> }; + modifier_map Mod1 { <META> }; + modifier_map Mod4 { <SUPR> }; + modifier_map Mod4 { <HYPR> }; +}; + +}; diff --git a/test/data/rules/base b/test/data/rules/base index 44fa866..d629596 100644 --- a/test/data/rules/base +++ b/test/data/rules/base @@ -106,10 +106,22 @@ ! $thinkpads = thinkpad thinkpad60 thinkpadz60 -! $sun_t6_custom = ara be br ca ch cz de dk \ - ee es fi fr gb gr it kr \ - lt lv nl no pl pt ro ru \ - se sk tr tw ua +! $sun = sun_type6_jp sun_type6_usb sun_type6_euro_usb \ + sun_type6_jp_usb sun_type6_unix_usb sun_type7_jp_usb \ + sun_type7_usb sun_type7_euro_usb sun_type7_unix_usb + +! $sun_jp = sun_type6_jp sun_type6_jp_usb sun_type7_jp_usb + +// Sun Type_6_7 keyboards with custom layouts +! $sun_custom = ara be br ca ch cz de dk \ + ee es fi fr gb gr it jp \ + kr lt lv nl no pl pt ro \ + ru se sk tr tw ua us + +! $sun_var = sun_type6 sun_type6_suncompat sun_type6_de sun_type6_fr \ + sun_type7 sun_type7_suncompat suncompat + +! $sun_compat = sun_type6 sun_type6_suncompat sun_type7_suncompat suncompat ! $htcdreamlayouts = us it de @@ -119,10 +131,8 @@ amiga = amiga(de) ataritt = ataritt(de) empty = empty - sun4 = sun(type4_euro) - sun5 = sun(type5_euro) - sun6 = sun(type6_usb) - sun6euro = sun(type6tuv_usb) + $sun_jp = sun(type6_jp_usb) + $sun = sun(type6_usb) pc98 = xfree98(pc98) $applealu = macintosh(alukbd) macintosh_hhk = macintosh(hhk) @@ -173,6 +183,15 @@ hhk = hhk(basic) kinesis = kinesis(model100) $nokiamodels = nokia(%m) + sun_type6_jp = sun(type6jp) + sun_type6_usb = sun(type6) + sun_type6_euro_usb = sun(type6tuv) + sun_type6_jp_usb = sun(type6jp) + sun_type6_unix_usb = sun(type6unix) + sun_type7_jp_usb = sun(type6jp) + sun_type7_usb = sun(type7) + sun_type7_euro_usb = sun(type7tuv) + sun_type7_unix_usb = sun(type7unix) * = pc(pc104) ! model layout variant = symbols @@ -229,6 +248,7 @@ classmate us alt-intl = pc+us(classmate-alt-intl) classmate us altgr-intl = pc+us(classmate-altgr-intl) nokiarx51 cz qwerty = nokia_vndr/rx-51(cz_qwerty) + * $sun_custom $sun_var = pc+sun_vndr/%l%(v) ! model layout = symbols * ar = pc+ara @@ -247,7 +267,6 @@ * lo = pc+la * kan = pc+in(kan) * mi = pc+mao - * ml = pc+in(mal) * ogham = pc+ie(ogam) * ori = pc+ie(ori) * sapmi = pc+no(smi) @@ -314,18 +333,7 @@ classmate us = pc+%l(classmate) empty * = empty(basic) * empty = empty(basic) - sun4 $nonlatin = latin+sun_vndr/us(type4)+%l%(v):2 - sun4 * = latin+sun_vndr/us(type4)+%l%(v) - sun5 $nonlatin = latin+sun_vndr/us(type5)+%l%(v):2 - sun5 * = latin+sun_vndr/us(type5)+%l%(v) - sun6 us = pc+sun_vndr/us(type6) - sun6 en_US = pc+sun_vndr/us(type6)+iso9995-3(basic) - sun6 $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v) - sun6 * = pc+sun_vndr/us(type6)+%l%(v) - sun6euro us = pc+sun_vndr/us(type6) - sun6euro en_US = pc+sun_vndr/us(type6)+iso9995-3(basic) - sun6euro $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v) - sun6euro * = pc+sun_vndr/us(type6)+%l%(v) + $sun $sun_custom = pc+sun_vndr/%l%(v) pc98 nec_vndr/jp = nec_vndr/jp(pc98) macintosh_old us = macintosh_vndr/us(oldmac) macintosh_old en_US = macintosh_vndr/us(oldmac) @@ -345,6 +353,11 @@ olpc $olpclayouts = olpc+%l%(m) olpc * = olpc+%l%(v) $thinkpads br = pc+br(thinkpad) + sl-c3x00 * = pc+sharp_vndr/sl-c3x00(basic) + ws003sh * = pc+sharp_vndr/ws003sh(basic) + ws007sh * = pc+sharp_vndr/ws007sh(basic) + ws011sh * = pc+sharp_vndr/ws011sh(basic) + ws020sh * = pc+sharp_vndr/ws020sh(basic) htcdream $htcdreamlayouts = %l(htcdream) * $nonlatin = pc+us+%l%(v):2 * * = pc+%l%(v) @@ -366,7 +379,6 @@ * lo = pc+la%(v[1]) * kan = pc+in(kan) * mi = pc+mao%(v[1]) - * ml = pc+in(mal) * ogham = pc+ie(ogam) * ori = pc+ie(ori) * sapmi = pc+no(smi) @@ -428,8 +440,7 @@ * yu(unicodeyz) = pc+srp(latinunicodeyz) ataritt * = xfree68_vndr/ataritt(us)+%l[1]%(v[1]) amiga * = xfree68_vndr/amiga(usa1)+%l[1]%(v[1]) - sun4 * = latin+sun_vndr/us(type4)+%l[1]%(v[1]) - sun5 * = latin+sun_vndr/us(type5)+%l[1]%(v[1]) + $sun $sun_custom = pc+sun_vndr/%l[1]%(v[1]) macintosh_old us = macintosh_vndr/us(oldmac) macintosh_old $macvendorlayouts = macintosh_vndr/us(oldmac)+macintosh_vndr/%l[1]%(v[1]) macintosh_old * = macintosh_vndr/us(oldmac)+%l[1]%(v[1]) @@ -510,7 +521,6 @@ * lo = +la%(v[2]):2 * kan = +in(kan):2 * mi = +mao%(v[2]):2 - * ml = +in(mal):2 * ogham = +ie(ogam):2 * ori = +ie(ori):2 * sapmi = +no(smi):2 @@ -572,6 +582,7 @@ * yu(unicodeyz) = +srp(latinunicodeyz):2 nokiarx51 cz(qwerty) = +nokia_vndr/rx-51(cz_qwerty):2 nokiarx51 * = +nokia_vndr/rx-51(%l[2]%_v[2]):2 + $sun $sun_custom = +sun_vndr/%l[2]%(v[2]):2 * * = +%l[2]%(v[2]):2 ! model layout[3] = symbols @@ -591,7 +602,6 @@ * lo = +la%(v[3]):3 * kan = +in(kan):3 * mi = +mao%(v[3]):3 - * ml = +in(mal):3 * ogham = +ie(ogam):3 * ori = +ie(ori):3 * sapmi = +no(smi):3 @@ -653,6 +663,7 @@ * yu(unicodeyz) = +srp(latinunicodeyz):3 nokiarx51 cz(qwerty) = +nokia_vndr/rx-51(cz_qwerty):3 nokiarx51 * = +nokia_vndr/rx-51(%l[3]%_v[3]):3 + $sun $sun_custom = +sun_vndr/%l[3]%(v[3]):3 * * = +%l[3]%(v[3]):3 ! model layout[4] = symbols @@ -672,7 +683,6 @@ * lo = +la%(v[4]):4 * kan = +in(kan):4 * mi = +mao%(v[4]):4 - * ml = +in(mal):4 * ogham = +ie(ogam):4 * ori = +ie(ori):4 * sapmi = +no(smi):4 @@ -734,6 +744,7 @@ * yu(unicodeyz) = +srp(latinunicodeyz):4 nokiarx51 cz(qwerty) = +nokia_vndr/rx-51(cz_qwerty):4 nokiarx51 * = +nokia_vndr/rx-51(%l[4]%_v[4]):4 + $sun $sun_custom = +sun_vndr/%l[4]%(v[4]):4 * * = +%l[4]%(v[4]):4 ! model layout[2] variant[2] = symbols @@ -941,21 +952,28 @@ $maclaptop = +inet(apple)+level3(enter_switch) $applealu = +inet(apple) $macs = +inet(apple) + sun_type7_jp_usb = +sun_vndr/solaris(defaults_type7jp) + $sun = +sun_vndr/solaris(defaults) ! layout variant = compat de neo = +caps(caps_lock)+misc(assign_shift_left_action)+level5(level5_lock) + jp $sun_compat = complete+japan(kana_lock) ! layout[1] variant[1] = compat de neo = +caps(caps_lock)+misc(assign_shift_left_action)+level5(level5_lock) + jp $sun_compat = complete+japan(kana_lock) ! layout[2] variant[2] = compat de neo = +caps(caps_lock):2+misc(assign_shift_left_action):2+level5(level5_lock):2 + jp $sun_compat = +complete+japan(kana_lock):2 ! layout[3] variant[3] = compat de neo = +caps(caps_lock):3+misc(assign_shift_left_action):3+level5(level5_lock):3 + jp $sun_compat = +complete+japan(kana_lock):3 ! layout[4] variant[4] = compat de neo = +caps(caps_lock):4+misc(assign_shift_left_action):4+level5(level5_lock):4 + jp $sun_compat = +complete+japan(kana_lock):4 ! model layout = compat pc98 nec_vndr/jp = pc98(basic) @@ -1002,7 +1020,7 @@ altwin:left_meta_win = +altwin(left_meta_win) altwin:hyper_win = +altwin(hyper_win) altwin:alt_super_win = +altwin(alt_super_win) - altwin:swap_lalt_lwin = +altwin(swap_lalt_lwin) + altwin:swap_alt_win = +altwin(swap_alt_win) grp:switch = +group(switch) grp:lswitch = +group(lswitch) grp:win_switch = +group(win_switch) @@ -1130,6 +1148,7 @@ shift:both_shiftlock = +shift(both_shiftlock) shift:lshift_both_shiftlock = +shift(lshift_both_shiftlock) shift:rshift_both_shiftlock = +shift(rshift_both_shiftlock) + solaris:sun_compat = +sun_vndr/solaris(sun_compat) lv3:caps_switch = +level3(caps_switch) lv3:bksl_switch = +level3(bksl_switch) lv3:lsgt_switch = +level3(lsgt_switch) diff --git a/test/data/rules/evdev b/test/data/rules/evdev index 874dce2..905a210 100644 --- a/test/data/rules/evdev +++ b/test/data/rules/evdev @@ -106,10 +106,22 @@ ! $thinkpads = thinkpad thinkpad60 thinkpadz60 -! $sun_t6_custom = ara be br ca ch cz de dk \ - ee es fi fr gb gr it kr \ - lt lv nl no pl pt ro ru \ - se sk tr tw ua +! $sun = sun_type6_jp sun_type6_usb sun_type6_euro_usb \ + sun_type6_jp_usb sun_type6_unix_usb sun_type7_jp_usb \ + sun_type7_usb sun_type7_euro_usb sun_type7_unix_usb + +! $sun_jp = sun_type6_jp sun_type6_jp_usb sun_type7_jp_usb + +// Sun Type_6_7 keyboards with custom layouts +! $sun_custom = ara be br ca ch cz de dk \ + ee es fi fr gb gr it jp \ + kr lt lv nl no pl pt ro \ + ru se sk tr tw ua us + +! $sun_var = sun_type6 sun_type6_suncompat sun_type6_de sun_type6_fr \ + sun_type7 sun_type7_suncompat suncompat + +! $sun_compat = sun_type6 sun_type6_suncompat sun_type7_suncompat suncompat ! $htcdreamlayouts = us it de @@ -131,8 +143,6 @@ * = +aliases(qwerty) ! option = keycodes - apple:badmap = +macintosh(badmap) - apple:goodmap = +macintosh(goodmap) ! model layout = geometry thinkpad us = thinkpad(us) @@ -164,6 +174,15 @@ hhk = hhk(basic) kinesis = kinesis(model100) $nokiamodels = nokia(%m) + sun_type6_jp = sun(type6jp) + sun_type6_usb = sun(type6) + sun_type6_euro_usb = sun(type6tuv) + sun_type6_jp_usb = sun(type6jp) + sun_type6_unix_usb = sun(type6unix) + sun_type7_jp_usb = sun(type6jp) + sun_type7_usb = sun(type7) + sun_type7_euro_usb = sun(type7tuv) + sun_type7_unix_usb = sun(type7unix) * = pc(pc104) ! model layout variant = symbols @@ -220,6 +239,7 @@ classmate us alt-intl = pc+us(classmate-alt-intl) classmate us altgr-intl = pc+us(classmate-altgr-intl) nokiarx51 cz qwerty = nokia_vndr/rx-51(cz_qwerty) + * $sun_custom $sun_var = pc+sun_vndr/%l%(v) ! model layout = symbols * ar = pc+ara @@ -238,7 +258,6 @@ * lo = pc+la * kan = pc+in(kan) * mi = pc+mao - * ml = pc+in(mal) * ogham = pc+ie(ogam) * ori = pc+ie(ori) * sapmi = pc+no(smi) @@ -305,18 +324,7 @@ classmate us = pc+%l(classmate) empty * = empty(basic) * empty = empty(basic) - sun4 $nonlatin = latin+sun_vndr/us(type4)+%l%(v):2 - sun4 * = latin+sun_vndr/us(type4)+%l%(v) - sun5 $nonlatin = latin+sun_vndr/us(type5)+%l%(v):2 - sun5 * = latin+sun_vndr/us(type5)+%l%(v) - sun6 us = pc+sun_vndr/us(type6) - sun6 en_US = pc+sun_vndr/us(type6)+iso9995-3(basic) - sun6 $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v) - sun6 * = pc+sun_vndr/us(type6)+%l%(v) - sun6euro us = pc+sun_vndr/us(type6) - sun6euro en_US = pc+sun_vndr/us(type6)+iso9995-3(basic) - sun6euro $sun_t6_custom = pc+sun_vndr/us(type6)+sun_vndr/%l%(v) - sun6euro * = pc+sun_vndr/us(type6)+%l%(v) + $sun $sun_custom = pc+sun_vndr/%l%(v) pc98 nec_vndr/jp = nec_vndr/jp(pc98) macintosh_old us = macintosh_vndr/us(oldmac) macintosh_old en_US = macintosh_vndr/us(oldmac) @@ -336,6 +344,11 @@ olpc $olpclayouts = olpc+%l%(m) olpc * = olpc+%l%(v) $thinkpads br = pc+br(thinkpad) + sl-c3x00 * = pc+sharp_vndr/sl-c3x00(basic) + ws003sh * = pc+sharp_vndr/ws003sh(basic) + ws007sh * = pc+sharp_vndr/ws007sh(basic) + ws011sh * = pc+sharp_vndr/ws011sh(basic) + ws020sh * = pc+sharp_vndr/ws020sh(basic) htcdream $htcdreamlayouts = %l(htcdream) * $nonlatin = pc+us+%l%(v):2 * * = pc+%l%(v) @@ -357,7 +370,6 @@ * lo = pc+la%(v[1]) * kan = pc+in(kan) * mi = pc+mao%(v[1]) - * ml = pc+in(mal) * ogham = pc+ie(ogam) * ori = pc+ie(ori) * sapmi = pc+no(smi) @@ -419,8 +431,7 @@ * yu(unicodeyz) = pc+srp(latinunicodeyz) ataritt * = xfree68_vndr/ataritt(us)+%l[1]%(v[1]) amiga * = xfree68_vndr/amiga(usa1)+%l[1]%(v[1]) - sun4 * = latin+sun_vndr/us(type4)+%l[1]%(v[1]) - sun5 * = latin+sun_vndr/us(type5)+%l[1]%(v[1]) + $sun $sun_custom = pc+sun_vndr/%l[1]%(v[1]) macintosh_old us = macintosh_vndr/us(oldmac) macintosh_old $macvendorlayouts = macintosh_vndr/us(oldmac)+macintosh_vndr/%l[1]%(v[1]) macintosh_old * = macintosh_vndr/us(oldmac)+%l[1]%(v[1]) @@ -501,7 +512,6 @@ * lo = +la%(v[2]):2 * kan = +in(kan):2 * mi = +mao%(v[2]):2 - * ml = +in(mal):2 * ogham = +ie(ogam):2 * ori = +ie(ori):2 * sapmi = +no(smi):2 @@ -563,6 +573,7 @@ * yu(unicodeyz) = +srp(latinunicodeyz):2 nokiarx51 cz(qwerty) = +nokia_vndr/rx-51(cz_qwerty):2 nokiarx51 * = +nokia_vndr/rx-51(%l[2]%_v[2]):2 + $sun $sun_custom = +sun_vndr/%l[2]%(v[2]):2 * * = +%l[2]%(v[2]):2 ! model layout[3] = symbols @@ -582,7 +593,6 @@ * lo = +la%(v[3]):3 * kan = +in(kan):3 * mi = +mao%(v[3]):3 - * ml = +in(mal):3 * ogham = +ie(ogam):3 * ori = +ie(ori):3 * sapmi = +no(smi):3 @@ -644,6 +654,7 @@ * yu(unicodeyz) = +srp(latinunicodeyz):3 nokiarx51 cz(qwerty) = +nokia_vndr/rx-51(cz_qwerty):3 nokiarx51 * = +nokia_vndr/rx-51(%l[3]%_v[3]):3 + $sun $sun_custom = +sun_vndr/%l[3]%(v[3]):3 * * = +%l[3]%(v[3]):3 ! model layout[4] = symbols @@ -663,7 +674,6 @@ * lo = +la%(v[4]):4 * kan = +in(kan):4 * mi = +mao%(v[4]):4 - * ml = +in(mal):4 * ogham = +ie(ogam):4 * ori = +ie(ori):4 * sapmi = +no(smi):4 @@ -725,6 +735,7 @@ * yu(unicodeyz) = +srp(latinunicodeyz):4 nokiarx51 cz(qwerty) = +nokia_vndr/rx-51(cz_qwerty):4 nokiarx51 * = +nokia_vndr/rx-51(%l[4]%_v[4]):4 + $sun $sun_custom = +sun_vndr/%l[4]%(v[4]):4 * * = +%l[4]%(v[4]):4 ! model layout[2] variant[2] = symbols @@ -887,18 +898,23 @@ ! layout variant = compat de neo = +caps(caps_lock)+misc(assign_shift_left_action)+level5(level5_lock) + jp $sun_compat = complete+japan(kana_lock) ! layout[1] variant[1] = compat de neo = +caps(caps_lock)+misc(assign_shift_left_action)+level5(level5_lock) + jp $sun_compat = complete+japan(kana_lock) ! layout[2] variant[2] = compat de neo = +caps(caps_lock):2+misc(assign_shift_left_action):2+level5(level5_lock):2 + jp $sun_compat = +complete+japan(kana_lock):2 ! layout[3] variant[3] = compat de neo = +caps(caps_lock):3+misc(assign_shift_left_action):3+level5(level5_lock):3 + jp $sun_compat = +complete+japan(kana_lock):3 ! layout[4] variant[4] = compat de neo = +caps(caps_lock):4+misc(assign_shift_left_action):4+level5(level5_lock):4 + jp $sun_compat = +complete+japan(kana_lock):4 ! model layout = compat pc98 nec_vndr/jp = pc98(basic) @@ -945,7 +961,7 @@ altwin:left_meta_win = +altwin(left_meta_win) altwin:hyper_win = +altwin(hyper_win) altwin:alt_super_win = +altwin(alt_super_win) - altwin:swap_lalt_lwin = +altwin(swap_lalt_lwin) + altwin:swap_alt_win = +altwin(swap_alt_win) grp:switch = +group(switch) grp:lswitch = +group(lswitch) grp:win_switch = +group(win_switch) @@ -1073,6 +1089,7 @@ shift:both_shiftlock = +shift(both_shiftlock) shift:lshift_both_shiftlock = +shift(lshift_both_shiftlock) shift:rshift_both_shiftlock = +shift(rshift_both_shiftlock) + solaris:sun_compat = +sun_vndr/solaris(sun_compat) lv3:caps_switch = +level3(caps_switch) lv3:bksl_switch = +level3(bksl_switch) lv3:lsgt_switch = +level3(lsgt_switch) @@ -1094,5 +1111,17 @@ grp_led:num = +lednum(group_lock) grp_led:caps = +ledcaps(group_lock) grp_led:scroll = +ledscroll(group_lock) + japan:kana_lock = +japan(kana_lock) caps:shiftlock = +ledcaps(shift_lock) grab:break_actions = +xfree86(grab_break) + + +! option = types + caps:internal = +caps(internal) + caps:internal_nocancel = +caps(internal_nocancel) + caps:shift = +caps(shift) + caps:shift_nocancel = +caps(shift_nocancel) + numpad:pc = +numpad(pc) + numpad:mac = +numpad(mac) + numpad:microsoft = +numpad(microsoft) + numpad:shift3 = +numpad(shift3) diff --git a/test/data/symbols/altwin b/test/data/symbols/altwin index 9259912..f7578b4 100644 --- a/test/data/symbols/altwin +++ b/test/data/symbols/altwin @@ -72,8 +72,21 @@ xkb_symbols "alt_super_win" { }; partial modifier_keys +xkb_symbols "swap_alt_win" { + include "altwin(swap_lalt_lwin)" + include "altwin(swap_ralt_rwin)" +}; + +partial hidden modifier_keys xkb_symbols "swap_lalt_lwin" { key <LALT> { type[Group1] = "ONE_LEVEL", symbols[Group1] = [ Super_L ] }; key <LWIN> { [ Alt_L, Meta_L ] }; }; + +partial hidden modifier_keys +xkb_symbols "swap_ralt_rwin" { + key <RALT> { type[Group1] = "ONE_LEVEL", + symbols[Group1] = [ Super_R ] }; + key <RWIN> { [ Alt_R, Meta_R ] }; +}; diff --git a/test/data/symbols/ca b/test/data/symbols/ca index ab9cef1..e939953 100644 --- a/test/data/symbols/ca +++ b/test/data/symbols/ca @@ -528,3 +528,8 @@ xkb_symbols "shs" { include "compose(rctrl)" }; + +partial alphanumeric_keys + xkb_symbols "sun_type6" { + include "sun_vndr/ca(sun_type6)" +}; diff --git a/test/data/symbols/de b/test/data/symbols/de index 13f5c87..6872f46 100644 --- a/test/data/symbols/de +++ b/test/data/symbols/de @@ -26,7 +26,7 @@ xkb_symbols "basic" { key <AD03> { [ e, E, EuroSign, EuroSign ] }; key <AD06> { [ z, Z, leftarrow, yen ] }; key <AD11> { [udiaeresis, Udiaeresis, dead_diaeresis, dead_abovering ] }; - key <AD12> { [ plus, asterisk, dead_tilde, dead_macron ] }; + key <AD12> { [ plus, asterisk, asciitilde, macron ] }; key <AC02> { [ s, S, U017F, U1E9E ] }; key <AC07> { [ j, J, dead_belowdot, dead_abovedot ] }; @@ -50,6 +50,16 @@ xkb_symbols "basic" { }; partial alphanumeric_keys +xkb_symbols "legacy" { + // previous standard German layout with tilde as dead key + + include "de(basic)" + name[Group1]="German (legacy)"; + + key <AD12> { [ plus, asterisk, dead_tilde, dead_macron ] }; +}; + +partial alphanumeric_keys xkb_symbols "nodeadkeys" { // modify the basic German layout to not have any dead keys @@ -319,7 +329,7 @@ xkb_symbols "neo_base" { key <AB02> { [ odiaeresis, Odiaeresis, dollar, U03F5, Tab, Tab, intersection, NoSymbol ] }; key <AB03> { [ adiaeresis, Adiaeresis, bar, Greek_eta, Insert, Insert, U2135, NoSymbol ] }; key <AB04> { [ p, P, asciitilde, Greek_pi, Return, Return, Greek_PI, NoSymbol ] }; - key <AB05> { [ z, Z, grave, Greek_zeta, Undo, Undo, U2124, NoSymbol ] }; + key <AB05> { [ z, Z, grave, Greek_zeta, Undo, Redo, U2124, NoSymbol ] }; key <AB06> { [ b, B, plus, Greek_beta, colon, NoSymbol, U21D0, NoSymbol ] }; key <AB07> { [ m, M, percent, Greek_mu, KP_1, KP_1, ifonlyif, NoSymbol ] }; @@ -344,7 +354,7 @@ xkb_symbols "neo_base" { // Topmost row // -------------------------------------------------------------- key <KPDV> { [ KP_Divide, KP_Divide, division, U2300, U2215, NoSymbol, U2223, NoSymbol ] }; - key <KPMU> { [ KP_Multiply, KP_Multiply, U2219, U2299, multiply, NoSymbol, U2297, NoSymbol ] }; + key <KPMU> { [ KP_Multiply, KP_Multiply, U22C5, U2299, multiply, NoSymbol, U2297, NoSymbol ] }; key <KPSU> { [ KP_Subtract, KP_Subtract, U2212, U2296, U2216, NoSymbol, U2238, NoSymbol ] }; // Top row @@ -484,6 +494,21 @@ xkb_symbols "dsb_qwertz" key <AD09> { [ o, O, oacute, Oacute ] }; }; +partial alphanumeric_keys +xkb_symbols "qwerty" { + + // This layout should work exactly as a de with the exception + // of 'Z' and 'Y' keys, which are in the qwerty style (ie. swapped). + // 2008 by Matej KoÅ¡Ãk <kosik@fiit.stuba.sk> + + include "de(basic)" + + name[Group1] = "German (qwerty)"; + + key <AB01> { [ z, Z, leftarrow, yen ] }; + key <AD06> { [ y, Y, guillemotleft, less ] }; +}; + // layout for Russian letters on an german keyboard // based on US-RU layout by Ivan Popov <pin@konvalo.org> 2005-07-17 // adopted for german layout by Alexey Fisher <bug-track@fisher-privat.net> 2010-08-19 @@ -625,3 +650,8 @@ xkb_symbols "hu" { }; + +partial alphanumeric_keys + xkb_symbols "sun_type6" { + include "sun_vndr/de(sun_type6)" +}; diff --git a/test/data/symbols/il b/test/data/symbols/il index 8bbeaaa..7842533 100644 --- a/test/data/symbols/il +++ b/test/data/symbols/il @@ -126,8 +126,16 @@ xkb_symbols "lyx" { // Note the parens mirroring below: key <AD11> { [ bracketright, braceright ] }; key <AD12> { [ bracketleft, braceleft ] }; - key <AE09> { [ 9 , parenright ] }; - key <AE10> { [ 0 , parenleft ] }; + key <AE01> { [ 1, exclam ]}; + key <AE02> { [ 2, at ]}; + key <AE03> { [ 3, numbersign ]}; + key <AE04> { [ 4, dollar ]}; + key <AE05> { [ 5, percent ]}; + key <AE06> { [ 6, asciicircum ]}; + key <AE07> { [ 7, ampersand ]}; + key <AE08> { [ 8, asterisk ]}; + key <AE09> { [ 9, parenright ]}; + key <AE10> { [ 0, parenleft ]}; key <AE11> { [ minus , 0x10005be ] }; // H. Hiphen key <AE12> { [ equal , plus ] }; @@ -249,3 +257,71 @@ xkb_symbols "biblical" { key <SPCE> { [ space, space, thinspace, nobreakspace ] }; }; + +// EXTRAS + +// Biblical hebrew (SIL) US Standard layout version 1.5 +// This map is based closely on v 1.5 of the standard. The only deviation being the replacement of the composite characters sin and shin +// by their more recent Unicodev6 counterparts +// this map contains all the characters found in Biblical annotation, masoretic and Dead Sea Scroll related work. +// The layout corresponds phonetically to a US standard layout or similar (Qwerty). +// If you are using an actual Hebrew keyboard, you are probably better off using a Tiro compliant scholarly layout +// This linux port created and maintained by Dennis Meulensteen, dennis@meulensteen.nl +partial alphanumeric_keys +xkb_symbols "biblicalSIL" { + name[Group1]= "Hebrew (Biblical, SIL phonetic)"; + key.type = "FOUR_LEVEL_SEMIALPHABETIC"; + + key <TLDE> { [ U20AC, U20AA, U0024 ] }; //Euro, Shekel, Dollar - + key <AE01> { [ 1, U0021, U05BD, U0597 ] }; //1, exclamation meteg revia + key <AE02> { [ 2, U0598, U05A2, U05AE ] }; //2, zarqa atn. hafukh zinor + key <AE03> { [ 3, U05A8, U0596, U0599 ] }; //3, qadma tipeha pashta + key <AE04> { [ 4, U059C, U05A5, U05A0 ] }; //4, geresh merkha tel. gedola + key <AE05> { [ 5, U059E, U05A6, U05A9 ] }; //5, gershayim mer. kefula tel qetana + key <AE06> { [ 6, VoidSymbol, U05AD, U059F ] }; //6, - dehi qar. para + key <AE07> { [ 7, U05AC, U05A3, U05A1 ] }; //7, iluy munah pazer + key <AE08> { [ 8, U059D, U059B, U0595 ] }; //8, g. muqdam tevir zaq. gadol + key <AE09> { [ 9, U0029, U05A7, U0593 ] }; //9, parenth.R darqa shalshelet + key <AE10> { [ 0, U0028, U05AA, U05AF ] }; //0, paren.L yer. ben yomo masora c. + key <AE11> { [ U05BE, U2013, U2014, U05BF ] }; //Maqaf, en dash em dash rafe + key <AE12> { [ U05BC, VoidSymbol, U0591, U25CC ] }; //Dagesh - etnahta mark base + + key <AD01> { [ hebrew_qoph, U0597 ] }; //Qof revia - - + key <AD02> { [ hebrew_waw] }; //waw - - - + key <AD03> { [ U05B6, U05B5, VoidSymbol, U05B1 ] }; //segol tsere - hat. segol + key <AD04> { [ hebrew_resh ] }; //resh - - - + key <AD05> { [ hebrew_taw ] }; //taw - - - + key <AD06> { [ hebrew_yod, U059F ] }; //jod qar. para - - + key <AD07> { [ U05BB] }; //quibuts - - - + key <AD08> { [ U05B4 ] }; //hiriq, - - - + key <AD09> { [ U05B9, U05BA, U05C7, U05B3 ] }; //holam, holam(wav) qam. qatan hat. Qamats + key <AD10> { [ hebrew_pe, hebrew_finalpe, VoidSymbol, U034F ] }; //pe final pe - c. grapheme joiner + key <AD11> { [ bracketright, braceright, VoidSymbol, U0594 ] }; //Bracket R brace R - zaq. qatan + key <AD12> { [ bracketleft, braceleft, U059A, U0592 ] }; //Brachket L brace L yetiv segolta + key <BKSL> { [ U05C0, U05C0, U05A4, U05AB ] };//Paseq Paseq mahapakh ole + + key <AC01> { [ U05B7, U05B8, U05C7, U05B2 ] }; //patah Qamats Qam. Qatan hat. patah + key <AC02> { [ hebrew_samech, U05E9 ] }; //Samech, shin no dot - - + key <AC03> { [ hebrew_dalet ] }; //dalet - - - + key <AC04> { [ UFB2B, hebrew_sin, U05C2 ] }; //UCSv6 Sin sin (nodot) sindot - + key <AC05> { [ hebrew_gimel, VoidSymbol, U25E6, U2022 ] }; //gimel - bullet(DSS) bulletfill (DSS) + key <AC06> { [ hebrew_he, VoidSymbol, U0336, U030A ] };//he - strikeout(DSS) Ring Above(DSS) + key <AC07> { [ UFB2A, hebrew_shin, U05C1] }; //UCSv6 Shin shin (nodot) shindot - + key <AC08> { [ hebrew_kaph, hebrew_finalkaph ] }; //kaph Final kaph - + key <AC09> { [ hebrew_lamed, VoidSymbol ] }; //lamed - - + key <AC10> { [ U05B0, U05F4, semicolon, U05C3 ] }; //sva gers. p semicolon sof pasuq + key <AC11> { [ U2019, U201D, U0323, U05C4 ] };//QuoteRight double R Quote punctum punctum Above + + key <AB01> { [ hebrew_zain ] }; //Zayin - - + key <AB02> { [ hebrew_chet ] }; //chet - - + key <AB03> { [ hebrew_zade, U05E5 ] }; // tzade, final tzade - + key <AB04> { [ hebrew_tet ] }; //tet - - + key <AB05> { [ hebrew_bet ] }; //bet - - + key <AB06> { [ hebrew_nun, hebrew_finalnun ] }; //nun, final nun + key <AB07> { [ hebrew_mem, hebrew_finalmem, U200C, U200D ] }; //mem, final mem 0.wid.non.join. 0.wid.joiner + key <AB08> { [ U002C, U05E2, U00AB, U0307 ] }; //comma, ayin guillemetsR masora dot + key <AB09> { [ U0002E, U05D0, U00BB, U0308 ] }; //period, alef guillemetsL thousands + key <AB10> { [ slash, question, U05F3 ] }; //slash question geresh P + + key <SPCE> { [ space, space, thinspace, nobreakspace ] };//space space thin space, nbsp +}; diff --git a/test/data/symbols/in b/test/data/symbols/in index 84d9b06..b995fbb 100644 --- a/test/data/symbols/in +++ b/test/data/symbols/in @@ -38,7 +38,7 @@ xkb_symbols "deva" { // INSCRIPT in place of the symbols that are here for now. But this // requires XKB to map 1 key into two to three other key presses. key <AE03> { [ U0969, numbersign, 3, numbersign ] }; - key <AE04> { [ U096a, dollar, 4, dollar ] }; + key <AE04> { [ U096a, dollar, 4 ] }; key <AE05> { [ U096b, percent, 5, percent ] }; key <AE06> { [ U096c, asciicircum, 6, asciicircum ] }; key <AE07> { [ U096d, ampersand, 7, ampersand ] }; @@ -89,6 +89,8 @@ xkb_symbols "deva" { // space, space, Zero-Width-Non-Joiner (ZWNJ), Zero-Width-Joiner (ZWJ): include "nbsp(zwnj3zwj4)" + include "rupeesign(4)" + include "level3(ralt_switch)" }; //Name : Bolnagri (Combined) @@ -98,7 +100,7 @@ xkb_symbols "deva" { //Inspired by "devrom" keymap by Steve Smith for the windows tool "keyman" //Original Author : Noah Levitt<nlevitt at columbia.edu> //Past Authors : Pramod.R <pramodr at gmail.com> and Ravikant <ravikant at sarai.net> -// Current Main.: G Karunakar <karunakar@sarai.net> +//Current Main. : G Karunakar <karunakar@indlinux.org> partial alphanumeric_keys xkb_symbols "bolnagri" { @@ -110,7 +112,7 @@ xkb_symbols "bolnagri" { key <AE01> { [ 1, exclam, U0967, exclam ] }; key <AE02> { [ 2, at, U0968, at ] }; key <AE03> { [ 3, numbersign, U0969, numbersign ] }; - key <AE04> { [ 4, dollar, U096A, dollar ] }; + key <AE04> { [ 4, dollar, U096A ] }; // Rupee symbol on AltGr+4 key <AE05> { [ 5, percent, U096B, percent ] }; key <AE06> { [ 6, asciicircum, U096C, asciicircum ] }; key <AE07> { [ 7, ampersand, U096D, ampersand ] }; @@ -125,7 +127,7 @@ xkb_symbols "bolnagri" { key <AD01> { [ U200C, U200D ] }; // Q: ZWNJ, ZWJ key <AD02> { [ U0935, U950 ] }; // W: wa, OM key <AD03> { [ U0947, U0948, U090F, U0910 ] }; // E: e, ai matras - key <AD04> { [ U0930, U0943 ] }; // R: ra, vocalic Ri + key <AD04> { [ U0930, U0943, U0931, U090B ] }; // R: ra, vocalic Ri key <AD05> { [ U0924, U0925 ] }; // T: ta, tha key <AD06> { [ U092f, U091E ] }; // Y: ya, nya key <AD07> { [ U0941, U0942, U0909, U090A ] }; // U: u, uu matras @@ -136,7 +138,7 @@ xkb_symbols "bolnagri" { key <AD12> { [ bracketright, braceright ] }; //A Row - key <AC01> { [ U093E, U0906, U0905, U0906 ] }; // A: aa + key <AC01> { [ U093E, U0906, U0905, U0906 ] }; // A: aa, full A, AA key <AC02> { [ U0938, U0937 ] }; // S: sa, ssa key <AC03> { [ U0926, U0927 ] }; // D: da, dha key <AC04> { [ U091F, U0920 ] }; // F: TA, THA @@ -144,18 +146,18 @@ xkb_symbols "bolnagri" { key <AC06> { [ U0939, U0903 ] }; // H: ha, visarg key <AC07> { [ U091C, U091D ] }; // J: ja, jha key <AC08> { [ U0915, U0916 ] }; // K: ka, kha - key <AC09> { [ U0932, U0962 ] }; // L: la, vocalic L or lru matra` + key <AC09> { [ U0932, U0933, U0962, U090C ] }; // L: la, vocalic L or lru matra key <AC10> { [ semicolon, colon ] }; key <AC11> { [apostrophe, quotedbl ] }; //Z Row - key <AB01> { [ U0936, U0945 ] }; // Z: sha, akaar candra - key <AB02> { [ U094D, U0949 ] }; // X: halant, aakaar candra + key <AB01> { [ U0936, U0945, U0936, U090D ] }; // Z: sha, akaar candra + key <AB02> { [ U094D, U0949, U094D, U0911 ] }; // X: halant, aakaar candra, chandra A key <AB03> { [ U091A, U091B ] }; // C: ca, cha key <AB04> { [ U0921, U0922 ] }; // V: da, dha key <AB05> { [ U092C, U092D ] }; // B: ba, bha - key <AB06> { [ U0928, U0923 ] }; // N: na, nha - key <AB07> { [ U092E, U093D, U092E, U093D ] }; // M: ma, avagraha + key <AB06> { [ U0928, U0923 ] }; // N: na, nna + key <AB07> { [ U092E, U0919, U092E, U093D ] }; // M: ma, nga, avagraha key <AB08> { [ comma, U0970 ] };// comma: comma, dev abbreviation sign key <AB09> { [ period, U093C ] }; // period: period, nukta key <AB10> { [ slash, question ] }; @@ -165,7 +167,9 @@ xkb_symbols "bolnagri" { // modifier_map Lock { Caps_Lock }; // modifier_map Control{ Control_L }; // modifier_map Mod3 { Mode_switch }; + include "level3(ralt_switch)" + include "rupeesign(4)" }; // based on a keyboard map from an 'xkb/symbols/ben' file @@ -234,6 +238,9 @@ xkb_symbols "ben" { key <AB08> { [ comma, U09B7 ] }; key <AB09> { [ period, U0964 ] }; key <AB10> { [ U09DF, U09AF ] }; + + include "level3(ralt_switch)" + include "rupeesign(4)" }; xkb_symbols "ben_probhat" { @@ -307,6 +314,8 @@ xkb_symbols "ben_probhat" { // modifier_map Lock { Caps_Lock }; // modifier_map Control{ Control_L }; + include "level3(ralt_switch)" + include "rupeesign(4)" }; // Bengali Baishakhi, Bengali Baishakhi Inscript, Bengali Bornona, Uni Gitanjali Layouts are added by Promathesh Mandal <promathesh812004@gmail.com> @@ -670,6 +679,8 @@ xkb_symbols "guj" { key <AB08> { [ comma, U0AB7 ] }; key <AB09> { [ period, U0964 ] }; key <AB10> { [ U0AAF, question ] }; + include "rupeesign(4)" + include "level3(ralt_switch)" }; partial alphanumeric_keys @@ -736,7 +747,8 @@ xkb_symbols "kan" { symbols[Group1] = [ Mode_switch, Multi_key ], virtualMods = AltGr }; - + include "rupeesign(4)" + include "level3(ralt_switch)" }; // Description : A keymap for Malayalam @@ -828,6 +840,9 @@ xkb_symbols "mal" { key <AB09> { [ period , U0200d ] }; key <AB10> { [ U0d2f , question ] }; + include "rupeesign(4)" + include "level3(ralt_switch)" + }; //Name : Lalitha @@ -845,7 +860,7 @@ xkb_symbols "mal_lalitha" { key <AE01> { [ 1, exclam, U0D67, exclam ] }; key <AE02> { [ 2, at, U0D68, at ] }; key <AE03> { [ 3, numbersign, U0D69, numbersign ] }; - key <AE04> { [ 4, dollar, U0D6A, dollar ] }; + key <AE04> { [ 4, dollar, U0D6A ] }; key <AE05> { [ 5, percent, U0D6B, percent ] }; key <AE06> { [ 6, asciicircum, U0D6C, asciicircum ] }; key <AE07> { [ 7, ampersand, U0D6D, ampersand ] }; @@ -901,6 +916,7 @@ xkb_symbols "mal_lalitha" { // modifier_map Control{ Control_L }; // modifier_map Mod3 { Mode_switch }; include "level3(ralt_switch)" + include "rupeesign(4)" }; @@ -964,6 +980,8 @@ xkb_symbols "ori" { symbols[Group1] = [ Mode_switch, Multi_key ], virtualMods = AltGr }; + include "rupeesign(4)" + include "level3(ralt_switch)" }; // based on a keyboard map from an 'xkb/symbols/tml' file @@ -1029,6 +1047,9 @@ xkb_symbols "tam" { key <AB08> { [ comma, U0BB7 ] }; key <AB09> { [ period, U0964 ] }; key <AB10> { [ U0BAF, question ] }; + + include "level3(ralt_switch)" + include "rupeesign(4)" }; partial alphanumeric_keys @@ -1340,6 +1361,8 @@ xkb_symbols "tel" { symbols[Group1] = [ Mode_switch, Multi_key ], virtualMods = AltGr }; + include "rupeesign(4)" + include "level3(ralt_switch)" }; partial alphanumeric_keys @@ -1425,6 +1448,9 @@ xkb_symbols "guru" { key <AB08> { [ comma, less ] }; key <AB09> { [ period, U0964 ] }; key <AB10> { [ U0A2F, question ] }; + + include "rupeesign(4)" + include "level3(ralt_switch)" }; //Name : Jhelum (Refind Inscript) @@ -1443,10 +1469,10 @@ xkb_symbols "jhelum" { key <AE01> { [ 1,exclam, U0A67, exclam ] }; key <AE02> { [ 2,at, U0A68, at ] }; key <AE03> { [ 3,numbersign, U0A69, numbersign ] }; - key <AE04> { [ 4,dollar, U0A6A, dollar ] }; + key <AE04> { [ 4,dollar, U0A6A ] }; key <AE05> { [ 5,percent,U0A6B, percent ] }; - key <AE06> { [ 6,asciicircum, U0A6C,asciicircum ] }; - key <AE07> { [ 7,ampersand,U0A6D,ampersand ] }; + key <AE06> { [ 6,U0A73, U0A6C,asciicircum ] }; + key <AE07> { [ 7,U0A72,U0A6D,ampersand ] }; key <AE08> { [ 8,asterisk,U0A6E, asterisk ] }; key <AE09> { [ 9,parenleft,U0A6F,parenleft ] }; key <AE10> { [ 0,parenright,U0A66,parenright ] }; @@ -1458,27 +1484,27 @@ xkb_symbols "jhelum" { key <AD01> { [ U0A4C, U0A14 ] }; // Q: oo, ooh key <AD02> { [ U0A48, U0A10 ] }; // W: ee, ae key <AD03> { [ U0A3E, U0A06 ] }; // E: a, aa - key <AD04> { [ U0A40, U0A08 ] }; // R: ee, ai + key <AD04> { [ U0A40, U0A08, U20B9 ] }; // R: ee, ai, rupeesign key <AD05> { [ U0A42, U0A0A ] }; // T: u, uu key <AD06> { [ U0A30, U0A5C ] }; // Y: ra, raa key <AD07> { [ U0A26, U0A27 ] }; // U: tha, thha - key <AD08> { [ U0A17, U0A18 ] }; // I:ga, gha + key <AD08> { [ U0A17, U0A18, U0A5A ] }; // I:ga, gha key <AD09> { [ U0A24, U0A1F ] }; // O: ta, tha - key <AD10> { [ U0A2A, U0A5E ] }; // P: pa, pha + key <AD10> { [ U0A2A, U0A5E, VoidSymbol,U0A5E ] }; // P: pa, pha key <AD11> { [ U0A21, U0A22, bracketleft, braceleft ] }; key <AD12> { [ U0A19, U0A1E, bracketright, braceright ] }; //A Row key <AC01> { [ U0A4B, U0A13 ] }; // A: o, oo - key <AC02> { [ U0A40, U0A0F ] }; // S: e, ee + key <AC02> { [ U0A47, U0A0F ] }; // S: e, ee key <AC03> { [ U0A4D, U0A05 ] }; // D: halant, aa key <AC04> { [ U0A3F, U0A07 ] }; // F: i, aa key <AC05> { [ U0A41, U0A09 ] }; // G: u, uh key <AC06> { [ U0A39, U0A20 ] }; // H: ha, thha - key <AC07> { [ U0A1C, U0A1D ] }; // J: ja, jha - key <AC08> { [ U0A15, U0A16 ] }; // K: ka, kha - key <AC09> { [ U0A32, U0A25 ] }; // L: la, tha - key <AC10> { [ U0A38, semicolon, colon ] }; //; sa + key <AC07> { [ U0A1C, U0A1D, U0A5B ] }; // J: ja, jha + key <AC08> { [ U0A15, U0A16,VoidSymbol ,U0A59 ] }; // K: ka, kha + key <AC09> { [ U0A32, U0A25, U0A33 ] }; // L: la, tha + key <AC10> { [ U0A38, colon, U0A36 ] }; //; sa key <AC11> { [apostrophe, quotedbl ] }; //Z Row @@ -1563,6 +1589,8 @@ xkb_symbols "olpc" { include "nbsp(zwnj3zwj4)" include "group(olpc)" + include "rupeesign(4)" + include "level3(ralt_switch)" }; partial alphanumeric_keys @@ -1628,6 +1656,7 @@ xkb_symbols "hin-wx" { key <AB10> { [ slash, question ] }; include "level3(ralt_switch)" + include "rupeesign(4)" }; partial alphanumeric_keys diff --git a/test/data/symbols/inet b/test/data/symbols/inet index b8f4d19..4c172fa 100644 --- a/test/data/symbols/inet +++ b/test/data/symbols/inet @@ -97,7 +97,7 @@ xkb_symbols "evdev" { key <UNDO> { [ Undo ] }; key <FRNT> { [ SunFront ] }; key <COPY> { [ XF86Copy ] }; - key <OPEN> { [ SunOpen ] }; + key <OPEN> { [ XF86Open ] }; key <PAST> { [ XF86Paste ] }; key <FIND> { [ Find ] }; key <CUT> { [ XF86Cut ] }; diff --git a/test/data/symbols/keypad b/test/data/symbols/keypad index d82c87c..85d4d6e 100644 --- a/test/data/symbols/keypad +++ b/test/data/symbols/keypad @@ -267,13 +267,12 @@ xkb_symbols "legacymath" { partial keypad_keys xkb_symbols "ossmath" { - key.type[Group1]="FOUR_LEVEL_X" ; - - key <KPDV> { [ KP_Divide, 0x1002215, 0x10000F7, XF86_Ungrab ] }; // / ∕ ÷ <XF86_Ungrab> - key <KPMU> { [ KP_Multiply, 0x10022C5, 0x10000D7, XF86_ClearGrab ] }; // * â‹… × <XF86_ClearGrab> - key <KPSU> { [ KP_Subtract, 0x1002212, 0x1002212, XF86_Prev_VMode ] }; // - − − <XF86_Prev_VMode> + key.type[Group1]="CTRL+ALT" ; - key <KPAD> { [ KP_Add, 0x100002B, 0x100002B, XF86_Next_VMode ] }; // + + + <XF86_Next_VMode> + key <KPDV> { [ KP_Divide, 0x1002215, 0x10000F7, VoidSymbol, XF86_Ungrab ] }; // / ∕ ÷ <XF86_Ungrab> + key <KPMU> { [ KP_Multiply, 0x10022C5, 0x10000D7, VoidSymbol, XF86_ClearGrab ] }; // * â‹… × <XF86_ClearGrab> + key <KPSU> { [ KP_Subtract, 0x1002212, 0x1002212, VoidSymbol, XF86_Prev_VMode ] }; // - − − <XF86_Prev_VMode> + key <KPAD> { [ KP_Add, 0x100002B, 0x100002B, VoidSymbol, XF86_Next_VMode ] }; // + + + <XF86_Next_VMode> }; diff --git a/test/data/symbols/latin b/test/data/symbols/latin index 77b99d4..424768e 100644 --- a/test/data/symbols/latin +++ b/test/data/symbols/latin @@ -35,7 +35,7 @@ xkb_symbols "basic" { key <AC04> { [ f, F, dstroke, ordfeminine ] }; key <AC05> { [ g, G, eng, ENG ] }; key <AC06> { [ h, H, hstroke, Hstroke ] }; - key <AC07> { [ j, J, j, J ] }; + key <AC07> { [ j, J, dead_hook, dead_horn ] }; key <AC08> { [ k, K, kra, ampersand ] }; key <AC09> { [ l, L, lstroke, Lstroke ] }; key <AC10> { [ semicolon, colon, dead_acute, dead_doubleacute ] }; diff --git a/test/data/symbols/level3 b/test/data/symbols/level3 index 9d49555..8bf83bb 100644 --- a/test/data/symbols/level3 +++ b/test/data/symbols/level3 @@ -2,6 +2,19 @@ // the third shift level can be reached // +// Ensure a mapping to a real modifier for LevelThree +partial modifier_keys +xkb_symbols "modifier_mapping" { + key.type[Group1] = "ONE_LEVEL"; + + replace key <LVL3> { + vmods = LevelThree, + symbols[Group1] = [ ISO_Level3_Shift ], + actions[Group1] = [ SetMods(modifiers=LevelThree) ] + }; + modifier_map Mod5 { <LVL3> }; +}; + // the default behavior is for the right Alt key (AltGr) to generate the // third engraved symbol default partial modifier_keys @@ -10,7 +23,7 @@ xkb_symbols "ralt_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; // Right Alt key never chooses 3rd level. @@ -38,6 +51,7 @@ xkb_symbols "ralt_switch_multikey" { type[Group1]="TWO_LEVEL", symbols[Group1] = [ ISO_Level3_Shift, Multi_key ] }; + include "level3(modifier_mapping)" }; // special case or right Alt switch - for use with grp:alts_toggle @@ -55,7 +69,7 @@ xkb_symbols "ralt_switch_for_alts_toggle" { symbols[Group1] = [ ISO_Level3_Shift, ISO_Next_Group ], virtualMods= AltGr }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; // using the level(alt_switch) map, either Alt key temporarily chooses @@ -72,7 +86,7 @@ xkb_symbols "lalt_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { <LALT> }; + include "level3(modifier_mapping)" }; // using the level(switch) map, the right Control key temporarily @@ -83,7 +97,7 @@ xkb_symbols "switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; // using the level(menu_switch) map, the Menu key temporarily @@ -94,7 +108,7 @@ xkb_symbols "menu_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; // using the level3(win_switch) map, the either Windows' logo key @@ -113,7 +127,7 @@ xkb_symbols "lwin_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; // using the level(rwin_switch) map, the right Windows' logo key @@ -126,7 +140,7 @@ xkb_symbols "rwin_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; // using the level3(enter_switch) map, the Enter key on the keypad @@ -138,7 +152,7 @@ xkb_symbols "enter_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; partial modifier_keys @@ -147,7 +161,7 @@ xkb_symbols "caps_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; partial modifier_keys @@ -156,7 +170,7 @@ xkb_symbols "bksl_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; partial modifier_keys @@ -165,7 +179,7 @@ xkb_symbols "lsgt_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; partial modifier_keys @@ -174,7 +188,7 @@ xkb_symbols "caps_switch_latch" { type[Group1]="THREE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift, ISO_Level3_Latch ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; partial modifier_keys @@ -183,7 +197,7 @@ xkb_symbols "bksl_switch_latch" { type[Group1]="THREE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift, ISO_Level3_Latch ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; partial modifier_keys @@ -192,5 +206,5 @@ xkb_symbols "lsgt_switch_latch" { type[Group1]="THREE_LEVEL", symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift, ISO_Level3_Latch ] }; - modifier_map Mod5 { ISO_Level3_Shift }; + include "level3(modifier_mapping)" }; diff --git a/test/data/symbols/level5 b/test/data/symbols/level5 index ce219b5..f5ecb62 100644 --- a/test/data/symbols/level5 +++ b/test/data/symbols/level5 @@ -2,6 +2,19 @@ // the third shift level can be reached // +// Ensure a mapping to a real modifier for LevelFive +partial modifier_keys +xkb_symbols "modifier_mapping" { + key.type[Group1] = "ONE_LEVEL"; + + replace key <MDSW> { + vmods = LevelFive, + symbols[Group1] = [ ISO_Level5_Shift ], + actions[Group1] = [ SetMods(modifiers=LevelFive) ] + }; + modifier_map Mod3 { <MDSW> }; +}; + // using the level(switch) map, the right Control key temporarily // chooses the fifth shift level (until it is released). partial modifier_keys @@ -10,7 +23,7 @@ xkb_symbols "rctrl_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level5_Shift ] }; - modifier_map Mod3 { ISO_Level5_Shift }; + include "level5(modifier_mapping)" }; partial modifier_keys @@ -19,7 +32,7 @@ xkb_symbols "lsgt_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level5_Shift ] }; - modifier_map Mod3 { ISO_Level5_Shift }; + include "level5(modifier_mapping)" }; partial modifier_keys @@ -28,7 +41,7 @@ xkb_symbols "ralt_switch" { type[Group1]="ONE_LEVEL", symbols[Group1] = [ ISO_Level5_Shift ] }; - modifier_map Mod3 { ISO_Level5_Shift }; + include "level5(modifier_mapping)" }; @@ -43,12 +56,7 @@ xkb_symbols "lock" { // See also: compat/level5(level5_lock) key.type[Group1] = "ONE_LEVEL"; - replace key <MDSW> { - vmods = LevelFive, - symbols[Group1] = [ ISO_Level5_Shift ], - actions[Group1] = [ SetMods(modifiers=LevelFive) ] - }; - modifier_map Mod3 { <MDSW> }; + include "level5(modifier_mapping)" replace key <HYPR> { vmods = NumLock, diff --git a/test/data/symbols/pc b/test/data/symbols/pc index 7e13ecb..d259709 100644 --- a/test/data/symbols/pc +++ b/test/data/symbols/pc @@ -37,7 +37,7 @@ xkb_symbols "pc105" { // begin modifier mappings modifier_map Shift { Shift_L, Shift_R }; - modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Lock { Caps_Lock }; modifier_map Control{ Control_L, Control_R }; modifier_map Mod2 { Num_Lock }; modifier_map Mod4 { Super_L, Super_R }; diff --git a/test/data/symbols/ru b/test/data/symbols/ru index 408e408..0248dc6 100644 --- a/test/data/symbols/ru +++ b/test/data/symbols/ru @@ -273,13 +273,13 @@ xkb_symbols "cv" { key.type[group1]="FOUR_LEVEL"; key <AD03> { [ Cyrillic_u, Cyrillic_U, - 0x010004f3, 0x010004f2 ] }; + U04F3, U04F2 ] }; key <AD05> { [ Cyrillic_ie, Cyrillic_IE, - 0x01000115, 0x01000114 ] }; + U04D7, U04D6 ] }; key <AC04> { [ Cyrillic_a, Cyrillic_A, - abreve, Abreve ] }; + U04D1, U04D0 ] }; key <AB03> { [ Cyrillic_es, Cyrillic_ES, - ccedilla, Ccedilla ] }; + U04AB, U04AA ] }; include "level3(ralt_switch)" }; @@ -651,3 +651,8 @@ xkb_symbols "ruu" { include "level3(ralt_switch)" }; + +partial alphanumeric_keys + xkb_symbols "sun_type6" { + include "sun_vndr/ru(sun_type6)" +}; diff --git a/test/data/symbols/rupeesign b/test/data/symbols/rupeesign new file mode 100644 index 0000000..efde69c --- /dev/null +++ b/test/data/symbols/rupeesign @@ -0,0 +1,5 @@ +// keyboards having the RupeeSign on the 4 key +partial +xkb_symbols "4" { + key <AE04> { [ NoSymbol, NoSymbol, U20B9 ] }; +}; diff --git a/test/data/symbols/us b/test/data/symbols/us index 49f8d2d..d4bac06 100644 --- a/test/data/symbols/us +++ b/test/data/symbols/us @@ -11,8 +11,8 @@ xkb_symbols "basic" { key <AE03> { [ 3, numbersign ] }; key <AE04> { [ 4, dollar ] }; key <AE05> { [ 5, percent ] }; - key <AE06> { [ { H, E, L, L, O }, asciicircum ] }; - key <AE07> { [ { Y, E, S, space, T, H, I, S, space, I, S, space, D, O, G }, ampersand ] }; + key <AE06> { [ { H, E, L, L, O }, asciicircum ] }; + key <AE07> { [ { Y, E, S, space, T, H, I, S, space, I, S, space, D, O, G }, ampersand ] }; key <AE08> { [ 8, asterisk ] }; key <AE09> { [ 9, parenleft ] }; key <AE10> { [ 0, parenright ] }; @@ -259,7 +259,7 @@ xkb_symbols "dvorak" { partial alphanumeric_keys xkb_symbols "dvorak-intl" { - name[Group1]= "English (Dvorak international with dead keys)"; + name[Group1]= "English (Dvorak, international with dead keys)"; include "us(dvorak)" @@ -729,7 +729,7 @@ xkb_symbols "mac" { }; // Colemak symbols for xkb on X.Org Server 7.x -// 2006-01-01 Shai Coleman, http://colemak.com/ . Public domain. +// 2006-01-01 Shai Coleman, http://colemak.com/ partial alphanumeric_keys xkb_symbols "colemak" { @@ -1129,6 +1129,8 @@ xkb_symbols "hbs" { key <TLDE> { [ grave, asciitilde ] }; key <AE06> { [ 6, dead_caron, asciicircum, asciicircum ] }; + key <AE08> { [ 8, asterisk, multiply, division ] }; + key <AE11> { [ minus, underscore, endash, emdash ] }; key <AC09> { [ l, L, U1C9, U1C8 ] }; key <AB06> { [ n, N, U1CC, U1CB ] }; key <AB01> { [ z, Z, U1C6, U1C5 ] }; @@ -1136,8 +1138,8 @@ xkb_symbols "hbs" { key <AC03> { [ d, D, dstroke, Dstroke ] }; key <AC11> { [ dead_acute, quotedbl, apostrophe, apostrophe ] }; key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; - key <AB08> { [ comma, less, NoSymbol, guillemotright ] }; - key <AB09> { [ period, greater, NoSymbol, guillemotleft ] }; + key <AB08> { [ comma, less, U3003, guillemotright ] }; + key <AB09> { [ period, greater, ellipsis, guillemotleft ] }; include "level3(ralt_switch)" }; @@ -1187,8 +1189,146 @@ xkb_symbols "htcdream" { include "level3(alt_switch)" }; +// Workman Keyboard Layout symbols for xkb on X.Org Server 7.x +// 09-06-2010 OJ Bucao. http://www.workmanlayout.com + +partial alphanumeric_keys +xkb_symbols "workman" { + + name[Group1]= "English (Workman)"; + + include "us(basic)" + + // Alphanumeric section + key <AD01> { [ q, Q ] }; + key <AD02> { [ d, D ] }; + key <AD03> { [ r, R ] }; + key <AD04> { [ w, W ] }; + key <AD05> { [ b, B ] }; + key <AD06> { [ j, J ] }; + key <AD07> { [ f, F ] }; + key <AD08> { [ u, U ] }; + key <AD09> { [ p, P ] }; + key <AD10> { [ semicolon, colon ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ s, S ] }; + key <AC03> { [ h, H ] }; + key <AC04> { [ t, T ] }; + key <AC05> { [ g, G ] }; + key <AC06> { [ y, Y ] }; + key <AC07> { [ n, N ] }; + key <AC08> { [ e, E ] }; + key <AC09> { [ o, O ] }; + key <AC10> { [ i, I ] }; + + key <AB01> { [ z, Z ] }; + key <AB02> { [ x, X ] }; + key <AB03> { [ m, M ] }; + key <AB04> { [ c, C ] }; + key <AB05> { [ v, V ] }; + key <AB06> { [ k, K ] }; + key <AB07> { [ l, L ] }; + // End alphanumeric section + + key <CAPS> { [ BackSpace, Escape, BackSpace, BackSpace ] }; + + include "level3(ralt_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "workman-intl" { + + name[Group1]= "English (Workman, international with dead keys)"; + + include "us(intl)" + + // Alphanumeric section + key <AD01> { [ q, Q, adiaeresis, Adiaeresis ] }; + key <AD02> { [ d, D, eth, ETH ] }; + key <AD03> { [ r, R, registered, registered ] }; + key <AD04> { [ w, W, aring, Aring ] }; + key <AD05> { [ b, B, b, B ] }; + key <AD06> { [ j, J, j, J ] }; + key <AD07> { [ f, F, f, F ] }; + key <AD08> { [ u, U, uacute, Uacute ] }; + key <AD09> { [ p, P, odiaeresis, Odiaeresis ] }; + key <AD10> { [ semicolon, colon, paragraph, degree ] }; + + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ s, S, ssharp, section ] }; + key <AC03> { [ h, H, h, H ] }; + key <AC04> { [ t, T, thorn, THORN ] }; + key <AC05> { [ g, G, g, G ] }; + key <AC06> { [ y, Y, udiaeresis, Udiaeresis ] }; + key <AC07> { [ n, N, ntilde, Ntilde ] }; + key <AC08> { [ e, E, eacute, Eacute ] }; + key <AC09> { [ o, O, oacute, Oacute ] }; + key <AC10> { [ i, I, iacute, Iacute ] }; + + key <AB01> { [ z, Z, ae, AE ] }; + key <AB02> { [ x, X, x, X ] }; + key <AB03> { [ m, M, mu, mu ] }; + key <AB04> { [ c, C, copyright, cent ] }; + key <AB05> { [ v, V, v, V ] }; + key <AB06> { [ k, K, oe, OE ] }; + key <AB07> { [ l, L, oslash, Ooblique ] }; + // End alphanumeric section + + key <CAPS> { [ BackSpace, Escape, BackSpace, BackSpace ] }; + + include "level3(ralt_switch)" +}; + // EXTRAS: +// Czech, Slovak and German charecters added as third level symbols to US keyboard layout. +partial alphanumeric_keys +xkb_symbols "cz_sk_de" { + include "us" + name[Group1]="Czech Slovak and German (US)"; + + key <TLDE> { [grave, asciitilde, uring, Uring ] }; + key <AE01> { [ 1, exclam, uacute, Uacute ] }; + key <AE02> { [ 2, at, ecaron, Ecaron ] }; + key <AE03> { [ 3, numbersign, scaron, Scaron ] }; + key <AE04> { [ 4, dollar, ccaron, Ccaron ] }; + key <AE05> { [ 5, percent, rcaron, Rcaron ] }; + key <AE06> { [ 6, asciicircum, zcaron, Zcaron ] }; + key <AE07> { [ 7, ampersand, yacute, Yacute ] }; + key <AE08> { [ 8, asterisk, aacute, Aacute ] }; + key <AE09> { [ 9, parenleft, iacute, Iacute ] }; + key <AE10> { [ 0, parenright, eacute, Eacute ] }; + key <AE11> { [minus, underscore, ssharp, 0x1001E9E ] }; + key <AE12> { [equal, plus, dead_acute, dead_caron ] }; + + key <AD03> { [ e, E, EuroSign, Eacute ] }; + + key <AD11> { [bracketleft, braceleft, udiaeresis, Udiaeresis ] }; + key <AC10> { [ semicolon, colon, odiaeresis, Odiaeresis ] }; + key <AC11> { [apostrophe, quotedbl,adiaeresis, Adiaeresis ] }; + + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AD08> { [ i, I, iacute, Iacute ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + key <AD06> { [ y, Y, yacute, Yacute ] }; + key <AD07> { [ u, U, uring, Uring ] }; + + key <AC02> { [ s, S, scaron, Scaron ] }; + key <AB01> { [ z, Z, zcaron, Zcaron ] }; + key <AB03> { [ c, C, ccaron, Ccaron ] }; + key <AD04> { [ r, R, rcaron, Rcaron ] }; + key <AD05> { [ t, T, tcaron, Tcaron ] }; + key <AC03> { [ d, D, dcaron, Dcaron ] }; + key <AB06> { [ n, N, ncaron, Ncaron ] }; + key <AC09> { [ l, L, lcaron, Lcaron ] }; + key <AD10> { [ p, P,ocircumflex, Ocircumflex ] }; + + key <SPCE> { [ space, space, nobreakspace, nobreakspace] }; + + include "level3(ralt_switch)" +}; + // XCompose is out! Unicode combining is in! For those of us who live // on the edge: A keymap using Unicode combining characters instead of // deadkeys. This variation does not deviate from the lame MS-style @@ -1241,7 +1381,7 @@ xkb_symbols "intl-unicode" { // abovedot, caron key <AB09> { [ period, greater, U0307, U030C ] }; // hook - key <AB10> { [ slash, question, questiondown, 0309 ] }; + key <AB10> { [ slash, question, questiondown, U0309 ] }; // alt-intl compatibility // cedilla, caron @@ -1264,8 +1404,7 @@ xkb_symbols "alt-intl-unicode" { name[Group1]= "English (US, international AltGr Unicode combining, alternative)"; - include "extras/us(intl-unicode)" - include "level3(ralt_switch)" + include "us(intl-unicode)" // easier macron; em-dash. // em-dash is available via compose, but I added here since it's such @@ -1335,3 +1474,9 @@ xkb_symbols "crd" { // End alphanumeric section }; + + +partial alphanumeric_keys + xkb_symbols "sun_type6" { + include "sun_vndr/us(sun_type6)" +}; diff --git a/test/data/sync.sh b/test/data/sync.sh new file mode 100755 index 0000000..7f2538a --- /dev/null +++ b/test/data/sync.sh @@ -0,0 +1,63 @@ +#/bin/sh + +XKBCONFIGROOT='/usr/share/X11/xkb' + +if [ ! -d test/data ]; then + echo "Run this from the top source dir" + exit 1 +fi + +for file in \ + symbols/terminate \ + symbols/in \ + symbols/keypad \ + symbols/altwin \ + symbols/ctrl \ + symbols/eurosign \ + symbols/inet \ + symbols/shift \ + symbols/pc \ + symbols/ca \ + symbols/srvr_ctrl \ + symbols/capslock \ + symbols/latin \ + symbols/level5 \ + symbols/us \ + symbols/nbsp \ + symbols/il \ + symbols/group \ + symbols/compose \ + symbols/level3 \ + symbols/ru \ + symbols/rupeesign \ + symbols/kpdl \ + symbols/de \ + keycodes/xfree86 \ + keycodes/aliases \ + keycodes/evdev \ + types/complete \ + types/pc \ + types/basic \ + types/iso9995 \ + types/level5 \ + types/numpad \ + types/extra \ + types/mousekeys \ + compat/complete \ + compat/lednum \ + compat/pc \ + compat/ledscroll \ + compat/basic \ + compat/misc \ + compat/iso9995 \ + compat/accessx \ + compat/xfree86 \ + compat/level5 \ + compat/caps \ + compat/ledcaps \ + compat/mousekeys \ + rules/base \ + rules/evdev \ +; do + cp "$XKBCONFIGROOT/$file" "test/data/$file" +done diff --git a/test/data/types/level5 b/test/data/types/level5 index f9ba5b2..672f0a1 100644 --- a/test/data/types/level5 +++ b/test/data/types/level5 @@ -188,6 +188,7 @@ partial default xkb_types "default" { map[LevelFive] = Level5; map[Shift+LevelFive] = Level6; map[Lock+LevelFive] = Level6; + map[Lock+Shift+LevelFive] = Level6; map[LevelThree+LevelFive] = Level7; map[Shift+LevelThree+LevelFive] = Level8; map[Lock+LevelThree+LevelFive] = Level7; diff --git a/test/data/types/pc b/test/data/types/pc index 01a5634..daebe74 100644 --- a/test/data/types/pc +++ b/test/data/types/pc @@ -59,17 +59,19 @@ partial default xkb_types "default" { }; type "CTRL+ALT" { - modifiers = Control+Alt+Shift+LevelThree; + modifiers = Control+Alt+Shift+LevelThree; map[None] = Level1; map[Shift] = Level2; map[LevelThree] = Level3; map[Shift+LevelThree] = Level4; - map[Control+Alt] = Level5; + map[Control+Alt] = Level5; + preserve[Shift] = Shift; + preserve[Shift+LevelThree] = Shift; level_name[Level1] = "Base"; level_name[Level2] = "Shift"; level_name[Level3] = "Alt Base"; level_name[Level4] = "Shift Alt"; - level_name[Level5] = "Ctrl+Alt"; + level_name[Level5] = "Ctrl+Alt"; }; // Local eight level diff --git a/test/filecomp.c b/test/filecomp.c index 0c1111a..0e41dea 100644 --- a/test/filecomp.c +++ b/test/filecomp.c @@ -38,7 +38,7 @@ test_file(struct xkb_context *ctx, const char *path_rel) int main(void) { - struct xkb_context *ctx = test_get_context(); + struct xkb_context *ctx = test_get_context(0); assert(test_file(ctx, "keymaps/basic.xkb")); assert(test_file(ctx, "keymaps/comprehensive-plus-geom.xkb")); @@ -48,6 +48,15 @@ main(void) assert(!test_file(ctx, "keymaps/bad.xkb")); assert(!test_file(ctx, "does not exist")); + /* Test response to invalid flags and formats. */ + fclose(stdin); + assert(!xkb_keymap_new_from_file(ctx, NULL, XKB_KEYMAP_FORMAT_TEXT_V1, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, 0, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, XKB_KEYMAP_USE_ORIGINAL_FORMAT, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, 1234, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, XKB_KEYMAP_FORMAT_TEXT_V1, -1)); + assert(!xkb_keymap_new_from_file(ctx, stdin, XKB_KEYMAP_FORMAT_TEXT_V1, 1234)); + xkb_context_unref(ctx); return 0; diff --git a/test/interactive.c b/test/interactive.c index 94b14a7..f90f6eb 100644 --- a/test/interactive.c +++ b/test/interactive.c @@ -85,7 +85,8 @@ is_keyboard(int fd) } static int -keyboard_new(struct dirent *ent, struct xkb_keymap *xkb, struct keyboard **out) +keyboard_new(struct dirent *ent, struct xkb_keymap *keymap, + struct keyboard **out) { int ret; char *path; @@ -109,7 +110,7 @@ keyboard_new(struct dirent *ent, struct xkb_keymap *xkb, struct keyboard **out) goto err_fd; } - state = xkb_state_new(xkb); + state = xkb_state_new(keymap); if (!state) { fprintf(stderr, "Couldn't create xkb state for %s\n", path); ret = -EFAULT; @@ -223,7 +224,7 @@ print_keycode(struct keyboard *kbd, xkb_keycode_t keycode) unsigned int nsyms; char s[16]; uint32_t unicode; - xkb_layout_index_t group; + xkb_layout_index_t layout; xkb_mod_index_t mod; xkb_led_index_t led; @@ -255,15 +256,12 @@ print_keycode(struct keyboard *kbd, xkb_keycode_t keycode) printf("] "); #endif - printf("group [ "); - for (group = 0; group < xkb_keymap_num_layouts_for_key(keymap, keycode); - group++) { - if (xkb_state_layout_index_is_active(state, group, - XKB_STATE_LAYOUT_EFFECTIVE) <= 0) - continue; - printf("%s (%d) ", xkb_keymap_layout_get_name(keymap, group), group); - } - printf("] "); + layout = xkb_state_key_get_layout(state, keycode); + printf("layout [ %s (%d) ] ", + xkb_keymap_layout_get_name(keymap, layout), layout); + + printf("level [ %d ] ", + xkb_state_key_get_level(state, keycode, layout)); printf("mods [ "); for (mod = 0; mod < xkb_keymap_num_mods(keymap); mod++) { @@ -499,7 +497,7 @@ main(int argc, char *argv[]) } } - ctx = test_get_context(); + ctx = test_get_context(0); if (!ctx) { ret = -1; fprintf(stderr, "Couldn't create xkb context\n"); diff --git a/test/keyseq.c b/test/keyseq.c index 5aa53a6..57ea496 100644 --- a/test/keyseq.c +++ b/test/keyseq.c @@ -25,113 +25,10 @@ #include "test.h" -enum { - DOWN, - REPEAT, - UP, - BOTH, - NEXT, - FINISH, -}; - -#define EVDEV_OFFSET 8 - -/* - * Test a sequence of keysyms, resulting from a sequence of key presses, - * against the keysyms they're supposed to generate. - * - * - Each test runs with a clean state. - * - Each line in the test is made up of: - * + A keycode, given as a KEY_* from linux/input.h. - * + A direction - DOWN for press, UP for release, BOTH for - * immediate press + release, REPEAT to just get the syms. - * + A sequence of keysyms that should result from this keypress. - * - * The vararg format is: - * <KEY_*> <DOWN | UP | BOTH> <XKB_KEY_* (zero or more)> <NEXT | FINISH> - * - * See below for examples. - */ -static int -test_key_seq(struct xkb_keymap *keymap, ...) -{ - struct xkb_state *state; - - va_list ap; - xkb_keycode_t kc; - int op; - xkb_keysym_t keysym; - - const xkb_keysym_t *syms; - unsigned int nsyms, i; - char ksbuf[64]; - - fprintf(stderr, "----\n"); - - state = xkb_state_new(keymap); - assert(state); - - va_start(ap, keymap); - - for (;;) { - kc = va_arg(ap, int) + EVDEV_OFFSET; - op = va_arg(ap, int); - - nsyms = xkb_state_key_get_syms(state, kc, &syms); - fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, kc); - - if (op == DOWN || op == BOTH) - xkb_state_update_key(state, kc, XKB_KEY_DOWN); - if (op == UP || op == BOTH) - xkb_state_update_key(state, kc, XKB_KEY_UP); - - for (i = 0; i < nsyms; i++) { - keysym = va_arg(ap, int); - xkb_keysym_get_name(syms[i], ksbuf, sizeof(ksbuf)); - fprintf(stderr, "%s%s", (i != 0) ? ", " : "", ksbuf); - - if (keysym == FINISH || keysym == NEXT) { - xkb_keysym_get_name(syms[i], ksbuf, sizeof(ksbuf)); - fprintf(stderr, "Did not expect keysym: %s.\n", ksbuf); - goto fail; - } - - if (keysym != syms[i]) { - xkb_keysym_get_name(keysym, ksbuf, sizeof(ksbuf)); - fprintf(stderr, "Expected keysym: %s. ", ksbuf);; - xkb_keysym_get_name(syms[i], ksbuf, sizeof(ksbuf)); - fprintf(stderr, "Got keysym: %s.\n", ksbuf);; - goto fail; - } - } - - fprintf(stderr, "]\n"); - - keysym = va_arg(ap, int); - if (keysym == NEXT) - continue; - if (keysym == FINISH) - break; - - xkb_keysym_get_name(keysym, ksbuf, sizeof(ksbuf)); - fprintf(stderr, "Expected keysym: %s. Didn't get it.\n", ksbuf); - goto fail; - } - - va_end(ap); - xkb_state_unref(state); - return 1; - -fail: - va_end(ap); - xkb_state_unref(state); - return 0; -} - int main(void) { - struct xkb_context *ctx = test_get_context(); + struct xkb_context *ctx = test_get_context(0); struct xkb_keymap *keymap; assert(ctx); @@ -206,6 +103,35 @@ main(void) KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT, KEY_O, BOTH, XKB_KEY_o, FINISH)); + /* + * Two key presses from the same key (e.g. if two keyboards use the + * same xkb_state) should only be released after two releases. + */ + assert(test_key_seq(keymap, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_LEFTSHIFT, UP, XKB_KEY_Shift_L, NEXT, + KEY_H, BOTH, XKB_KEY_h, FINISH)); + + /* Same as above with locked modifiers. */ + assert(test_key_seq(keymap, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_CAPSLOCK, DOWN, XKB_KEY_Caps_Lock, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_CAPSLOCK, DOWN, XKB_KEY_Caps_Lock, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_CAPSLOCK, UP, XKB_KEY_Caps_Lock, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_CAPSLOCK, UP, XKB_KEY_Caps_Lock, NEXT, + KEY_H, BOTH, XKB_KEY_H, NEXT, + KEY_CAPSLOCK, BOTH, XKB_KEY_Caps_Lock, NEXT, + KEY_H, BOTH, XKB_KEY_h, FINISH)); + /* Group switching / locking. */ assert(test_key_seq(keymap, KEY_H, BOTH, XKB_KEY_h, NEXT, @@ -370,12 +296,11 @@ main(void) /* Level 5. */ KEY_RIGHTALT, DOWN, XKB_KEY_ISO_Level5_Shift, NEXT, - /* - * XXX: This doesn't work, but gives level1 keysyms. - * This does work when when de(neo) is the first layout - * (before us,il etc.). It's like that in the X server - * as well. Investigate. - */ + KEY_5, BOTH, XKB_KEY_periodcentered, NEXT, + KEY_E, BOTH, XKB_KEY_Up, NEXT, + KEY_SPACE, BOTH, XKB_KEY_KP_0, NEXT, + KEY_KP8, BOTH, XKB_KEY_KP_Up, NEXT, + KEY_ESC, BOTH, XKB_KEY_Escape, NEXT, KEY_RIGHTALT, UP, XKB_KEY_ISO_Level5_Shift, NEXT, KEY_V, BOTH, XKB_KEY_p, FINISH)); @@ -421,7 +346,6 @@ main(void) KEY_H, BOTH, XKB_KEY_h, FINISH)); xkb_keymap_unref(keymap); - assert(ctx); keymap = test_compile_rules(ctx, "evdev", "", "us,il,ru", "", "grp:switch,grp:lswitch,grp:menu_toggle"); assert(keymap); @@ -465,6 +389,16 @@ main(void) KEY_H, BOTH, XKB_KEY_h, FINISH)); xkb_keymap_unref(keymap); + keymap = test_compile_file(ctx, "keymaps/unbound-vmod.xkb"); + assert(keymap); + + assert(test_key_seq(keymap, + KEY_H, BOTH, XKB_KEY_h, NEXT, + KEY_Z, BOTH, XKB_KEY_y, NEXT, + KEY_MINUS, BOTH, XKB_KEY_ssharp, NEXT, + KEY_Z, BOTH, XKB_KEY_y, FINISH)); + + xkb_keymap_unref(keymap); xkb_context_unref(ctx); return 0; } diff --git a/test/keysym.c b/test/keysym.c index 8991595..46d70ac 100644 --- a/test/keysym.c +++ b/test/keysym.c @@ -103,6 +103,10 @@ main(void) assert(test_keysym(0x0, "NoSymbol")); assert(test_keysym(0x1008FE20, "XF86Ungrab")); assert(test_keysym(0x01001234, "U1234")); + /* 16-bit unicode padded to width 4. */ + assert(test_keysym(0x010002DE, "U02DE")); + /* 32-bit unicode padded to width 8. */ + assert(test_keysym(0x0101F4A9, "U0001F4A9")); assert(test_casestring("Undo", 0xFF65)); assert(test_casestring("UNDO", 0xFF65)); @@ -74,7 +74,7 @@ main(void) assert(ret == 0); ret = setenv("XKB_LOG_VERBOSITY", "5", 1); assert(ret == 0); - ctx = xkb_context_new(0); + ctx = test_get_context(0); assert(ctx); darray_init(log_string); diff --git a/test/print-compiled-keymap.c b/test/print-compiled-keymap.c index 0e14205..7e57fdd 100644 --- a/test/print-compiled-keymap.c +++ b/test/print-compiled-keymap.c @@ -71,7 +71,7 @@ main(int argc, char *argv[]) } } - ctx = test_get_context(); + ctx = test_get_context(0); if (!ctx) { fprintf(stderr, "Couldn't create xkb context\n"); goto err_out; diff --git a/test/rmlvo-to-kccgst.c b/test/rmlvo-to-kccgst.c index 338cbb8..bab725d 100644 --- a/test/rmlvo-to-kccgst.c +++ b/test/rmlvo-to-kccgst.c @@ -61,14 +61,7 @@ main(int argc, char *argv[]) } } - if (isempty(rmlvo.rules)) - rmlvo.rules = DEFAULT_XKB_RULES; - if (isempty(rmlvo.model)) - rmlvo.model = DEFAULT_XKB_MODEL; - if (isempty(rmlvo.layout)) - rmlvo.layout = DEFAULT_XKB_LAYOUT; - - ctx = test_get_context(); + ctx = test_get_context(0); if (!ctx) { fprintf(stderr, "Failed to get xkb context\n"); return 1; @@ -81,5 +74,11 @@ main(int argc, char *argv[]) printf("types: %s\n", kccgst.types); printf("compat: %s\n", kccgst.compat); printf("symbols: %s\n", kccgst.symbols); + + free(kccgst.keycodes); + free(kccgst.types); + free(kccgst.compat); + free(kccgst.symbols); + xkb_context_unref(ctx); return 0; } diff --git a/test/rules-file.c b/test/rules-file.c index b3b3b6c..da14e3a 100644 --- a/test/rules-file.c +++ b/test/rules-file.c @@ -132,7 +132,7 @@ main(int argc, char *argv[]) { struct xkb_context *ctx; - ctx = test_get_context(); + ctx = test_get_context(0); assert(ctx); if (argc > 1 && streq(argv[1], "bench")) { diff --git a/test/rulescomp.c b/test/rulescomp.c index 7318f75..97b4315 100644 --- a/test/rulescomp.c +++ b/test/rulescomp.c @@ -21,6 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ +#include <linux/input.h> #include <time.h> #include "test.h" @@ -28,22 +29,42 @@ #define BENCHMARK_ITERATIONS 1000 static int -test_rmlvo(struct xkb_context *context, const char *rules, - const char *model, const char *layout, - const char *variant, const char *options) +test_rmlvo_va(struct xkb_context *context, const char *rules, + const char *model, const char *layout, + const char *variant, const char *options, va_list ap) { struct xkb_keymap *keymap; + int ret; keymap = test_compile_rules(context, rules, model, layout, variant, options); - if (keymap) { - fprintf(stderr, "Compiled '%s' '%s' '%s' '%s' '%s'\n", - strnull(rules), strnull(model), strnull(layout), - strnull(variant), strnull(options)); - xkb_keymap_unref(keymap); - } + if (!keymap) + return 0; - return keymap != NULL; + fprintf(stderr, "Compiled '%s' '%s' '%s' '%s' '%s'\n", + strnull(rules), strnull(model), strnull(layout), + strnull(variant), strnull(options)); + + ret = test_key_seq_va(keymap, ap); + + xkb_keymap_unref(keymap); + + return ret; +} + +static int +test_rmlvo(struct xkb_context *context, const char *rules, + const char *model, const char *layout, const char *variant, + const char *options, ...) +{ + va_list ap; + int ret; + + va_start(ap, options); + ret = test_rmlvo_va(context, rules, model, layout, variant, options, ap); + va_end(ap); + + return ret; } static int @@ -61,6 +82,48 @@ test_rmlvo_silent(struct xkb_context *context, const char *rules, return keymap != NULL; } +static int +test_rmlvo_env(struct xkb_context *ctx, const char *rules, const char *model, + const char *layout, const char *variant, const char *options, + ...) +{ + va_list ap; + int ret; + + va_start (ap, options); + + if (!isempty(rules)) + setenv("XKB_DEFAULT_RULES", rules, 1); + else + unsetenv("XKB_DEFAULT_RULES"); + + if (!isempty(model)) + setenv("XKB_DEFAULT_MODEL", model, 1); + else + unsetenv("XKB_DEFAULT_MODEL"); + + if (!isempty(layout)) + setenv("XKB_DEFAULT_LAYOUT", layout, 1); + else + unsetenv("XKB_DEFAULT_LAYOUT"); + + if (!isempty(variant)) + setenv("XKB_DEFAULT_VARIANT", variant, 1); + else + unsetenv("XKB_DEFAULT_VARIANT"); + + if (!isempty(options)) + setenv("XKB_DEFAULT_OPTIONS", options, 1); + else + unsetenv("XKB_DEFAULT_OPTIONS"); + + ret = test_rmlvo_va(ctx, NULL, NULL, NULL, NULL, NULL, ap); + + va_end(ap); + + return ret; +} + static void benchmark(struct xkb_context *context) { @@ -91,9 +154,10 @@ benchmark(struct xkb_context *context) BENCHMARK_ITERATIONS, elapsed.tv_sec, elapsed.tv_nsec); } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - struct xkb_context *ctx = test_get_context(); + struct xkb_context *ctx = test_get_context(CONTEXT_ALLOW_ENVIRONMENT_NAMES); assert(ctx); @@ -102,21 +166,83 @@ int main(int argc, char *argv[]) return 0; } - assert(test_rmlvo(ctx, "evdev", "pc105", "us,il,ru,ca", ",,,multix", "grp:alts_toggle,ctrl:nocaps,compose:rwin")); - assert(test_rmlvo(ctx, "base", "pc105", "us,in", "", "")); - assert(test_rmlvo(ctx, "evdev", "pc105", "us", "intl", "")); - assert(test_rmlvo(ctx, "evdev", "evdev", "us", "intl", "grp:alts_toggle")); +#define KS(name) xkb_keysym_from_name(name, 0) + + assert(test_rmlvo(ctx, "evdev", "pc105", "us,il,ru,ca", ",,,multix", "grp:alts_toggle,ctrl:nocaps,compose:rwin", + KEY_Q, BOTH, XKB_KEY_q, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Alt_L, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_ISO_Next_Group, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Alt_L, NEXT, + KEY_Q, BOTH, XKB_KEY_slash, NEXT, + KEY_LEFTSHIFT, DOWN, XKB_KEY_Shift_L, NEXT, + KEY_Q, BOTH, XKB_KEY_Q, NEXT, + KEY_RIGHTMETA, BOTH, XKB_KEY_Multi_key, FINISH)); + assert(test_rmlvo(ctx, "evdev", "pc105", "us,in", "", "grp:alts_toggle", + KEY_A, BOTH, XKB_KEY_a, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Alt_L, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_ISO_Next_Group, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Alt_L, NEXT, + KEY_A, BOTH, KS("U094b"), FINISH)); + assert(test_rmlvo(ctx, "evdev", "pc105", "us", "intl", "", + KEY_GRAVE, BOTH, XKB_KEY_dead_grave, FINISH)); + assert(test_rmlvo(ctx, "evdev", "evdev", "us", "intl", "grp:alts_toggle", + KEY_GRAVE, BOTH, XKB_KEY_dead_grave, FINISH)); /* 20 is not a legal group; make sure this is handled gracefully. */ - assert(test_rmlvo(ctx, "evdev", "", "us:20", "", "")); + assert(test_rmlvo(ctx, "evdev", "", "us:20", "", "", + KEY_A, BOTH, XKB_KEY_a, FINISH)); + + /* Don't choke on missing values in RMLVO. Should just skip them. + Currently generates us,us,ca. */ + assert(test_rmlvo(ctx, "evdev", "", "us,,ca", "", "grp:alts_toggle", + KEY_A, BOTH, XKB_KEY_a, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Alt_L, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_ISO_Next_Group, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Next_Group, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Alt_L, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Alt_L, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_ISO_Next_Group, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Alt_L, NEXT, + KEY_APOSTROPHE, BOTH, XKB_KEY_dead_grave, FINISH)); + + assert(test_rmlvo(ctx, "", "", "", "", "", + KEY_A, BOTH, XKB_KEY_a, FINISH)); + + assert(!test_rmlvo(ctx, "does-not-exist", "", "", "", "", + KEY_A, BOTH, XKB_KEY_a, FINISH)); + + assert(test_rmlvo_env(ctx, "evdev", "", "us", "", "", + KEY_A, BOTH, XKB_KEY_a, FINISH)); + assert(test_rmlvo_env(ctx, "evdev", "", "us", "", "ctrl:nocaps", + KEY_CAPSLOCK, BOTH, XKB_KEY_Control_L, FINISH)); + + /* Ignores multix and generates us,ca. */ + assert(test_rmlvo_env(ctx, "evdev", "", "us,ca", ",,,multix", "grp:alts_toggle", + KEY_A, BOTH, XKB_KEY_a, NEXT, + KEY_LEFTALT, DOWN, XKB_KEY_Alt_L, NEXT, + KEY_RIGHTALT, DOWN, XKB_KEY_ISO_Next_Group, NEXT, + KEY_RIGHTALT, UP, XKB_KEY_ISO_Level3_Shift, NEXT, + KEY_LEFTALT, UP, XKB_KEY_Alt_L, NEXT, + KEY_GRAVE, UP, XKB_KEY_numbersign, FINISH)); + + assert(!test_rmlvo_env(ctx, "broken", "what-on-earth", "invalid", "", "", + KEY_A, BOTH, XKB_KEY_a, FINISH)); - /* Don't choke on missing values in RMLVO. Should just skip them. */ - assert(test_rmlvo(ctx, "evdev", "", "us,,ca", "", "")); + xkb_context_unref(ctx); - assert(test_rmlvo(ctx, "", "", "", "", "")); - assert(test_rmlvo(ctx, NULL, NULL, NULL, NULL, NULL)); + ctx = test_get_context(0); + assert(test_rmlvo_env(ctx, "broken", "but", "ignored", "per", "ctx flags", + KEY_A, BOTH, XKB_KEY_a, FINISH)); - assert(!test_rmlvo(ctx, "does-not-exist", "", "", "", "")); + /* Test response to invalid flags. */ + { + struct xkb_rule_names rmlvo = { NULL }; + assert(!xkb_keymap_new_from_names(ctx, &rmlvo, -1)); + assert(!xkb_keymap_new_from_names(ctx, &rmlvo, 5453)); + } xkb_context_unref(ctx); } diff --git a/test/state.c b/test/state.c index 83a8f45..34da201 100644 --- a/test/state.c +++ b/test/state.c @@ -334,7 +334,7 @@ test_consume(struct xkb_keymap *keymap) int main(void) { - struct xkb_context *context = test_get_context(); + struct xkb_context *context = test_get_context(0); struct xkb_keymap *keymap; assert(context); diff --git a/test/stringcomp.c b/test/stringcomp.c index 7d13340..3aefba9 100644 --- a/test/stringcomp.c +++ b/test/stringcomp.c @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) { - struct xkb_context *ctx = test_get_context(); + struct xkb_context *ctx = test_get_context(0); struct xkb_keymap *keymap; char *original, *dump; @@ -81,6 +81,16 @@ main(int argc, char *argv[]) xkb_keymap_unref(keymap); keymap = test_compile_string(ctx, dump); assert(keymap); + + /* Test response to invalid formats and flags. */ + assert(!xkb_keymap_new_from_string(ctx, dump, 0, 0)); + assert(!xkb_keymap_new_from_string(ctx, dump, -1, 0)); + assert(!xkb_keymap_new_from_string(ctx, dump, XKB_KEYMAP_FORMAT_TEXT_V1+1, 0)); + assert(!xkb_keymap_new_from_string(ctx, dump, XKB_KEYMAP_FORMAT_TEXT_V1, -1)); + assert(!xkb_keymap_new_from_string(ctx, dump, XKB_KEYMAP_FORMAT_TEXT_V1, 1414)); + assert(!xkb_keymap_get_as_string(keymap, 0)); + assert(!xkb_keymap_get_as_string(keymap, 4893)); + xkb_keymap_unref(keymap); free(dump); diff --git a/test/test.h b/test/test.h index 046b64e..804606e 100644 --- a/test/test.h +++ b/test/test.h @@ -25,19 +25,43 @@ #include <assert.h> - /* Don't use compat names in internal code. */ +/* Don't use compat names in internal code. */ #define _XKBCOMMON_COMPAT_H #include "xkbcommon/xkbcommon.h" #include "utils.h" +/* The offset between KEY_* numbering, and keycodes in the XKB evdev + * dataset. */ +#define EVDEV_OFFSET 8 + +enum key_seq_state { + DOWN, + REPEAT, + UP, + BOTH, + NEXT, + FINISH, +}; + +int +test_key_seq(struct xkb_keymap *keymap, ...); + +int +test_key_seq_va(struct xkb_keymap *keymap, va_list args); + const char * test_get_path(const char *path_rel); char * test_read_file(const char *path_rel); +enum test_context_flags { + CONTEXT_NO_FLAG = 0, + CONTEXT_ALLOW_ENVIRONMENT_NAMES = (1 << 0), +}; + struct xkb_context * -test_get_context(void); +test_get_context(enum test_context_flags flags); struct xkb_keymap * test_compile_file(struct xkb_context *context, const char *path_rel); @@ -46,6 +70,9 @@ struct xkb_keymap * test_compile_string(struct xkb_context *context, const char *string); struct xkb_keymap * +test_compile_buffer(struct xkb_context *context, const char *buf, size_t len); + +struct xkb_keymap * test_compile_rules(struct xkb_context *context, const char *rules, const char *model, const char *layout, const char *variant, const char *options); diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h index 244b35b..a2aecfb 100644 --- a/xkbcommon/xkbcommon.h +++ b/xkbcommon/xkbcommon.h @@ -103,11 +103,10 @@ extern "C" { * * The context contains various general library data and state, like * logging level and include paths. + * * Objects are created in a specific context, and multiple contexts may - * coexist simultaneously. Objects from different contexts are completely + * coexist simultaneously. Objects from different contexts are completely * separated and do not share any memory or state. - * A context is created, accessed, manipulated and destroyed through the - * xkb_context_*() API. */ struct xkb_context; @@ -120,9 +119,6 @@ struct xkb_context; * * A keymap is immutable after it is created (besides reference counts, etc.); * if you need to change it, you must create a new one. - * - * A keymap object is created, accessed and destroyed through the - * xkb_keymap_*() API. */ struct xkb_keymap; @@ -131,12 +127,9 @@ struct xkb_keymap; * Opaque keyboard state object. * * State objects contain the active state of a keyboard (or keyboards), such - * as the currently effective layout and the active modifiers. It acts as a + * as the currently effective layout and the active modifiers. It acts as a * simple state machine, wherein key presses and releases are the input, and * key symbols (keysyms) are the output. - * - * A state object is created, accessed, manipulated and destroyed through the - * xkb_state_*() API. */ struct xkb_state; @@ -155,15 +148,20 @@ struct xkb_state; * Keymaps and applications which are compatible with X11 should not use * these keycodes. * - * @todo Explain how keycodes are mapped to scancodes. + * The values of specific keycodes are determined by the keymap and the + * underlying input system. For example, with an X11-compatible keymap + * and Linux evdev scan codes (see linux/input.h), a fixed offset is used: + * + * @code + * xkb_keycode_t keycode_A = KEY_A + 8; + * @endcode * * @sa xkb_keycode_is_legal_ext() xkb_keycode_is_legal_x11() */ typedef uint32_t xkb_keycode_t; /** - * A number used to represent the symbols visible on the keycaps of a - * keyboard. + * A number used to represent the symbols generated from a key on a keyboard. * * A key, represented by a keycode, may generate different symbols according * to keyboard state. For example, on a QWERTY keyboard, pressing the key @@ -183,7 +181,7 @@ typedef uint32_t xkb_keycode_t; * * Besides those, any Unicode/ISO 10646 character in the range U0100 to * U10FFFF can be represented by a keysym value in the range 0x01000100 to - * 0x0110FFFF. The name of Unicode keysyms is "U<codepoint>", e.g. "Ua1b2". + * 0x0110FFFF. The name of Unicode keysyms is "U<codepoint>", e.g. "UA1B2". * * The name of other unnamed keysyms is the hexadecimal representation of * their value, e.g. "0xabcd1234". @@ -193,31 +191,16 @@ typedef uint32_t xkb_keycode_t; typedef uint32_t xkb_keysym_t; /** - * Index of a modifier. - * - * @todo Explain what are modifiers. - * - * Modifier indexes are consecutive. The first modifier has index 0. - * - * Each modifier must have a name, and the names are unique. Therefore, it - * is safe to use the name as a unique identifier for a modifier. Modifier - * names are case-sensitive. - * - * @sa xkb_keymap_num_mods() - */ -typedef uint32_t xkb_mod_index_t; -/** A mask of modifier indexes. */ -typedef uint32_t xkb_mod_mask_t; - -/** * Index of a keyboard layout. * - * @todo Explain what are layouts. + * The layout index is a state component which detemines which <em>keyboard + * layout</em> is active. These may be different alphabets, different key + * arrangements, etc. * * Layout indexes are consecutive. The first layout has index 0. * * Each layout is not required to have a name, and the names are not - * guarenteed to be unique (though they are usually provided and unique). + * guaranteed to be unique (though they are usually provided and unique). * Therefore, it is not safe to use the name as a unique identifier for a * layout. Layout names are case-sensitive. * @@ -237,16 +220,43 @@ typedef uint32_t xkb_layout_mask_t; typedef uint32_t xkb_level_index_t; /** + * Index of a modifier. + * + * A @e modifier is a state component which changes the way keys are + * interpreted. A keymap defines a set of modifiers, such as Alt, Shift, + * Num Lock or Meta, and specifies which keys may @e activate which + * modifiers (in a many-to-many relationship, i.e. a key can activate + * several modifiers, and a modifier may be activated by several keys. + * Different keymaps do this differently). + * + * When retrieving the keysyms for a key, the active modifier set is + * consulted; this detemines the correct shift level to use within the + * currently active layout (see xkb_level_index_t). + * + * Modifier indexes are consecutive. The first modifier has index 0. + * + * Each modifier must have a name, and the names are unique. Therefore, it + * is safe to use the name as a unique identifier for a modifier. The names + * of some common modifiers are provided in the xkbcommon/xkbcommon-names.h + * header file. Modifier names are case-sensitive. + * + * @sa xkb_keymap_num_mods() + */ +typedef uint32_t xkb_mod_index_t; +/** A mask of modifier indexes. */ +typedef uint32_t xkb_mod_mask_t; + +/** * Index of a keyboard LED. * * @todo Explain what are LEDs. * * LED indexes are non-consecutive. The first LED has index 0. * - * LED names are case-sensitive. - * * Each LED must have a name, and the names are unique. Therefore, - * it is safe to use the name as a unique identifier for a LED. + * it is safe to use the name as a unique identifier for a LED. The names + * of some common LEDs are provided in the xkbcommon/xkbcommon-names.h + * header file. LED names are case-sensitive. * * @warning A given keymap may specify an exact index for a given LED. * Therefore, LED indexing is not necessarily sequential, as opposed to @@ -263,10 +273,10 @@ typedef uint32_t xkb_led_index_t; /** A mask of LED indexes. */ typedef uint32_t xkb_led_mask_t; -#define XKB_MOD_INVALID (0xffffffff) -#define XKB_LAYOUT_INVALID (0xffffffff) #define XKB_KEYCODE_INVALID (0xffffffff) +#define XKB_LAYOUT_INVALID (0xffffffff) #define XKB_LEVEL_INVALID (0xffffffff) +#define XKB_MOD_INVALID (0xffffffff) #define XKB_LED_INVALID (0xffffffff) #define XKB_KEYCODE_MAX (0xffffffff - 1) @@ -297,13 +307,13 @@ struct xkb_rule_names { const char *rules; /** The keyboard model by which to interpret keycodes and LEDs. */ const char *model; - /** A comma seperated list of layouts (languages) to include in the + /** A comma separated list of layouts (languages) to include in the * keymap. */ const char *layout; - /** A comma seperated list of variants, one per layout, which may + /** A comma separated list of variants, one per layout, which may * modify or augment the respective layout in various ways. */ const char *variant; - /** A comma seprated list of options, through which the user specifies + /** A comma separated list of options, through which the user specifies * non-layout related preferences, like which key combinations are used * for switching layouts, or which key is the Compose key. */ const char *options; @@ -331,7 +341,7 @@ struct xkb_rule_names { * @returns The number of bytes in the name, excluding the NUL byte. If * the keysym is invalid, returns -1. * - * You may check if truncation has occured by comparing the return value + * You may check if truncation has occurred by comparing the return value * with the length of buffer, similarly to the snprintf(3) function. * * @sa xkb_keysym_t @@ -407,7 +417,9 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym); /** Flags for context creation. */ enum xkb_context_flags { /** Create this context with an empty include path. */ - XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0) + XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0), + /** Don't take RMLVO names from the environment. */ + XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1), }; /** @@ -449,7 +461,7 @@ xkb_context_unref(struct xkb_context *context); /** * Store custom user data in the context. * - * This may be useful in conjuction with xkb_context_set_log_fn() or other + * This may be useful in conjunction with xkb_context_set_log_fn() or other * callbacks. * * @memberof xkb_context @@ -629,8 +641,8 @@ xkb_context_get_log_verbosity(struct xkb_context *context); * function allows you to replace the default behavior with a custom * handler. The handler is only called with messages which match the * current logging level and verbosity settings for the context. - * level is the logging level of the message. format and args are the - * same as in the vprintf(3) function. + * level is the logging level of the message. @a format and @a args are + * the same as in the vprintf(3) function. * * You may use xkb_context_set_user_data() on the context, and then call * xkb_context_get_user_data() from within the logging function to provide @@ -669,7 +681,9 @@ enum xkb_keymap_compile_flags { * keymaps. * * @param context The context in which to create the keymap. - * @param names The RMLVO names to use. + * @param names The RMLVO names to use. In xkbcommon versions prior + * to 0.2.1, this field must be non-NULL. In later + * versions, passing NULL will use the default keymap. * @param flags Optional flags for the keymap, or 0. * * @returns A keymap compiled according to the RMLVO names, or NULL if @@ -683,7 +697,7 @@ xkb_keymap_new_from_names(struct xkb_context *context, const struct xkb_rule_names *names, enum xkb_keymap_compile_flags flags); -/** The possible keymap text formats. */ +/** The possible keymap formats. */ enum xkb_keymap_format { /** The current/classic XKB text format, as generated by xkbcomp -xkb. */ XKB_KEYMAP_FORMAT_TEXT_V1 = 1 @@ -727,6 +741,20 @@ xkb_keymap_new_from_string(struct xkb_context *context, const char *string, enum xkb_keymap_compile_flags flags); /** + * Create a keymap from a memory buffer. + * + * This is just like xkb_keymap_new_from_string(), but takes a length argument + * so the input string does not have to be zero-terminated. + * + * @see xkb_keymap_new_from_string() + * @memberof xkb_keymap + */ +struct xkb_keymap * +xkb_keymap_new_from_buffer(struct xkb_context *context, const char *buffer, + size_t length, enum xkb_keymap_format format, + enum xkb_keymap_compile_flags flags); + +/** * Take a new reference on a keymap. * * @returns The passed in keymap. @@ -1082,7 +1110,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key, * * @param[in] state The keyboard state object. * @param[in] key The keycode of the key. - * @param[out] syms_out An immutible array of keysyms corresponding the + * @param[out] syms_out An immutable array of keysyms corresponding the * key in the given keyboard state. * * As an extension to XKB, this function can return more than one keysym. @@ -1178,7 +1206,7 @@ enum xkb_state_match { /** * Update a keyboard state from a set of explicit masks. * - * This entrypoint is really only for window systems and the like, where a + * This entry point is really only for window systems and the like, where a * master process holds an xkb_state, then serializes it over a wire * protocol, and clients then use the serialization to feed in to their own * xkb_state. @@ -1196,6 +1224,8 @@ enum xkb_state_match { * the update. If nothing in the state has changed, returns 0. * * @memberof xkb_state + * + * @sa xkb_state_component */ enum xkb_state_component xkb_state_update_mask(struct xkb_state *state, @@ -1332,7 +1362,7 @@ xkb_state_mod_indices_are_active(struct xkb_state *state, * Num Lock modifier does not affect this translation at all, even if it * active, so it is not consumed by this translation. * - * It may be desireable for some application to not reuse consumed modifiers + * It may be desirable for some application to not reuse consumed modifiers * for further processing, e.g. for hotkeys or keyboard shortcuts. To * understand why, consider some requirements from a standard shortcut * mechanism, and how they are implemented: |