Commit Graph

12 Commits (c1b5da1dbf697925d6d2031cf734a28c58f644a8)

Author SHA1 Message Date
Ran Benita a17701327e Compose: add iterator API
Allow users to iterate the entries in a compose table. This is useful
for other projects which want programmable access to the sequences,
without having to write their own parser.

- New API:
  - `xkb_compose_table_entry_sequence`;
  - `xkb_compose_table_entry_keysym`;
  - `xkb_compose_table_entry_utf8`;
  - `xkb_compose_table_iterator_new`;
  - `xkb_compose_table_iterator_free`;
  - `xkb_compose_table_iterator_next`.
- Add tests in `test/compose.c`.
- Add benchmark for compose traversal.
- `tools/compose.c`:
  - Print entries instead of just validating them.
  - Add `--file` option.
  - TODO: make this tool part of the xkbcli commands.

Co-authored-by: Pierre Le Marre <dev@wismill.eu>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Signed-off-by: Ran Benita <ran@unusedvar.com>
2023-09-26 09:02:45 +02: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
Ran Benita 12f99d0dfe Bump version to 1.0.0
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-09-06 00:00:14 +03:00
Jaroslaw Kubik d92a248c48 API to query modifier set required to type a keysym
The new API is useful to implement features like auto-type and
desktop automation. Since the inputs for these features is usually
specified in terms of the symbols that need to be typed, the
implementation needs to be able to invert the keycode->keysym
transformation and produce a sequence of keycodes that can be used
to type the requested character(s).
2020-03-20 19:20:36 +02:00
Jaroslaw Kubik 0345aba082 Support translation Unicode codepoints to keysyms
In order to support features like auto-type and UI automation, the
relevant tools need to be able to invert the keycode->keysym->text
transformation. In order to facilitate that, a new API was added.
It allows querying the keysyms that correspond to particular Unicode
codepoints. For all practical purposes, it can be thought of as an
inverse of xkb_keysym_to_utf32().
2020-02-24 09:54:09 +02:00
Ran Benita 18d6aebec0 keysym: add xkb_keysym_to_{lower,upper} to public API
These can be useful in some odd cases.

There is already an implementation (+ tests) for internal use, so all
that's needed is to export them.

If xkbcommon were to provide a way to convert a Unicode codepoint to a
keysym, this could have been implemented externally as follows:

    uint32_t codepoint = xkb_keysym_to_utf32(keysym);
    uint32_t upper_codepoint = my_unicode_library_to_upper(codepoint);
    xkb_keysym_t upper_keysym = theoretical_xkb_keysym_from_utf32(upper_codepoint);

However keysym -> codepoint is not injective so such a function is not
possible strictly speaking.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-12-11 23:01:18 +02:00
Ran Benita a0a41332cc state: allow different modes for calculating consumed modifiers
The current functions dealing with consumed modifiers use the
traditional XKB definition of consumed modifiers (see description in the
added documentation). However, for several users of the library (e.g.
GTK) this definition is unsuitable or too eager. This is exacerbated by
some less-than-ideal xkeyboard-config type definitions (CTRL+ALT seems
to cause most grief...).

So, because we
- want to enable alternative interpretations, but
- don't want to expose too much internal details, and
- want to keep things simple for all library users,
we add a high-level "mode" parameter which selects the desired
interpretation. New ones can be added as long as they make some sense.

All of the old consumed-modifiers functions keep using the traditional
("XKB") mode. I mark xkb_state_mod_mask_remove_consumed() and as
deprecated without adding a *2 variant because I don't it is very useful
(or used) in practice.

Alternative modes are added in subsequent commits (this commit only adds
a mode for the existing behavior).

https://github.com/xkbcommon/libxkbcommon/issues/17

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-10-31 12:52:26 +02:00
Ran Benita 1c6d21b45f Add symbol versions forgotten in 0ce17ef3ea
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-13 23:17:21 +02:00
Ran Benita b92f792409 Change initial symbol file versions to V_0.5.0
It will be quite confusing to use V_0.4.3 since this was already
released without symbol versioning.

Hopefully this doesn't cause any trouble for people who are using -git.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 16:40:59 +03:00
Ran Benita edc98b5403 compose: add xkbcommon-compose - implementation
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-05 12:56:46 +03:00
Ran Benita 1ba7d9ecda doc: reorder "Keymap Components" functions
Put the general keymap stuff before key-specific functions.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-19 12:52:45 +03:00
Jan Engelhardt 5444f6a8ca build: use symbol versioning
Symbol versions provide a means by which ELF utilities can determine
whether a program is incompatible with a too-old library version so
that package management tools can autodetect version-based
dependencies and suggest upgrade paths.

[ran: swap xkbcommon.map and xkbcommon-x11.map]

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-10 18:52:13 +03:00