[xkbcommon] Use an integer type for modifiers bit mask.

Wander Lairson Costa wander.lairson at gmail.com
Thu Oct 3 19:03:44 PDT 2013


If we combine two enum values, the result is not a valid enum value
anymore, so it cannot be attributed to an enum variable.

C++ compilers will complain if such an assigment is done.

Signed-off-by: Wander Lairson Costa <wander.lairson at gmail.com>
---
 src/state.c           | 10 +++++-----
 xkbcommon/xkbcommon.h |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/state.c b/src/state.c
index e13d1fd..aaae5c7 100644
--- a/src/state.c
+++ b/src/state.c
@@ -678,7 +678,7 @@ xkb_state_update_derived(struct xkb_state *state)
     xkb_state_led_update_all(state);
 }
 
-static enum xkb_state_component
+static xkb_mod_mask_t
 get_state_component_changes(const struct state_components *a,
                             const struct state_components *b)
 {
@@ -710,7 +710,7 @@ get_state_component_changes(const struct state_components *a,
  * Given a particular key event, updates the state structure to reflect the
  * new modifiers.
  */
-XKB_EXPORT enum xkb_state_component
+XKB_EXPORT xkb_mod_mask_t
 xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc,
                      enum xkb_key_direction direction)
 {
@@ -760,7 +760,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc,
  * lossy, and should only be used to update a slave state mirroring the
  * master, e.g. in a client/server window system.
  */
-XKB_EXPORT enum xkb_state_component
+XKB_EXPORT xkb_mod_mask_t
 xkb_state_update_mask(struct xkb_state *state,
                       xkb_mod_mask_t base_mods,
                       xkb_mod_mask_t latched_mods,
@@ -861,7 +861,7 @@ xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t kc)
  */
 XKB_EXPORT xkb_mod_mask_t
 xkb_state_serialize_mods(struct xkb_state *state,
-                         enum xkb_state_component type)
+                         xkb_mod_mask_t type)
 {
     xkb_mod_mask_t ret = 0;
 
@@ -884,7 +884,7 @@ xkb_state_serialize_mods(struct xkb_state *state,
  */
 XKB_EXPORT xkb_layout_index_t
 xkb_state_serialize_layout(struct xkb_state *state,
-                           enum xkb_state_component type)
+                           xkb_mod_mask_t type)
 {
     xkb_layout_index_t ret = 0;
 
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index cc9262f..b9d1dd0 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -1166,7 +1166,7 @@ enum xkb_state_component {
  *
  * @sa xkb_state_update_mask()
  */
-enum xkb_state_component
+xkb_mod_mask_t
 xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
                      enum xkb_key_direction direction);
 
@@ -1197,7 +1197,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
  * @sa xkb_state_component
  * @sa xkb_state_update_key
  */
-enum xkb_state_component
+xkb_mod_mask_t
 xkb_state_update_mask(struct xkb_state *state,
                       xkb_mod_mask_t depressed_mods,
                       xkb_mod_mask_t latched_mods,
@@ -1331,7 +1331,7 @@ enum xkb_state_match {
  */
 xkb_mod_mask_t
 xkb_state_serialize_mods(struct xkb_state *state,
-                         enum xkb_state_component components);
+                         xkb_mod_mask_t components);
 
 /**
  * The counterpart to xkb_state_update_mask for layouts, to be used on
@@ -1353,7 +1353,7 @@ xkb_state_serialize_mods(struct xkb_state *state,
  */
 xkb_layout_index_t
 xkb_state_serialize_layout(struct xkb_state *state,
-                           enum xkb_state_component components);
+                           xkb_mod_mask_t components);
 
 /**
  * Test whether a modifier is active in a given keyboard state by name.
-- 
1.8.1.2



More information about the wayland-devel mailing list