summaryrefslogtreecommitdiff
path: root/xkbcommon
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-08-07 00:20:40 +0300
committerRan Benita <ran234@gmail.com>2012-08-08 10:03:38 +0300
commit1a930bf256d87a0edde66a0b00271e3faf664d45 (patch)
tree7babac98d8a22e1b167960273b076d918bcf9a3d /xkbcommon
parent262bf97f9bfeed535d94034cf5ded9dac962ffaa (diff)
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>
Diffstat (limited to 'xkbcommon')
-rw-r--r--xkbcommon/xkbcommon.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index 2b3f8e3..58e4183 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -635,6 +635,16 @@ xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
enum xkb_state_component type);
/**
+ * Returns 1 if the modifier specified by 'idx' is used in the
+ * translation of the keycode 'key' to the key symbols obtained by
+ * pressing it (as in xkb_key_get_syms), given the current state.
+ * Returns 0 otherwise.
+ */
+int
+xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_index_t idx);
+
+/**
* Returns 1 if the modifiers specified by the varargs (treated as
* xkb_mod_index_t, terminated with XKB_MOD_INVALID) are active in the manner
* specified by 'match' and 'type', 0 otherwise, or -1 if the modifier does not