st/oxr: Rename the remaining oxr_source things to oxr_action

This commit is contained in:
Ryan Pavlik 2020-06-16 16:31:29 -05:00
parent d778c236fe
commit adbafad079
3 changed files with 47 additions and 47 deletions

View file

@ -44,9 +44,9 @@ oxr_session_get_action_attachment(
struct oxr_action_attachment **out_act_attached); struct oxr_action_attachment **out_act_attached);
static void static void
oxr_source_cache_update(struct oxr_logger *log, oxr_action_cache_update(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
struct oxr_source_cache *cache, struct oxr_action_cache *cache,
int64_t time, int64_t time,
bool select); bool select);
@ -61,11 +61,11 @@ oxr_action_attachment_update(struct oxr_logger *log,
struct oxr_sub_paths sub_paths); struct oxr_sub_paths sub_paths);
static void static void
oxr_source_bind_inputs(struct oxr_logger *log, oxr_action_bind_inputs(struct oxr_logger *log,
struct oxr_sink_logger *slog, struct oxr_sink_logger *slog,
struct oxr_session *sess, struct oxr_session *sess,
struct oxr_action *act, struct oxr_action *act,
struct oxr_source_cache *cache, struct oxr_action_cache *cache,
struct oxr_interaction_profile *profile, struct oxr_interaction_profile *profile,
enum oxr_sub_action_path sub_path); enum oxr_sub_action_path sub_path);
@ -76,11 +76,11 @@ oxr_source_bind_inputs(struct oxr_logger *log,
*/ */
/*! /*!
* De-initialize/de-allocate all dynamic members of @ref oxr_source_cache * De-initialize/de-allocate all dynamic members of @ref oxr_action_cache
* @private @memberof oxr_source_cache * @private @memberof oxr_action_cache
*/ */
static void static void
oxr_source_cache_teardown(struct oxr_source_cache *cache) oxr_action_cache_teardown(struct oxr_action_cache *cache)
{ {
free(cache->inputs); free(cache->inputs);
cache->inputs = NULL; cache->inputs = NULL;
@ -101,11 +101,11 @@ oxr_action_attachment_teardown(struct oxr_action_attachment *act_attached)
struct oxr_session *sess = act_attached->sess; struct oxr_session *sess = act_attached->sess;
u_hashmap_int_erase(sess->act_attachments_by_key, u_hashmap_int_erase(sess->act_attachments_by_key,
act_attached->act_key); act_attached->act_key);
oxr_source_cache_teardown(&(act_attached->user)); oxr_action_cache_teardown(&(act_attached->user));
oxr_source_cache_teardown(&(act_attached->head)); oxr_action_cache_teardown(&(act_attached->head));
oxr_source_cache_teardown(&(act_attached->left)); oxr_action_cache_teardown(&(act_attached->left));
oxr_source_cache_teardown(&(act_attached->right)); oxr_action_cache_teardown(&(act_attached->right));
oxr_source_cache_teardown(&(act_attached->gamepad)); oxr_action_cache_teardown(&(act_attached->gamepad));
// Unref this action's refcounted data // Unref this action's refcounted data
oxr_refcounted_unref(&act_attached->act_ref->base); oxr_refcounted_unref(&act_attached->act_ref->base);
} }
@ -430,7 +430,7 @@ oxr_classify_sub_action_paths(struct oxr_logger *log,
} }
XrResult XrResult
oxr_source_get_pose_input(struct oxr_logger *log, oxr_action_get_pose_input(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
uint32_t act_key, uint32_t act_key,
const struct oxr_sub_paths *sub_paths, const struct oxr_sub_paths *sub_paths,
@ -558,10 +558,10 @@ ends_with(const char *str, const char *suffix)
} }
static void static void
oxr_source_cache_determine_redirect(struct oxr_logger *log, oxr_action_cache_determine_redirect(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
struct oxr_action *act, struct oxr_action *act,
struct oxr_source_cache *cache, struct oxr_action_cache *cache,
XrPath bound_path) XrPath bound_path)
{ {
@ -732,31 +732,31 @@ oxr_action_attachment_bind(struct oxr_logger *log,
if (act_ref->sub_paths.user || act_ref->sub_paths.any) { if (act_ref->sub_paths.user || act_ref->sub_paths.any) {
#if 0 #if 0
oxr_source_bind_inputs(log, slog, sess, act, &act_attached->user, user, oxr_action_bind_inputs(log, slog, sess, act, &act_attached->user, user,
OXR_SUB_ACTION_PATH_USER); OXR_SUB_ACTION_PATH_USER);
#endif #endif
} }
if (act_ref->sub_paths.head || act_ref->sub_paths.any) { if (act_ref->sub_paths.head || act_ref->sub_paths.any) {
oxr_source_bind_inputs(log, &slog, sess, act, oxr_action_bind_inputs(log, &slog, sess, act,
&act_attached->head, head, &act_attached->head, head,
OXR_SUB_ACTION_PATH_HEAD); OXR_SUB_ACTION_PATH_HEAD);
} }
if (act_ref->sub_paths.left || act_ref->sub_paths.any) { if (act_ref->sub_paths.left || act_ref->sub_paths.any) {
oxr_source_bind_inputs(log, &slog, sess, act, oxr_action_bind_inputs(log, &slog, sess, act,
&act_attached->left, left, &act_attached->left, left,
OXR_SUB_ACTION_PATH_LEFT); OXR_SUB_ACTION_PATH_LEFT);
} }
if (act_ref->sub_paths.right || act_ref->sub_paths.any) { if (act_ref->sub_paths.right || act_ref->sub_paths.any) {
oxr_source_bind_inputs(log, &slog, sess, act, oxr_action_bind_inputs(log, &slog, sess, act,
&act_attached->right, right, &act_attached->right, right,
OXR_SUB_ACTION_PATH_RIGHT); OXR_SUB_ACTION_PATH_RIGHT);
} }
if (act_ref->sub_paths.gamepad || act_ref->sub_paths.any) { if (act_ref->sub_paths.gamepad || act_ref->sub_paths.any) {
oxr_source_bind_inputs(log, &slog, sess, act, oxr_action_bind_inputs(log, &slog, sess, act,
&act_attached->gamepad, gamepad, &act_attached->gamepad, gamepad,
OXR_SUB_ACTION_PATH_GAMEPAD); OXR_SUB_ACTION_PATH_GAMEPAD);
} }
@ -774,9 +774,9 @@ oxr_action_attachment_bind(struct oxr_logger *log,
} }
static void static void
oxr_source_cache_stop_output(struct oxr_logger *log, oxr_action_cache_stop_output(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
struct oxr_source_cache *cache) struct oxr_action_cache *cache)
{ {
// Set this as stopped. // Set this as stopped.
cache->stop_output_time = 0; cache->stop_output_time = 0;
@ -792,9 +792,9 @@ oxr_source_cache_stop_output(struct oxr_logger *log,
} }
static void static void
oxr_source_cache_update(struct oxr_logger *log, oxr_action_cache_update(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
struct oxr_source_cache *cache, struct oxr_action_cache *cache,
int64_t time, int64_t time,
bool selected) bool selected)
{ {
@ -802,7 +802,7 @@ oxr_source_cache_update(struct oxr_logger *log,
if (!selected) { if (!selected) {
if (cache->stop_output_time > 0) { if (cache->stop_output_time > 0) {
oxr_source_cache_stop_output(log, sess, cache); oxr_action_cache_stop_output(log, sess, cache);
} }
U_ZERO(&cache->current); U_ZERO(&cache->current);
return; return;
@ -811,7 +811,7 @@ oxr_source_cache_update(struct oxr_logger *log,
if (cache->num_outputs > 0) { if (cache->num_outputs > 0) {
cache->current.active = true; cache->current.active = true;
if (cache->stop_output_time < time) { if (cache->stop_output_time < time) {
oxr_source_cache_stop_output(log, sess, cache); oxr_action_cache_stop_output(log, sess, cache);
} }
} }
@ -936,10 +936,10 @@ oxr_action_attachment_update(struct oxr_logger *log,
bool select_gamepad = sub_paths.gamepad || sub_paths.any; bool select_gamepad = sub_paths.gamepad || sub_paths.any;
// clang-format off // clang-format off
oxr_source_cache_update(log, sess, &act_attached->head, time, select_head); oxr_action_cache_update(log, sess, &act_attached->head, time, select_head);
oxr_source_cache_update(log, sess, &act_attached->left, time, select_left); oxr_action_cache_update(log, sess, &act_attached->left, time, select_left);
oxr_source_cache_update(log, sess, &act_attached->right, time, select_right); oxr_action_cache_update(log, sess, &act_attached->right, time, select_right);
oxr_source_cache_update(log, sess, &act_attached->gamepad, time, select_gamepad); oxr_action_cache_update(log, sess, &act_attached->gamepad, time, select_gamepad);
// clang-format on // clang-format on
if (!select_any) { if (!select_any) {
@ -1021,11 +1021,11 @@ oxr_action_attachment_update(struct oxr_logger *log,
} }
static void static void
oxr_source_bind_inputs(struct oxr_logger *log, oxr_action_bind_inputs(struct oxr_logger *log,
struct oxr_sink_logger *slog, struct oxr_sink_logger *slog,
struct oxr_session *sess, struct oxr_session *sess,
struct oxr_action *act, struct oxr_action *act,
struct oxr_source_cache *cache, struct oxr_action_cache *cache,
struct oxr_interaction_profile *profile, struct oxr_interaction_profile *profile,
enum oxr_sub_action_path sub_path) enum oxr_sub_action_path sub_path)
{ {
@ -1061,7 +1061,7 @@ oxr_source_bind_inputs(struct oxr_logger *log,
cache->num_outputs = num_outputs; cache->num_outputs = num_outputs;
} }
oxr_source_cache_determine_redirect(log, sess, act, cache, bound_path); oxr_action_cache_determine_redirect(log, sess, act, cache, bound_path);
} }
@ -1493,7 +1493,7 @@ oxr_action_get_pose(struct oxr_logger *log,
static void static void
set_action_output_vibration(struct oxr_session *sess, set_action_output_vibration(struct oxr_session *sess,
struct oxr_source_cache *cache, struct oxr_action_cache *cache,
int64_t stop, int64_t stop,
const XrHapticVibration *data) const XrHapticVibration *data)
{ {
@ -1573,19 +1573,19 @@ oxr_action_stop_haptic_feedback(struct oxr_logger *log,
// clang-format off // clang-format off
if (act_attached->user.current.active && (sub_paths.user || sub_paths.any)) { if (act_attached->user.current.active && (sub_paths.user || sub_paths.any)) {
oxr_source_cache_stop_output(log, sess, &act_attached->user); oxr_action_cache_stop_output(log, sess, &act_attached->user);
} }
if (act_attached->head.current.active && (sub_paths.head || sub_paths.any)) { if (act_attached->head.current.active && (sub_paths.head || sub_paths.any)) {
oxr_source_cache_stop_output(log, sess, &act_attached->head); oxr_action_cache_stop_output(log, sess, &act_attached->head);
} }
if (act_attached->left.current.active && (sub_paths.left || sub_paths.any)) { if (act_attached->left.current.active && (sub_paths.left || sub_paths.any)) {
oxr_source_cache_stop_output(log, sess, &act_attached->left); oxr_action_cache_stop_output(log, sess, &act_attached->left);
} }
if (act_attached->right.current.active && (sub_paths.right || sub_paths.any)) { if (act_attached->right.current.active && (sub_paths.right || sub_paths.any)) {
oxr_source_cache_stop_output(log, sess, &act_attached->right); oxr_action_cache_stop_output(log, sess, &act_attached->right);
} }
if (act_attached->gamepad.current.active && (sub_paths.gamepad || sub_paths.any)) { if (act_attached->gamepad.current.active && (sub_paths.gamepad || sub_paths.any)) {
oxr_source_cache_stop_output(log, sess, &act_attached->gamepad); oxr_action_cache_stop_output(log, sess, &act_attached->gamepad);
} }
// clang-format on // clang-format on

View file

@ -388,7 +388,7 @@ oxr_classify_sub_action_paths(struct oxr_logger *log,
* @public @memberof oxr_session * @public @memberof oxr_session
*/ */
XrResult XrResult
oxr_source_get_pose_input(struct oxr_logger *log, oxr_action_get_pose_input(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
uint32_t key, uint32_t key,
const struct oxr_sub_paths *sub_paths, const struct oxr_sub_paths *sub_paths,
@ -1428,7 +1428,7 @@ struct oxr_action_output
* *
* @see oxr_action_attachment * @see oxr_action_attachment
*/ */
struct oxr_source_cache struct oxr_action_cache
{ {
struct oxr_action_state current; struct oxr_action_state current;
@ -1472,11 +1472,11 @@ struct oxr_action_attachment
struct oxr_action_state any_state; struct oxr_action_state any_state;
struct oxr_source_cache user; struct oxr_action_cache user;
struct oxr_source_cache head; struct oxr_action_cache head;
struct oxr_source_cache left; struct oxr_action_cache left;
struct oxr_source_cache right; struct oxr_action_cache right;
struct oxr_source_cache gamepad; struct oxr_action_cache gamepad;
}; };
/*! /*!

View file

@ -235,7 +235,7 @@ oxr_space_action_relation(struct oxr_logger *log,
return XR_SUCCESS; return XR_SUCCESS;
} }
oxr_source_get_pose_input(log, sess, act_spc->act_key, oxr_action_get_pose_input(log, sess, act_spc->act_key,
&act_spc->sub_paths, &input); &act_spc->sub_paths, &input);
// If the input isn't active. // If the input isn't active.