mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-21 09:31:33 -08:00
Wait 3s when the session is not running before calling on_unfocused
This commit is contained in:
1 parent
e584d9607f
commit
52be025d51
2 files changed
+12
-4
No files matched your search
@@ -1369,7 +1369,7 @@ void application::load_locale()
|
||||
std::locale::global(loc);
|
||||
}
|
||||
|
||||
std::pair<XrAction, XrActionType> application::get_action(const std::string & requested_name)
|
||||
std::pair<XrAction, XrActionType> application::get_action(std::string_view requested_name)
|
||||
{
|
||||
for (const auto & [action, type, name]: instance().actions)
|
||||
{
|
||||
@@ -1567,15 +1567,21 @@ void application::loop()
|
||||
poll_events();
|
||||
|
||||
auto scene = current_scene();
|
||||
if (!is_session_running())
|
||||
if (not is_session_running())
|
||||
{
|
||||
if (scene)
|
||||
if (not timestamp_unsynchronized)
|
||||
timestamp_unsynchronized = std::chrono::steady_clock::now();
|
||||
|
||||
if (scene and std::chrono::steady_clock::now() - *timestamp_unsynchronized > 3s)
|
||||
scene->set_focused(false);
|
||||
|
||||
// Throttle loop since xrWaitFrame won't be called.
|
||||
std::this_thread::sleep_for(250ms);
|
||||
}
|
||||
else
|
||||
{
|
||||
timestamp_unsynchronized.reset();
|
||||
|
||||
if (scene)
|
||||
{
|
||||
poll_actions();
|
||||
|
||||
Reference in new issue
Block a user