Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all
Unified · Split
| @@ -58,6 +58,7 @@ · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | #include <shared/FileUtils.h> |
| 60 | 60 | #include <shared/QtHelpers.h> |
| 61 | +#include <shared/PlatformHelper.h> | |
| 61 | 62 | #include <shared/GlobalAppProperties.h> |
| 62 | 63 | #include <StatTracker.h> |
| 63 | 64 | #include <Trace.h> |
| @@ -257,10 +258,6 @@ extern "C" { · 193 unmodified lines | ||
| 257 | 258 | } |
| 258 | 259 | #endif |
| 259 | 260 | |
| 260 | −#ifdef Q_OS_MAC | |
| 261 | −#include "MacHelper.h" | |
| 262 | −#endif | |
| 263 | − | |
| 264 | 261 | #if defined(Q_OS_ANDROID) |
| 265 | 262 | #include <android/log.h> |
| 266 | 263 | #include "AndroidHelper.h" |
| @@ -552,13 +549,6 @@ public: · 285 unmodified lines | ||
| 552 | 549 | return true; |
| 553 | 550 | } |
| 554 | 551 | |
| 555 | − if (message->message == WM_POWERBROADCAST) { | |
| 556 | − if (message->wParam == PBT_APMRESUMEAUTOMATIC) { | |
| 557 | − qCInfo(interfaceapp) << "Waking up from sleep or hybernation."; | |
| 558 | − QMetaObject::invokeMethod(DependencyManager::get<NodeList>().data(), "noteAwakening", Qt::QueuedConnection); | |
| 559 | − } | |
| 560 | − } | |
| 561 | − | |
| 562 | 552 | if (message->message == WM_COPYDATA) { |
| 563 | 553 | COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)(message->lParam); |
| 564 | 554 | QUrl url = QUrl((const char*)(pcds->lpData)); |
| @@ -964,9 +954,12 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 399 unmodified lines | ||
| 964 | 954 | DependencyManager::set<KeyboardScriptingInterface>(); |
| 965 | 955 | DependencyManager::set<GrabManager>(); |
| 966 | 956 | DependencyManager::set<AvatarPackager>(); |
| 967 | −#ifdef Q_OS_MAC | |
| 968 | − DependencyManager::set<MacHelper>(); | |
| 969 | −#endif | |
| 957 | + PlatformHelper::setup(); | |
| 958 | + | |
| 959 | + QObject::connect(DependencyManager::get<PlatformHelper>().get(), &PlatformHelper::systemWillWake, [] { | |
| 960 | + QMetaObject::invokeMethod(DependencyManager::get<NodeList>().data(), "noteAwakening", Qt::QueuedConnection); | |
| 961 | + }); | |
| 962 | + | |
| 970 | 963 | |
| 971 | 964 | QString setBookmarkValue = getCmdOption(argc, constArgv, "--setBookmark"); |
| 972 | 965 | if (!setBookmarkValue.isEmpty()) { |
| @@ -1172,6 +1165,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 199 unmodified lines | ||
| 1172 | 1165 | deadlockWatchdogThread->setMainThreadID(QThread::currentThreadId()); |
| 1173 | 1166 | deadlockWatchdogThread->start(); |
| 1174 | 1167 | |
| 1168 | + // Pause the deadlock watchdog when we sleep, or it might | |
| 1169 | + // trigger a false positive when we wake back up | |
| 1170 | + auto platformHelper = DependencyManager::get<PlatformHelper>(); | |
| 1171 | + | |
| 1172 | + connect(platformHelper.get(), &PlatformHelper::systemWillSleep, [] { | |
| 1173 | + DeadlockWatchdogThread::pause(); | |
| 1174 | + }); | |
| 1175 | + | |
| 1176 | + connect(platformHelper.get(), &PlatformHelper::systemWillWake, [] { | |
| 1177 | + DeadlockWatchdogThread::resume(); | |
| 1178 | + }); | |
| 1175 | 1179 | |
| 1176 | 1180 | // Main thread timer to keep the watchdog updated |
| 1177 | 1181 | QTimer* watchdogUpdateTimer = new QTimer(this); |
| @@ -2869,9 +2873,7 @@ Application::~Application() { · 1691 unmodified lines | ||
| 2869 | 2873 | _gameWorkload.shutdown(); |
| 2870 | 2874 | |
| 2871 | 2875 | DependencyManager::destroy<Preferences>(); |
| 2872 | −#ifdef Q_OS_MAC | |
| 2873 | − DependencyManager::destroy<MacHelper>(); | |
| 2874 | −#endif | |
| 2876 | + PlatformHelper::shutdown(); | |
| 2875 | 2877 | |
| 2876 | 2878 | _entityClipboard->eraseAllOctreeElements(); |
| 2877 | 2879 | _entityClipboard.reset(); |