The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

st/oxr: Make oxr_binding_find_bindings_from_key more readable

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2431>

authored by

Christoph Haag and committed by
Marge Bot
5c4b1da5 a5b1ef94

+11 -11
+8 -8
src/xrt/state_trackers/oxr/oxr_binding.c
··· 398 398 399 399 void 400 400 oxr_binding_find_bindings_from_key(struct oxr_logger *log, 401 - struct oxr_interaction_profile *p, 401 + struct oxr_interaction_profile *profile, 402 402 uint32_t key, 403 403 size_t max_bounding_count, 404 - struct oxr_binding **bindings, 404 + struct oxr_binding **out_bindings, 405 405 size_t *out_binding_count) 406 406 { 407 - if (p == NULL) { 407 + if (profile == NULL) { 408 408 *out_binding_count = 0; 409 409 return; 410 410 } ··· 416 416 * Loop over all app provided bindings for this profile 417 417 * and return those matching the action. 418 418 */ 419 - for (size_t y = 0; y < p->binding_count; y++) { 420 - struct oxr_binding *b = &p->bindings[y]; 419 + for (size_t binding_index = 0; binding_index < profile->binding_count; binding_index++) { 420 + struct oxr_binding *profile_binding = &profile->bindings[binding_index]; 421 421 422 - for (size_t z = 0; z < b->key_count; z++) { 423 - if (b->keys[z] == key) { 424 - bindings[binding_count++] = b; 422 + for (size_t key_index = 0; key_index < profile_binding->key_count; key_index++) { 423 + if (profile_binding->keys[key_index] == key) { 424 + out_bindings[binding_count++] = profile_binding; 425 425 break; 426 426 } 427 427 }
+1 -1
src/xrt/state_trackers/oxr/oxr_input.c
··· 735 735 profile, // p 736 736 act_ref->act_key, // key 737 737 ARRAY_SIZE(binding_points), // max_bounding_count 738 - binding_points, // bindings 738 + binding_points, // out_bindings 739 739 &binding_count); // out_binding_count 740 740 if (binding_count == 0) { 741 741 oxr_slog(slog, "\t\t\tNo bindings!\n");
+2 -2
src/xrt/state_trackers/oxr/oxr_objects.h
··· 682 682 */ 683 683 void 684 684 oxr_binding_find_bindings_from_key(struct oxr_logger *log, 685 - struct oxr_interaction_profile *p, 685 + struct oxr_interaction_profile *profile, 686 686 uint32_t key, 687 687 size_t max_bounding_count, 688 - struct oxr_binding **bindings, 688 + struct oxr_binding **out_bindings, 689 689 size_t *out_binding_count); 690 690 691 691 /*!