Commit Graph

65 Commits (20329baf4d0571fbb4eaed6edd85108a0c94d503)

Author SHA1 Message Date
Pierre Le Marre 79502700a6 Doc: fix malformed links and some typos 2023-11-14 10:33:31 +01:00
Pierre Le Marre 00e3058e7b Prevent recursive includes of keymap components
- Add check for recursive includes of keymap components. It relies on
  limiting the include depth. The threshold is currently to 15, which
  seems reasonable with plenty of margin for keymaps in the wild.
- Add corresponding new log message `recursive-include`.
- Add tests for recursive includes.
2023-11-06 22:06:25 +01:00
Pierre Le Marre 171e0170c2 Fix memory leak in FindFileInXkbPath
The string `buf` was not freed after each call to `asprintf_safe`.

Avoid allocating and introduce the new message: `XKB_ERROR_INSUFFICIENT_BUFFER_SIZE`.
2023-11-06 21:44:41 +01:00
Pierre Le Marre ca7aa69cc0 Disallow producing NULL character with escape sequences
NULL usually terminates the strings; allowing to produce it via escape
sequences may lead to undefined behaviour.

- Make NULL escape sequences (e.g. `\0` and `\x0`) invalid.
- Add corresponding test.
- Introduce the new message: XKB_WARNING_INVALID_ESCAPE_SEQUENCE.
2023-09-26 17:25:49 +02:00
Pierre Le Marre a83d745b62 Messages: add new messages to registry
This commit is another step to identify and document the maximum number
of logging messages. Bulk changes:

- Rename `conflicting-key-type` to `conflicting-key-type-merging-groups`.
  Giving more context in the name allow us to introduce
  `conflicting-key-type-definitions` later.
- Add conflicting-key-type-definitions
- Add conflicting-key-type-map-entry
- Add undeclared-modifiers-in-key-type
  Also improve the log messages.
- Add conflicting-key-type-preserve-entries
- Use XKB_ERROR_UNSUPPORTED_MODIFIER_MASK
- Add illegal-key-type-preserve-result
- Add conflicting-key-type-level-names
- Add duplicate-entry
- Add unsupported-symbols-field
- Add missing-symbols-group-name-index
- Use XKB_ERROR_WRONG_FIELD_TYPE
- Add conflicting-key-name
- Use XKB_WARNING_UNDEFINED_KEYCODE
- Add illegal-keycode-alias
- Add unsupported-geometry-section
- Add missing-default-section
- Add XKB_LOG_MESSAGE_NO_ID
- Rename log_vrb_with_code to log_vrb
- Use ERROR_WRONG_FIELD_TYPE & ERROR_INVALID_SYNTAX
- Add unknown-identifier
- Add invalid-expression-type
- Add invalid-operation + fixes
- Add unknown-operator
- Rename ERROR_UNKNOWN_IDENTIFIER to ERROR_INVALID_IDENTIFIER
- Add undeclared-virtual-modifier
- Add expected-array-entry
- Add invalid-include-statement
- Add included-file-not-found
- Add allocation-error
- Add invalid-included-file
- Process symbols.c
- Add invalid-value
- Add invalid-real-modifier
- Add unknown-field
- Add wrong-scope
- Add invalid-modmap-entry
- Add wrong-statement-type
- Add conflicting-key-symbols-entry
- Add invalid-set-default-statement
2023-09-24 09:09:24 +02:00
Pierre Le Marre eafd3aceca Add a new warning for numeric keysyms
Usually it is better to use the corresponding human-friendly keysym
names. If there is none, then the keysym is most probably not
supported in the ecosystem. The only use case I see is similar to the
PUA in Unicode (see: https://en.wikipedia.org/wiki/Private_Use_Areas).
I am not aware of examples of this kind of use.
2023-09-19 08:49:52 +02:00
Pierre Le Marre ef81d04eef Structured log messages with a message registry
Currently there is little structure in the log messages, making
difficult to use them for the following use cases:

- A user looking for help about a log message: the user probably
  uses a search engine, thus the results will depend on the proper
  indexing of our documentation and the various forums. It relies
  only on the wording of the message, which may change with time.
- A user wants to filter the logs resulting of the use of one of the
  components of xkbcommon. A typical example would be testing
  xkeyboard-config against libxkbcommon. It requires the use of a
  pattern (simple words detection or regex). The issue is that the
  pattern may become silently out-of-sync with xkbcommon.

A common practice (e.g. in compilers) is to assign unique error codes
to reference theses messages, along with an error index for
documentation.

Thus this commit implements the following features:

- Create a message registry (message-registry.yaml) that defines the
  log messages produced by xkbcommon. This is a simple YAML file that
  provides, for each message:

  - A unique numeric code as a short identifier. It is used in the
    output message and thus can be easily be filtered to spot errors
    or searched in the internet. It must not change: if the
    semantics of message changes, it is better to introduce a new
    message for clarity.
  - A unique text identifier, meant for two uses:

    1. Generate constants dealing with log information in our code
       base.
    2. Generate human-friendly names for the documentation.

  - A type: currently warning or error. Used to prefix the constants
    (see hereinabove) and for basic classification in documentation.
  - A short description, used as concise and mandatory documentation.
  - An optionnal detailed description.
  - Optional examples, intended to help the user to fix issues
    themself.
  - Version of xkbcommon it was added. For old entries this often
    unknown, so they will default to 1.0.0.
  - Version of xkbcommon it was removed (optional)

  No entry should ever be deleted from this index, even if the message
  is not used anymore: it ensures we have unique identifiers along the
  history of xkbcommon, and that users can refer to the documentation
  even for older versions.

- Add the script update-message-registry.py to generate the following
  files:

  - messages.h: message code enumeration for the messages currently
    used in the code base. Currently a private API.
  - message.registry.md: the error index documentation page.

- Modify the logging functions to use structured messages. This is a
  work in progress.
2023-09-19 08:49:52 +02:00
Ran Benita c1b6c79aba doc: fix some Doxygen warnings
```
libxkbcommon/doc/introduction-to-xkb.md:67: warning: unable to resolve reference to 'rule-file-format' for \ref command
libxkbcommon/doc/introduction-to-xkb.md:181: warning: unable to resolve reference to 'keymap-text-format-v1' for \ref command
libxkbcommon/doc/rules-format.md:10: warning: unable to resolve reference to 'xkb-intro' for \ref command
```

Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-08-05 22:29:56 +03:00
Wismill 64aaa7cda2
Add support for stable doc URLs (#342)
Doc URLs may change with time because they depend on Doxygen machinery.
This is unfortunate because it is good practice to keep valid URLs
(see: https://www.w3.org/Provider/Style/URI.html).

I could not find a built-in solution in Doxygen, so the solution proposed
here is to maintain a registry of all URLs and manage legacy URLs as
redirections to their canonical page.

This commit adds a registry of URLs that has three functions:
- Check no previous URL is now invalid.
- Add aliases for moved pages.
- Generate redirection pages for aliases. The redirection works with
  a simple <meta http-equiv="refresh"> HTML tag. See:
  https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#http-equiv

This commit also initialize the URLs registry with current pages and some
redirections needed after recent documentation refactoring.

Finally, the CI is updated to catch any change that invalidate previous
URLs.
2023-05-14 15:11:15 +02:00
Pierre Le Marre fc664cf1cc Improve documentation
- Add introduction to XKB
- Embrace Doxygen features
- More cross links
2023-05-13 22:05:23 +03:00
Ran Benita e422601121 Use consistent indentation for map and CSS files
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-05-04 11:58:48 +03:00
Wismill 0e9c2ec97e
Improve the doc of the XKB keymap text format, V1 (#321)
- Add table of contents
- Add terminology section
- (WIP) Add Introduction to the format
- Improve the keycode section
- Improve the interpret section
- Add guide to create and use modifiers
- (WIP) Add actions documentation
- Add cross-references
- Add keysyms header to documentation
2023-04-30 22:30:36 +03:00
Ran Benita 09ac27f744 ignore: remove no longer relevant gitignore files
These were relevant for the autoconf build but now we're meson only.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-05-22 19:51:02 +03:00
Jouke Witteveen 8b603dbe11 doc: fix user-configuration sample file
Support copy-pasting from the docs to get something functional.

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
2021-04-11 10:25:56 +03:00
Ran Benita 83e3a53ddc doc: add keymap-format-text-v1.md to the HTML documentation
It's incomplete but might be helpful for someone.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2021-02-27 22:38:21 +02:00
Ran Benita 44df69c928 doc/keymap: some slight editing
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-12-27 09:49:20 +02:00
Simon Zeni 7420521ff4
doc/keymap: add documentation for xkb_symbols (#205) 2020-12-27 09:48:39 +02:00
Peter Hutterer ae90a6a0a9 doc: add some disclaimer regarding user-specific key types and compat entries
It's a niche use-case but basically the same as adding symbols, so let's go with
a general handwavy explanation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Peter Hutterer d7b39f6ffb Add /etc/xkb as extra lookup path for system data files
This completes the usual triplet of configuration locations available for most
processes:
- vendor-provided data files in /usr/share/X11/xkb
- system-specific data files in /etc/xkb
- user-specific data files in $XDG_CONFIG_HOME/xkb

The default lookup order user, system, vendor, just like everything else that
uses these conventions.

For include directives in rules files, the '%E' resolves to that path.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-30 21:49:41 +03:00
Ran Benita 81842f7fbb doc: ignore rxkb, RXBK prefixes in doxygen
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 17:21:46 +03:00
Peter Hutterer afb26e7df9 Add libxkbregistry to query available RMLVO
This library is the replacement for clients parsing evdev.xml directly.
Instead, they should use the API here so that in the future we may even
be able to swap evdev.xml for a more suitable data format.

The library parses through evdev.xml (using libxml2) and - if requested -
through evdev.extras.xml as well. The merge approach is optimised for
the default case where we have a system-installed rules XML and another file in
$XDG_CONFIG_DIR that adds a few entries.  We load the system file first, then
append any custom ones to that. It's not possible to overwrite the MLVO list
provided by the system files - if you want to do that, get the change upstream.

XML validation is handled through the DTD itself which means we only need to
check for a nonempty name, everything else the DTD validation should complain
about.

The logging system is effectively identical to xkbcommon.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-06 15:15:20 +10:00
Peter Hutterer 3adbe54eac tools: move the remaining tools from test to here
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25 10:32:08 +10:00
Peter Hutterer 4e544e2792 doc: correct the include path list
XKB_CONFIG_ROOT (if defined) replaces the built-in system directories.

Fixes 5fb2c6769b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-16 11:26:49 +03:00
Peter Hutterer 5fb2c6769b doc: add documentation for user configuration
Most of this is currently hidden in the commit message for ca033a29d2, let's
make it a bit more public so we have a link to point users to.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-15 07:32:10 +03:00
Peter Hutterer a26578742c doc: add the rules-format file (as markdown)
Useful to have this as part of the documentation. The rendering isn't great but
at least not any worse than pure text. Markdown escapes % so explaining our use
of %S and %H would require a double % - not idea. Let's just wrap it as a code
block and done.

Includes two typo fixes too, yay.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-15 07:32:10 +03:00
Ran Benita 517464eb7a doc/rules-format.txt: document include support
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-01-18 23:06:58 +02:00
Ran Benita 41bea9ab2b build: make doxygen run from the source tree
I couldn't find any other way to make this work!

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-08-01 23:32:15 +03:00
Ran Benita 4983dbcf43 build: change doxygen target to be properly dependency-based
This hackery (thanks libinput) is clearer and more precise than the
previous hackery.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-07-31 15:55:48 +03:00
Ran Benita 148aec8bdf doc/compat: correct the XKB protocol version from 1.1 to 1.0
There is no XKB 1.1!

Thanks to Oded Arbel for catching this.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-04-29 15:26:38 +03:00
Ran Benita 599fd9ba39 doc/compat: (! MODIFIER) syntax is parsed but ignored
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-01 21:23:23 +03:00
Ran Benita c29afcc346 doc/compat.md: xkbcomp ignores multiple-keysyms these days
https://cgit.freedesktop.org/xorg/app/xkbcomp/commit/?id=e119cbec7e750ffc4d4bd08b577db2c697035a30

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-09-01 21:23:12 +03:00
Bryce Harrington d58fc90a29 doc: Also mention the wayland test client in the quick guide
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-21 11:35:21 +10:00
Bryce Harrington 094c8dc59b doc: Declare keymap for wayland example
keymap was defined in the X11 example, but also define it in the wayland
example just to make it a bit more standalone

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-21 11:35:21 +10:00
Bryce Harrington 832e32dc6c doc: Fix ctx type in example
xkb_context_new() returns a xkb_context pointer, so change the variable
definition to be consistent.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-21 11:35:21 +10:00
Daniel Stone a2974d5f8a doc: Fix Doxygen include for srcdir != builddir
Instead of giving Doxygen a series of absolute paths to the source
files and a relative path to the output directory, run it from the
source directory with purely relative paths to the source files, and
give it an absolute path to the build directory.

This fixes the parsing of README.md with a separate build directory,
since the relative includes for doc/quick-guide.md and doc/compat.md
don't resolve otherwise. Doxygen's INCLUDE_PATH turns out not to fix
this either, since that's just a set of paths to open and parse, rather
than an analogue to cpp's -I.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-03-15 11:21:29 +00:00
Ran Benita 4aa50c9d88 doc: some notes about key names and aliases
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-01-20 23:17:42 +02:00
Ran Benita 7f3bb16729 doc/keymap-format-text-v1: add title and intro
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-11-23 00:07:15 +02:00
Ran Benita cf337875c5 doc/quick-guide: small improvements
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-11-21 23:17:55 +02:00
Ran Benita 4266402345 doc/keymap-format-text-v1: convert to markdown
Make it more readable for random browsing.

Signed-off-by: Ran Benita <ran234@gmail.com>
2015-11-21 23:12:18 +02:00
Ran Benita 8891953514 doc/keymap-format-text-v1: update info on preserve
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-11-21 22:51:13 +02:00
Ran Benita 7bb425c14e doc/Doxyfile: explicitly set HTML_TIMESTAMP = NO
YES was the default in older version. Having a timestamp hurts
reproducible builds, and serves no purpose, so remove it.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=789071

Signed-off-by: Ran Benita <ran234@gmail.com>
2015-09-08 17:28:42 +03:00
Ran Benita 7a15c0efcc doc/Doxyfile: only keep non-default values
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-09-08 09:21:32 +03:00
Ran Benita 8c0d6c7960 doc/Doxyfile: sync with latest version
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-09-08 09:17:16 +03:00
Ran Benita aa41d88334 doc/compat.md: add compose incompatibilities
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 16:03:41 +03:00
Ran Benita 0419f6e783 docs: make html output have a fixed width, hide footer
It's hard to read text which stretches indefinitely.

The footer is not adding much.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 15:06:16 +03:00
Ran Benita 49dc91cedb doc/quick-guide: some improvements
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 15:05:30 +03:00
Ran Benita ab9cb11c91 doc/compat.md: we don't support more groups or mods yet
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 15:05:30 +03:00
Ran Benita 494a8fbf3f README: move compatibility notes to their own page
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 15:05:30 +03:00
Ran Benita 046c802e96 compose: add xkbcommon-compose - API
xkbcommon-compose is a Compose implementation for xkbcommon. It mostly
behaves like libX11's Compose, but the support is somewhat low-level and
is not transparent like in libX11. The user must add some supporting code
in order to utilize it.

The intended audience are users who use xkbcommon but not a full-blown
input method. With this they can add Compose support in a straightforward
manner, so they have a fairly complete keyboard input for Latin-like
languages at least.

See the header documentation for details.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-03 00:15:39 +03:00
Ran Benita 9c088df3b3 doc: disable alphabetical data structure index
It is useless - we have very little data structures.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-22 15:46:13 +03:00