summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.gitignore2
-rw-r--r--README.md19
-rw-r--r--indra/cmake/APR.cmake17
-rw-r--r--indra/cmake/Boost.cmake8
-rw-r--r--indra/cmake/CURL.cmake2
-rw-r--r--indra/cmake/GLM.cmake2
-rw-r--r--indra/cmake/LLPrimitive.cmake35
-rw-r--r--indra/cmake/Meshoptimizer.cmake6
-rw-r--r--indra/cmake/OpenSSL.cmake2
-rw-r--r--indra/cmake/WebRTC.cmake14
-rw-r--r--indra/llcommon/CMakeLists.txt5
-rw-r--r--indra/llcommon/llapr.cpp2
-rw-r--r--indra/llcommon/llmemory.h2
-rw-r--r--indra/llmath/llsimdmath.h2
-rw-r--r--indra/llwindow/llwindow.cpp2
-rw-r--r--indra/llwindow/llwindowsdl.cpp1351
-rw-r--r--indra/llwindow/llwindowsdl.h45
-rw-r--r--indra/media_plugins/cef/CMakeLists.txt1
-rw-r--r--indra/newview/CMakeLists.txt8
-rw-r--r--indra/newview/app_settings/settings.xml6
-rwxr-xr-xindra/newview/linux_tools/wrapper.sh23
-rw-r--r--indra/newview/llagentcamera.cpp4
-rw-r--r--indra/newview/lldirpicker.cpp1
-rw-r--r--indra/newview/res-sdl/cross.BMPbin2102 -> 2186 bytes
-rw-r--r--indra/newview/res-sdl/lltoolcamera.BMPbin2102 -> 2186 bytes
-rw-r--r--indra/newview/res-sdl/lltoolcreate.BMPbin2102 -> 2186 bytes
-rw-r--r--indra/newview/res-sdl/lltoolpipette.BMPbin3126 -> 3210 bytes
-rw-r--r--indra/newview/res-sdl/lltoolrotate.BMPbin2186 -> 2186 bytes
-rw-r--r--indra/newview/res-sdl/toolmediaopen.BMPbin4234 -> 3210 bytes
-rw-r--r--indra/newview/res-sdl/toolopen.BMPbin4234 -> 3210 bytes
-rw-r--r--indra/newview/res-sdl/toolplay.BMPbin4234 -> 3210 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/MP_Logo.pngbin7297 -> 1106 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/SL_Logo.pngbin10535 -> 1484 bytes
-rw-r--r--indra/newview/skins/default/textures/icons/hand.pngbin5338 -> 899 bytes
-rw-r--r--indra/newview/skins/default/textures/windows/first_login_image.jpgbin398853 -> 199811 bytes
-rw-r--r--indra/newview/skins/default/xui/en/floater_about.xml5
-rwxr-xr-xindra/newview/viewer_manifest.py28
37 files changed, 439 insertions, 1153 deletions
diff --git a/.gitignore b/.gitignore
index c4b559f016..72187e23f2 100755
--- a/.gitignore
+++ b/.gitignore
@@ -23,7 +23,7 @@ LICENSES
build-darwin-*
build-freebsd-*
build-linux-*
-build-mingw-*
+build-mingw64_nt*
debian/files
debian/secondlife-appearance-utility*
debian/secondlife-viewer*
diff --git a/README.md b/README.md
index 78417ebde9..a5fd7a08e0 100644
--- a/README.md
+++ b/README.md
@@ -55,14 +55,20 @@ $ megapahit
### FreeBSD
```
$ sudo su -
-# portmaster devel/cmake devel/pkgconf audio/freealut devel/apr1 devel/boost-libs x11-toolkits/fltk math/glm textproc/hunspell misc/meshoptimizer archivers/minizip graphics/nanosvg graphics/openjpeg www/libnghttp2 devel/sdl20 multimedia/vlc audio/libvorbis devel/xxhash
+# portmaster devel/cmake devel/pkgconf audio/freealut devel/apr1 devel/boost-libs x11-toolkits/fltk math/glm textproc/hunspell misc/meshoptimizer archivers/minizip graphics/nanosvg www/libnghttp2 graphics/openjpeg devel/sdl20 multimedia/vlc audio/libvorbis devel/xxhash
# exit
$ setenv LL_BUILD "-O3 -std=c++20 -fPIC"
+$ setenv PYTHON /usr/local/bin/python3.11
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:STRING=64 -DUSE_OPENAL:BOOL=ON -DUSE_FMODSTUDIO:BOOL=OFF -DENABLE_MEDIA_PLUGINS:BOOL=ON -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=OFF -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../indra
$ make -j`nproc`
+$ cd ..
+$ mv -i indra/newview/app_settings/windlight ..
+$ cd -
$ sudo cpack -G FREEBSD
-$ sudo pkg add megapahit-`cat newview/viewer_version.txt`-FreeBSD.pkg
-$ sudo pkg set -yA 1 freealut apr1 fltk hunspell meshoptimizer minizip nanosvg openjpeg sdl20 vlc libvorbis
+$ sudo pkg add megapahit-`cat newview/viewer_version.txt`-`uname -s`.pkg
+$ cd ..
+$ mv -i ../windlight indra/newview/app_settings/
+$ sudo pkg set -yA 1 freealut apr1 boost-libs fltk hunspell meshoptimizer minizip libnghttp2 openjpeg sdl20 vlc libvorbis
$ megapahit
```
@@ -114,8 +120,11 @@ $ megapahit
### Windows
```
-$ pacman -S mingw-w64-clang-aarch64-cmake mingw-w64-clang-aarch64-pkgconf mingw-w64-clang-aarch64-freealut mingw-w64-clang-aarch64-apr-util mingw-w64-clang-aarch64-boost mingw-w64-clang-aarch64-fltk mingw-w64-clang-aarch64-glm mingw-w64-clang-aarch64-hunspell mingw-w64-clang-aarch64-minizip mingw-w64-clang-aarch64-nghttp2 mingw-w64-clang-aarch64-SDL2 mingw-w64-clang-aarch64-vlc mingw-w64-clang-aarch64-libvorbis mingw-w64-clang-aarch64-xxhash
-$ export LL_BUILD="-O3 -std=c++20 -fPIC -DLL_WINDOWS=1"
+$ vcpkg install pkgconf python3 freealut apr-util boost freetype glm hunspell libjpeg-turbo meshoptimizer minizip nghttp2 openjpeg libvorbis libxml2[tools] xxhash
+$ export LL_BUILD="/MD /O2 /Ob2 /std:c++20 /Zc:wchar_t- /Zi /GR /DLL_RELEASE=1 /DLL_RELEASE_FOR_DOWNLOAD=1 /DNDEBUG /D_SECURE_STL=0 /D_HAS_ITERATOR_DEBUGGING=0 /DWIN32 /D_WINDOWS /DLL_WINDOWS=1 /DUNICODE /D_UNICODE /DWINVER=0x0602 /D_WIN32_WINNT=0x0602"
+$ export PATH="/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin:$VCPKG_ROOT/downloads/tools/msys2/21caed2f81ec917b/mingw64/bin:$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/libxml2:$PATH"
+$ export PKG_CONFIG_LIBDIR="$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/lib/pkgconfig"
+$ export PYTHON="$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/python3/python.exe"
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:STRING=64 -DUSE_OPENAL:BOOL=ON -DUSE_FMODSTUDIO:BOOL=OFF -DENABLE_MEDIA_PLUGINS:BOOL=OFF -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=OFF -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=OFF -DPACKAGE:BOOL=OFF ../indra
```
diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake
index cf31027c9a..fa3b8a4ffb 100644
--- a/indra/cmake/APR.cmake
+++ b/indra/cmake/APR.cmake
@@ -5,11 +5,18 @@ include_guard()
add_library( ll::apr INTERFACE IMPORTED )
-include(FindPkgConfig)
-pkg_check_modules(Apr REQUIRED apr-1 apr-util-1)
-target_include_directories(ll::apr SYSTEM INTERFACE ${Apr_INCLUDE_DIRS})
-target_link_directories(ll::apr INTERFACE ${Apr_LIBRARY_DIRS})
-target_link_libraries(ll::apr INTERFACE ${Apr_LIBRARIES})
+if (WINDOWS)
+ target_include_directories(ll::apr SYSTEM INTERFACE ${prefix_result}/../include)
+ target_link_directories(ll::apr INTERFACE ${prefix_result})
+ target_link_libraries(ll::apr INTERFACE apr-1 apr-util-1)
+else ()
+ include(FindPkgConfig)
+ pkg_check_modules(Apr REQUIRED apr-1 apr-util-1)
+ target_include_directories(ll::apr SYSTEM INTERFACE ${Apr_INCLUDE_DIRS})
+ target_link_directories(ll::apr INTERFACE ${Apr_LIBRARY_DIRS})
+ target_link_libraries(ll::apr INTERFACE ${Apr_LIBRARIES})
+endif ()
+
return ()
use_system_binary( apr apr-util )
diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake
index ba2eaccf63..9ea1f6c9a6 100644
--- a/indra/cmake/Boost.cmake
+++ b/indra/cmake/Boost.cmake
@@ -6,13 +6,13 @@ include_guard()
add_library( ll::boost INTERFACE IMPORTED )
if (DARWIN)
- set(sfx -mt)
target_include_directories( ll::boost SYSTEM INTERFACE /opt/local/libexec/boost/1.87/include)
target_link_directories( ll::boost INTERFACE /opt/local/libexec/boost/1.87/lib)
-elseif (WINDOWS)
set(sfx -mt)
- target_include_directories( ll::boost SYSTEM INTERFACE /opt/local/x86_64-w64-mingw32/include)
- target_link_directories( ll::boost INTERFACE /opt/local/x86_64-w64-mingw32/lib)
+elseif (WINDOWS)
+ target_include_directories( ll::boost SYSTEM INTERFACE ${prefix_result}/../include)
+ target_link_directories( ll::boost INTERFACE ${prefix_result})
+ set(sfx -vc143-mt-x64-1_88)
else ()
find_package( Boost REQUIRED )
endif ()
diff --git a/indra/cmake/CURL.cmake b/indra/cmake/CURL.cmake
index b301819536..06d5927174 100644
--- a/indra/cmake/CURL.cmake
+++ b/indra/cmake/CURL.cmake
@@ -6,7 +6,7 @@ include_guard()
add_library( ll::libcurl INTERFACE IMPORTED )
#use_system_binary(libcurl)
-if (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 OR DARWIN)
+if (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 OR DARWIN OR WINDOWS)
use_prebuilt_binary(curl)
if (DARWIN)
execute_process(
diff --git a/indra/cmake/GLM.cmake b/indra/cmake/GLM.cmake
index fcf5e77cae..db6acc065e 100644
--- a/indra/cmake/GLM.cmake
+++ b/indra/cmake/GLM.cmake
@@ -6,6 +6,6 @@ add_library( ll::glm INTERFACE IMPORTED )
#use_system_binary( glm )
if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed))
use_prebuilt_binary(glm)
-else ()
+elseif (NOT WINDOWS)
find_package( glm REQUIRED )
endif ()
diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake
index 21952713ca..3429a744f5 100644
--- a/indra/cmake/LLPrimitive.cmake
+++ b/indra/cmake/LLPrimitive.cmake
@@ -18,19 +18,11 @@ if( USE_CONAN )
"${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" )
endif()
-if( WINDOWS )
- include(FindPkgConfig)
- pkg_check_modules(Colladadom REQUIRED collada-dom-141)
- target_compile_definitions( ll::colladadom INTERFACE COLLADA_DOM_SUPPORT141 )
- target_include_directories( ll::colladadom SYSTEM INTERFACE ${Colladadom_INCLUDE_DIRS} )
- target_link_directories( ll::colladadom INTERFACE ${Colladadom_LIBRARY_DIRS} )
- target_link_libraries( ll::colladadom INTERFACE ${Colladadom_LIBRARIES} )
- return()
-elseif( LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD )
+if( LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD )
# Build of the collada-dom for Linux and FreeBSD is done in
# indra/llprimitive/CMakeLists.txt
return()
-else()
+elseif ( NOT WINDOWS )
include(FindPkgConfig)
pkg_check_modules(Minizip REQUIRED minizip)
pkg_check_modules(Libxml2 REQUIRED libxml-2.0)
@@ -47,15 +39,24 @@ else()
INPUT ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8.tar.gz
DESTINATION ${CMAKE_BINARY_DIR}
)
- execute_process(
- COMMAND sed -i "" -e "s/SHARED/STATIC/g" CMakeLists.txt
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4
- )
+ if ( WINDOWS )
+ execute_process(
+ COMMAND sed -i "s/SHARED/STATIC/g" CMakeLists.txt
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4
+ )
+ set(BOOST_LIBRARY_SUFFIX -vc143-mt-x64-1_88)
+ else ()
+ execute_process(
+ COMMAND sed -i "" -e "s/SHARED/STATIC/g" CMakeLists.txt
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4
+ )
+ endif ()
if( DARWIN )
set(BOOST_CFLAGS -I${Libxml2_LIBRARY_DIRS}exec/boost/1.87/include)
set(BOOST_LIBS -L${Minizip_LIBRARY_DIRS}exec/boost/1.87/lib)
set(BOOST_LIBRARY_SUFFIX -mt)
endif()
+ file(MAKE_DIRECTORY ${LIBS_PREBUILT_DIR}/include/collada/1.4)
try_compile(COLLADADOM_RESULT
PROJECT colladadom
SOURCE_DIR ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8
@@ -92,10 +93,12 @@ else()
endif()
endif()
-if( FALSE )
-use_system_binary( colladadom )
+#use_system_binary( colladadom )
+if (WINDOWS)
use_prebuilt_binary(colladadom)
+endif ()
+if( FALSE )
use_prebuilt_binary(minizip-ng) # needed for colladadom
use_prebuilt_binary(libxml2)
diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake
index 4b428e4b83..5058614580 100644
--- a/indra/cmake/Meshoptimizer.cmake
+++ b/indra/cmake/Meshoptimizer.cmake
@@ -7,8 +7,10 @@ include_guard()
add_library( ll::meshoptimizer INTERFACE IMPORTED )
#use_system_binary(meshoptimizer)
-if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
- find_package(meshoptimizer)
+if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR CMAKE_SYSTEM_NAME MATCHES FreeBSD OR WINDOWS)
+ if (NOT WINDOWS)
+ find_package(meshoptimizer)
+ endif ()
target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer)
return ()
elseif (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 AND NOT (${LINUX_DISTRO} MATCHES gentoo))
diff --git a/indra/cmake/OpenSSL.cmake b/indra/cmake/OpenSSL.cmake
index 7cb59b04c3..ef90068993 100644
--- a/indra/cmake/OpenSSL.cmake
+++ b/indra/cmake/OpenSSL.cmake
@@ -6,7 +6,7 @@ include_guard()
add_library( ll::openssl INTERFACE IMPORTED )
#use_system_binary(openssl)
-if (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 OR DARWIN)
+if (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 OR DARWIN OR WINDOWS)
use_prebuilt_binary(openssl)
if (DARWIN)
execute_process(
diff --git a/indra/cmake/WebRTC.cmake b/indra/cmake/WebRTC.cmake
index 19457924d8..454ed8c0a1 100644
--- a/indra/cmake/WebRTC.cmake
+++ b/indra/cmake/WebRTC.cmake
@@ -6,9 +6,9 @@ include_guard()
add_library( ll::webrtc INTERFACE IMPORTED )
target_include_directories( ll::webrtc SYSTEM INTERFACE "${LIBS_PREBUILT_DIR}/include/webrtc" "${LIBS_PREBUILT_DIR}/include/webrtc/third_party/abseil-cpp")
-if (${LINUX_DISTRO} MATCHES debian OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
+if (${LINUX_DISTRO} MATCHES debian OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR WINDOWS)
use_prebuilt_binary(webrtc)
-elseif (NOT (WINDOWS OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
+elseif (NOT CMAKE_SYSTEM_NAME MATCHES FreeBSD)
target_compile_definitions(ll::webrtc INTERFACE CM_WEBRTC=1)
if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/webrtc_installed OR NOT ${webrtc_installed} EQUAL 0)
if (DARWIN)
@@ -17,14 +17,14 @@ elseif (NOT (WINDOWS OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
set(WEBRTC_PLATFORM linux-arm64)
else ()
set(WEBRTC_PLATFORM linux-x64)
- endif (DARWIN)
+ endif ()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz)
file(DOWNLOAD
https://github.com/crow-misia/libwebrtc-bin/releases/download/114.5735.6.1/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
SHOW_PROGRESS
)
- endif (NOT EXISTS ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz)
+ endif ()
file(ARCHIVE_EXTRACT
INPUT ${CMAKE_BINARY_DIR}/libwebrtc-${WEBRTC_PLATFORM}.tar.xz
DESTINATION ${LIBS_PREBUILT_DIR}
@@ -74,10 +74,10 @@ elseif (NOT (WINDOWS OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
${ARCH_PREBUILT_DIRS_RELEASE}/WebRTC.framework
)
file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/Frameworks)
- endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ endif ()
file(WRITE ${PREBUILD_TRACKING_DIR}/webrtc_installed "0")
- endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/webrtc_installed OR NOT ${webrtc_installed} EQUAL 0)
-endif (${LINUX_DISTRO} MATCHES debian OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
+ endif ()
+endif ()
if (WINDOWS)
target_link_libraries( ll::webrtc INTERFACE webrtc.lib )
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index ac35bec368..6c1e1ef64a 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -303,7 +303,10 @@ if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR (${LIN
target_include_directories(llcommon PUBLIC ${LIBS_PREBUILT_DIR}/include)
endif ()
-target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations)
+if (NOT WINDOWS)
+ target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations)
+endif ()
+
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set_source_files_properties(
llapp.cpp
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index 01763c49aa..04aba817f8 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -230,7 +230,7 @@ bool LLVolatileAPRPool::isFull()
bool _ll_apr_warn_status(apr_status_t status, const char* file, int line)
{
if(APR_SUCCESS == status) return false;
-#if !LL_LINUX
+#if !LL_LINUX && !__FreeBSD__
char buf[MAX_STRING]; /* Flawfinder: ignore */
apr_strerror(status, buf, sizeof(buf));
LL_WARNS("APR") << "APR: " << file << ":" << line << " " << buf << LL_ENDL;
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 4a9359f8e2..d5802b9d95 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -71,7 +71,7 @@ LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment);
#define ll_assert_aligned(ptr,alignment)
#endif
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__) || _M_X64
#include <xmmintrin.h>
#else
#include <sse2neon.h>
diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h
index 590d8de92f..6242095456 100644
--- a/indra/llmath/llsimdmath.h
+++ b/indra/llmath/llsimdmath.h
@@ -39,7 +39,7 @@
#include <stdint.h>
#endif
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__) || _M_X64
#include <xmmintrin.h>
#include <emmintrin.h>
#else
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 302d038a79..4f3cc69c75 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -421,7 +421,7 @@ LLWindow* LLWindowManager::createWindow(
fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth);
#elif LL_SDL
new_window = new LLWindowSDL(callbacks,
- title, x, y, width, height, flags,
+ title, name, x, y, width, height, flags,
fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_WINDOWS
new_window = new LLWindowWin32(callbacks,
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index f667ff7542..69332e36b6 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -61,9 +61,6 @@ extern bool gDebugWindowProc;
const S32 MAX_NUM_RESOLUTIONS = 200;
-// static variable for ATI mouse cursor crash work-around:
-static bool ATIbug = false;
-
#if LL_DARWIN
#include <OpenGL/OpenGL.h>
@@ -152,257 +149,14 @@ Display* LLWindowSDL::get_SDL_Display(void)
}
#endif // LL_X11
-#if LL_X11
-
-// Clipboard handing via native X11, base on the implementation in Cool VL by Henri Beauchamp
-
-namespace
-{
- std::array<Atom, 3> gSupportedAtoms;
-
- Atom XA_CLIPBOARD;
- Atom XA_TARGETS;
- Atom PVT_PASTE_BUFFER;
- long const MAX_PASTE_BUFFER_SIZE = 16383;
-
- void filterSelectionRequest( XEvent aEvent )
- {
- auto *display = LLWindowSDL::getSDLDisplay();
- auto &request = aEvent.xselectionrequest;
-
- XSelectionEvent reply { SelectionNotify, aEvent.xany.serial, aEvent.xany.send_event, display,
- request.requestor, request.selection, request.target,
- request.property,request.time };
-
- if (request.target == XA_TARGETS)
- {
- XChangeProperty(display, request.requestor, request.property,
- XA_ATOM, 32, PropModeReplace,
- (unsigned char *) &gSupportedAtoms.front(), gSupportedAtoms.size());
- }
- else if (std::find(gSupportedAtoms.begin(), gSupportedAtoms.end(), request.target) !=
- gSupportedAtoms.end())
- {
- std::string utf8;
- if (request.selection == XA_PRIMARY)
- utf8 = wstring_to_utf8str(gWindowImplementation->getPrimaryText());
- else
- utf8 = wstring_to_utf8str(gWindowImplementation->getSecondaryText());
-
- XChangeProperty(display, request.requestor, request.property,
- request.target, 8, PropModeReplace,
- (unsigned char *) utf8.c_str(), utf8.length());
- }
- else if (request.selection == XA_CLIPBOARD)
- {
- // Did not have what they wanted, so no property set
- reply.property = None;
- }
- else
- return;
-
- XSendEvent(request.display, request.requestor, False, NoEventMask, (XEvent *) &reply);
- XSync(display, False);
- }
-
- void filterSelectionClearRequest( XEvent aEvent )
- {
- auto &request = aEvent.xselectionrequest;
- if (request.selection == XA_PRIMARY)
- gWindowImplementation->clearPrimaryText();
- else if (request.selection == XA_CLIPBOARD)
- gWindowImplementation->clearSecondaryText();
- }
-
- int x11_clipboard_filter(void*, SDL_Event *evt)
- {
- Display *display = LLWindowSDL::getSDLDisplay();
- if (!display)
- return 1;
-
- if (evt->type != SDL_SYSWMEVENT)
- return 1;
-
- auto xevent = evt->syswm.msg->msg.x11.event;
-
- if (xevent.type == SelectionRequest)
- filterSelectionRequest( xevent );
- else if (xevent.type == SelectionClear)
- filterSelectionClearRequest( xevent );
- return 1;
- }
-
- bool grab_property(Display* display, Window window, Atom selection, Atom target)
- {
- if( !display )
- return false;
-
- maybe_lock_display();
-
- XDeleteProperty(display, window, PVT_PASTE_BUFFER);
- XFlush(display);
-
- XConvertSelection(display, selection, target, PVT_PASTE_BUFFER, window, CurrentTime);
-
- // Unlock the connection so that the SDL event loop may function
- maybe_unlock_display();
-
- const auto start{ SDL_GetTicks() };
- const auto end{ start + 1000 };
-
- XEvent xevent {};
- bool response = false;
-
- do
- {
- SDL_Event event {};
-
- // Wait for an event
- SDL_WaitEvent(&event);
-
- // If the event is a window manager event
- if (event.type == SDL_SYSWMEVENT)
- {
- xevent = event.syswm.msg->msg.x11.event;
-
- if (xevent.type == SelectionNotify && xevent.xselection.requestor == window)
- response = true;
- }
- } while (!response && SDL_GetTicks() < end );
-
- return response && xevent.xselection.property != None;
- }
-}
-
-void LLWindowSDL::initialiseX11Clipboard()
-{
- if (!mSDL_Display)
- return;
-
- SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
- SDL_SetEventFilter(x11_clipboard_filter, nullptr);
-
- maybe_lock_display();
-
- XA_CLIPBOARD = XInternAtom(mSDL_Display, "CLIPBOARD", False);
-
- gSupportedAtoms[0] = XInternAtom(mSDL_Display, "UTF8_STRING", False);
- gSupportedAtoms[1] = XInternAtom(mSDL_Display, "COMPOUND_TEXT", False);
- gSupportedAtoms[2] = XA_STRING;
-
- // TARGETS atom
- XA_TARGETS = XInternAtom(mSDL_Display, "TARGETS", False);
-
- // SL_PASTE_BUFFER atom
- PVT_PASTE_BUFFER = XInternAtom(mSDL_Display, "FS_PASTE_BUFFER", False);
-
- maybe_unlock_display();
-}
-
-bool LLWindowSDL::getSelectionText( Atom aSelection, Atom aType, LLWString &text )
-{
- if( !mSDL_Display )
- return false;
-
- if( !grab_property(mSDL_Display, mSDL_XWindowID, aSelection,aType ) )
- return false;
-
- maybe_lock_display();
-
- Atom type;
- int format{};
- unsigned long len{},remaining {};
- unsigned char* data = nullptr;
- int res = XGetWindowProperty(mSDL_Display, mSDL_XWindowID,
- PVT_PASTE_BUFFER, 0, MAX_PASTE_BUFFER_SIZE, False,
- AnyPropertyType, &type, &format, &len,
- &remaining, &data);
- if (data && len)
- {
- text = LLWString(
- utf8str_to_wstring(reinterpret_cast< char const *>( data ) )
- );
- XFree(data);
- }
-
- maybe_unlock_display();
- return res == Success;
-}
-
-bool LLWindowSDL::getSelectionText(Atom selection, LLWString& text)
-{
- if (!mSDL_Display)
- return false;
-
- maybe_lock_display();
-
- Window owner = XGetSelectionOwner(mSDL_Display, selection);
- if (owner == None)
- {
- if (selection == XA_PRIMARY)
- {
- owner = DefaultRootWindow(mSDL_Display);
- selection = XA_CUT_BUFFER0;
- }
- else
- {
- maybe_unlock_display();
- return false;
- }
- }
-
- maybe_unlock_display();
-
- for( Atom atom : gSupportedAtoms )
- {
- if(getSelectionText(selection, atom, text ) )
- return true;
- }
-
- return false;
-}
-
-bool LLWindowSDL::setSelectionText(Atom selection, const LLWString& text)
-{
- maybe_lock_display();
-
- if (selection == XA_PRIMARY)
- {
- std::string utf8 = wstring_to_utf8str(text);
- XStoreBytes(mSDL_Display, utf8.c_str(), utf8.length() + 1);
- mPrimaryClipboard = text;
- }
- else
- mSecondaryClipboard = text;
-
- XSetSelectionOwner(mSDL_Display, selection, mSDL_XWindowID, CurrentTime);
-
- auto owner = XGetSelectionOwner(mSDL_Display, selection);
-
- maybe_unlock_display();
-
- return owner == mSDL_XWindowID;
-}
-
-Display* LLWindowSDL::getSDLDisplay()
-{
- if (gWindowImplementation)
- return gWindowImplementation->mSDL_Display;
- return nullptr;
-}
-
-#endif
-
-
LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
- const std::string& title, S32 x, S32 y, S32 width,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
bool fullscreen, bool clearBg,
- bool disable_vsync, bool use_gl,
+ bool enable_vsync, bool use_gl,
bool ignore_pixel_depth, U32 fsaa_samples)
: LLWindow(callbacks, fullscreen, flags),
Lock_Display(NULL),
- //Unlock_Display(NULL), mGamma(1.0f)
Unlock_Display(NULL), mGamma(1.0f)
{
// Initialize the keyboard
@@ -427,19 +181,19 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
#if LL_X11
mSDL_XWindowID = None;
- mSDL_Display = NULL;
+ mSDL_Display = nullptr;
#endif // LL_X11
// Assume 4:3 aspect ratio until we know better
mOriginalAspectRatio = 1024.0 / 768.0;
if (title.empty())
- mWindowTitle = "SDL Window"; // *FIX: (?)
+ mWindowTitle = "Second Life";
else
mWindowTitle = title;
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
- if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
+ if(createContext(x, y, width, height, 32, fullscreen, enable_vsync))
{
gGLManager.initGL();
@@ -453,10 +207,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
// Stash an object pointer for OSMessageBox()
gWindowImplementation = this;
-#if LL_X11
mFlashing = false;
- initialiseX11Clipboard();
-#endif // LL_X11
mKeyVirtualKey = 0;
mKeyModifiers = KMOD_NONE;
@@ -478,145 +229,6 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)
return SDL_LoadBMP(path_buffer);
}
-#if LL_X11
-// This is an XFree86/XOrg-specific hack for detecting the amount of Video RAM
-// on this machine. It works by searching /var/log/var/log/Xorg.?.log or
-// /var/log/XFree86.?.log for a ': (VideoRAM ?|Memory): (%d+) kB' regex, where
-// '?' is the X11 display number derived from $DISPLAY
-static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str)
-{
- const int line_buf_size = 1000;
- char line_buf[line_buf_size];
- while (fgets(line_buf, line_buf_size, fp))
- {
- //LL_DEBUGS() << "XLOG: " << line_buf << LL_ENDL;
-
- // Why the ad-hoc parser instead of using a regex? Our
- // favourite regex implementation - libboost_regex - is
- // quite a heavy and troublesome dependency for the client, so
- // it seems a shame to introduce it for such a simple task.
- // *FIXME: libboost_regex is a dependency now anyway, so we may
- // as well use it instead of this hand-rolled nonsense.
- const char *part1_template = prefix_str;
- const char part2_template[] = " kB";
- char *part1 = strstr(line_buf, part1_template);
- if (part1) // found start of matching line
- {
- part1 = &part1[strlen(part1_template)]; // -> after
- char *part2 = strstr(part1, part2_template);
- if (part2) // found end of matching line
- {
- // now everything between part1 and part2 is
- // supposed to be numeric, describing the
- // number of kB of Video RAM supported
- int rtn = 0;
- for (; part1 < part2; ++part1)
- {
- if (*part1 < '0' || *part1 > '9')
- {
- // unexpected char, abort parse
- rtn = 0;
- break;
- }
- rtn *= 10;
- rtn += (*part1) - '0';
- }
- if (rtn > 0)
- {
- // got the kB number. return it now.
- return rtn;
- }
- }
- }
- }
- return 0; // 'could not detect'
-}
-
-static int x11_detect_VRAM_kb()
-{
- std::string x_log_location("/var/log/");
- std::string fname;
- int rtn = 0; // 'could not detect'
- int display_num = 0;
- FILE *fp;
- char *display_env = getenv("DISPLAY"); // e.g. :0 or :0.0 or :1.0 etc
- // parse DISPLAY number so we can go grab the right log file
- if (display_env[0] == ':' &&
- display_env[1] >= '0' && display_env[1] <= '9')
- {
- display_num = display_env[1] - '0';
- }
-
- // *TODO: we could be smarter and see which of Xorg/XFree86 has the
- // freshest time-stamp.
-
- // Try Xorg log first
- fname = x_log_location;
- fname += "Xorg.";
- fname += ('0' + display_num);
- fname += ".log";
- fp = fopen(fname.c_str(), "r");
- if (fp)
- {
- LL_INFOS() << "Looking in " << fname
- << " for VRAM info..." << LL_ENDL;
- rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: ");
- fclose(fp);
- if (0 == rtn)
- {
- fp = fopen(fname.c_str(), "r");
- if (fp)
- {
- rtn = x11_detect_VRAM_kb_fp(fp, ": Video RAM: ");
- fclose(fp);
- if (0 == rtn)
- {
- fp = fopen(fname.c_str(), "r");
- if (fp)
- {
- rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
- fclose(fp);
- }
- }
- }
- }
- }
- else
- {
- LL_INFOS() << "Could not open " << fname
- << " - skipped." << LL_ENDL;
- // Try old XFree86 log otherwise
- fname = x_log_location;
- fname += "XFree86.";
- fname += ('0' + display_num);
- fname += ".log";
- fp = fopen(fname.c_str(), "r");
- if (fp)
- {
- LL_INFOS() << "Looking in " << fname
- << " for VRAM info..." << LL_ENDL;
- rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: ");
- fclose(fp);
- if (0 == rtn)
- {
- fp = fopen(fname.c_str(), "r");
- if (fp)
- {
- rtn = x11_detect_VRAM_kb_fp(fp, ": Memory: ");
- fclose(fp);
- }
- }
- }
- else
- {
- LL_INFOS() << "Could not open " << fname
- << " - skipped." << LL_ENDL;
- }
- }
- return rtn;
-}
-#endif // LL_X11
-
void LLWindowSDL::setTitle(const std::string title)
{
SDL_SetWindowTitle( mWindow, title.c_str() );
@@ -675,7 +287,7 @@ void LLWindowSDL::tryFindFullscreenSize( int &width, int &height )
}
}
-bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync)
+bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync)
{
//bool glneedsinit = false;
@@ -734,6 +346,10 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
width = 1024;
if (height == 0)
width = 768;
+ if (x == 0)
+ x = SDL_WINDOWPOS_UNDEFINED;
+ if (y == 0)
+ y = SDL_WINDOWPOS_UNDEFINED;
mFullscreen = fullscreen;
@@ -749,23 +365,16 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
mSDLFlags = sdlflags;
+ // Setup default backing colors
GLint redBits{8}, greenBits{8}, blueBits{8}, alphaBits{8};
+ GLint depthBits{24}, stencilBits{8};
- GLint depthBits{(bits <= 16) ? 16 : 24}, stencilBits{8};
-
- if (getenv("LL_GL_NO_STENCIL"))
- stencilBits = 0;
-
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, redBits);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, greenBits);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, blueBits);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits );
-
- // We need stencil support for a few (minor) things.
- if (stencilBits)
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits);
- // *FIX: try to toggle vsync here?
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
#if LL_DARWIN
@@ -777,30 +386,40 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- if (mFSAASamples > 0)
+ U32 context_flags = 0;
+ if (gDebugGL)
{
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples);
+ context_flags |= SDL_GL_CONTEXT_DEBUG_FLAG;
}
-
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, context_flags);
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
- mWindow = SDL_CreateWindow( mWindowTitle.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, mSDLFlags );
- if( mWindow )
+ // Create the window
+ mWindow = SDL_CreateWindow(mWindowTitle.c_str(), x, y, width, height, mSDLFlags);
+ if (mWindow == nullptr)
{
- mContext = SDL_GL_CreateContext( mWindow );
+ LL_WARNS() << "Window creation failure. SDL: " << SDL_GetError() << LL_ENDL;
+ setupFailure("Window creation error", "Error", OSMB_OK);
+ return false;
+ }
- if( mContext == 0 )
- {
- LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL;
- setupFailure("GL Context creation error creation error", "Error", OSMB_OK);
- return false;
- }
- // SDL_GL_SetSwapInterval(1);
+ // Create the context
+ mContext = SDL_GL_CreateContext(mWindow);
+ if(!mContext)
+ {
+ LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL;
+ setupFailure("GL Context creation error", "Error", OSMB_OK);
+ return false;
}
+ if (SDL_GL_MakeCurrent(mWindow, mContext) != 0)
+ {
+ LL_WARNS() << "Failed to make context current. SDL: " << SDL_GetError() << LL_ENDL;
+ setupFailure("GL Context failed to set current failure", "Error", OSMB_OK);
+ return false;
+ }
- if( mFullscreen )
+ if(mFullscreen)
{
if (mWindow)
{
@@ -844,70 +463,6 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
}
}
- // Set the application icon.
- SDL_Surface *bmpsurface;
- bmpsurface = Load_BMP_Resource("ll_icon.BMP");
- if (bmpsurface)
- {
- SDL_SetWindowIcon(mWindow, bmpsurface);
- SDL_FreeSurface(bmpsurface);
- bmpsurface = NULL;
- }
-
- // Detect video memory size.
-# if LL_X11
- gGLManager.mVRAM = x11_detect_VRAM_kb() / 1024;
- if (gGLManager.mVRAM != 0)
- {
- LL_INFOS() << "X11 log-parser detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL;
- } else
- {
- PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC queryInteger;
- queryInteger = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)
- glXGetProcAddressARB((const GLubyte *)"glXQueryCurrentRendererIntegerMESA");
- unsigned int vram_megabytes = 0;
- queryInteger(GLX_RENDERER_VIDEO_MEMORY_MESA, &vram_megabytes);
- if (!vram_megabytes) {
- glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, (int *)&vram_megabytes);
- vram_megabytes /= 1024;
- }
- if (!vram_megabytes) {
- glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, (int *)&vram_megabytes);
- vram_megabytes /= 1024;
- }
- gGLManager.mVRAM = vram_megabytes;
- }
-#elif LL_DARWIN
- CGLRendererInfoObj info = 0;
- GLint vram_megabytes = 0;
- int num_renderers = 0;
- auto err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),
- &info, &num_renderers);
- if (!err) {
- CGLDescribeRenderer(info, 0, kCGLRPVideoMemoryMegabytes, &vram_megabytes);
- CGLDestroyRendererInfo(info);
- } else
- vram_megabytes = 256;
- gGLManager.mVRAM = vram_megabytes;
-# endif // LL_X11
-/*
- {
- // fallback to letting SDL detect VRAM.
- // note: I've not seen SDL's detection ever actually find
- // VRAM != 0, but if SDL *does* detect it then that's a bonus.
- gGLManager.mVRAM = 0;
- if (gGLManager.mVRAM != 0)
- {
- LL_INFOS() << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL;
- }
- }
-*/
- // If VRAM is not detected, that is handled later
-
- // *TODO: Now would be an appropriate time to check for some
- // explicitly unsupported cards.
- //const char* RENDERER = (const char*) glGetString(GL_RENDERER);
-
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits);
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenBits);
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueBits);
@@ -943,6 +498,20 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
#endif
}
+ LL_PROFILER_GPU_CONTEXT;
+
+ // Enable vertical sync
+ toggleVSync(enable_vsync);
+
+ // Set the application icon.
+ SDL_Surface* bmpsurface = Load_BMP_Resource("ll_icon.BMP");
+ if (bmpsurface)
+ {
+ SDL_SetWindowIcon(mWindow, bmpsurface);
+ SDL_FreeSurface(bmpsurface);
+ bmpsurface = NULL;
+ }
+
#if LL_X11
/* Grab the window manager specific information */
SDL_SysWMinfo info;
@@ -968,7 +537,38 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
}
#endif // LL_X11
-
+# if LL_X11
+ PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC queryInteger;
+ queryInteger = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXQueryCurrentRendererIntegerMESA");
+ unsigned int vram_megabytes = 0;
+ queryInteger(GLX_RENDERER_VIDEO_MEMORY_MESA, &vram_megabytes);
+ if (!vram_megabytes)
+ {
+ glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, (int *)&vram_megabytes);
+ vram_megabytes /= 1024;
+ }
+ if (!vram_megabytes)
+ {
+ glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, (int *)&vram_megabytes);
+ vram_megabytes /= 1024;
+ }
+ gGLManager.mVRAM = vram_megabytes;
+#elif LL_DARWIN
+ CGLRendererInfoObj info = 0;
+ GLint vram_megabytes = 0;
+ int num_renderers = 0;
+ auto err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &num_renderers);
+ if (!err)
+ {
+ CGLDescribeRenderer(info, 0, kCGLRPVideoMemoryMegabytes, &vram_megabytes);
+ CGLDestroyRendererInfo(info);
+ }
+ else
+ {
+ vram_megabytes = 256;
+ }
+ gGLManager.mVRAM = vram_megabytes;
+# endif
SDL_StartTextInput();
//make sure multisampling is disabled by default
#if GL_VERSION_1_3
@@ -979,9 +579,48 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
return true;
}
+void* LLWindowSDL::createSharedContext()
+{
+ SDL_GLContext pContext = SDL_GL_CreateContext(mWindow);
+ if (pContext)
+ {
+ LL_DEBUGS() << "Creating shared OpenGL context successful!" << LL_ENDL;
+ return (void*)pContext;
+ }
+
+ LL_WARNS() << "Creating shared OpenGL context failed!" << LL_ENDL;
+ return nullptr;
+}
+
+void LLWindowSDL::makeContextCurrent(void* contextPtr)
+{
+ SDL_GL_MakeCurrent(mWindow, contextPtr);
+ LL_PROFILER_GPU_CONTEXT;
+}
+
+void LLWindowSDL::destroySharedContext(void* contextPtr)
+{
+ SDL_GL_DeleteContext(contextPtr);
+}
+
+void LLWindowSDL::toggleVSync(bool enable_vsync)
+{
+ if (!enable_vsync)
+ {
+ LL_INFOS("Window") << "Disabling vertical sync" << LL_ENDL;
+ SDL_GL_SetSwapInterval(0);
+ SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC,"0",SDL_HINT_OVERRIDE);
+ }
+ else
+ {
+ LL_INFOS("Window") << "Enabling vertical sync" << LL_ENDL;
+ SDL_GL_SetSwapInterval(1);
+ SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC,"1",SDL_HINT_OVERRIDE);
+ }
+}
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
-bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp)
+bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp)
{
const bool needsRebuild = true; // Just nuke the context and start over.
bool result = true;
@@ -991,7 +630,7 @@ bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool
if(needsRebuild)
{
destroyContext();
- result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync);
+ result = createContext(0, 0, size.mX, size.mY, 32, fullscreen, enable_vsync);
if (result)
{
gGLManager.initGL();
@@ -1011,7 +650,13 @@ void LLWindowSDL::destroyContext()
{
LL_INFOS() << "destroyContext begins" << LL_ENDL;
+ // Stop unicode input
SDL_StopTextInput();
+
+ // Clean up remaining GL state before blowing away window
+ LL_INFOS() << "shutdownGL begins" << LL_ENDL;
+ gGLManager.shutdownGL();
+
#if LL_X11
mSDL_Display = NULL;
mSDL_XWindowID = None;
@@ -1019,18 +664,38 @@ void LLWindowSDL::destroyContext()
Unlock_Display = NULL;
#endif // LL_X11
- // Clean up remaining GL state before blowing away window
- LL_INFOS() << "shutdownGL begins" << LL_ENDL;
- gGLManager.shutdownGL();
+ LL_INFOS() << "Destroying SDL cursors" << LL_ENDL;
+ quitCursors();
+
+ if (mContext)
+ {
+ LL_INFOS() << "Destroying SDL GL Context" << LL_ENDL;
+ SDL_GL_DeleteContext(mContext);
+ mContext = nullptr;
+ }
+ else
+ {
+ LL_INFOS() << "SDL GL Context already destroyed" << LL_ENDL;
+ }
+
+ if (mWindow)
+ {
+ LL_INFOS() << "Destroying SDL Window" << LL_ENDL;
+ SDL_DestroyWindow(mWindow);
+ mWindow = nullptr;
+ }
+ else
+ {
+ LL_INFOS() << "SDL Window already destroyed" << LL_ENDL;
+ }
+ LL_INFOS() << "destroyContext end" << LL_ENDL;
+
LL_INFOS() << "SDL_QuitSS/VID begins" << LL_ENDL;
SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky...
-
- mWindow = NULL;
}
LLWindowSDL::~LLWindowSDL()
{
- quitCursors();
destroyContext();
if(mSupportedResolutions != NULL)
@@ -1044,7 +709,6 @@ LLWindowSDL::~LLWindowSDL()
void LLWindowSDL::show()
{
- // *FIX: What to do with SDL?
if (mWindow)
{
SDL_ShowWindow(mWindow);
@@ -1053,7 +717,6 @@ void LLWindowSDL::show()
void LLWindowSDL::hide()
{
- // *FIX: What to do with SDL?
if (mWindow)
{
SDL_HideWindow(mWindow);
@@ -1063,7 +726,6 @@ void LLWindowSDL::hide()
//virtual
void LLWindowSDL::minimize()
{
- // *FIX: What to do with SDL?
if (mWindow)
{
SDL_MinimizeWindow(mWindow);
@@ -1073,14 +735,12 @@ void LLWindowSDL::minimize()
//virtual
void LLWindowSDL::restore()
{
- // *FIX: What to do with SDL?
if (mWindow)
{
SDL_RestoreWindow(mWindow);
}
}
-
// close() destroys all OS-specific code associated with a window.
// Usually called from LLWindowManager::destroyWindow()
void LLWindowSDL::close()
@@ -1106,56 +766,54 @@ bool LLWindowSDL::isValid()
bool LLWindowSDL::getVisible()
{
bool result = false;
-
- // *FIX: This isn't really right...
- // Then what is?
if (mWindow)
{
- if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_SHOWN ) result = true;
+ Uint32 flags = SDL_GetWindowFlags(mWindow);
+ if (flags & SDL_WINDOW_SHOWN)
+ {
+ result = true;
+ }
}
-
- return(result);
+ return result;
}
bool LLWindowSDL::getMinimized()
{
bool result = false;
-
- if (mWindow/*&& (1 == mIsMinimized)*/)
+ if (mWindow)
{
- if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MINIMIZED ) result = true;
+ Uint32 flags = SDL_GetWindowFlags(mWindow);
+ if (flags & SDL_WINDOW_MINIMIZED)
+ {
+ result = true;
+ }
}
-
- mIsMinimized = result;
- return(result);
+ return result;
}
bool LLWindowSDL::getMaximized()
{
bool result = false;
-
if (mWindow)
{
- // TODO
- if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED ) result = true;
- else result = false;
+ Uint32 flags = SDL_GetWindowFlags(mWindow);
+ if (flags & SDL_WINDOW_MAXIMIZED)
+ {
+ result = true;
+ }
}
- return(result);
+ return result;
}
bool LLWindowSDL::maximize()
{
- // TODO
- bool result = false;
-
if (mWindow)
{
SDL_MaximizeWindow(mWindow);
- result = true;
+ return true;
}
-
- return result;
+ return false;
}
bool LLWindowSDL::getFullscreen()
@@ -1165,10 +823,12 @@ bool LLWindowSDL::getFullscreen()
bool LLWindowSDL::getPosition(LLCoordScreen *position)
{
- // *FIX: can anything be done with this?
- position->mX = 0;
- position->mY = 0;
- return true;
+ if (mWindow)
+ {
+ SDL_GetWindowPosition(mWindow, &position->mX, &position->mY);
+ return true;
+ }
+ return false;
}
bool LLWindowSDL::getSize(LLCoordScreen *size)
@@ -1203,17 +863,13 @@ bool LLWindowSDL::getSize(LLCoordWindow *size)
bool LLWindowSDL::setPosition(const LLCoordScreen position)
{
- bool result = false;
-
- if(mWindow)
+ if (mWindow)
{
- // *FIX: (?)
- //MacMoveWindow(mWindow, position.mX, position.mY, false);
SDL_SetWindowPosition(mWindow, position.mX, position.mY);
- result = true;
+ return true;
}
- return result;
+ return false;
}
template< typename T > bool setSizeImpl( const T& newSize, SDL_Window *pWin )
@@ -1254,8 +910,9 @@ void LLWindowSDL::swapBuffers()
{
if (mWindow)
{
- SDL_GL_SwapWindow( mWindow );
+ SDL_GL_SwapWindow(mWindow);
}
+ LL_PROFILER_GPU_COLLECT;
}
U32 LLWindowSDL::getFSAASamples()
@@ -1270,28 +927,33 @@ void LLWindowSDL::setFSAASamples(const U32 samples)
F32 LLWindowSDL::getGamma()
{
- return 1/mGamma;
+ return 1.f / mGamma;
}
bool LLWindowSDL::restoreGamma()
{
- //CGDisplayRestoreColorSyncSettings();
- // SDL_SetGamma(1.0f, 1.0f, 1.0f);
- Uint16 ramp;
- SDL_CalculateGammaRamp(1.0f, &ramp);
- SDL_SetWindowGammaRamp(mWindow, &ramp, &ramp, &ramp);
+ if (mWindow)
+ {
+ Uint16 ramp[256];
+ SDL_CalculateGammaRamp(1.f, ramp);
+ SDL_SetWindowGammaRamp(mWindow, ramp, ramp, ramp);
+ }
return true;
}
bool LLWindowSDL::setGamma(const F32 gamma)
{
- mGamma = gamma;
- if (mGamma == 0) mGamma = 0.1f;
- mGamma = 1/mGamma;
- // SDL_SetGamma(mGamma, mGamma, mGamma);
- Uint16 ramp;
- SDL_CalculateGammaRamp(mGamma, &ramp);
- SDL_SetWindowGammaRamp(mWindow, &ramp, &ramp, &ramp);
+ if (mWindow)
+ {
+ Uint16 ramp[256];
+
+ mGamma = gamma;
+ if (mGamma == 0) mGamma = 0.1f;
+ mGamma = 1.f / mGamma;
+
+ SDL_CalculateGammaRamp(mGamma, ramp);
+ SDL_SetWindowGammaRamp(mWindow, ramp, ramp, ramp);
+ }
return true;
}
@@ -1300,10 +962,8 @@ bool LLWindowSDL::isCursorHidden()
return mCursorHidden;
}
-
-
// Constrains the mouse to the window.
-void LLWindowSDL::setMouseClipping( bool b )
+void LLWindowSDL::setMouseClipping(bool b)
{
//SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF);
}
@@ -1313,18 +973,10 @@ void LLWindowSDL::setMinSize(U32 min_width, U32 min_height, bool enforce_immedia
{
LLWindow::setMinSize(min_width, min_height, enforce_immediately);
-#if LL_X11
- // Set the minimum size limits for X11 window
- // so the window manager doesn't allow resizing below those limits.
- XSizeHints* hints = XAllocSizeHints();
- hints->flags |= PMinSize;
- hints->min_width = mMinWindowWidth;
- hints->min_height = mMinWindowHeight;
-
- XSetWMNormalHints(mSDL_Display, mSDL_XWindowID, hints);
-
- XFree(hints);
-#endif
+ if (mWindow && min_width > 0 && min_height > 0)
+ {
+ SDL_SetWindowMinimumSize(mWindow, mMinWindowWidth, mMinWindowHeight);
+ }
}
bool LLWindowSDL::setCursorPosition(const LLCoordWindow position)
@@ -1359,7 +1011,6 @@ bool LLWindowSDL::getCursorPosition(LLCoordWindow *position)
//Point cursor_point;
LLCoordScreen screen_pos;
- //GetMouse(&cursor_point);
int x, y;
SDL_GetMouseState(&x, &y);
@@ -1479,116 +1130,70 @@ void LLWindowSDL::afterDialog()
}
}
-
-#if LL_X11
-// set/reset the XWMHints flag for 'urgency' that usually makes the icon flash
-void LLWindowSDL::x11_set_urgent(bool urgent)
-{
- if (mSDL_Display && !mFullscreen)
- {
- XWMHints *wm_hints;
-
- LL_INFOS() << "X11 hint for urgency, " << urgent << LL_ENDL;
-
- maybe_lock_display();
- wm_hints = XGetWMHints(mSDL_Display, mSDL_XWindowID);
- if (!wm_hints)
- wm_hints = XAllocWMHints();
-
- if (urgent)
- wm_hints->flags |= XUrgencyHint;
- else
- wm_hints->flags &= ~XUrgencyHint;
-
- XSetWMHints(mSDL_Display, mSDL_XWindowID, wm_hints);
- XFree(wm_hints);
- XSync(mSDL_Display, False);
- maybe_unlock_display();
- }
-}
-#endif // LL_X11
-
void LLWindowSDL::flashIcon(F32 seconds)
{
- if (getMinimized())
- {
-#if !LL_X11
- LL_INFOS() << "Stub LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
-#else
- LL_INFOS() << "X11 LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
+ LL_INFOS() << "LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
- F32 remaining_time = mFlashTimer.getRemainingTimeF32();
- if (remaining_time < seconds)
- remaining_time = seconds;
- mFlashTimer.reset();
- mFlashTimer.setTimerExpirySec(remaining_time);
+ F32 remaining_time = mFlashTimer.getRemainingTimeF32();
+ if (remaining_time < seconds)
+ remaining_time = seconds;
+ mFlashTimer.reset();
+ mFlashTimer.setTimerExpirySec(remaining_time);
- x11_set_urgent(true);
- mFlashing = true;
-#endif // LL_X11
- }
+ SDL_FlashWindow(mWindow, SDL_FLASH_UNTIL_FOCUSED);
+ mFlashing = true;
}
bool LLWindowSDL::isClipboardTextAvailable()
{
-#if LL_X11
- return mSDL_Display && XGetSelectionOwner(mSDL_Display, XA_CLIPBOARD) != None;
-#else
- return SDL_HasClipboardText();
-#endif
+ return SDL_HasClipboardText() == SDL_TRUE;
}
bool LLWindowSDL::pasteTextFromClipboard(LLWString &dst)
{
-#if LL_X11
- return getSelectionText(XA_CLIPBOARD, dst);
-#else
- auto data = SDL_GetClipboardText();
- if (data)
+ if (isClipboardTextAvailable())
{
- dst = LLWString(utf8str_to_wstring(data));
- SDL_free(data);
- return true;
+ char* data = SDL_GetClipboardText();
+ if (data)
+ {
+ dst = LLWString(utf8str_to_wstring(data));
+ SDL_free(data);
+ return true;
+ }
}
return false;
-#endif
}
-bool LLWindowSDL::copyTextToClipboard(const LLWString &s)
+bool LLWindowSDL::copyTextToClipboard(const LLWString& text)
{
-#if LL_X11
- return setSelectionText(XA_CLIPBOARD, s);
-#else
- return !SDL_SetClipboardText(wstring_to_utf8str(s).c_str());
-#endif
+ const std::string utf8 = wstring_to_utf8str(text);
+ return SDL_SetClipboardText(utf8.c_str()) == 0; // success == 0
}
bool LLWindowSDL::isPrimaryTextAvailable()
{
-#if LL_X11
- LLWString text;
- return getSelectionText(XA_PRIMARY, text) && !text.empty();
-#else
- return false; // unsupported
-#endif
+ return SDL_HasPrimarySelectionText() == SDL_TRUE;
}
bool LLWindowSDL::pasteTextFromPrimary(LLWString &dst)
{
-#if LL_X11
- return getSelectionText(XA_PRIMARY, dst);
-#else
- return false; // unsupported
-#endif
+ if (isPrimaryTextAvailable())
+ {
+ char* data = SDL_GetPrimarySelectionText();
+ if (data)
+ {
+ dst = LLWString(utf8str_to_wstring(data));
+ SDL_free(data);
+ return true;
+ }
+ }
+ return false;
}
-bool LLWindowSDL::copyTextToPrimary(const LLWString &s)
+bool LLWindowSDL::copyTextToPrimary(const LLWString& text)
{
-#if LL_X11
- return setSelectionText(XA_PRIMARY, s);
-#else
- return false; // unsupported
-#endif
+ const std::string utf8 = wstring_to_utf8str(text);
+ return SDL_SetPrimarySelectionText(utf8.c_str()) == 0; // success == 0
}
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
@@ -1693,9 +1298,6 @@ bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to)
return(convertCoords(from, &window_coord) && convertCoords(window_coord, to));
}
-
-
-
void LLWindowSDL::setupFailure(const std::string& text, const std::string& caption, U32 type)
{
destroyContext();
@@ -1730,47 +1332,24 @@ bool LLWindowSDL::SDLReallyCaptureInput(bool capture)
bool newGrab = wantGrab;
-#if LL_X11
if (!mFullscreen) /* only bother if we're windowed anyway */
{
- if (mSDL_Display)
+ int result;
+ if (wantGrab == true)
{
- /* we dirtily mix raw X11 with SDL so that our pointer
- isn't (as often) constrained to the limits of the
- window while grabbed, which feels nicer and
- hopefully eliminates some reported 'sticky pointer'
- problems. We use raw X11 instead of
- SDL_WM_GrabInput() because the latter constrains
- the pointer to the window and also steals all
- *keyboard* input from the window manager, which was
- frustrating users. */
- int result;
- if (wantGrab == true)
- {
- maybe_lock_display();
- result = XGrabPointer(mSDL_Display, mSDL_XWindowID,
- True, 0, GrabModeAsync,
- GrabModeAsync,
- None, None, CurrentTime);
- maybe_unlock_display();
- if (GrabSuccess == result)
- newGrab = true;
- else
- newGrab = false;
- }
+ result = SDL_CaptureMouse(SDL_TRUE);
+ if (0 == result)
+ newGrab = true;
else
- {
newGrab = false;
-
- maybe_lock_display();
- XUngrabPointer(mSDL_Display, CurrentTime);
- // Make sure the ungrab happens RIGHT NOW.
- XSync(mSDL_Display, False);
- maybe_unlock_display();
- }
+ }
+ else
+ {
+ newGrab = false;
+ result = SDL_CaptureMouse(SDL_FALSE);
}
}
-#endif // LL_X11
+
// return boolean success for whether we ended up in the desired state
return capture == newGrab;
}
@@ -1900,7 +1479,7 @@ void check_vm_bloat()
last_rss_size = this_rss_size;
last_vm_size = this_vm_size;
- finally:
+finally:
if (NULL != ptr)
{
free(ptr);
@@ -1936,11 +1515,6 @@ void LLWindowSDL::processMiscNativeEvents()
void LLWindowSDL::gatherInput()
{
- const Uint32 CLICK_THRESHOLD = 300; // milliseconds
- static int leftClick = 0;
- static int rightClick = 0;
- static Uint32 lastLeftDown = 0;
- static Uint32 lastRightDown = 0;
SDL_Event event;
// Handle all outstanding SDL events
@@ -1949,13 +1523,21 @@ void LLWindowSDL::gatherInput()
switch (event.type)
{
case SDL_MOUSEWHEEL:
+ {
if( event.wheel.y != 0 )
+ {
mCallbacks->handleScrollWheel(this, -event.wheel.y);
+ }
+ if (event.wheel.x != 0)
+ {
+ mCallbacks->handleScrollHWheel(this, -event.wheel.x);
+ }
break;
+ }
case SDL_MOUSEMOTION:
{
- LLCoordWindow winCoord(event.button.x, event.button.y);
+ LLCoordWindow winCoord(event.motion.x, event.motion.y);
LLCoordGL openGlCoord;
convertCoords(winCoord, &openGlCoord);
@@ -2034,7 +1616,6 @@ void LLWindowSDL::gatherInput()
case SDL_MOUSEBUTTONDOWN:
{
- bool isDoubleClick = false;
LLCoordWindow winCoord(event.button.x, event.button.y);
LLCoordGL openGlCoord;
convertCoords(winCoord, &openGlCoord);
@@ -2044,58 +1625,25 @@ void LLWindowSDL::gatherInput()
MASK mask = gKeyboard->currentMask(true);
- if (event.button.button == SDL_BUTTON_LEFT) // SDL doesn't manage double clicking...
- {
- Uint32 now = SDL_GetTicks();
- if ((now - lastLeftDown) > CLICK_THRESHOLD)
- leftClick = 1;
- else
- {
- if (++leftClick >= 2)
- {
- leftClick = 0;
- isDoubleClick = true;
- }
- }
- lastLeftDown = now;
- }
- else if (event.button.button == SDL_BUTTON_RIGHT)
- {
- Uint32 now = SDL_GetTicks();
- if ((now - lastRightDown) > CLICK_THRESHOLD)
- rightClick = 1;
- else
- {
- if (++rightClick >= 2)
- {
- rightClick = 0;
- isDoubleClick = true;
- }
- }
- lastRightDown = now;
- }
-
if (event.button.button == SDL_BUTTON_LEFT) // left
{
- if (isDoubleClick)
+ if (event.button.clicks >= 2)
mCallbacks->handleDoubleClick(this, openGlCoord, mask);
else
mCallbacks->handleMouseDown(this, openGlCoord, mask);
}
-
else if (event.button.button == SDL_BUTTON_RIGHT) // right
{
mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
}
-
else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
{
mCallbacks->handleMiddleMouseDown(this, openGlCoord, mask);
}
- else if (event.button.button == 4) // mousewheel up...thanks to X11 for making SDL consider these "buttons".
- mCallbacks->handleScrollWheel(this, -1);
- else if (event.button.button == 5) // mousewheel down...thanks to X11 for making SDL consider these "buttons".
- mCallbacks->handleScrollWheel(this, 1);
+ else
+ {
+ mCallbacks->handleOtherMouseDown(this, openGlCoord, mask, event.button.button);
+ }
break;
}
@@ -2112,99 +1660,64 @@ void LLWindowSDL::gatherInput()
MASK mask = gKeyboard->currentMask(true);
if (event.button.button == SDL_BUTTON_LEFT) // left
- mCallbacks->handleMouseUp(this, openGlCoord, mask);
- else if (event.button.button == SDL_BUTTON_RIGHT) // right
- mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
- else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
- mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
- // don't handle mousewheel here...
-
- break;
- }
-
- case SDL_WINDOWEVENT: // *FIX: handle this?
- {
- if( event.window.event == SDL_WINDOWEVENT_RESIZED
- /* || event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED*/ ) // <FS:ND> SDL_WINDOWEVENT_SIZE_CHANGED is followed by SDL_WINDOWEVENT_RESIZED, so handling one shall be enough
{
- LL_INFOS() << "Handling a resize event: " << event.window.data1 << "x" << event.window.data2 << LL_ENDL;
-
- S32 width = llmax(event.window.data1, (S32)mMinWindowWidth);
- S32 height = llmax(event.window.data2, (S32)mMinWindowHeight);
-
- // *FIX: I'm not sure this is necessary!
- // <FS:ND> I think is is not
- // SDL_SetWindowSize(mWindow, width, height);
- //
-
- mCallbacks->handleResize(this, width * getSystemUISize(), height * getSystemUISize());
- }
- else if(event.window.event == SDL_WINDOWEVENT_ENTER)
- {
- LL_INFOS() << "SDL_WINDOWEVENT_ENTER" << LL_ENDL;
- if(!mHaveInputFocus) mCallbacks->handleFocus(this);
- mHaveInputFocus = true;
+ mCallbacks->handleMouseUp(this, openGlCoord, mask);
}
- else if(event.window.event == SDL_WINDOWEVENT_LEAVE)
+ else if (event.button.button == SDL_BUTTON_RIGHT) // right
{
- LL_INFOS() << "SDL_WINDOWEVENT_LEAVE" << LL_ENDL;
- if(mHaveInputFocus) mCallbacks->handleFocusLost(this);
- mHaveInputFocus = false;
+ mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
}
- else if( event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED ) // <FS:ND> What about SDL_WINDOWEVENT_ENTER (mouse focus)
+ else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
{
- // We have to do our own state massaging because SDL
- // can send us two unfocus events in a row for example,
- // which confuses the focus code [SL-24071].
- mHaveInputFocus = true;
-
- mCallbacks->handleFocus(this);
+ mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
}
- else if( event.window.event == SDL_WINDOWEVENT_FOCUS_LOST ) // <FS:ND> What about SDL_WINDOWEVENT_LEAVE (mouse focus)
+ else
{
- // We have to do our own state massaging because SDL
- // can send us two unfocus events in a row for example,
- // which confuses the focus code [SL-24071].
- mHaveInputFocus = false;
-
- mCallbacks->handleFocusLost(this);
+ mCallbacks->handleOtherMouseUp(this, openGlCoord, mask, event.button.button);
}
- /*
- Bug : the app remains inactive when maximized ..
+ break;
+ }
- else if(event.window.event == SDL_WINDOWEVENT_MINIMIZED)
- {
- LL_INFOS() << "SDL_WINDOWEVENT_MINIMIZED" << LL_ENDL;
- if(!mIsMinimized) mCallbacks->handleActivate(this,false);
- mIsMinimized = true;
- }
- else if(event.window.event == SDL_WINDOWEVENT_MAXIMIZED)
- {
- LL_INFOS() << "SDL_WINDOWEVENT_MAXIMIZED" << LL_ENDL;
- if(mIsMinimized) mCallbacks->handleActivate(this,true);
- mIsMinimized = false;
- }
- */
- else if (event.window.event == SDL_WINDOWEVENT_EXPOSED)
+ case SDL_WINDOWEVENT:
+ {
+ switch(event.window.event)
{
- int w, h;
- SDL_GL_GetDrawableSize(mWindow, &w, &h);
+ //case SDL_WINDOWEVENT_SIZE_CHANGED: <FS:ND> SDL_WINDOWEVENT_SIZE_CHANGED is followed by SDL_WINDOWEVENT_RESIZED, so handling one shall be enough
+ case SDL_WINDOWEVENT_RESIZED:
+ {
+ LL_INFOS() << "Handling a resize event: " << event.window.data1 << "x" << event.window.data2 << LL_ENDL;
+ S32 width = llmax(event.window.data1, (S32)mMinWindowWidth);
+ S32 height = llmax(event.window.data2, (S32)mMinWindowHeight);
- mCallbacks->handlePaint(this, 0, 0, w, h);
- }
- else if( event.window.event == SDL_WINDOWEVENT_MINIMIZED ||
- event.window.event == SDL_WINDOWEVENT_MAXIMIZED ||
- event.window.event == SDL_WINDOWEVENT_RESTORED ||
- event.window.event == SDL_WINDOWEVENT_EXPOSED ||
- event.window.event == SDL_WINDOWEVENT_SHOWN )
- {
- mIsMinimized = (event.window.event == SDL_WINDOWEVENT_MINIMIZED);
+ mCallbacks->handleResize(this, width * getSystemUISize(), height * getSystemUISize());
+ break;
+ }
+ case SDL_WINDOWEVENT_LEAVE:
+ mCallbacks->handleMouseLeave(this);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_GAINED:
+ mCallbacks->handleFocus(this);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_LOST:
+ mCallbacks->handleFocusLost(this);
+ break;
+ case SDL_WINDOWEVENT_EXPOSED:
+ case SDL_WINDOWEVENT_SHOWN:
+ case SDL_WINDOWEVENT_HIDDEN:
+ case SDL_WINDOWEVENT_MINIMIZED:
+ case SDL_WINDOWEVENT_MAXIMIZED:
+ case SDL_WINDOWEVENT_RESTORED:
+ {
+ Uint32 flags = SDL_GetWindowFlags(mWindow);
+ bool minimized = (flags & SDL_WINDOW_MINIMIZED);
+ bool hidden = (flags & SDL_WINDOW_HIDDEN);
- mCallbacks->handleActivate(this, !mIsMinimized);
- LL_INFOS() << "SDL deiconification state switched to " << mIsMinimized << LL_ENDL;
+ mCallbacks->handleActivate(this, !minimized || !hidden);
+ LL_INFOS() << "SDL deiconification state switched to " << minimized << LL_ENDL;
+ break;
+ }
}
-
break;
}
case SDL_QUIT:
@@ -2223,20 +1736,18 @@ void LLWindowSDL::gatherInput()
updateCursor();
-#if LL_X11
// This is a good time to stop flashing the icon if our mFlashTimer has
// expired.
if (mFlashing && mFlashTimer.hasExpired())
{
- x11_set_urgent(false);
+ SDL_FlashWindow(mWindow, SDL_FLASH_CANCEL);
mFlashing = false;
}
-#endif // LL_X11
}
static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty)
{
- SDL_Cursor *sdlcursor = NULL;
+ SDL_Cursor *sdlcursor = nullptr;
SDL_Surface *bmpsurface;
// Load cursor pixel data from BMP file
@@ -2310,12 +1821,6 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty
void LLWindowSDL::updateCursor()
{
- if (ATIbug) {
- // cursor-updating is very flaky when this bug is
- // present; do nothing.
- return;
- }
-
if (mCurrentCursor != mNextCursor)
{
if (mNextCursor < UI_CURSOR_COUNT)
@@ -2327,10 +1832,13 @@ void LLWindowSDL::updateCursor()
sdlcursor = mSDLCursors[UI_CURSOR_ARROW];
if (sdlcursor)
SDL_SetCursor(sdlcursor);
- } else {
+
+ mCurrentCursor = mNextCursor;
+ }
+ else
+ {
LL_WARNS() << "Tried to set invalid cursor number " << mNextCursor << LL_ENDL;
}
- mCurrentCursor = mNextCursor;
}
}
@@ -2340,24 +1848,24 @@ void LLWindowSDL::initCursors()
// Blank the cursor pointer array for those we may miss.
for (i=0; i<UI_CURSOR_COUNT; ++i)
{
- mSDLCursors[i] = NULL;
+ mSDLCursors[i] = nullptr;
}
// Pre-make an SDL cursor for each of the known cursor types.
// We hardcode the hotspots - to avoid that we'd have to write
// a .cur file loader.
// NOTE: SDL doesn't load RLE-compressed BMP files.
- mSDLCursors[UI_CURSOR_ARROW] = makeSDLCursorFromBMP("llarrow.BMP",0,0);
- mSDLCursors[UI_CURSOR_WAIT] = makeSDLCursorFromBMP("wait.BMP",12,15);
- mSDLCursors[UI_CURSOR_HAND] = makeSDLCursorFromBMP("hand.BMP",7,10);
- mSDLCursors[UI_CURSOR_IBEAM] = makeSDLCursorFromBMP("ibeam.BMP",15,16);
- mSDLCursors[UI_CURSOR_CROSS] = makeSDLCursorFromBMP("cross.BMP",16,14);
- mSDLCursors[UI_CURSOR_SIZENWSE] = makeSDLCursorFromBMP("sizenwse.BMP",14,17);
- mSDLCursors[UI_CURSOR_SIZENESW] = makeSDLCursorFromBMP("sizenesw.BMP",17,17);
- mSDLCursors[UI_CURSOR_SIZEWE] = makeSDLCursorFromBMP("sizewe.BMP",16,14);
- mSDLCursors[UI_CURSOR_SIZENS] = makeSDLCursorFromBMP("sizens.BMP",17,16);
- mSDLCursors[UI_CURSOR_SIZEALL] = makeSDLCursorFromBMP("sizeall.BMP", 17, 17);
- mSDLCursors[UI_CURSOR_NO] = makeSDLCursorFromBMP("llno.BMP",8,8);
- mSDLCursors[UI_CURSOR_WORKING] = makeSDLCursorFromBMP("working.BMP",12,15);
+ mSDLCursors[UI_CURSOR_ARROW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
+ mSDLCursors[UI_CURSOR_WAIT] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT);
+ mSDLCursors[UI_CURSOR_HAND] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
+ mSDLCursors[UI_CURSOR_IBEAM] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
+ mSDLCursors[UI_CURSOR_CROSS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR);
+ mSDLCursors[UI_CURSOR_SIZENWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
+ mSDLCursors[UI_CURSOR_SIZENESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
+ mSDLCursors[UI_CURSOR_SIZEWE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
+ mSDLCursors[UI_CURSOR_SIZENS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
+ mSDLCursors[UI_CURSOR_SIZEALL] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
+ mSDLCursors[UI_CURSOR_NO] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
+ mSDLCursors[UI_CURSOR_WORKING] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAITARROW);
mSDLCursors[UI_CURSOR_TOOLGRAB] = makeSDLCursorFromBMP("lltoolgrab.BMP",2,13);
mSDLCursors[UI_CURSOR_TOOLLAND] = makeSDLCursorFromBMP("lltoolland.BMP",1,6);
mSDLCursors[UI_CURSOR_TOOLFOCUS] = makeSDLCursorFromBMP("lltoolfocus.BMP",8,5);
@@ -2390,11 +1898,6 @@ void LLWindowSDL::initCursors()
mSDLCursors[UI_CURSOR_TOOLPATHFINDING_PATH_END] = makeSDLCursorFromBMP("lltoolpathfindingpathend.BMP", 16, 16);
mSDLCursors[UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD] = makeSDLCursorFromBMP("lltoolpathfindingpathendadd.BMP", 16, 16);
mSDLCursors[UI_CURSOR_TOOLNO] = makeSDLCursorFromBMP("llno.BMP",8,8);
-
- if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) {
- LL_INFOS() << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << LL_ENDL;
- ATIbug = true;
- }
}
void LLWindowSDL::quitCursors()
@@ -2444,7 +1947,7 @@ void LLWindowSDL::hideCursor()
// LL_INFOS() << "hideCursor: hiding" << LL_ENDL;
mCursorHidden = true;
mHideCursorPermanent = true;
- SDL_ShowCursor(0);
+ SDL_ShowCursor(SDL_DISABLE);
}
else
{
@@ -2459,7 +1962,7 @@ void LLWindowSDL::showCursor()
// LL_INFOS() << "showCursor: showing" << LL_ENDL;
mCursorHidden = false;
mHideCursorPermanent = false;
- SDL_ShowCursor(1);
+ SDL_ShowCursor(SDL_ENABLE);
}
else
{
@@ -2598,62 +2101,6 @@ LLSD LLWindowSDL::getNativeKeyData()
}
#endif // LL_DARWIN
-#if LL_LINUX || LL_SOLARIS || __FreeBSD__
-// extracted from spawnWebBrowser for clarity and to eliminate
-// compiler confusion regarding close(int fd) vs. LLWindow::close()
-void exec_cmd(const std::string& cmd, const std::string& arg)
-{
- char* const argv[] = {(char*)cmd.c_str(), (char*)arg.c_str(), NULL};
- fflush(NULL);
- pid_t pid = fork();
- if (pid == 0)
- { // child
- // disconnect from stdin/stdout/stderr, or child will
- // keep our output pipe undesirably alive if it outlives us.
- // close(0);
- // close(1);
- // close(2);
- // <FS:TS> Reopen stdin, stdout, and stderr to /dev/null.
- // It's good practice to always have those file
- // descriptors open to something, lest the exec'd
- // program actually try to use them.
- FILE *result;
- result = freopen("/dev/null","r",stdin);
- if (result == NULL)
- {
- LL_WARNS() << "Error reopening stdin for web browser: "
- << strerror(errno) << LL_ENDL;
- }
- result = freopen("/dev/null","w",stdout);
- if (result == NULL)
- {
- LL_WARNS() << "Error reopening stdout for web browser: "
- << strerror(errno) << LL_ENDL;
- }
- result = freopen("/dev/null","w",stderr);
- if (result == NULL)
- {
- LL_WARNS() << "Error reopening stderr for web browser: "
- << strerror(errno) << LL_ENDL;
- }
- // end ourself by running the command
- execv(cmd.c_str(), argv); /* Flawfinder: ignore */
- // if execv returns at all, there was a problem.
- LL_WARNS() << "execv failure when trying to start " << cmd << LL_ENDL;
- _exit(1); // _exit because we don't want atexit() clean-up!
- } else {
- if (pid > 0)
- {
- // parent - wait for child to die
- int childExitStatus;
- waitpid(pid, &childExitStatus, 0);
- } else {
- LL_WARNS() << "fork failure." << LL_ENDL;
- }
- }
-}
-#endif
-
// Open a URL with the user's default web browser.
// Must begin with protocol identifier.
void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
@@ -2677,69 +2124,14 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL;
-#if LL_LINUX || __FreeBSD__
-# if LL_X11
- if (mSDL_Display)
- {
- maybe_lock_display();
- // Just in case - before forking.
- XSync(mSDL_Display, False);
- maybe_unlock_display();
- }
-# endif // LL_X11
-
- std::string cmd, arg;
- cmd = gDirUtilp->getExecutableDir();
- cmd += gDirUtilp->getDirDelimiter();
- cmd += "launch_url.sh";
- arg = escaped_url;
- exec_cmd(cmd, arg);
-
-#elif LL_DARWIN
-
- S32 result = 0;
- CFURLRef urlRef = NULL;
-
- LL_INFOS() << "Opening URL " << escaped_url << LL_ENDL;
-
- CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8);
- if (stringRef)
+ if (SDL_OpenURL(escaped_url.c_str()) != 0)
{
- // This will succeed if the string is a full URL, including the http://
- // Note that URLs specified this way need to be properly percent-escaped.
- urlRef = CFURLCreateWithString(NULL, stringRef, NULL);
-
- // Don't use CRURLCreateWithFileSystemPath -- only want valid URLs
-
- CFRelease(stringRef);
+ LL_WARNS() << "spawn_web_browser failed with error: " << SDL_GetError() << LL_ENDL;
}
- if (urlRef)
- {
- result = LSOpenCFURLRef(urlRef, NULL);
-
- if (result != noErr)
- {
- LL_INFOS() << "Error " << result << " on open." << LL_ENDL;
- }
-
- CFRelease(urlRef);
- }
- else
- {
- LL_INFOS() << "Error: couldn't create URL." << LL_ENDL;
- }
-
-#endif // LL_LINUX
-
LL_INFOS() << "spawn_web_browser returning." << LL_ENDL;
}
-void LLWindowSDL::openFile(const std::string& file_name)
-{
- spawnWebBrowser("file://"+file_name,true);
-}
-
void *LLWindowSDL::getPlatformWindow()
{
return NULL;
@@ -2750,15 +2142,10 @@ void LLWindowSDL::bringToFront()
// This is currently used when we are 'launched' to a specific
// map position externally.
LL_INFOS() << "bringToFront" << LL_ENDL;
-#if LL_X11
- if (mSDL_Display && !mFullscreen)
+ if (mWindow && !mFullscreen)
{
- maybe_lock_display();
- XRaiseWindow(mSDL_Display, mSDL_XWindowID);
- XSync(mSDL_Display, False);
- maybe_unlock_display();
+ SDL_RaiseWindow(mWindow);
}
-#endif // LL_X11
}
//static
@@ -2862,54 +2249,6 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
return rtns;
}
-
-void* LLWindowSDL::createSharedContext()
-{
- auto *pContext = SDL_GL_CreateContext(mWindow);
- if ( pContext)
- {
- SDL_GL_SetSwapInterval(0);
- SDL_GL_MakeCurrent(mWindow, mContext);
-
- LLCoordScreen size;
- if (getSize(&size))
- setSize(size);
-
- LL_DEBUGS() << "Creating shared OpenGL context successful!" << LL_ENDL;
-
- return (void*)pContext;
- }
-
- LL_WARNS() << "Creating shared OpenGL context failed!" << LL_ENDL;
-
- return nullptr;
-}
-
-void LLWindowSDL::makeContextCurrent(void* contextPtr)
-{
- LL_PROFILER_GPU_CONTEXT;
- SDL_GL_MakeCurrent( mWindow, contextPtr );
-}
-
-void LLWindowSDL::destroySharedContext(void* contextPtr)
-{
- SDL_GL_DeleteContext( contextPtr );
-}
-
-void LLWindowSDL::toggleVSync(bool enable_vsync)
-{
- if( !enable_vsync)
- {
- SDL_GL_SetSwapInterval(0);
- SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC,"0",SDL_HINT_OVERRIDE);
- }
- else
- {
- SDL_GL_SetSwapInterval(1);
- SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC,"1",SDL_HINT_OVERRIDE);
- }
-}
-
void LLWindowSDL::setLanguageTextInput(const LLCoordGL& position)
{
LLCoordWindow win_pos;
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 3ed2811572..144216f658 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -84,7 +84,7 @@ public:
bool setSizeImpl(LLCoordWindow size) override;
- bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync,
+ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync,
const LLCoordScreen *const posp = NULL) override;
bool setCursorPosition(LLCoordWindow position) override;
@@ -177,13 +177,11 @@ public:
void *getPlatformWindow() override;
void bringToFront() override;
-
+
void setLanguageTextInput(const LLCoordGL& pos) override;
void spawnWebBrowser(const std::string &escaped_url, bool async) override;
- void openFile(const std::string &file_name);
-
void setTitle(const std::string title) override;
static std::vector<std::string> getDynamicFallbackFontList();
@@ -221,8 +219,8 @@ public:
protected:
LLWindowSDL(LLWindowCallbacks *callbacks,
- const std::string &title, int x, int y, int width, int height, U32 flags,
- bool fullscreen, bool clearBg, bool disable_vsync, bool use_gl,
+ const std::string &title, const std::string& name, int x, int y, int width, int height, U32 flags,
+ bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl,
bool ignore_pixel_depth, U32 fsaa_samples);
~LLWindowSDL();
@@ -251,14 +249,12 @@ protected:
//
// create or re-create the GL context/window. Called from the constructor and switchContext().
- bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync);
+ bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync);
void destroyContext();
void setupFailure(const std::string &text, const std::string &caption, U32 type);
- void fixWindowSize(void);
-
U32 SDLCheckGrabbyKeys(U32 keysym, bool gain);
bool SDLReallyCaptureInput(bool capture);
@@ -285,50 +281,19 @@ protected:
int mHaveInputFocus; /* 0=no, 1=yes, else unknown */
int mIsMinimized; /* 0=no, 1=yes, else unknown */
- int mIsActive; /* 0=no, 1=yes, else unknown */
friend class LLWindowManager;
private:
-#if LL_X11
-
- void x11_set_urgent(bool urgent);
-
bool mFlashing;
LLTimer mFlashTimer;
-#endif //LL_X11
-
U32 mKeyVirtualKey;
U32 mKeyModifiers;
std::string mInputType;
-public:
-#if LL_X11
-
- static Display *getSDLDisplay();
-
- LLWString const &getPrimaryText() const { return mPrimaryClipboard; }
-
- LLWString const &getSecondaryText() const { return mSecondaryClipboard; }
-
- void clearPrimaryText() { mPrimaryClipboard.clear(); }
-
- void clearSecondaryText() { mSecondaryClipboard.clear(); }
private:
- void initialiseX11Clipboard();
-
- bool getSelectionText(Atom selection, LLWString &text);
-
- bool getSelectionText(Atom selection, Atom type, LLWString &text);
-
- bool setSelectionText(Atom selection, const LLWString &text);
-#endif
-
void tryFindFullscreenSize(int &aWidth, int &aHeight);
-
- LLWString mPrimaryClipboard;
- LLWString mSecondaryClipboard;
};
class LLSplashScreenSDL : public LLSplashScreen
diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt
index be016eadc4..9142a4516a 100644
--- a/indra/media_plugins/cef/CMakeLists.txt
+++ b/indra/media_plugins/cef/CMakeLists.txt
@@ -180,6 +180,7 @@ if (INSTALL)
install(
FILES
${ARCH_PREBUILT_DIRS_RELEASE}/libcef.so
+ ${ARCH_PREBUILT_DIRS_RELEASE}/libvk_swiftshader.so
${AUTOBUILD_INSTALL_DIR}/bin/release/snapshot_blob.bin
${AUTOBUILD_INSTALL_DIR}/bin/release/v8_context_snapshot.bin
${AUTOBUILD_INSTALL_DIR}/resources/chrome_100_percent.pak
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 5fd549dca2..80f0b60f98 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1472,7 +1472,7 @@ if (DARWIN)
# pointer variables. As of 2019-06-26, the BugsplatMac version we're using
# does not yet do so in its own header files. This -W flag prevents fatal
# warnings.
- COMPILE_FLAGS "-fmodules -fcxx-modules -Wno-nullability-completeness"
+ COMPILE_FLAGS "-fmodules -fcxx-modules -Wno-nullability-completeness -std=c++17"
)
# Add resource files to the project.
@@ -1764,6 +1764,8 @@ if (WINDOWS)
)
target_compile_options(${VIEWER_BINARY_NAME} PRIVATE /bigobj)
+ if (FALSE)
+
# If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency
# here.
# *NOTE:Mani - This is a crappy hack to have important dependencies for the viewer_manifest copy action
@@ -1891,6 +1893,8 @@ if (WINDOWS)
add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts)
endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
+ endif (FALSE)
+
add_dependencies(${VIEWER_BINARY_NAME} SLPlugin)
# sets the 'working directory' for debugging from visual studio.
@@ -2311,7 +2315,7 @@ else (LINUX)
CACHE STRING "FreeBSD package maintainer.")
set(CPACK_FREEBSD_PACKAGE_ORIGIN net/${VIEWER_BINARY_NAME}
CACHE STRING "FreeBSD package origin.")
- set(CPACK_FREEBSD_PACKAGE_DEPS "audio/freealut;graphics/libGLU;textproc/hunspell;misc/meshoptimizer;archivers/minizip;www/libnghttp2;graphics/openjpeg;multimedia/vlc;audio/libvorbis"
+ set(CPACK_FREEBSD_PACKAGE_DEPS "audio/freealut;devel/apr;devel/boost-libs;x11-toolkits/fltk;textproc/hunspell;misc/meshoptimizer;archivers/minizip;www/libnghttp2;graphics/openjpeg;devel/sdl2;multimedia/vlc;audio/libvorbis"
CACHE STRING "FreeBSD package dependencies.")
endif ()
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 3156439181..85ac38aa49 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7909,11 +7909,11 @@
<key>Comment</key>
<string>If available free physical memory is below this value textures get agresively scaled down</string>
<key>Persist</key>
- <integer>0</integer>
+ <integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
- <integer>512</integer>
+ <integer>256</integer>
</map>
<key>RenderLowMemMinDiscardIncrement</key>
<map>
@@ -14980,7 +14980,7 @@
<key>Comment</key>
<string>Avatar follows cursor with avatars eyes, when disabled, avatar will look forward</string>
<key>Persist</key>
- <integer>0</integer>
+ <integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index a027aaf6d1..3019e844d2 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -4,16 +4,9 @@
## These options are for self-assisted troubleshooting during this beta
## testing phase; you should not usually need to touch them.
-## - Avoids using any FMOD STUDIO audio driver.
-#export LL_BAD_FMODSTUDIO_DRIVER=x
## - Avoids using any OpenAL audio driver.
#export LL_BAD_OPENAL_DRIVER=x
-## - Avoids using the FMOD Studio or FMOD Ex PulseAudio audio driver.
-#export LL_BAD_FMOD_PULSEAUDIO=x
-## - Avoids using the FMOD Studio or FMOD Ex ALSA audio driver.
-#export LL_BAD_FMOD_ALSA=x
-
## - Avoids the optional OpenGL extensions which have proven most problematic
## on some hardware. Disabling this option may cause BETTER PERFORMANCE but
## may also cause CRASHES and hangs on some unstable combinations of drivers
@@ -34,16 +27,10 @@
## LL_GL_BLACKLIST which solves your problems.
#export LL_GL_BLACKLIST=abcdefghijklmno
-## - Some ATI/Radeon users report random X server crashes when the mouse
-## cursor changes shape. If you suspect that you are a victim of this
-## driver bug, try enabling this option and report whether it helps:
-#export LL_ATI_MOUSE_CURSOR_BUG=x
-
if [ "`uname -m`" = "x86_64" ]; then
echo '64-bit Linux detected.'
fi
-
## Everything below this line is just for advanced troubleshooters.
##-------------------------------------------------------------------
@@ -55,9 +42,6 @@ fi
#export LL_WRAPPER='gdb --args'
#export LL_WRAPPER='valgrind --smc-check=all --error-limit=no --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp'
-## - Avoids an often-buggy X feature that doesn't really benefit us anyway.
-export SDL_VIDEO_X11_DGAMOUSE=0
-
## - The 'scim' GTK IM module widely crashes the viewer. Avoid it.
if [ "$GTK_IM_MODULE" = "scim" ]; then
export GTK_IM_MODULE=xim
@@ -67,13 +51,6 @@ if [ "$XMODIFIERS" = "" ]; then
export XMODIFIERS="@im=fcitx"
fi
-## - Automatically work around the ATI mouse cursor crash bug:
-## (this workaround is disabled as most fglrx users do not see the bug)
-#if lsmod | grep fglrx &>/dev/null ; then
-# export LL_ATI_MOUSE_CURSOR_BUG=x
-#fi
-
-
## Nothing worth editing below this line.
##-------------------------------------------------------------------
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 40cb6f6265..4856eb1199 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1504,6 +1504,7 @@ void LLAgentCamera::updateCamera()
LLVector3 chest_scale = chest_joint->getScale();
// shorten avatar skeleton to avoid foot interpenetration
+#if 0 // This offsets mouselook attachments, is disabled in other TPVs
if (!gAgentAvatarp->mInAir)
{
LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation();
@@ -1517,6 +1518,7 @@ void LLAgentCamera::updateCamera()
chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
diff.mV[VZ] = 0.f;
}
+#endif
// SL-315
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
@@ -2658,7 +2660,7 @@ void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, con
if (mCameraAnimating)
{
- const F64 ANIM_METERS_PER_SECOND = 15.0;
+ const F64 ANIM_METERS_PER_SECOND = 20.0;
const F64 MIN_ANIM_SECONDS = 0.5;
const F64 MAX_ANIM_SECONDS = 3.0;
F64 anim_duration = llmax( MIN_ANIM_SECONDS, sqrt(focus_delta_squared) / ANIM_METERS_PER_SECOND );
diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp
index 1425aab947..fa8acac2ce 100644
--- a/indra/newview/lldirpicker.cpp
+++ b/indra/newview/lldirpicker.cpp
@@ -272,6 +272,7 @@ bool LLDirPicker::getDir(std::string* filename, bool blocking)
}
return !mDir.empty();
#endif
+ return false;
}
std::string LLDirPicker::getDirName()
diff --git a/indra/newview/res-sdl/cross.BMP b/indra/newview/res-sdl/cross.BMP
index 0b4672d4d6..96ed7a4d60 100644
--- a/indra/newview/res-sdl/cross.BMP
+++ b/indra/newview/res-sdl/cross.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/lltoolcamera.BMP b/indra/newview/res-sdl/lltoolcamera.BMP
index c961d7a49c..f281181091 100644
--- a/indra/newview/res-sdl/lltoolcamera.BMP
+++ b/indra/newview/res-sdl/lltoolcamera.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/lltoolcreate.BMP b/indra/newview/res-sdl/lltoolcreate.BMP
index 08a4a9322d..4b7a144143 100644
--- a/indra/newview/res-sdl/lltoolcreate.BMP
+++ b/indra/newview/res-sdl/lltoolcreate.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/lltoolpipette.BMP b/indra/newview/res-sdl/lltoolpipette.BMP
index 2d27118289..6580ab0e68 100644
--- a/indra/newview/res-sdl/lltoolpipette.BMP
+++ b/indra/newview/res-sdl/lltoolpipette.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/lltoolrotate.BMP b/indra/newview/res-sdl/lltoolrotate.BMP
index 6115984c62..4d29e99177 100644
--- a/indra/newview/res-sdl/lltoolrotate.BMP
+++ b/indra/newview/res-sdl/lltoolrotate.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/toolmediaopen.BMP b/indra/newview/res-sdl/toolmediaopen.BMP
index 670f07235e..5d70cb0463 100644
--- a/indra/newview/res-sdl/toolmediaopen.BMP
+++ b/indra/newview/res-sdl/toolmediaopen.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/toolopen.BMP b/indra/newview/res-sdl/toolopen.BMP
index ae4908fd35..3e26ceec28 100644
--- a/indra/newview/res-sdl/toolopen.BMP
+++ b/indra/newview/res-sdl/toolopen.BMP
Binary files differ
diff --git a/indra/newview/res-sdl/toolplay.BMP b/indra/newview/res-sdl/toolplay.BMP
index d0e14838e9..7edf03d86a 100644
--- a/indra/newview/res-sdl/toolplay.BMP
+++ b/indra/newview/res-sdl/toolplay.BMP
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/MP_Logo.png b/indra/newview/skins/default/textures/icons/MP_Logo.png
index e33a830d3b..6aba54189f 100644
--- a/indra/newview/skins/default/textures/icons/MP_Logo.png
+++ b/indra/newview/skins/default/textures/icons/MP_Logo.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/SL_Logo.png b/indra/newview/skins/default/textures/icons/SL_Logo.png
index 943265e240..5e376c72f9 100644
--- a/indra/newview/skins/default/textures/icons/SL_Logo.png
+++ b/indra/newview/skins/default/textures/icons/SL_Logo.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/icons/hand.png b/indra/newview/skins/default/textures/icons/hand.png
index 3f497eefbb..5fbdb70c2b 100644
--- a/indra/newview/skins/default/textures/icons/hand.png
+++ b/indra/newview/skins/default/textures/icons/hand.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/windows/first_login_image.jpg b/indra/newview/skins/default/textures/windows/first_login_image.jpg
index 860fed4ac7..58c417081a 100644
--- a/indra/newview/skins/default/textures/windows/first_login_image.jpg
+++ b/indra/newview/skins/default/textures/windows/first_login_image.jpg
Binary files differ
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index 89c6e41a85..09b134eac5 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -70,7 +70,7 @@
follows="all"
left="10"
name="megapahit_credits_panel"
- height="405"
+ height="420"
top="10">
<text
follows="top|left|right"
@@ -86,7 +86,7 @@ Megapahit is brought to you by (in order of appearance):
<text_editor
enabled="false"
follows="top|left"
- height="245"
+ height="260"
bg_readonly_color="Transparent"
left="5"
text_color="LtGray"
@@ -111,6 +111,7 @@ Hiroo Ono
Melodey
Keysin (scoutkeysin)
Yikes Lopez
+~ ( ^-^ ) ~ (cutie_qu)
</text_editor>
<text
follows="top|left"
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index e9112694d9..c778f1e838 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1803,34 +1803,6 @@ class Linux_x86_64_Manifest(LinuxManifest):
self.path("libalut.so*")
self.path("libopenal.so*")
self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname
- # KLUDGE: As of 2012-04-11, the 'fontconfig' package installs
- # libfontconfig.so.1.4.4, along with symlinks libfontconfig.so.1
- # and libfontconfig.so. Before we added support for library-file
- # wildcards, though, this self.path() call specifically named
- # libfontconfig.so.1.4.4 WITHOUT also copying the symlinks. When I
- # (nat) changed the call to self.path("libfontconfig.so.*"), we
- # ended up with the libfontconfig.so.1 symlink in the target
- # directory as well. But guess what! At least on Ubuntu 10.04,
- # certain viewer fonts look terrible with libfontconfig.so.1
- # present in the target directory. Removing that symlink suffices
- # to improve them. I suspect that means we actually do better when
- # the viewer fails to find our packaged libfontconfig.so*, falling
- # back on the system one instead -- but diagnosing and fixing that
- # is a bit out of scope for the present project. Meanwhile, this
- # particular wildcard specification gets us exactly what the
- # previous call did, without having to explicitly state the
- # version number.
- self.path("libfontconfig.so.*.*")
-
- # Include libfreetype.so. but have it work as libfontconfig does.
- self.path("libfreetype.so.*.*")
-
- try:
- self.path("libtcmalloc.so*") #formerly called google perf tools
- pass
- except:
- print("tcmalloc files not found, skipping")
- pass
# Vivox runtimes
with self.prefix(src=relpkgdir, dst="bin"):