state: allow different modes for calculating consumed modifiers
authorRan Benita <ran234@gmail.com>
Sat, 27 Feb 2016 17:06:14 +0000 (19:06 +0200)
committerRan Benita <ran234@gmail.com>
Mon, 31 Oct 2016 10:52:26 +0000 (12:52 +0200)
commita0a41332cc3811370b4f9d46528b7a590846e289
tree7a735267fe0bea2bb7b82a5f8f0a1d89300f4654
parent90611719572fbac04ddf3329f5683feb3b71e681
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>
src/state.c
test/common.c
test/interactive-evdev.c
test/interactive-wayland.c
test/interactive-x11.c
test/test.h
xkbcommon.map
xkbcommon/xkbcommon.h