Monado OpenXR Runtime
u_debug_gui.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// Copyright 2024-2025, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief SDL2 Debug UI implementation
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Moshi Turner <moshiturner@protonmail.com>
9 */
10
11#pragma once
12
13#include "xrt/xrt_compiler.h"
14
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#define U_DEBUG_GUI_WINDOW_TITLE_MAX (256)
21
22struct xrt_instance;
24
25struct u_debug_gui;
26
27/*!
28 * Controls if the debug gui window is opened, allowing code to always call
29 * create and progmatically or external control if the window is opened.
30 *
31 * @ingroup aux_util
32 */
34{
35 //! Opens the window if the environmental variable XRT_DEBUG_GUI is true.
37 //! Always (if supported) opens the window.
39 //! Never opens the window.
41};
42
43/*!
44 * Argument to the function @ref u_debug_gui_create.
45 *
46 * @ingroup aux_util
47 */
49{
50 char window_title[U_DEBUG_GUI_WINDOW_TITLE_MAX];
51
52 enum u_debug_gui_open open;
53};
54
55/*!
56 * Creates the debug gui, may not create it.
57 *
58 * If the debug gui is disabled through the means listed below this function
59 * will return 0, but not create any struct and set @p out_debug_gui to NULL.
60 * It is safe to call the other functions with a NULL @p debug_gui argument.
61 *
62 * The window will be disabled and 0 returned if:
63 * * Monado was compiled without the needed dependencies, like SDL.
64 * * The @p open field on the info struct set to NEVER.
65 * * The XRT_DEBUG_GUI env variable is false (or unset).
66 *
67 * @ingroup aux_util
68 */
69int
70u_debug_gui_create(const struct u_debug_gui_create_info *info, struct u_debug_gui **out_debug_gui);
71
72/*!
73 * Starts the debug gui, also passes in some structs that might be needed.
74 *
75 * @ingroup aux_util
76 */
77void
78u_debug_gui_start(struct u_debug_gui *debug_gui, struct xrt_instance *xinst, struct xrt_system_devices *xsysd);
79
80/*!
81 * Stops the debug gui, closing the window and freeing resources.
82 *
83 * @ingroup aux_util
84 */
85void
86u_debug_gui_stop(struct u_debug_gui **debug_gui);
87
88
89#ifdef __cplusplus
90}
91#endif
u_debug_gui_open
Controls if the debug gui window is opened, allowing code to always call create and progmatically or ...
Definition: u_debug_gui.h:34
int u_debug_gui_create(const struct u_debug_gui_create_info *info, struct u_debug_gui **out_debug_gui)
Creates the debug gui, may not create it.
Definition: u_debug_gui.c:20
void u_debug_gui_start(struct u_debug_gui *debug_gui, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
Starts the debug gui, also passes in some structs that might be needed.
Definition: u_debug_gui.c:26
void u_debug_gui_stop(struct u_debug_gui **debug_gui)
Stops the debug gui, closing the window and freeing resources.
Definition: u_debug_gui.c:32
@ U_DEBUG_GUI_OPEN_AUTO
Opens the window if the environmental variable XRT_DEBUG_GUI is true.
Definition: u_debug_gui.h:36
@ U_DEBUG_GUI_OPEN_NEVER
Never opens the window.
Definition: u_debug_gui.h:40
@ U_DEBUG_GUI_OPEN_ALWAYS
Always (if supported) opens the window.
Definition: u_debug_gui.h:38
Argument to the function u_debug_gui_create.
Definition: u_debug_gui.h:49
This interface acts as a root object for Monado.
Definition: xrt_instance.h:114
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition: xrt_system.h:222
Header holding common defines.