summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yaml2
-rw-r--r--indra/cmake/NFDE.cmake2
-rw-r--r--indra/llwindow/llsdl.cpp1
-rw-r--r--indra/llwindow/llwindowsdl.cpp70
-rw-r--r--indra/llwindow/llwindowsdl.h2
-rw-r--r--indra/newview/llfilepicker.cpp2
6 files changed, 37 insertions, 42 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index e40f2cdf3a..9cfd0f3117 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -137,7 +137,7 @@ jobs:
libgl1-mesa-dev libglu1-mesa-dev libxinerama-dev \
libxcursor-dev libxfixes-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev ninja-build libxft-dev \
- llvm mold libpipewire-0.3-dev
+ llvm mold libpipewire-0.3-dev libdbus-1-dev
- name: Install windows dependencies
if: runner.os == 'Windows'
diff --git a/indra/cmake/NFDE.cmake b/indra/cmake/NFDE.cmake
index 461a46431a..196ba575b2 100644
--- a/indra/cmake/NFDE.cmake
+++ b/indra/cmake/NFDE.cmake
@@ -35,7 +35,7 @@ if(USE_NFDE)
target_link_libraries(ll::nfde INTERFACE ${DBUS_LINK_LIBRARIES})
endif()
endif()
-
+
target_include_directories( ll::nfde SYSTEM INTERFACE
${LIBS_PREBUILT_DIR}/include/nfde
)
diff --git a/indra/llwindow/llsdl.cpp b/indra/llwindow/llsdl.cpp
index 3f7992a1d7..6161bd2972 100644
--- a/indra/llwindow/llsdl.cpp
+++ b/indra/llwindow/llsdl.cpp
@@ -56,7 +56,6 @@ 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/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index ae04a9c936..68704e65bb 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -114,18 +114,6 @@ Display* LLWindowSDL::get_SDL_Display(void)
#include <wayland-client-protocol.h>
#include <dlfcn.h>
-bool LLWindowSDL::isWaylandWindowNotDrawing() const
-{
- if( Wayland != mServerProtocol || mWaylandData.mLastFrameEvent == 0 )
- return false;
-
- auto currentTime = LLTimer::getTotalTime();
- if( (currentTime - mWaylandData.mLastFrameEvent) > 250000 )
- return true;
-
- return false;
-}
-
uint32_t (*ll_wl_proxy_get_version)(struct wl_proxy *proxy);
void (*ll_wl_proxy_destroy)(struct wl_proxy *proxy);
int (*ll_wl_proxy_add_listener)(struct wl_proxy *proxy, void (**implementation)(void), void *data);
@@ -210,8 +198,22 @@ void LLWindowSDL::waylandFrameDoneCB(void *data, struct wl_callback *cb, uint32_
pThis->setupWaylandFrameCallback(); // ask for a new frame
}
+bool LLWindowSDL::isWaylandWindowNotDrawing() const
+{
+ if(!mWaylandLoaded || Wayland != mServerProtocol || mWaylandData.mLastFrameEvent == 0)
+ return false;
+
+ auto currentTime = LLTimer::getTotalTime();
+ if( (currentTime - mWaylandData.mLastFrameEvent) > 250000 )
+ return true;
+
+ return false;
+}
+
void LLWindowSDL::setupWaylandFrameCallback()
{
+ if(!mWaylandLoaded) return;
+
static wl_callback_listener frame_listener { nullptr };
frame_listener.done = &LLWindowSDL::waylandFrameDoneCB;
@@ -403,12 +405,14 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
if(!mContext)
{
LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL;
+ close();
setupFailure("GL Context creation error", "Error", OSMB_OK);
}
if (SDL_GL_MakeCurrent(mWindow, mContext) != 0)
{
LL_WARNS() << "Failed to make context current. SDL: " << SDL_GetError() << LL_ENDL;
+ close();
setupFailure("GL Context failed to set current failure", "Error", OSMB_OK);
}
@@ -443,14 +447,6 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
setupFailure( error, "Error", OSMB_OK );
}
}
- else
- {
- if (!mWindow)
- {
- LL_WARNS() << "createContext: window creation failure. SDL: " << SDL_GetError() << LL_ENDL;
- setupFailure("Window creation error", "Error", OSMB_OK);
- }
- }
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits);
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenBits);
@@ -468,9 +464,6 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
LL_INFOS() << " Stencil Bits " << S32(stencilBits) << LL_ENDL;
GLint colorBits = redBits + greenBits + blueBits + alphaBits;
- // fixme: actually, it's REALLY important for picking that we get at
- // least 8 bits each of red,green,blue. Alpha we can be a bit more
- // relaxed about if we have to.
if (colorBits < 32)
{
close();
@@ -504,26 +497,26 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
if ( SDL_GetWindowWMInfo(mWindow, &info) )
{
/* Save the information for later use */
- if ( info.subsystem == SDL_SYSWM_X11 )
+ 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;
LL_INFOS() << "Running under X11" << LL_ENDL;
}
- else if ( info.subsystem == SDL_SYSWM_WAYLAND )
+ else if (info.subsystem == SDL_SYSWM_WAYLAND)
{
#ifdef LL_WAYLAND
- 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");
+ mWaylandLoaded = loadWaylandClient();
+ if(!mWaylandLoaded)
+ {
+ LL_WARNS() << "Failed to load wayland-client.so or grab required functions" << LL_ENDL;
}
+#endif
mWaylandData.mSurface = info.info.wl.surface;
mServerProtocol = Wayland;
+
setupWaylandFrameCallback();
// If set (XWayland) remove DISPLAY, this will prompt dullahan to also use Wayland
@@ -531,15 +524,11 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
unsetenv("DISPLAY");
LL_INFOS() << "Running under Wayland" << LL_ENDL;
- LL_WARNS() << "Be aware that with at least SDL2 the window will not receive minimizing events, thus minimized state can only be estimated."
- "also setting the application icon via SDL_SetWindowIcon does not work." << LL_ENDL;
-#else
- setupFailure("Viewer is running under Wayland, but was not compiled with full wayland support!\nYou can compile the viewer with wayland prelimiary support using COMPILE_WAYLAND_SUPPORT", "Error", OSMB_OK);
-#endif
+ LL_WARNS() << "Be aware that with at least SDL2 the window will not receive minimizing events, thus minimized state can only be estimated." << LL_ENDL;
}
else
{
- LL_WARNS() << "We're not running under X11 or Wayland? Wild." << LL_ENDL;
+ LL_WARNS() << "Unsupported windowing system" << LL_ENDL;
}
}
else
@@ -1268,6 +1257,7 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(U32 keysym, bool gain)
void check_vm_bloat()
{
+#if LL_LINUX
// watch our own VM and RSS sizes, warn if we bloated rapidly
static const std::string STATS_FILE = "/proc/self/stat";
FILE *fp = fopen(STATS_FILE.c_str(), "r");
@@ -1351,6 +1341,7 @@ finally:
free(ptr);
fclose(fp);
}
+#endif
}
@@ -1968,6 +1959,8 @@ void LLWindowSDL::bringToFront()
//static
std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
{
+ std::vector<std::string> rtns;
+#if LL_LINUX
// Use libfontconfig to find us a nice ordered list of fallback fonts
// specific to this system.
std::string final_fallback("/usr/share/fonts/truetype/kochi/kochi-gothic.ttf");
@@ -1984,7 +1977,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
// renderable range if for some reason our FreeType actually fails
// to use some of the fonts we want it to.
const bool elide_unicode_coverage = true;
- std::vector<std::string> rtns;
+
FcFontSet *fs = nullptr;
FcPattern *sortpat = nullptr;
@@ -2058,6 +2051,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
LL_INFOS() << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << LL_ENDL;
rtns.push_back(final_fallback);
+#endif
return rtns;
}
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 974ba69b61..c3b2f32cf7 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -254,6 +254,8 @@ private:
uint64_t mLastFrameEvent = 0;
} mWaylandData;
+ bool mWaylandLoaded = false;
+
bool isWaylandWindowNotDrawing() const;
void setupWaylandFrameCallback();
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 8bdaea95c8..760f5a700e 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -261,7 +261,7 @@ bool LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
// prepare filters for the dialog
auto filterItem = setupFilter(filter);
-
+
nfdwindowhandle_t windowHandle = nfdwindowhandle_t();
#if LL_USE_SDL_WINDOW
if(!NFD_GetNativeWindowFromSDLWindow((SDL_Window*)gViewerWindow->getPlatformWindow(), &windowHandle))