Commit Graph

115 Commits (850ba7e636edb136916a2b5fa73b557ab5980759)

Author SHA1 Message Date
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
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
Emmanuel Gil Peyrot 17ad0df14a compose: add xdg base directory support
Before reading ~/.XCompose, try to read $XDG_CONFIG_HOME/XCompose
(falling back to ~/.config/XCompose).

This helps unclutter the home directory of users who want that.
2020-07-23 09:39:53 +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
Ran Benita 892cfef834 keysyms: add XKB_KEY_XF86FullScreen
Updated using ./scripts/update-keysyms using latest xorgproto.

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/147
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-05-20 20:42:02 +03:00
Ran Benita 90e5aa8bc5 doc: add missing `@since` tags
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-03-20 19:40:14 +02: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 c90703265f doc: must -> should
Using an out-of-range is not an error, just useless.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-02-16 13:32:09 +02:00
Ran Benita 335ebcadd4 docs: add missing reference to $XDG_CONFIG_HOME
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-01-18 22:59:58 +02:00
Ran Benita 670566f0d4 Only add GCC diagnostic pragmas when compiler is GCC compatible
Avoid "unknown pragma" warnings on other compilers.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2019-12-27 15:20:25 +02:00
Peter Hutterer 59d2a71383 docs: update the include path documentation
Missing from e23f1061b2 and
3a91788d92.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-14 10:17:46 +02:00
Jesse 8129f3b256
Fix some doc typos 2019-06-04 23:44:42 +02:00
Ran Benita 73794e1e54 docs: fix a doxygen reference warning 2019-01-28 16:29:09 +02:00
Peter Hutterer e08d589f2c keysyms: fix comment for XKB_KEY_OCARON
Reported-by: Keve Müller
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-25 10:39:22 +10:00
Hans de Goede 9b85d96d2a Sync Keysyms with recent xproto additions
xproto recently has been extended with 2 new keysyms:
XF86XK_MonBrightnessCycle
XF86XK_RotationLockToggle

This commit is the result of running "scripts/update-keysyms" on a system
with the updated xproto installed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2019-01-22 08:31:43 +01:00
Ran Benita 740c66885f doc: improve the description of the consumed modifier modes
Hopefully it is more understandable now.

https://bugs.freedesktop.org/show_bug.cgi?id=104768

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
2018-01-26 13:11:04 +02:00
Ran Benita 767fa86d42 Convert http:// -> https:// where possible
Signed-off-by: Ran Benita <ran234@gmail.com>
2017-12-21 14:18:07 +02:00
Ran Benita 4fccdee383 x11: check and document the correct range of device IDs
The actual value is 127, not 255.

https://bugs.freedesktop.org/show_bug.cgi?id=104321

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
2017-12-18 16:41:21 +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 f468f0b243 xkbcommon-compose.h: change recommended locale fallback code to treat empty string same as unset
The previous code would cause failures to find the Compose file if one
of the environment variables LC_ALL, LC_CTYPE or LANG are set to the
empty string.

The description of the fallback procedure in loclale(7) talks about
"non-null environment variable"; I interpreted this to mean the
environment variable is unset, but it actually means unset or empty (I
verified this by looking at what glibc and musl do).

A recent bug in systemd https://github.com/systemd/systemd/issues/6407
exposed this issue. It causes these these variables to be set to the
empty string in TTY sessions.

Reported by "doodoo" in https://bbs.archlinux.org/viewtopic.php?id=228658

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-08-13 18:03:57 +03:00
Ran Benita 00b08eae82 build: rewrite the update-keysyms sed script in python
A bit more manageable this way, and the other part of the target is
already using python.

The output is the same, except I removed the reference to Makefile.am.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-07-31 15:55:48 +03:00
Hans de Goede 939d0909a4 Sync Keysyms with recent xproto additions
xproto recently has been extended with 4 new keysyms:
XF86XK_Keyboard
XF86XK_WWAN
XF86XK_RFKill
XF86XK_AudioPreset

This commit is the result of running "make update-keysyms" on a system
with the updated xproto installed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2017-05-12 12:27:05 +02:00
Ran Benita 47d6e5a8d9 compose/doc: note that it is safe to pass the result of getenv() as locale
See the NOTES section of getenv(3). Somewhat obscure but it doesn't hurt
to reassure the readers who know about this.

Signed-off-by: Ran Benita <ran234@gmail.com>
2017-01-15 18:32:02 +02:00
Ran Benita 7984a30bbc doc: note that XKB_KEYSYM_CASE_INSENSITIVE does C folding only
and not locale-dependent.

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-12-03 00:02:57 +02:00
Ran Benita babc9e0c30 state: add GTK consumed modifiers mode
This is more or less what is implemented here:
https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkkeys-x11.c?h=3.19.10#n1131

The implementation here is more technically correct but should provide
the same results.

Try it out with ./test/interactive-evdev -g (modifiers prefixed with "-"
are consumed).

https://bugzilla.gnome.org/show_bug.cgi?id=754110
https://github.com/xkbcommon/libxkbcommon/issues/17

Signed-off-by: Ran Benita <ran234@gmail.com>
2016-10-31 12:52:28 +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 b91584a8f3 doc: update reference to compat symbol to its new name
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-03-26 01:56:03 +03:00
Ran Benita e8f04f222a doc: add environment variables index
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-01-20 23:17:42 +02: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
Mike Blumenkrantz 0ce17ef3ea keymap: add xkb_keymap_key_by_name(), xkb_keymap_key_get_name(), tests
xkb_keymap_key_by_name() allows finding a keycode from a given keyname and
is useful for generating keyboard events to use in regression tests
during CI

xkb_keymap_key_get_name() is the inverse of xkb_keymap_key_by_name()

Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
[ran: some stylistic tweaks + another test case]
Signed-off-by: Ran Benita <ran234@gmail.com>
2016-01-20 23:17:10 +02:00
Ran Benita b0450847ff doc: some editorial changes to compose documentation
Use nicer Markdown syntax, `surround` some words, fix some typos.

Signed-off-by: Ran Benita <ran234@gmail.com>
2015-02-19 17:03:06 +02:00
Ran Benita 508fbcd167 doc: explain the envvars which affect compose
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-24 23:03:41 +03:00
Ran Benita 47bb9fd137 compose: fill @since TBD
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-10-18 16:40:59 +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 0b448548a8 doc: linkify some references
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-22 15:24:15 +03:00
Ran Benita f088d23f1e x11, doc: add note about Key{Press,Release}->state field
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-22 11:54:04 +03:00
Ran Benita 7831fe2198 x11, doc: add note about per-client flags like detectable autorepeat
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-22 11:54:04 +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
Ran Benita 494e318946 doc: move consumed modifier description to its own section
With small edits.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-19 00:59:01 +03:00
Ran Benita c00df88577 x11, doc: fix typo
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-18 12:14:43 +03:00
Ran Benita ab4df099ca x11, doc: add overview
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-18 11:59:27 +03:00
Ran Benita 5f8ccd18f6 doc: fix @param display for xkb_x11_setup_xkb_extension()
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-09-11 12:09:57 +03:00
Ran Benita 527bf96f9b keymap: fix typo
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-08-24 10:16:41 +03:00
David Herrmann c62cde57f5 keymap: fix description of xkb_keymap_key_get_syms_by_level()
The @level argument is restricted by xkb_keymap_num_levels_for_key(). Fix
the description to no longer mention xkb_keymap_num_layouts_for_key().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2014-08-24 10:14:07 +03:00
Ran Benita 9db1432326 docs: move keysym-transformations page to a better position
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-07-28 18:04:34 +03:00
Ran Benita b629576266 docs: fix self-reference
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-07-28 10:03:48 +03:00
Ran Benita 89fbf979f1 doc: explain keysym/string transformation
The documentation should be clear about what is happening, even if it's
rather unlikely anyone will really dig into the details.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-04-12 00:22:47 +03:00
Ran Benita da83e678ab doc: add @since annotations for API added since 0.3.0
And also add release dates to the NEWS.

We're adding API freely, so this can make life easier for anyone who
wants to stay compatible with an older version.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-04-11 19:09:48 +03:00