Commit Graph

103 Commits (ca033a29d2ca910fd17b1ae287cb420205bdddc8)

Author SHA1 Message Date
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
Ran Benita b973d71e82 state: add xkb_state_key_get_{utf8,utf32}() API functions
These functions generally have the same effect as
xkb_state_key_get_syms() + xkb_keysym_to_utf{8,32}().

So why add them?

- They provide a slightly nicer interface, especially if the string is
  the only interest.

- It makes the handling of multiple-keysyms-to-utf8 transparent. For the
  designated use-case of multiple-keysyms (unicode combining
  characters), this is a must. We also validate the UTF-8, which the
  user might not otherwise do.

- We will need to apply some transformation on the resulting string
  which depend on the xkb_state. This is not possible with the
  xkb_keysym_* functions.

With these functions, the existing xkb_keysym_to_utf{8,32}() are not
expected to be used by a typical user; they are "raw" functions.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-22 17:17:16 +02:00
Ran Benita fdb4de1f85 doc: extend xkb_rule_names default-value description
Especially a mention of the XKB_DEFAULT_* envvars was missing.

Reported-by: Paeglis Gatis <Gatis.Paeglis@digia.com> (thanks!)
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-04 19:30:09 +02:00
Ran Benita e086ba9416 doc: remove possibly confusing comment
There are valid reasons to use the other keymap-creation functions, if
one needs them. On the other hand, if one is supposed to use RMLVO, it
is more or less the only choice, so the comment is not needed in this
case as well.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-03-04 18:24:11 +02:00
Ran Benita d7c91a15f8 doc: add comments about update_key() and get_syms() order
I remember we had a comment about this, but I can't find it. So add it
again.

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-02-28 14:50:48 +02:00
Jasper St. Pierre 4fb7b06b0f state: Add xkb_state_key_get_consumed_mods
This retrieves the mask of consumed modifiers for a given key and state,
which is helpful for toolkits without having them to do it one modifier
at a time, or pass in 0xFFFFFFFF to xkb_state_remove_consumed_mods to
"reverse-engineer" the consumed mods.
2014-02-22 02:23:37 +02:00
Ran Benita 973b8fd47e api: deprecate XKB_MAP_COMPILE_PLACEHOLDER, and use KEYMAP instead of MAP
The PLACEHOLDER was not meant to be used, but c++ doesn't like passing 0
to enums, so it was used. For this reason we add all the NO_FLAGS items,
so the PLACEHOLDER shouldn't be used anymore.

Second, XKB_MAP is the prefix we used ages ago, KEYMAP is the expected
prefix here. So deprecate that as well.

The old names may still be used through the xkbcommon-compat.h header,
which is included by default (no need to include directly).

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-02-08 16:40:20 +02:00
Ran Benita 779eec3b8b x11: add missing #ifdef __cplusplus to header
Signed-off-by: Ran Benita <ran234@gmail.com>
2014-02-04 22:18:12 +02:00
Ran Benita eb34825560 x11: add XKB protocol keymap and state creation support
These are function to create an xkb_keymap directly from XKB requests
to the X server. This opens up the possibility for X clients to use
xcb + xcb-xkb + xkbcommon as a proper replacement for Xlib + xkbfile for
keyboard support.

The X11 support must be enabled with --enable-x11 for now.
The functions are in xkbcommon/xkbcommon-x11.h. It depends on a recent
libxcb with xkb enabled. The functions are in a new libxkbcommon-x11.so,
with a new pkg-config file, etc. so that the packages may be split, and
libxkbcommon.so itself remains dependency-free.

Why not just use the RMLVO that the server puts in the _XKB_RULES_NAMES
property? This does not account for custom keymaps, on-the-fly keymap
modifications, remote clients, etc., so is not a proper solution in
practice. Also, some servers don't even set it. Now, the client just
needs to recreate the keymap in response to a change in the server's
keymap (as Xlib clients do with XRefreshKeyboardMapping() and friends).

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-02-02 11:16:40 +02:00
Hardening e77712bd27 Add a constant for NumLock
This trivial patch adds the name of the Numlock modifier
2014-01-11 17:29:02 +02:00
Ran Benita 53e7a135c2 keysyms: add German T3 layout keysyms from xproto
Reference:
http://cgit.freedesktop.org/xorg/proto/xproto/commit/?id=6d4acb0e3a6568a8faaa651d4e3d32f917b9067b

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-01-01 10:40:09 +02:00
Wander Lairson Costa ac59e735eb Make C++ happy.
For most functions taking an enum flags parameter, we use 0 value to
indicate that no flags should be applied.

C++ has a stronger type system than C and will not implicitly convert
int's to enum's. Thus, we create valid 0 enum values for enum types
where it makes sense.

Signed-off-by: Wander Lairson Costa <wander.lairson@gmail.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
2013-09-26 15:54:53 +03:00
Ran Benita dbf07de14d doc: use 'indices' instead of 'indexes' consistently
We use 'indices' in some function names so use that.

Signed-off-by: Ran Benita <ran234@gmail.com>
2013-08-29 19:49:40 +03:00