Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_subaction.h
Go to the documentation of this file.
1// Copyright 2020, Collabora, Ltd.
2// Copyright 2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Provides a utility macro for dealing with subaction paths
7 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
8 * @ingroup oxr_input
9 */
10
11#pragma once
12
13/*!
14 * Expansion macro (x-macro) that calls the macro you pass with the shorthand
15 * name of each valid subaction path.
16 *
17 * Use to generate code that checks each subaction path in sequence, etc.
18 *
19 * If you also want the bogus subaction path of just plain `/user`, then see
20 * OXR_FOR_EACH_SUBACTION_PATH()
21 *
22 * @note Keep this synchronized with OXR_ACTION_GET_FILLER!
23 */
24#define OXR_FOR_EACH_VALID_SUBACTION_PATH(_) \
25 _(left) \
26 _(right) \
27 _(head) \
28 _(gamepad) \
29 _(eyes)
30
31
32/*!
33 * Expansion macro (x-macro) that calls the macro you pass with the shorthand
34 * name of each subaction path, including just bare `user`.
35 *
36 * Use to generate code that checks each subaction path in sequence, etc.
37 *
38 * @note Keep this synchronized with OXR_ACTION_GET_FILLER!
39 */
40#define OXR_FOR_EACH_SUBACTION_PATH(_) \
41 OXR_FOR_EACH_VALID_SUBACTION_PATH(_) \
42 _(user)
43
44/*!
45 * Expansion macro (x-macro) that calls the macro you pass for each valid
46 * subaction path, with the shorthand name of each subaction path, the same
47 * name capitalized, and the corresponding path string.
48 *
49 * If you also want the bogus subaction path of just plain `/user`, then see
50 * OXR_FOR_EACH_SUBACTION_PATH_DETAILED()
51 *
52 * Use to generate code that checks each subaction path in sequence, etc.
53 *
54 * Most of the time you can just use OXR_FOR_EACH_VALID_SUBACTION_PATH() or
55 * OXR_FOR_EACH_SUBACTION_PATH()
56 */
57#define OXR_FOR_EACH_VALID_SUBACTION_PATH_DETAILED(_) \
58 _(left, LEFT, "/user/hand/left") \
59 _(right, RIGHT, "/user/hand/right") \
60 _(head, HEAD, "/user/head") \
61 _(gamepad, GAMEPAD, "/user/gamepad") \
62 _(eyes, EYES, "/user/eyes_ext")
63
64/*!
65 * Expansion macro (x-macro) that calls the macro you pass for each subaction
66 * path (including the bare `/user`), with the shorthand name of each subaction
67 * path, the same name capitalized, and the corresponding path string.
68 *
69 * Use to generate code that checks each subaction path in sequence, etc.
70 *
71 * Most of the time you can just use OXR_FOR_EACH_VALID_SUBACTION_PATH() or
72 * OXR_FOR_EACH_SUBACTION_PATH()
73 */
74#define OXR_FOR_EACH_SUBACTION_PATH_DETAILED(_) \
75 OXR_FOR_EACH_VALID_SUBACTION_PATH_DETAILED(_) \
76 _(user, USER, "/user")