The Application constructor must setup event handlers for events emitted when the Desktop is constructed *before* calling initializeUi(). Otherwise, sometimes these event handlers won't be called. When this problem happened (usually on slow machines), Interface would start but neither the Desktop nor the Login Screen would appear.
Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -1446,6 +1446,34 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1445 unmodified lines | ||
| 1446 | 1446 | _overlays.init(); // do this before scripts load |
| 1447 | 1447 | DependencyManager::set<ContextOverlayInterface>(); |
| 1448 | 1448 | |
| 1449 | + auto offscreenUi = getOffscreenUI(); | |
| 1450 | + connect(offscreenUi.data(), &OffscreenUi::desktopReady, []() { | |
| 1451 | + // Now that we've loaded the menu and thus switched to the previous display plugin | |
| 1452 | + // we can unlock the desktop repositioning code, since all the positions will be | |
| 1453 | + // relative to the desktop size for this plugin | |
| 1454 | + auto offscreenUi = getOffscreenUI(); | |
| 1455 | + auto desktop = offscreenUi->getDesktop(); | |
| 1456 | + if (desktop) { | |
| 1457 | + desktop->setProperty("repositionLocked", false); | |
| 1458 | + } | |
| 1459 | + }); | |
| 1460 | + | |
| 1461 | + connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() { | |
| 1462 | +#if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML) | |
| 1463 | + // Do not show login dialog if requested not to on the command line | |
| 1464 | + QString hifiNoLoginCommandLineKey = QString("--").append(HIFI_NO_LOGIN_COMMAND_LINE_KEY); | |
| 1465 | + int index = arguments().indexOf(hifiNoLoginCommandLineKey); | |
| 1466 | + if (index != -1) { | |
| 1467 | + resumeAfterLoginDialogActionTaken(); | |
| 1468 | + return; | |
| 1469 | + } | |
| 1470 | + | |
| 1471 | + showLoginScreen(); | |
| 1472 | +#else | |
| 1473 | + resumeAfterLoginDialogActionTaken(); | |
| 1474 | +#endif | |
| 1475 | + }); | |
| 1476 | + | |
| 1449 | 1477 | // Initialize the user interface and menu system |
| 1450 | 1478 | // Needs to happen AFTER the render engine initialization to access its configuration |
| 1451 | 1479 | initializeUi(); |
| @@ -1791,34 +1819,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 339 unmodified lines | ||
| 1791 | 1819 | |
| 1792 | 1820 | updateVerboseLogging(); |
| 1793 | 1821 | |
| 1794 | − // Now that we've loaded the menu and thus switched to the previous display plugin | |
| 1795 | − // we can unlock the desktop repositioning code, since all the positions will be | |
| 1796 | − // relative to the desktop size for this plugin | |
| 1797 | − auto offscreenUi = getOffscreenUI(); | |
| 1798 | − connect(offscreenUi.data(), &OffscreenUi::desktopReady, []() { | |
| 1799 | − auto offscreenUi = getOffscreenUI(); | |
| 1800 | − auto desktop = offscreenUi->getDesktop(); | |
| 1801 | − if (desktop) { | |
| 1802 | − desktop->setProperty("repositionLocked", false); | |
| 1803 | − } | |
| 1804 | − }); | |
| 1805 | − | |
| 1806 | − connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() { | |
| 1807 | −#if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML) | |
| 1808 | − // Do not show login dialog if requested not to on the command line | |
| 1809 | − QString hifiNoLoginCommandLineKey = QString("--").append(HIFI_NO_LOGIN_COMMAND_LINE_KEY); | |
| 1810 | − int index = arguments().indexOf(hifiNoLoginCommandLineKey); | |
| 1811 | − if (index != -1) { | |
| 1812 | − resumeAfterLoginDialogActionTaken(); | |
| 1813 | − return; | |
| 1814 | − } | |
| 1815 | − | |
| 1816 | − showLoginScreen(); | |
| 1817 | −#else | |
| 1818 | − resumeAfterLoginDialogActionTaken(); | |
| 1819 | −#endif | |
| 1820 | − }); | |
| 1821 | − | |
| 1822 | 1822 | // Make sure we don't time out during slow operations at startup |
| 1823 | 1823 | updateHeartbeat(); |
| 1824 | 1824 | QTimer* settingsTimer = new QTimer(); |