summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llgamecontrol.cpp8
-rw-r--r--indra/llwindow/llsdl.cpp1
-rw-r--r--indra/llwindow/llwindow.cpp4
-rw-r--r--indra/llwindow/llwindowmacosx.cpp8
-rw-r--r--indra/llwindow/llwindowsdl.cpp11
-rw-r--r--indra/llwindow/llwindowwin32.cpp20
6 files changed, 44 insertions, 8 deletions
diff --git a/indra/llwindow/llgamecontrol.cpp b/indra/llwindow/llgamecontrol.cpp
index 9d3c854ca2..67847600e7 100644
--- a/indra/llwindow/llgamecontrol.cpp
+++ b/indra/llwindow/llgamecontrol.cpp
@@ -1530,6 +1530,9 @@ void LLGameControl::init(const std::string& gamecontrollerdb_path,
llassert(saveObject);
llassert(updateUI);
+#ifndef LL_DARWIN
+ // SDL2 is temporarily disabled on Mac, so this needs to be a no-op on that platform
+
int result = SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR);
if (result < 0)
{
@@ -1555,6 +1558,7 @@ void LLGameControl::init(const std::string& gamecontrollerdb_path,
LL_INFOS("SDL2") << "Total " << count << " mappings added from " << gamecontrollerdb_path << LL_ENDL;
}
}
+#endif // LL_DARWIN
g_gameControl = LLGameControl::getInstance();
@@ -1614,6 +1618,9 @@ void LLGameControl::clearAllStates()
// static
void LLGameControl::processEvents(bool app_has_focus)
{
+#ifndef LL_DARWIN
+ // SDL2 is temporarily disabled on Mac, so this needs to be a no-op on that platform
+
// This method used by non-linux platforms which only use SDL for GameController input
SDL_Event event;
if (!app_has_focus)
@@ -1631,6 +1638,7 @@ void LLGameControl::processEvents(bool app_has_focus)
{
handleEvent(event, app_has_focus);
}
+#endif // LL_DARWIN
}
void LLGameControl::handleEvent(const SDL_Event& event, bool app_has_focus)
diff --git a/indra/llwindow/llsdl.cpp b/indra/llwindow/llsdl.cpp
index 6161bd2972..3f7992a1d7 100644
--- a/indra/llwindow/llsdl.cpp
+++ b/indra/llwindow/llsdl.cpp
@@ -56,6 +56,7 @@ void init_sdl()
std::initializer_list<std::tuple< char const*, char const * > > hintList =
{
{SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR,"0"},
+ {SDL_HINT_VIDEODRIVER,"wayland,x11"},
{SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH,"1"},
{SDL_HINT_IME_INTERNAL_EDITING,"1"}
};
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 93ac58ca6f..066d29c624 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -416,7 +416,11 @@ LLWindow* LLWindowManager::createWindow(
if (use_gl)
{
+#ifndef LL_DARWIN
+ // SDL2 is temporarily disabled on Mac
init_sdl();
+#endif
+
#if LL_WINDOWS
new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 1883c6c9c1..b90e85d911 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1037,7 +1037,7 @@ F32 LLWindowMacOSX::getGamma() const
&greenGamma,
&blueMin,
&blueMax,
- &blueGamma) == noErr)
+ &blueGamma) == static_cast<CGError>(noErr))
{
// So many choices...
// Let's just return the green channel gamma for now.
@@ -1088,7 +1088,7 @@ bool LLWindowMacOSX::setGamma(const F32 gamma)
&greenGamma,
&blueMin,
&blueMax,
- &blueGamma) != noErr)
+ &blueGamma) != static_cast<CGError>(noErr))
{
return false;
}
@@ -1103,7 +1103,7 @@ bool LLWindowMacOSX::setGamma(const F32 gamma)
gamma,
blueMin,
blueMax,
- gamma) != noErr)
+ gamma) != static_cast<CGError>(noErr))
{
return false;
}
@@ -1155,7 +1155,7 @@ bool LLWindowMacOSX::setCursorPosition(const LLCoordWindow position)
newPosition.y = screen_pos.mY;
CGSetLocalEventsSuppressionInterval(0.0);
- if(CGWarpMouseCursorPosition(newPosition) == noErr)
+ if(CGWarpMouseCursorPosition(newPosition) == static_cast<CGError>(noErr))
{
result = true;
}
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index f87a00c34b..4793ab4fc7 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -147,7 +147,7 @@ struct wl_proxy* (*ll_wl_proxy_marshal_flags)(struct wl_proxy *proxy, uint32_t o
bool loadWaylandClient()
{
- auto *pSO = dlopen( "libwayland-client.so", RTLD_NOW);
+ auto *pSO = dlopen( "libwayland-client.so.0", RTLD_NOW);
if( !pSO )
return false;
@@ -506,6 +506,7 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
/* Save the information for later use */
if ( info.subsystem == SDL_SYSWM_X11 )
{
+ SDL_SetHint(SDL_HINT_VIDEODRIVER, "x11");
mX11Data.mDisplay = info.info.x11.display;
mX11Data.mXWindowID = info.info.x11.window;
mServerProtocol = X11;
@@ -514,8 +515,12 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
else if ( info.subsystem == SDL_SYSWM_WAYLAND )
{
#ifdef LL_WAYLAND
- if( !loadWaylandClient() )
+ if( !loadWaylandClient() ) {
+ SDL_SetHint(SDL_HINT_VIDEODRIVER, "x11");
LL_ERRS() << "Failed to load wayland-client.so or grab required functions" << LL_ENDL;
+ } else {
+ SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland");
+ }
mWaylandData.mSurface = info.info.wl.surface;
mServerProtocol = Wayland;
@@ -1369,7 +1374,7 @@ void LLWindowSDL::processMiscNativeEvents()
void LLWindowSDL::gatherInput(bool app_has_focus)
{
- SDL_Event event;
+ SDL_Event event;
// Handle all outstanding SDL events
while (SDL_PollEvent(&event))
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index bacf5325fe..70bdb25415 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -343,6 +343,7 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool
LLWindowWin32Thread();
void run() override;
+ void close() override;
// Detroys handles and window
// Either post to or call from window thread
@@ -407,6 +408,7 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool
// until after some graphics setup. See SL-20177. -Cosmic,2023-09-18
bool mGLReady = false;
bool mGotGLBuffer = false;
+ bool mShuttingDown = false;
LLAtomicBool mDeleteOnExit = false;
};
@@ -4587,11 +4589,25 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
#endif // LL_WINDOWS
inline LLWindowWin32::LLWindowWin32Thread::LLWindowWin32Thread()
- : LL::ThreadPool("Window Thread", 1, MAX_QUEUE_SIZE, false)
+ : LL::ThreadPool("Window Thread", 1, MAX_QUEUE_SIZE, true /*should be false, temporary workaround for SL-18721*/)
{
LL::ThreadPool::start();
}
+void LLWindowWin32::LLWindowWin32Thread::close()
+{
+ LL::ThreadPool::close();
+ if (!mShuttingDown)
+ {
+ LL_WARNS() << "Closing window thread without using destroy_window_handler" << LL_ENDL;
+ // Workaround for SL-18721 in case window closes too early and abruptly
+ LLSplashScreen::show();
+ LLSplashScreen::update("..."); // will be updated later
+ mShuttingDown = true;
+ }
+}
+
+
/**
* LogChange is to log changes in status while trying to avoid spamming the
* log with repeated messages, especially in a tight loop. It refuses to log
@@ -4835,6 +4851,8 @@ bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy()
return false;
}
+ mShuttingDown = true;
+
// Make sure we don't leave a blank toolbar button.
// Also hiding window now prevents user from suspending it
// via some action (like dragging it around)