Add API to query whether a modifier is consumed
authorRan Benita <ran234@gmail.com>
Mon, 6 Aug 2012 21:20:40 +0000 (00:20 +0300)
committerRan Benita <ran234@gmail.com>
Wed, 8 Aug 2012 07:03:38 +0000 (10:03 +0300)
commit1a930bf256d87a0edde66a0b00271e3faf664d45
tree7babac98d8a22e1b167960273b076d918bcf9a3d
parent262bf97f9bfeed535d94034cf5ded9dac962ffaa
Add API to query whether a modifier is consumed

Currently the user has no way of knowing which of the active modifiers
have been used in the translation of a keycode to its keysyms. The use
case is described in the GTK docs: say there's a menu accelerator
activated by "<Alt>+". Some layouts have "+" shifted, and some have it
on the first level. So in keymaps where "+" is shifted, the Shift
modifier is consumed and must be ignored when the user is testing
for "<Alt>+". Otherwise, we may get "<Alt><Shift>+" and the accelerator
should not actually fire.

For this we also use the preserve[] information in the key types, which
can forces us to report modifiers as unconsumed even if they were used
in the translation. Until now we didn't do anything with this
information.

The API tries to match its surronding. It's not very efficient but this
can be fixed.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/map.c
test/interactive.c
xkbcommon/xkbcommon.h