diff options
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 108 |
1 files changed, 72 insertions, 36 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9942ea3de8..ef24bcf598 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1466,18 +1466,43 @@ void LLViewerWindow::handleMouseLeave(LLWindow *window) LLToolTipMgr::instance().blockToolTips(); } -bool LLViewerWindow::handleCloseRequest(LLWindow *window) +bool LLViewerWindow::handleCloseRequest(LLWindow *window, bool from_user) { if (!LLApp::isExiting() && !LLApp::isStopped()) { - // User has indicated they want to close, but we may need to ask - // about modified documents. - LLAppViewer::instance()->userQuit(); - // Don't quit immediately + if (from_user) + { + // User has indicated they want to close, but we may need to ask + // about modified documents. + LLAppViewer::instance()->userQuit(); + // Don't quit immediately + } + else + { + // OS is asking us to quit, assume we have time and start cleanup + LLAppViewer::instance()->requestQuit(); + } } return false; } +bool LLViewerWindow::handleSessionExit(LLWindow* window) +{ + if (!LLApp::isExiting() && !LLApp::isStopped()) + { + // Viewer received WM_ENDSESSION and app will be killed soon if it doesn't respond + LLAppViewer* app = LLAppViewer::instance(); + app->sendSimpleLogoutRequest(); + app->earlyExitNoNotify(); + + // Not viewer's fault, remove marker files so + // that statistics won't consider this to be a crash + app->removeMarkerFiles(); + return false; + } + return true; +} + void LLViewerWindow::handleQuit(LLWindow *window) { if (gNonInteractive) @@ -1897,7 +1922,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) p.ignore_pixel_depth, 0, max_core_count, - max_gl_version); //don't use window level anti-aliasing + max_gl_version); //don't use window level anti-aliasing, windows only if (NULL == mWindow) { @@ -2299,36 +2324,23 @@ void LLViewerWindow::initWorldUI() gToolBarView->setVisible(true); } - if (!gNonInteractive) + // Don't preload cef instances on low end hardware + const F32Gigabytes MIN_PHYSICAL_MEMORY(8); + F32Gigabytes physical_mem = LLMemory::getMaxMemKB(); + if (physical_mem <= 0) { - LLMediaCtrl* destinations = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents"); - if (destinations) - { - destinations->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL")); - std::string url = gSavedSettings.getString("DestinationGuideURL"); - url = LLWeb::expandURLSubstitutions(url, LLSD()); - destinations->navigateTo(url, HTTP_CONTENT_TEXT_HTML); - } - LLMediaCtrl* avatar_welcome_pack = LLFloaterReg::getInstance("avatar_welcome_pack")->findChild<LLMediaCtrl>("avatar_picker_contents"); - if (avatar_welcome_pack) - { - avatar_welcome_pack->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL")); - std::string url = gSavedSettings.getString("AvatarWelcomePack"); - url = LLWeb::expandURLSubstitutions(url, LLSD()); - avatar_welcome_pack->navigateTo(url, HTTP_CONTENT_TEXT_HTML); - } - LLMediaCtrl* search = LLFloaterReg::getInstance("search")->findChild<LLMediaCtrl>("search_contents"); - if (search) - { - search->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL")); - } - LLMediaCtrl* marketplace = LLFloaterReg::getInstance("marketplace")->getChild<LLMediaCtrl>("marketplace_contents"); - if (marketplace) - { - marketplace->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL")); - std::string url = gSavedSettings.getString("MarketplaceURL"); - marketplace->navigateTo(url, HTTP_CONTENT_TEXT_HTML); - } + LLMemory::updateMemoryInfo(); + physical_mem = LLMemory::getMaxMemKB(); + } + + if (!gNonInteractive && physical_mem > MIN_PHYSICAL_MEMORY) + { + LL_INFOS() << "Preloading cef instances" << LL_ENDL; + + LLFloaterReg::getInstance("destinations"); + LLFloaterReg::getInstance("avatar_welcome_pack"); + LLFloaterReg::getInstance("search"); + LLFloaterReg::getInstance("marketplace"); } } @@ -3317,7 +3329,31 @@ void LLViewerWindow::clearPopups() void LLViewerWindow::moveCursorToCenter() { - if (! gSavedSettings.getBOOL("DisableMouseWarp")) + bool mouse_warp = false; + LLCachedControl<S32> mouse_warp_mode(gSavedSettings, "MouseWarpMode", 1); + + switch (mouse_warp_mode()) + { + case 0: + // For Windows: + // Mouse usually uses 'delta' position since it isn't aware of own location, keep it centered. + // Touch screen reports absolute or virtual absolute position and warping a physical + // touch is pointless, so don't move it. + // + // MacOS + // If 'decoupled', CGAssociateMouseAndMouseCursorPosition can make mouse stay in + // one place and not move, do not move it (needs testing). + mouse_warp = mWindow->isWrapMouse(); + break; + case 1: + mouse_warp = true; + break; + default: + mouse_warp = false; + break; + } + + if (mouse_warp) { S32 x = getWorldViewWidthScaled() / 2; S32 y = getWorldViewHeightScaled() / 2; |
