st/oxr: Tidy events code [NFC]

This commit is contained in:
Jakob Bornecrantz 2023-12-12 19:28:21 +00:00
parent 1cad1baed0
commit 69ab1f486c
2 changed files with 37 additions and 33 deletions

View file

@ -134,6 +134,7 @@ is_session_link_to_event(struct oxr_event *event, XrSession session)
}
}
/*
*
* 'Exported' functions.
@ -166,7 +167,6 @@ oxr_event_push_XrEventDataSessionStateChanged(struct oxr_logger *log,
return XR_SUCCESS;
}
XrResult
oxr_event_push_XrEventDataInteractionProfileChanged(struct oxr_logger *log, struct oxr_session *sess)
{
@ -186,6 +186,30 @@ oxr_event_push_XrEventDataInteractionProfileChanged(struct oxr_logger *log, stru
return XR_SUCCESS;
}
#ifdef OXR_HAVE_FB_display_refresh_rate
XrResult
oxr_event_push_XrEventDataDisplayRefreshRateChangedFB(struct oxr_logger *log,
struct oxr_session *sess,
float fromDisplayRefreshRate,
float toDisplayRefreshRate)
{
struct oxr_instance *inst = sess->sys->inst;
XrEventDataDisplayRefreshRateChangedFB *changed;
struct oxr_event *event = NULL;
ALLOC(log, inst, &event, &changed);
changed->type = XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB;
changed->fromDisplayRefreshRate = fromDisplayRefreshRate;
changed->toDisplayRefreshRate = toDisplayRefreshRate;
event->result = XR_SUCCESS;
lock(inst);
push(inst, event);
unlock(inst);
return XR_SUCCESS;
}
#endif // OXR_HAVE_FB_display_refresh_rate
XrResult
oxr_event_push_XrEventDataMainSessionVisibilityChangedEXTX(struct oxr_logger *log,
struct oxr_session *sess,
@ -268,27 +292,3 @@ oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuf
return ret;
}
#ifdef OXR_HAVE_FB_display_refresh_rate
XrResult
oxr_event_push_XrEventDataDisplayRefreshRateChangedFB(struct oxr_logger *log,
struct oxr_session *sess,
float fromDisplayRefreshRate,
float toDisplayRefreshRate)
{
struct oxr_instance *inst = sess->sys->inst;
XrEventDataDisplayRefreshRateChangedFB *changed;
struct oxr_event *event = NULL;
ALLOC(log, inst, &event, &changed);
changed->type = XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB;
changed->fromDisplayRefreshRate = fromDisplayRefreshRate;
changed->toDisplayRefreshRate = toDisplayRefreshRate;
event->result = XR_SUCCESS;
lock(inst);
push(inst, event);
unlock(inst);
return XR_SUCCESS;
}
#endif // OXR_HAVE_FB_display_refresh_rate

View file

@ -928,26 +928,19 @@ oxr_system_get_eye_gaze_support(struct oxr_logger *log, struct oxr_instance *ins
bool
oxr_system_get_force_feedback_support(struct oxr_logger *log, struct oxr_instance *inst);
/*
*
* oxr_event.cpp
*
*/
XrResult
oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData);
XrResult
oxr_event_push_XrEventDataSessionStateChanged(struct oxr_logger *log,
struct oxr_session *sess,
XrSessionState state,
XrTime time);
XrResult
oxr_event_push_XrEventDataMainSessionVisibilityChangedEXTX(struct oxr_logger *log,
struct oxr_session *sess,
bool visible);
XrResult
oxr_event_push_XrEventDataInteractionProfileChanged(struct oxr_logger *log, struct oxr_session *sess);
@ -959,12 +952,23 @@ oxr_event_push_XrEventDataDisplayRefreshRateChangedFB(struct oxr_logger *log,
float toDisplayRefreshRate);
#endif // OXR_HAVE_FB_display_refresh_rate
XrResult
oxr_event_push_XrEventDataMainSessionVisibilityChangedEXTX(struct oxr_logger *log,
struct oxr_session *sess,
bool visible);
/*!
* This clears all pending events refers to the given session.
*/
XrResult
oxr_event_remove_session_events(struct oxr_logger *log, struct oxr_session *sess);
/*!
* Will return one event if available, also drain the sessions event queues.
*/
XrResult
oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData);
/*
*