Monado OpenXR Runtime
Loading...
Searching...
No Matches
openvr_events.hpp
Go to the documentation of this file.
1// Copyright 2026, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Implementation of OpenVR event handling and related functionality.
6 *
7 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
8 * @ingroup openvr
9 */
10
11#pragma once
12
13#include "xrt/xrt_session.h"
14
15#include "util/u_time.h"
16
18
19#include "openvr_interfaces_unified.h"
20
21#include <queue>
22
23
24namespace xrt::state_trackers::openvr {
25
26struct Event
27{
28 timepoint_ns timestamp;
29 vr::VREvent_t event;
30};
31
32struct Events
33{
34private: // Fields
35 xrt_session *xs{nullptr};
36
37 bool visible{false};
38 bool focused{false};
39
40 std::queue<Event> event_queue{};
41
42public: // Methods
44
45 void
46 TrackedDeviceActivated(vr::TrackedDeviceIndex_t index);
47
48 //! Handles active XRT session events, and pushes corresponding OpenVR events to the event queue.
51
52 //! Polls a single event from the event queue, if no event is available then `false` will be returned.
53 bool
54 PollEvent(openvr_logger &logger, vr::VREvent_t &out_event, uint32_t event_size);
55};
56
57}; // namespace xrt::state_trackers::openvr
int64_t timepoint_ns
Integer timestamp type.
Definition u_time.h:77
enum xrt_result xrt_result_t
Result type used across Monado.
Logging functions.
Definition openvr_events.hpp:27
Definition openvr_events.hpp:33
xrt_result_t HandleSessionEvents(openvr_logger &logger)
Handles active XRT session events, and pushes corresponding OpenVR events to the event queue.
Definition openvr_events.cpp:139
bool PollEvent(openvr_logger &logger, vr::VREvent_t &out_event, uint32_t event_size)
Polls a single event from the event queue, if no event is available then false will be returned.
Definition openvr_events.cpp:208
Definition openvr_logger.hpp:30
The XRT representation of XrSession, this object does not have all of the functionality of a session,...
Definition xrt_session.h:277
Time-keeping: a clock that is steady, convertible to system time, and ideally high-resolution.
Header for session object.