mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
st/oxr: Add some oxr_subaction_paths helpers.
This commit is contained in:
parent
4ade7e8e55
commit
2fbab42772
|
@ -77,6 +77,39 @@ oxr_action_bind_io(struct oxr_logger *log,
|
|||
struct oxr_interaction_profile *profile,
|
||||
enum oxr_subaction_path subaction_path);
|
||||
|
||||
/*!
|
||||
* Helper function to combine @ref oxr_subaction_paths structs, but skipping
|
||||
* @ref oxr_subaction_paths::any.
|
||||
*
|
||||
* If a real (non-"any") subaction path in @p new_subaction_paths is true, it will be
|
||||
* true in @p subaction_paths.
|
||||
*
|
||||
* @private @memberof oxr_subaction_paths
|
||||
*/
|
||||
static inline void
|
||||
oxr_subaction_paths_accumulate_except_any(struct oxr_subaction_paths *subaction_paths,
|
||||
const struct oxr_subaction_paths *new_subaction_paths)
|
||||
{
|
||||
#define ACCUMULATE_SUBACTION_PATHS(X) subaction_paths->X |= new_subaction_paths->X;
|
||||
OXR_FOR_EACH_SUBACTION_PATH(ACCUMULATE_SUBACTION_PATHS)
|
||||
#undef ACCUMULATE_SUBACTION_PATHS
|
||||
}
|
||||
|
||||
/*!
|
||||
* Helper function to combine @ref oxr_subaction_paths structs.
|
||||
*
|
||||
* If a subaction path in @p new_subaction_paths is true, it will be true in @p subaction_paths.
|
||||
*
|
||||
* @private @memberof oxr_subaction_paths
|
||||
*/
|
||||
static inline void
|
||||
oxr_subaction_paths_accumulate(struct oxr_subaction_paths *subaction_paths,
|
||||
const struct oxr_subaction_paths *new_subaction_paths)
|
||||
{
|
||||
subaction_paths->any |= new_subaction_paths->any;
|
||||
oxr_subaction_paths_accumulate_except_any(subaction_paths, new_subaction_paths);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Action attachment functions
|
||||
|
|
|
@ -1914,6 +1914,24 @@ struct oxr_subaction_paths
|
|||
#undef OXR_SUBPATH_MEMBER
|
||||
};
|
||||
|
||||
/*!
|
||||
* Helper function to determine if the set of paths in @p a is a subset of the
|
||||
* paths in @p b.
|
||||
*
|
||||
* @public @memberof oxr_subaction_paths
|
||||
*/
|
||||
static inline bool
|
||||
oxr_subaction_paths_is_subset_of(const struct oxr_subaction_paths *a, const struct oxr_subaction_paths *b)
|
||||
{
|
||||
#define OXR_CHECK_SUBACTION_PATHS(X) \
|
||||
if (a->X && !b->X) { \
|
||||
return false; \
|
||||
}
|
||||
OXR_FOR_EACH_SUBACTION_PATH(OXR_CHECK_SUBACTION_PATHS)
|
||||
#undef OXR_CHECK_SUBACTION_PATHS
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* The data associated with the attachment of an Action Set (@ref
|
||||
* oxr_action_set) to as Session (@ref oxr_session).
|
||||
|
|
Loading…
Reference in a new issue