summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-03-27 12:07:57 +0100
committerDaniel Stone <daniel@fooishbar.org>2012-03-27 12:11:27 +0100
commit7f471a702ed4e1af63c39370ea55f3fea0500cfc (patch)
treecb2aa051935d9041cdec049bbcdabf0f0906de20 /include
parent83b8b4b53324085fcc91f484535f1a43d0c0ccca (diff)
downloadxorg-lib-libxkbcommon-7f471a702ed4e1af63c39370ea55f3fea0500cfc.tar.gz
Add state serialisation API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'include')
-rw-r--r--include/xkbcommon/xkbcommon.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h
index 18441c0..b7259e6 100644
--- a/include/xkbcommon/xkbcommon.h
+++ b/include/xkbcommon/xkbcommon.h
@@ -63,6 +63,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
typedef uint32_t xkb_keycode_t;
typedef uint32_t xkb_keysym_t;
typedef uint32_t xkb_mod_index_t;
+typedef uint32_t xkb_mod_mask_t;
typedef uint32_t xkb_group_index_t;
typedef uint32_t xkb_led_index_t;
@@ -742,6 +743,52 @@ enum xkb_state_component {
};
/**
+ * Updates a state object from a set of explicit masks. This entrypoint is
+ * really only for window systems and the like, where a master process
+ * holds an xkb_state, then serialises it over a wire protocol, and clients
+ * then use the serialisation to feed in to their own xkb_state.
+ *
+ * All parameters must always be passed, or the resulting state may be
+ * incoherent.
+ *
+ * The serialisation is lossy and will not survive round trips; it must only
+ * be used to feed slave state objects, and must not be used to update the
+ * master state.
+ *
+ * Please do not use this unless you fit the description above.
+ */
+_X_EXPORT void
+xkb_state_update_mask(struct xkb_state *state,
+ xkb_mod_mask_t base_mods,
+ xkb_mod_mask_t latched_mods,
+ xkb_mod_mask_t locked_mods,
+ xkb_group_index_t base_group,
+ xkb_group_index_t latched_group,
+ xkb_group_index_t locked_group);
+
+/**
+ * The counterpart to xkb_state_update_mask, to be used on the server side
+ * of serialisation. Returns a xkb_mod_mask_t representing the given
+ * component(s) of the state.
+ *
+ * This function should not be used in regular clients; please use the
+ * xkb_state_mod_*_is_active or xkb_state_foreach_active_mod API instead.
+ *
+ * Can return NULL on failure.
+ */
+_X_EXPORT xkb_mod_mask_t
+xkb_state_serialise_mods(struct xkb_state *state,
+ enum xkb_state_component component);
+
+/**
+ * The group equivalent of xkb_state_serialise_mods: please see its
+ * documentation.
+ */
+_X_EXPORT xkb_group_index_t
+xkb_state_serialise_group(struct xkb_state *state,
+ enum xkb_state_component component);
+
+/**
* Returns 1 if the modifier specified by 'name' is active in the manner
* specified by 'type', 0 if it is unset, or -1 if the modifier does not
* exist in the current map.