diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-06-21 17:40:58 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-06-27 15:11:17 +0800 |
commit | 161935f3178f343848839ad93ccaa6c1988bdef6 (patch) | |
tree | a8ce522cef705028801c63ca6f2d088a9c245f59 /indra/llwindow | |
parent | d9325eb964d07edb773dee23f196452874ea2b62 (diff) |
Revert to using Cocoa instead of SDL2 for macOS
Our SDL2-based code is kept Darwin-ready. This move was triggered
by the merge with SLv's release/maint-b branch causing the viewer
to show only a black screen, even though everything else seemed to
be working (logging in, streaming, quitting the app). This decision
also has caused numerous MPv specific window-related macOS bugs to
be fixed. I wanted to commit this on the main branch, but somehow
it failed to build. This move was bound to happen at the arrival of
Maintenance B after all.
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/CMakeLists.txt | 12 | ||||
-rw-r--r-- | indra/llwindow/llwindow.cpp | 30 |
2 files changed, 19 insertions, 23 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 1e3c517483..4d5c6053fb 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -64,7 +64,7 @@ include_directories(${CMAKE_SOURCE_DIR}/llrender) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level -if (USESYSTEMLIBS) +if (USESYSTEMLIBS AND NOT DARWIN) list(APPEND viewer_SOURCE_FILES llkeyboardsdl.cpp llwindowsdl.cpp @@ -87,9 +87,9 @@ if (USESYSTEMLIBS) ) endif (BUILD_HEADLESS) -endif (USESYSTEMLIBS) +endif (USESYSTEMLIBS AND NOT DARWIN) -if (DARWIN AND (NOT USESYSTEMLIBS)) +if (DARWIN) list(APPEND llwindow_SOURCE_FILES llkeyboardmacosx.cpp llwindowmacosx.cpp @@ -111,7 +111,7 @@ if (DARWIN AND (NOT USESYSTEMLIBS)) PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations -fpascal-strings" ) -endif (DARWIN AND (NOT USESYSTEMLIBS)) +endif (DARWIN) if (WINDOWS) @@ -183,10 +183,10 @@ endif (SDL_FOUND) target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES}) target_include_directories(llwindow INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -if (DARWIN AND (NOT USESYSTEMLIBS)) +if (DARWIN) include(CMakeFindFrameworks) find_library(CARBON_LIBRARY Carbon) target_link_libraries(llwindow ${CARBON_LIBRARY}) -endif (DARWIN AND (NOT USESYSTEMLIBS)) +endif (DARWIN) include(LibraryInstall) diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index b51b4fad82..6556bc09c6 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -33,10 +33,8 @@ #include "llwindowsdl.h" #elif LL_WINDOWS #include "llwindowwin32.h" -/* #elif LL_DARWIN #include "llwindowmacosx.h" -*/ #endif #include "llerror.h" @@ -76,12 +74,12 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) #if LL_MESA_HEADLESS // !!! *FIX: (?) LL_WARNS() << "OSMessageBox: " << text << LL_ENDL; return OSBTN_OK; -#elif LL_SDL - result = OSMessageBoxSDL(text, caption, type); #elif LL_WINDOWS result = OSMessageBoxWin32(text, caption, type); -#elif LL_DARWIN +#elif LL_DARWIN && !LL_SDL result = OSMessageBoxMacOSX(text, caption, type); +#elif LL_SDL + result = OSMessageBoxSDL(text, caption, type); #else #error("OSMessageBox not implemented for this platform!") #endif @@ -261,12 +259,12 @@ BOOL LLWindow::copyTextToPrimary(const LLWString &src) // static std::vector<std::string> LLWindow::getDynamicFallbackFontList() { -#if LL_SDL - return LLWindowSDL::getDynamicFallbackFontList(); -#elif LL_WINDOWS +#if LL_WINDOWS return LLWindowWin32::getDynamicFallbackFontList(); -#elif LL_DARWIN +#elif LL_DARWIN && !LL_SDL return LLWindowMacOSX::getDynamicFallbackFontList(); +#elif LL_SDL + return LLWindowSDL::getDynamicFallbackFontList(); #else return std::vector<std::string>(); #endif @@ -275,12 +273,12 @@ std::vector<std::string> LLWindow::getDynamicFallbackFontList() // static std::vector<std::string> LLWindow::getDisplaysResolutionList() { -#ifdef LL_SDL - return std::vector<std::string>(); -#elif LL_WINDOWS +#if LL_WINDOWS return LLWindowWin32::getDisplaysResolutionList(); -#elif LL_DARWIN +#elif LL_DARWIN && !LL_SDL return LLWindowMacOSX::getDisplaysResolutionList(); +#else + return std::vector<std::string>(); #endif } @@ -348,7 +346,7 @@ LLSplashScreen *LLSplashScreen::create() return 0; #elif LL_WINDOWS return new LLSplashScreenWin32; -#elif LL_DARWIN +#elif LL_DARWIN && !LL_SDL return new LLSplashScreenMacOSX; #else #error("LLSplashScreen not implemented on this platform!") @@ -361,13 +359,11 @@ void LLSplashScreen::show() { if (!gSplashScreenp) { -#if !LL_SDL #if LL_WINDOWS && !LL_MESA_HEADLESS gSplashScreenp = new LLSplashScreenWin32; -#elif LL_DARWIN +#elif LL_DARWIN && !LL_SDL gSplashScreenp = new LLSplashScreenMacOSX; #endif -#endif // !LL_SDL if (gSplashScreenp) { gSplashScreenp->showImpl(); |