Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 84 additions & 33 deletions indra/llwindow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,46 @@ set(viewer_HEADER_FILES
llmousehandler.h
)

# Platform-specific files for IDE visibility (excluded from build on other platforms)
set(macosx_SOURCE_FILES
llkeyboardmacosx.cpp
llwindowmacosx.cpp
llwindowmacosx-objc.mm
llopenglview-objc.mm
)

set(macosx_HEADER_FILES
llkeyboardmacosx.h
llwindowmacosx.h
llwindowmacosx-objc.h
llopenglview-objc.h
llappdelegate-objc.h
)

set(linux_SOURCE_FILES
llkeyboardsdl.cpp
llwindowsdl.cpp
)

set(linux_HEADER_FILES
llkeyboardsdl.h
llwindowsdl.h
)

set(windows_SOURCE_FILES
llwindowwin32.cpp
lldxhardware.cpp
llkeyboardwin32.cpp
lldragdropwin32.cpp
)

set(windows_HEADER_FILES
llwindowwin32.h
lldxhardware.h
llkeyboardwin32.h
lldragdropwin32.h
)

set(llwindow_LINK_LIBRARIES
llcommon
llimage
Expand All @@ -63,14 +103,8 @@ set(llwindow_LINK_LIBRARIES
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
if (LINUX)
list(APPEND viewer_SOURCE_FILES
llkeyboardsdl.cpp
llwindowsdl.cpp
)
list(APPEND viewer_HEADER_FILES
llkeyboardsdl.h
llwindowsdl.h
)
list(APPEND viewer_SOURCE_FILES ${linux_SOURCE_FILES})
list(APPEND viewer_HEADER_FILES ${linux_HEADER_FILES})

if (BUILD_HEADLESS)
set(llwindowheadless_LINK_LIBRARIES
Expand All @@ -88,19 +122,8 @@ if (LINUX)
endif (LINUX)

if (DARWIN)
list(APPEND llwindow_SOURCE_FILES
llkeyboardmacosx.cpp
llwindowmacosx.cpp
llwindowmacosx-objc.mm
llopenglview-objc.mm
)
list(APPEND llwindow_HEADER_FILES
llkeyboardmacosx.h
llwindowmacosx.h
llwindowmacosx-objc.h
llopenglview-objc.h
llappdelegate-objc.h
)
list(APPEND llwindow_SOURCE_FILES ${macosx_SOURCE_FILES})
list(APPEND llwindow_HEADER_FILES ${macosx_HEADER_FILES})

# We use a bunch of deprecated system APIs.
set_source_files_properties(
Expand All @@ -113,18 +136,8 @@ endif (DARWIN)


if (WINDOWS)
list(APPEND llwindow_SOURCE_FILES
llwindowwin32.cpp
lldxhardware.cpp
llkeyboardwin32.cpp
lldragdropwin32.cpp
)
list(APPEND llwindow_HEADER_FILES
llwindowwin32.h
lldxhardware.h
llkeyboardwin32.h
lldragdropwin32.h
)
list(APPEND llwindow_SOURCE_FILES ${windows_SOURCE_FILES})
list(APPEND llwindow_HEADER_FILES ${windows_HEADER_FILES})
list(APPEND llwindow_LINK_LIBRARIES
comdlg32 # Common Dialogs for ChooseColor
ole32
Expand Down Expand Up @@ -167,10 +180,48 @@ endif (llwindow_HEADER_FILES)

list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES})

# Collect all platform files for IDE visibility, excluding already-added current platform
set(ide_visibility_files "")
if (NOT DARWIN)
list(APPEND ide_visibility_files ${macosx_SOURCE_FILES} ${macosx_HEADER_FILES})
endif()
if (NOT LINUX)
list(APPEND ide_visibility_files ${linux_SOURCE_FILES} ${linux_HEADER_FILES})
endif()
if (NOT WINDOWS)
list(APPEND ide_visibility_files ${windows_SOURCE_FILES} ${windows_HEADER_FILES})
endif()

add_library (llwindow
${llwindow_SOURCE_FILES}
${viewer_SOURCE_FILES}
# Add non-platform files for IDE visibility only
${ide_visibility_files}
)

# Mark non-platform files as excluded from build
if (WINDOWS)
set_source_files_properties(
${macosx_SOURCE_FILES}
${linux_SOURCE_FILES}
PROPERTIES
HEADER_FILE_ONLY TRUE
)
elseif (DARWIN)
set_source_files_properties(
${windows_SOURCE_FILES}
${linux_SOURCE_FILES}
PROPERTIES
HEADER_FILE_ONLY TRUE
)
elseif (LINUX)
set_source_files_properties(
${macosx_SOURCE_FILES}
${windows_SOURCE_FILES}
PROPERTIES
HEADER_FILE_ONLY TRUE
)
endif()

if (SDL_FOUND)
set_property(TARGET llwindow
Expand Down
71 changes: 71 additions & 0 deletions indra/newview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,38 @@ if (DARWIN)
list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES})
endif (DARWIN)

# Platform-specific files for IDE visibility (excluded from build on other platforms)
set(macosx_viewer_SOURCE_FILES
llappviewermacosx.cpp
llappviewermacosx-objc.mm
llfilepicker_mac.mm
llappdelegate-objc.mm
)

set(macosx_viewer_HEADER_FILES
llappviewermacosx.h
llappviewermacosx-objc.h
llfilepicker_mac.h
)

set(linux_viewer_SOURCE_FILES
llappviewerlinux.cpp
llappviewerlinux_api_dbus.cpp
)

set(linux_viewer_HEADER_FILES
)

set(windows_viewer_SOURCE_FILES
llappviewerwin32.cpp
llwindebug.cpp
)

set(windows_viewer_HEADER_FILES
llappviewerwin32.h
llwindebug.h
)

if (LINUX)
LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp)
set_source_files_properties(
Expand Down Expand Up @@ -1651,6 +1683,45 @@ if (WINDOWS)

endif (WINDOWS)

# Add all platform-specific files to the target for IDE visibility
# Collect non-platform files for IDE visibility only
set(ide_visibility_files "")
if (NOT DARWIN)
list(APPEND ide_visibility_files ${macosx_viewer_SOURCE_FILES} ${macosx_viewer_HEADER_FILES})
endif()
if (NOT LINUX)
list(APPEND ide_visibility_files ${linux_viewer_SOURCE_FILES} ${linux_viewer_HEADER_FILES})
endif()
if (NOT WINDOWS)
list(APPEND ide_visibility_files ${windows_viewer_SOURCE_FILES} ${windows_viewer_HEADER_FILES})
endif()

list(APPEND viewer_SOURCE_FILES ${ide_visibility_files})

# Mark non-platform files as excluded from build
if (WINDOWS)
set_source_files_properties(
${macosx_viewer_SOURCE_FILES}
${linux_viewer_SOURCE_FILES}
PROPERTIES
HEADER_FILE_ONLY TRUE
)
elseif (DARWIN)
set_source_files_properties(
${windows_viewer_SOURCE_FILES}
${linux_viewer_SOURCE_FILES}
PROPERTIES
HEADER_FILE_ONLY TRUE
)
elseif (LINUX)
set_source_files_properties(
${macosx_viewer_SOURCE_FILES}
${windows_viewer_SOURCE_FILES}
PROPERTIES
HEADER_FILE_ONLY TRUE
)
endif()

# Add the xui files. This is handy for searching for xui elements
# from within the IDE.
file(GLOB_RECURSE viewer_XUI_FILES LIST_DIRECTORIES FALSE
Expand Down
11 changes: 11 additions & 0 deletions indra/newview/app_settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14429,6 +14429,17 @@
<key>Value</key>
<integer>180</integer>
</map>
<key>OSHibernationMode</key>
<map>
<key>Comment</key>
<string>Whether to prevent OS from hibernating. 0 - can hibernate; 1 - can't hibernate, can turn screen off; 2 - can't hibernate, can't turn screen off </string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>HeightUnits</key>
<map>
<key>Comment</key>
Expand Down
9 changes: 9 additions & 0 deletions indra/newview/llagent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,8 @@ void LLAgent::setAFK()
setControlFlags(AGENT_CONTROL_AWAY | AGENT_CONTROL_STOP);
gAwayTimer.start();
}

LLAppViewer::instance()->setPermitOSHibernation(true);
}

//-----------------------------------------------------------------------------
Expand All @@ -1570,6 +1572,13 @@ void LLAgent::clearAFK()
sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
clearControlFlags(AGENT_CONTROL_AWAY);
}

if (isAgentAvatarValid())
{
// Only set this if agent is inworld, login screen
// shouldn't prevent hibernation.
LLAppViewer::instance()->setPermitOSHibernation(false);
}
}

//-----------------------------------------------------------------------------
Expand Down
48 changes: 46 additions & 2 deletions indra/newview/llappviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,12 @@ bool LLAppViewer::sendURLToOtherInstance(const std::string& url)
return false;
}

//virtual
void LLAppViewer::setOSHibernationMode(eHibernationMode mode)
{
// See OS specific files
}

//----------------------------------------------------------------------------
// LLAppViewer definition

Expand Down Expand Up @@ -4474,9 +4480,12 @@ void LLAppViewer::abortQuit()
mClosingFloaters = false;
}

void LLAppViewer::sendViewerStatistics()
void LLAppViewer::sendViewerStatistics(bool include_preferences)
{
send_viewer_stats(false);
if (!gDisconnected)
{
send_viewer_stats(include_preferences);
}
}

void LLAppViewer::migrateCacheDirectory()
Expand Down Expand Up @@ -5857,6 +5866,29 @@ void LLAppViewer::outOfMemorySoftQuit()
}
}

void LLAppViewer::setPermitOSHibernation(bool permit)
{
if (permit)
{
if (mCurrentHibernationMode != LL_HIBERNATE_MODE_DEFAULT)
{
// Will call OS specific code to let OS hibernate when idle
setOSHibernationMode(LL_HIBERNATE_MODE_DEFAULT);
mCurrentHibernationMode = LL_HIBERNATE_MODE_DEFAULT;
}
}
else
{
static LLCachedControl<S32> os_hibernation_mode(gSavedSettings, "OSHibernationMode", 0);
eHibernationMode mode = static_cast<eHibernationMode>(os_hibernation_mode());
if (mode != LL_HIBERNATE_MODE_DEFAULT && mCurrentHibernationMode != mode)
{
setOSHibernationMode(mode);
mCurrentHibernationMode = mode;
}
}
}

void LLAppViewer::idleNameCache()
{
// Neither old nor new name cache can function before agent has a region
Expand Down Expand Up @@ -6064,6 +6096,9 @@ void LLAppViewer::disconnectViewer()
// Pass the connection state to LLUrlEntryParcel not to attempt
// parcel info requests while disconnected.
LLUrlEntryParcel::setDisconnected(gDisconnected);

// Restore default OS hibernation mode
setPermitOSHibernation(true);
}

void LLAppViewer::forceErrorLLError()
Expand Down Expand Up @@ -6329,6 +6364,15 @@ void LLAppViewer::handleLoginComplete()
// we logged in successfully, so save settings on logout
LL_INFOS() << "Login successful, per account settings will be saved on log out." << LL_ENDL;
mSavePerAccountSettings=true;

// Don't allow hibernation while we're running
setPermitOSHibernation(false);
// Track 'hibernation' mode changes
mOSHibernationModeChangeConnection = gSavedSettings.getControl("OSHibernationMode")->getSignal()->connect([](LLControlVariable* control, const LLSD& new_val, const LLSD& old_val)
{
// setPermitOSHibernation will sort itself out based on new mode.
LLAppViewer::instance()->setPermitOSHibernation(false);
});
Comment thread
akleshchev marked this conversation as resolved.
}

//virtual
Expand Down
Loading
Loading