Showing the changes to interface/src/Application.cpp (1 of 94 files). Show all
Unified · Split
| @@ -136,7 +136,6 @@ · 135 unmodified lines | ||
| 136 | 136 | #include <SoundCacheScriptingInterface.h> |
| 137 | 137 | #include <ui/TabletScriptingInterface.h> |
| 138 | 138 | #include <ui/ToolbarScriptingInterface.h> |
| 139 | −#include <InteractiveWindow.h> | |
| 140 | 139 | #include <Tooltip.h> |
| 141 | 140 | #include <udt/PacketHeaders.h> |
| 142 | 141 | #include <UserActivityLogger.h> |
| @@ -213,6 +212,7 @@ · 70 unmodified lines | ||
| 213 | 212 | #include "ui/UpdateDialog.h" |
| 214 | 213 | #include "ui/DomainConnectionModel.h" |
| 215 | 214 | #include "ui/Keyboard.h" |
| 215 | +#include "ui/InteractiveWindow.h" | |
| 216 | 216 | #include "Util.h" |
| 217 | 217 | #include "InterfaceParentFinder.h" |
| 218 | 218 | #include "ui/OctreeStatsProvider.h" |
| @@ -374,7 +374,12 @@ const std::vector<std::pair<QString, Application::AcceptURLMethod>> Application: · 155 unmodified lines | ||
| 374 | 374 | class DeadlockWatchdogThread : public QThread { |
| 375 | 375 | public: |
| 376 | 376 | static const unsigned long HEARTBEAT_UPDATE_INTERVAL_SECS = 1; |
| 377 | + // TODO: go back to 2 min across the board, after figuring out the issues with mac | |
| 378 | +#if defined(Q_OS_MAC) | |
| 379 | + static const unsigned long MAX_HEARTBEAT_AGE_USECS = 600 * USECS_PER_SECOND; // 10 mins with no checkin probably a deadlock, right now, on MAC | |
| 380 | +#else | |
| 377 | 381 | static const unsigned long MAX_HEARTBEAT_AGE_USECS = 120 * USECS_PER_SECOND; // 2 mins with no checkin probably a deadlock |
| 382 | +#endif | |
| 378 | 383 | static const int WARNING_ELAPSED_HEARTBEAT = 500 * USECS_PER_MSEC; // warn if elapsed heartbeat average is large |
| 379 | 384 | static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples |
| 380 | 385 | |
| @@ -554,7 +559,10 @@ public: · 173 unmodified lines | ||
| 554 | 559 | return true; |
| 555 | 560 | } |
| 556 | 561 | } |
| 557 | − | |
| 562 | + // Attempting to close MIDI interfaces of a hot-unplugged device can result in audio-driver deadlock. | |
| 563 | + // Detecting MIDI devices that have been added/removed after starting Inteface has been disabled. | |
| 564 | + // https://support.microsoft.com/en-us/help/4460006/midi-device-app-hangs-when-former-midi-api-is-used | |
| 565 | +#if 0 | |
| 558 | 566 | if (message->message == WM_DEVICECHANGE) { |
| 559 | 567 | const float MIN_DELTA_SECONDS = 2.0f; // de-bounce signal |
| 560 | 568 | static float lastTriggerTime = 0.0f; |
| @@ -564,6 +572,7 @@ public: · 3 unmodified lines | ||
| 564 | 572 | Midi::USBchanged(); // re-scan the MIDI bus |
| 565 | 573 | } |
| 566 | 574 | } |
| 575 | +#endif | |
| 567 | 576 | } |
| 568 | 577 | return false; |
| 569 | 578 | } |
| @@ -661,9 +670,10 @@ private: · 91 unmodified lines | ||
| 661 | 670 | |
| 662 | 671 | /**jsdoc |
| 663 | 672 | * <p>The <code>Controller.Hardware.Application</code> object has properties representing Interface's state. The property |
| 664 | − * values are integer IDs, uniquely identifying each output. <em>Read-only.</em> These can be mapped to actions or functions or | |
| 665 | − * <code>Controller.Standard</code> items in a {@link RouteObject} mapping (e.g., using the {@link RouteObject#when} method). | |
| 666 | − * Each data value is either <code>1.0</code> for "true" or <code>0.0</code> for "false".</p> | |
| 673 | + * values are integer IDs, uniquely identifying each output. <em>Read-only.</em></p> | |
| 674 | + * <p>These states can be mapped to actions or functions or <code>Controller.Standard</code> items in a {@link RouteObject} | |
| 675 | + * mapping (e.g., using the {@link RouteObject#when} method). Each data value is either <code>1.0</code> for "true" or | |
| 676 | + * <code>0.0</code> for "false".</p> | |
| 667 | 677 | * <table> |
| 668 | 678 | * <thead> |
| 669 | 679 | * <tr><th>Property</th><th>Type</th><th>Data</th><th>Description</th></tr> |
| @@ -677,13 +687,17 @@ private: · 7 unmodified lines | ||
| 677 | 687 | * <tr><td><code>CameraIndependent</code></td><td>number</td><td>number</td><td>The camera is in independent mode.</td></tr> |
| 678 | 688 | * <tr><td><code>CameraEntity</code></td><td>number</td><td>number</td><td>The camera is in entity mode.</td></tr> |
| 679 | 689 | * <tr><td><code>InHMD</code></td><td>number</td><td>number</td><td>The user is in HMD mode.</td></tr> |
| 680 | − * <tr><td><code>AdvancedMovement</code></td><td>number</td><td>number</td><td>Advanced movement controls are enabled. | |
| 681 | − * </td></tr> | |
| 690 | + * <tr><td><code>AdvancedMovement</code></td><td>number</td><td>number</td><td>Advanced movement (walking) controls are | |
| 691 | + * enabled.</td></tr> | |
| 692 | + * <tr><td><code>StrafeEnabled</code></td><td>number</td><td>number</td><td>Strafing is enabled</td></tr> | |
| 682 | 693 | * <tr><td><code>LeftHandDominant</code></td><td>number</td><td>number</td><td>Dominant hand set to left.</td></tr> |
| 683 | 694 | * <tr><td><code>RightHandDominant</code></td><td>number</td><td>number</td><td>Dominant hand set to right.</td></tr> |
| 684 | 695 | * <tr><td><code>SnapTurn</code></td><td>number</td><td>number</td><td>Snap turn is enabled.</td></tr> |
| 685 | 696 | * <tr><td><code>Grounded</code></td><td>number</td><td>number</td><td>The user's avatar is on the ground.</td></tr> |
| 686 | 697 | * <tr><td><code>NavigationFocused</code></td><td>number</td><td>number</td><td><em>Not used.</em></td></tr> |
| 698 | + * <tr><td><code>PlatformWindows</code></td><td>number</td><td>number</td><td>The operating system is Windows.</td></tr> | |
| 699 | + * <tr><td><code>PlatformMac</code></td><td>number</td><td>number</td><td>The operating system is Mac.</td></tr> | |
| 700 | + * <tr><td><code>PlatformAndroid</code></td><td>number</td><td>number</td><td>The operating system is Android.</td></tr> | |
| 687 | 701 | * </tbody> |
| 688 | 702 | * </table> |
| 689 | 703 | * @typedef {object} Controller.Hardware-Application |
| @@ -1052,6 +1066,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 362 unmodified lines | ||
| 1052 | 1066 | } |
| 1053 | 1067 | } |
| 1054 | 1068 | |
| 1069 | + { | |
| 1070 | + // identify gpu as early as possible to help identify OpenGL initialization errors. | |
| 1071 | + auto gpuIdent = GPUIdent::getInstance(); | |
| 1072 | + setCrashAnnotation("gpu_name", gpuIdent->getName().toStdString()); | |
| 1073 | + setCrashAnnotation("gpu_driver", gpuIdent->getDriver().toStdString()); | |
| 1074 | + setCrashAnnotation("gpu_memory", std::to_string(gpuIdent->getMemory())); | |
| 1075 | + } | |
| 1076 | + | |
| 1055 | 1077 | // make sure the debug draw singleton is initialized on the main thread. |
| 1056 | 1078 | DebugDraw::getInstance().removeMarker(""); |
| 1057 | 1079 | |
| @@ -1327,7 +1349,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 269 unmodified lines | ||
| 1327 | 1349 | setCrashAnnotation("avatar", avatarURL.toString().toStdString()); |
| 1328 | 1350 | }); |
| 1329 | 1351 | |
| 1330 | − | |
| 1331 | 1352 | // Inititalize sample before registering |
| 1332 | 1353 | _sampleSound = DependencyManager::get<SoundCache>()->getSound(PathUtils::resourcesUrl("sounds/sample.wav")); |
| 1333 | 1354 | |
| @@ -1418,6 +1439,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 84 unmodified lines | ||
| 1418 | 1439 | initializeDisplayPlugins(); |
| 1419 | 1440 | qCDebug(interfaceapp, "Initialized Display"); |
| 1420 | 1441 | |
| 1442 | + if (_displayPlugin && !_displayPlugin->isHmd()) { | |
| 1443 | + _preferredCursor.set(Cursor::Manager::getIconName(Cursor::Icon::SYSTEM)); | |
| 1444 | + showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get())); | |
| 1445 | + } | |
| 1421 | 1446 | // An audio device changed signal received before the display plugins are set up will cause a crash, |
| 1422 | 1447 | // so we defer the setup of the `scripting::Audio` class until this point |
| 1423 | 1448 | { |
| @@ -1437,8 +1462,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 13 unmodified lines | ||
| 1437 | 1462 | audioScriptingInterface->environmentMuted(); |
| 1438 | 1463 | } |
| 1439 | 1464 | }); |
| 1440 | − connect(this, &Application::activeDisplayPluginChanged, | |
| 1441 | − reinterpret_cast<scripting::Audio*>(audioScriptingInterface.data()), &scripting::Audio::onContextChanged); | |
| 1465 | + QSharedPointer<scripting::Audio> scriptingAudioSharedPointer = qSharedPointerDynamicCast<scripting::Audio>(DependencyManager::get<AudioScriptingInterface>()); | |
| 1466 | + if (scriptingAudioSharedPointer) { | |
| 1467 | + connect(this, &Application::activeDisplayPluginChanged, | |
| 1468 | + scriptingAudioSharedPointer.data(), &scripting::Audio::onContextChanged); | |
| 1469 | + } | |
| 1442 | 1470 | } |
| 1443 | 1471 | |
| 1444 | 1472 | // Create the rendering engine. This can be slow on some machines due to lots of |
| @@ -1631,7 +1659,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 186 unmodified lines | ||
| 1631 | 1659 | connect(userInputMapper.data(), &UserInputMapper::actionEvent, [this](int action, float state) { |
| 1632 | 1660 | using namespace controller; |
| 1633 | 1661 | auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); |
| 1634 | − auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data()); | |
| 1662 | + QSharedPointer<scripting::Audio> audioScriptingInterface = qSharedPointerDynamicCast<scripting::Audio>(DependencyManager::get<AudioScriptingInterface>()); | |
| 1635 | 1663 | { |
| 1636 | 1664 | auto actionEnum = static_cast<Action>(action); |
| 1637 | 1665 | int key = Qt::Key_unknown; |
| @@ -1639,10 +1667,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1 unmodified line | ||
| 1639 | 1667 | bool navAxis = false; |
| 1640 | 1668 | switch (actionEnum) { |
| 1641 | 1669 | case Action::TOGGLE_PUSHTOTALK: |
| 1642 | − if (state > 0.0f) { | |
| 1643 | − audioScriptingInterface->setPushingToTalk(true); | |
| 1644 | − } else if (state <= 0.0f) { | |
| 1645 | − audioScriptingInterface->setPushingToTalk(false); | |
| 1670 | + if (audioScriptingInterface) { | |
| 1671 | + if (state > 0.0f) { | |
| 1672 | + audioScriptingInterface->setPushingToTalk(true); | |
| 1673 | + } else if (state <= 0.0f) { | |
| 1674 | + audioScriptingInterface->setPushingToTalk(false); | |
| 1675 | + } | |
| 1646 | 1676 | } |
| 1647 | 1677 | break; |
| 1648 | 1678 | |
| @@ -2764,14 +2794,14 @@ Application::~Application() { · 1115 unmodified lines | ||
| 2764 | 2794 | avatarManager->handleProcessedPhysicsTransaction(transaction); |
| 2765 | 2795 | |
| 2766 | 2796 | avatarManager->deleteAllAvatars(); |
| 2767 | − | |
| 2797 | + | |
| 2768 | 2798 | auto myCharacterController = getMyAvatar()->getCharacterController(); |
| 2769 | 2799 | myCharacterController->clearDetailedMotionStates(); |
| 2770 | − | |
| 2800 | + | |
| 2771 | 2801 | myCharacterController->buildPhysicsTransaction(transaction); |
| 2772 | 2802 | _physicsEngine->processTransaction(transaction); |
| 2773 | 2803 | myCharacterController->handleProcessedPhysicsTransaction(transaction); |
| 2774 | − | |
| 2804 | + | |
| 2775 | 2805 | _physicsEngine->setCharacterController(nullptr); |
| 2776 | 2806 | |
| 2777 | 2807 | // the _shapeManager should have zero references |
| @@ -2903,7 +2933,7 @@ void Application::initializeGL() { · 125 unmodified lines | ||
| 2903 | 2933 | |
| 2904 | 2934 | #if !defined(DISABLE_QML) |
| 2905 | 2935 | QStringList chromiumFlags; |
| 2906 | − // Bug 21993: disable microphone and camera input | |
| 2936 | + // Bug 21993: disable microphone and camera input | |
| 2907 | 2937 | chromiumFlags << "--use-fake-device-for-media-stream"; |
| 2908 | 2938 | // Disable signed distance field font rendering on ATI/AMD GPUs, due to |
| 2909 | 2939 | // https://highfidelity.manuscript.com/f/cases/13677/Text-showing-up-white-on-Marketplace-app |
| @@ -3374,6 +3404,7 @@ void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditiona · 464 unmodified lines | ||
| 3374 | 3404 | surfaceContext->setContextProperty("KeyboardScriptingInterface", DependencyManager::get<KeyboardScriptingInterface>().data()); |
| 3375 | 3405 | |
| 3376 | 3406 | if (setAdditionalContextProperties) { |
| 3407 | + qDebug() << "setting additional context properties!"; | |
| 3377 | 3408 | auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); |
| 3378 | 3409 | auto flags = tabletScriptingInterface->getFlags(); |
| 3379 | 3410 | |
| @@ -3588,7 +3619,14 @@ void Application::setPreferAvatarFingerOverStylus(bool value) { · 208 unmodified lines | ||
| 3588 | 3619 | |
| 3589 | 3620 | void Application::setPreferredCursor(const QString& cursorName) { |
| 3590 | 3621 | qCDebug(interfaceapp) << "setPreferredCursor" << cursorName; |
| 3591 | − _preferredCursor.set(cursorName.isEmpty() ? DEFAULT_CURSOR_NAME : cursorName); | |
| 3622 | + | |
| 3623 | + if (_displayPlugin && _displayPlugin->isHmd()) { | |
| 3624 | + _preferredCursor.set(cursorName.isEmpty() ? DEFAULT_CURSOR_NAME : cursorName); | |
| 3625 | + } | |
| 3626 | + else { | |
| 3627 | + _preferredCursor.set(cursorName.isEmpty() ? Cursor::Manager::getIconName(Cursor::Icon::SYSTEM) : cursorName); | |
| 3628 | + } | |
| 3629 | + | |
| 3592 | 3630 | showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get())); |
| 3593 | 3631 | } |
| 3594 | 3632 | |
| @@ -3992,8 +4030,8 @@ bool Application::notify(QObject * object, QEvent * event) { · 397 unmodified lines | ||
| 3992 | 4030 | if (thread() == QThread::currentThread()) { |
| 3993 | 4031 | PROFILE_RANGE_IF_LONGER(app, "notify", 2) |
| 3994 | 4032 | return QApplication::notify(object, event); |
| 3995 | − } | |
| 3996 | − | |
| 4033 | + } | |
| 4034 | + | |
| 3997 | 4035 | return QApplication::notify(object, event); |
| 3998 | 4036 | } |
| 3999 | 4037 | |
| @@ -4054,9 +4092,6 @@ bool Application::event(QEvent* event) { · 54 unmodified lines | ||
| 4054 | 4092 | case QEvent::KeyRelease: |
| 4055 | 4093 | keyReleaseEvent(static_cast<QKeyEvent*>(event)); |
| 4056 | 4094 | return true; |
| 4057 | − case QEvent::FocusIn: | |
| 4058 | − focusInEvent(static_cast<QFocusEvent*>(event)); | |
| 4059 | − return true; | |
| 4060 | 4095 | case QEvent::FocusOut: |
| 4061 | 4096 | focusOutEvent(static_cast<QFocusEvent*>(event)); |
| 4062 | 4097 | return true; |
| @@ -4099,6 +4134,11 @@ bool Application::eventFilter(QObject* object, QEvent* event) { · 36 unmodified lines | ||
| 4099 | 4134 | return true; |
| 4100 | 4135 | } |
| 4101 | 4136 | |
| 4137 | + auto eventType = event->type(); | |
| 4138 | + if (eventType == QEvent::KeyPress || eventType == QEvent::KeyRelease || eventType == QEvent::MouseMove) { | |
| 4139 | + getRefreshRateManager().resetInactiveTimer(); | |
| 4140 | + } | |
| 4141 | + | |
| 4102 | 4142 | if (event->type() == QEvent::Leave) { |
| 4103 | 4143 | getApplicationCompositor().handleLeaveEvent(); |
| 4104 | 4144 | } |
| @@ -4288,6 +4328,10 @@ void Application::keyPressEvent(QKeyEvent* event) { · 183 unmodified lines | ||
| 4288 | 4328 | if (isMeta) { |
| 4289 | 4329 | auto audioClient = DependencyManager::get<AudioClient>(); |
| 4290 | 4330 | audioClient->setMuted(!audioClient->isMuted()); |
| 4331 | + QSharedPointer<scripting::Audio> audioScriptingInterface = qSharedPointerDynamicCast<scripting::Audio>(DependencyManager::get<AudioScriptingInterface>()); | |
| 4332 | + if (audioScriptingInterface && audioScriptingInterface->getPTT()) { | |
| 4333 | + audioScriptingInterface->setPushingToTalk(!audioClient->isMuted()); | |
| 4334 | + } | |
| 4291 | 4335 | } |
| 4292 | 4336 | break; |
| 4293 | 4337 | |
| @@ -4410,13 +4454,6 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 116 unmodified lines | ||
| 4410 | 4454 | |
| 4411 | 4455 | } |
| 4412 | 4456 | |
| 4413 | −void Application::focusInEvent(QFocusEvent* event) { | |
| 4414 | − if (!_aboutToQuit && _startUpFinished) { | |
| 4415 | − getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::RUNNING); | |
| 4416 | − } | |
| 4417 | −} | |
| 4418 | − | |
| 4419 | − | |
| 4420 | 4457 | void Application::focusOutEvent(QFocusEvent* event) { |
| 4421 | 4458 | auto inputPlugins = PluginManager::getInstance()->getInputPlugins(); |
| 4422 | 4459 | foreach(auto inputPlugin, inputPlugins) { |
| @@ -4424,10 +4461,6 @@ void Application::focusOutEvent(QFocusEvent* event) { · 1 unmodified line | ||
| 4424 | 4461 | inputPlugin->pluginFocusOutEvent(); |
| 4425 | 4462 | } |
| 4426 | 4463 | } |
| 4427 | − | |
| 4428 | − if (!_aboutToQuit && _startUpFinished) { | |
| 4429 | − getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::UNFOCUS); | |
| 4430 | − } | |
| 4431 | 4464 | // FIXME spacemouse code still needs cleanup |
| 4432 | 4465 | #if 0 |
| 4433 | 4466 | //SpacemouseDevice::getInstance().focusOutEvent(); |
| @@ -5038,7 +5071,7 @@ void Application::idle() { · 604 unmodified lines | ||
| 5038 | 5071 | } |
| 5039 | 5072 | } |
| 5040 | 5073 | #endif |
| 5041 | − | |
| 5074 | + | |
| 5042 | 5075 | checkChangeCursor(); |
| 5043 | 5076 | |
| 5044 | 5077 | #if !defined(DISABLE_QML) |
| @@ -5349,8 +5382,10 @@ void Application::loadSettings() { · 304 unmodified lines | ||
| 5349 | 5382 | } |
| 5350 | 5383 | } |
| 5351 | 5384 | |
| 5352 | − auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data()); | |
| 5353 | − audioScriptingInterface->loadData(); | |
| 5385 | + QSharedPointer<scripting::Audio> audioScriptingInterface = qSharedPointerDynamicCast<scripting::Audio>(DependencyManager::get<AudioScriptingInterface>()); | |
| 5386 | + if (audioScriptingInterface) { | |
| 5387 | + audioScriptingInterface->loadData(); | |
| 5388 | + } | |
| 5354 | 5389 | |
| 5355 | 5390 | getMyAvatar()->loadData(); |
| 5356 | 5391 | _settingsLoaded = true; |
| @@ -5361,8 +5396,10 @@ void Application::saveSettings() const { · 4 unmodified lines | ||
| 5361 | 5396 | DependencyManager::get<AudioClient>()->saveSettings(); |
| 5362 | 5397 | DependencyManager::get<LODManager>()->saveSettings(); |
| 5363 | 5398 | |
| 5364 | − auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data()); | |
| 5365 | − audioScriptingInterface->saveData(); | |
| 5399 | + QSharedPointer<scripting::Audio> audioScriptingInterface = qSharedPointerDynamicCast<scripting::Audio>(DependencyManager::get<AudioScriptingInterface>()); | |
| 5400 | + if (audioScriptingInterface) { | |
| 5401 | + audioScriptingInterface->saveData(); | |
| 5402 | + } | |
| 5366 | 5403 | |
| 5367 | 5404 | Menu::getInstance()->saveSettings(); |
| 5368 | 5405 | getMyAvatar()->saveData(); |
| @@ -5596,7 +5633,7 @@ void Application::resumeAfterLoginDialogActionTaken() { · 227 unmodified lines | ||
| 5596 | 5633 | _myCamera.setMode(_previousCameraMode); |
| 5597 | 5634 | cameraModeChanged(); |
| 5598 | 5635 | _startUpFinished = true; |
| 5599 | − getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::RUNNING); | |
| 5636 | + getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::FOCUS_ACTIVE); | |
| 5600 | 5637 | } |
| 5601 | 5638 | |
| 5602 | 5639 | void Application::loadAvatarScripts(const QVector<QString>& urls) { |
| @@ -5801,7 +5838,8 @@ void Application::cameraModeChanged() { · 198 unmodified lines | ||
| 5801 | 5838 | Menu::getInstance()->setIsOptionChecked(MenuOption::FullscreenMirror, true); |
| 5802 | 5839 | break; |
| 5803 | 5840 | default: |
| 5804 | − break; | |
| 5841 | + // we don't have menu items for the others, so just leave it alone. | |
| 5842 | + return; | |
| 5805 | 5843 | } |
| 5806 | 5844 | cameraMenuChanged(); |
| 5807 | 5845 | } |
| @@ -8453,28 +8491,30 @@ bool Application::takeSnapshotOperators(std::queue<SnapshotOperator>& snapshotOp · 2645 unmodified lines | ||
| 8453 | 8491 | |
| 8454 | 8492 | void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio, const QString& filename) { |
| 8455 | 8493 | addSnapshotOperator(std::make_tuple([notify, includeAnimated, aspectRatio, filename](const QImage& snapshot) { |
| 8456 | − QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8457 | − | |
| 8458 | − // If we're not doing an animated snapshot as well... | |
| 8459 | − if (!includeAnimated) { | |
| 8460 | − if (!path.isEmpty()) { | |
| 8461 | − // Tell the dependency manager that the capture of the still snapshot has taken place. | |
| 8462 | − emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify); | |
| 8463 | − } | |
| 8464 | − } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) { | |
| 8465 | − qApp->postLambdaEvent([path, aspectRatio] { | |
| 8494 | + qApp->postLambdaEvent([snapshot, notify, includeAnimated, aspectRatio, filename] { | |
| 8495 | + QString path = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8496 | + | |
| 8497 | + // If we're not doing an animated snapshot as well... | |
| 8498 | + if (!includeAnimated) { | |
| 8499 | + if (!path.isEmpty()) { | |
| 8500 | + // Tell the dependency manager that the capture of the still snapshot has taken place. | |
| 8501 | + emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify); | |
| 8502 | + } | |
| 8503 | + } else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) { | |
| 8466 | 8504 | // Get an animated GIF snapshot and save it |
| 8467 | 8505 | SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, DependencyManager::get<WindowScriptingInterface>()); |
| 8468 | − }); | |
| 8469 | − } | |
| 8506 | + } | |
| 8507 | + }); | |
| 8470 | 8508 | }, aspectRatio, true)); |
| 8471 | 8509 | } |
| 8472 | 8510 | |
| 8473 | 8511 | void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) { |
| 8474 | 8512 | addSnapshotOperator(std::make_tuple([notify, filename](const QImage& snapshot) { |
| 8475 | − QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8513 | + qApp->postLambdaEvent([snapshot, notify, filename] { | |
| 8514 | + QString snapshotPath = DependencyManager::get<Snapshot>()->saveSnapshot(snapshot, filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); | |
| 8476 | 8515 | |
| 8477 | − emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify); | |
| 8516 | + emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify); | |
| 8517 | + }); | |
| 8478 | 8518 | }, 0.0f, false)); |
| 8479 | 8519 | } |
| 8480 | 8520 | |
| @@ -8539,11 +8579,20 @@ void Application::activeChanged(Qt::ApplicationState state) { · 58 unmodified lines | ||
| 8539 | 8579 | switch (state) { |
| 8540 | 8580 | case Qt::ApplicationActive: |
| 8541 | 8581 | _isForeground = true; |
| 8582 | + if (!_aboutToQuit && _startUpFinished) { | |
| 8583 | + getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::FOCUS_ACTIVE); | |
| 8584 | + } | |
| 8542 | 8585 | break; |
| 8543 | 8586 | |
| 8544 | 8587 | case Qt::ApplicationSuspended: |
| 8588 | + break; | |
| 8545 | 8589 | case Qt::ApplicationHidden: |
| 8590 | + break; | |
| 8546 | 8591 | case Qt::ApplicationInactive: |
| 8592 | + if (!_aboutToQuit && _startUpFinished) { | |
| 8593 | + getRefreshRateManager().setRefreshRateRegime(RefreshRateManager::RefreshRateRegime::UNFOCUS); | |
| 8594 | + } | |
| 8595 | + break; | |
| 8547 | 8596 | default: |
| 8548 | 8597 | _isForeground = false; |
| 8549 | 8598 | break; |
| @@ -8874,7 +8923,7 @@ void Application::setDisplayPlugin(DisplayPluginPointer newDisplayPlugin) { · 324 unmodified lines | ||
| 8874 | 8923 | RefreshRateManager& refreshRateManager = getRefreshRateManager(); |
| 8875 | 8924 | refreshRateManager.setRefreshRateOperator(OpenGLDisplayPlugin::getRefreshRateOperator()); |
| 8876 | 8925 | bool isHmd = newDisplayPlugin->isHmd(); |
| 8877 | − RefreshRateManager::UXMode uxMode = isHmd ? RefreshRateManager::UXMode::HMD : | |
| 8926 | + RefreshRateManager::UXMode uxMode = isHmd ? RefreshRateManager::UXMode::VR : | |
| 8878 | 8927 | RefreshRateManager::UXMode::DESKTOP; |
| 8879 | 8928 | |
| 8880 | 8929 | refreshRateManager.setUXMode(uxMode); |