Skip to content

Commit 753e934

Browse files
authored
Merge pull request #310 from AlchemyViewer/rye/sdl3-windows
Add opt-in SDL3 window backend for Windows
2 parents c222f5a + 58e378a commit 753e934

107 files changed

Lines changed: 2200 additions & 564 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ indra/lib/python/eventlet/
4141
indra/lib/python/mulib.*
4242
indra/llwindow/glh/glh_linear.h
4343
indra/newview/alchemy.icns
44+
indra/newview/app_settings/alchemy_logo.png
4445
indra/newview/app_settings/dictionaries
4546
indra/newview/app_settings/mozilla
4647
indra/newview/app_settings/mozilla-runtime-*

indra/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ option(HAVOK "Use Havok physics library" OFF)
7070
#cmake_dependent_option(USE_DISCORD "Enable Discord SDK and Rich Prescence support" ON "INSTALL_PROPRIETARY" OFF)
7171

7272
# SDL Options
73-
cmake_dependent_option(USE_SDL_WINDOW "Build with SDL based window management and input" ON "UNIX" OFF)
73+
if (UNIX)
74+
option(USE_SDL_WINDOW "Build with SDL based window management and input" ON)
75+
else ()
76+
option(USE_SDL_WINDOW "Build with SDL based window management and input (experimental on Windows)" OFF)
77+
endif ()
7478

7579
# Configure crash reporting
7680
option(RELEASE_CRASH_REPORTING "Enable use of crash reporting in release builds" OFF)

indra/CMakePresets.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@
105105
"nonfree"
106106
]
107107
},
108+
{
109+
"name": "vs2026-os-sdl",
110+
"displayName": "Visual Studio 2026 (SDL window)",
111+
"inherits": [
112+
"vs2026-os"
113+
],
114+
"cacheVariables": {
115+
"USE_SDL_WINDOW": true
116+
}
117+
},
108118
{
109119
"name": "ninja-os-arm64",
110120
"displayName": "Ninja Multi-Config(arm64)",
@@ -339,6 +349,22 @@
339349
"windows"
340350
]
341351
},
352+
{
353+
"name": "vs2026-os-sdl-relwithdebinfo",
354+
"configurePreset": "vs2026-os-sdl",
355+
"configuration": "RelWithDebInfo",
356+
"inherits": [
357+
"windows"
358+
]
359+
},
360+
{
361+
"name": "vs2026-os-sdl-release",
362+
"configurePreset": "vs2026-os-sdl",
363+
"configuration": "Release",
364+
"inherits": [
365+
"windows"
366+
]
367+
},
342368
{
343369
"name": "ninja-arm64-release",
344370
"configurePreset": "ninja-arm64",

indra/cmake/Linking.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ elseif (WINDOWS)
3737
advapi32
3838
shlwapi
3939
shell32
40+
wbemuuid
4041
ws2_32
4142
mswsock
4243
psapi

indra/cmake/SDL3.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ endif()
99
find_package(SDL3 CONFIG REQUIRED)
1010
target_link_libraries(ll::SDL3 INTERFACE SDL3::SDL3)
1111

12-
if(DARWIN)
13-
find_package(SDL3_image CONFIG REQUIRED)
14-
target_link_libraries(ll::SDL3 INTERFACE $<IF:$<TARGET_EXISTS:SDL3_image::SDL3_image-shared>,SDL3_image::SDL3_image-shared,SDL3_image::SDL3_image-static>)
15-
endif()
12+
# SDL3_ttf renders the LLWindowSDL splash-screen text (see LLSplashScreenSDL).
13+
find_package(SDL3_ttf CONFIG REQUIRED)
14+
target_link_libraries(ll::SDL3 INTERFACE $<IF:$<TARGET_EXISTS:SDL3_ttf::SDL3_ttf-shared>,SDL3_ttf::SDL3_ttf-shared,SDL3_ttf::SDL3_ttf-static>)
15+
16+
# SDL3_image loads the branded splash icon PNG (and, on macOS, the cursor TIFFs).
17+
find_package(SDL3_image CONFIG REQUIRED)
18+
target_link_libraries(ll::SDL3 INTERFACE $<IF:$<TARGET_EXISTS:SDL3_image::SDL3_image-shared>,SDL3_image::SDL3_image-shared,SDL3_image::SDL3_image-static>)

indra/cmake/UI.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ elseif(WINDOWS)
5151
odbccp32
5252
oleaut32
5353
shell32
54+
shlwapi
5455
Vfw32
5556
wer
5657
winspool

indra/llrender/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ target_link_libraries(llrender
105105

106106
target_precompile_headers(llrender REUSE_FROM llprecompiled)
107107

108-
if (DARWIN OR NOT USE_SDL_WINDOW)
108+
# llgl.cpp talks to WGL directly on Windows (wglGetCurrentDC for the
109+
# extensions string) even when SDL owns context creation, so keep the
110+
# OpenGL link explicit there regardless of the window backend.
111+
if (DARWIN OR WINDOWS OR NOT USE_SDL_WINDOW)
109112
target_link_libraries(llrender
110113
OpenGL::GL
111114
)

indra/llui/fsvirtualtrackpad.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ bool FSVirtualTrackpad::handleRightMouseDown(S32 x, S32 y, MASK mask)
597597
}
598598

599599
// pass wheel-clicks to third axis
600-
bool FSVirtualTrackpad::handleScrollWheel(S32 x, S32 y, S32 clicks)
600+
bool FSVirtualTrackpad::handleScrollWheel(S32 x, S32 y, LLScrollDelta delta)
601601
{
602602
if (hasMouseCapture() || isPointInTouchArea(x, y))
603603
{
@@ -607,7 +607,7 @@ bool FSVirtualTrackpad::handleScrollWheel(S32 x, S32 y, S32 clicks)
607607
if (mask & MASK_CONTROL)
608608
changeAmount /= 5;
609609

610-
mWheelClicksSinceLastDelta = -1 * clicks * changeAmount;
610+
mWheelClicksSinceLastDelta = -1 * delta.mClicks * changeAmount;
611611

612612
mValueDeltaX = mValueDeltaY = mValueDeltaZ = 0;
613613
mPinchValueDeltaX = mPinchValueDeltaY = mPinchValueDeltaZ = 0;
@@ -655,5 +655,5 @@ bool FSVirtualTrackpad::handleScrollWheel(S32 x, S32 y, S32 clicks)
655655
return true;
656656
}
657657
else
658-
return LLUICtrl::handleScrollWheel(x, y, clicks);
658+
return LLUICtrl::handleScrollWheel(x, y, delta);
659659
}

indra/llui/fsvirtualtrackpad.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FSVirtualTrackpad
5555
bool handleMouseDown(S32 x, S32 y, MASK mask) override;
5656
bool handleRightMouseUp(S32 x, S32 y, MASK mask) override;
5757
bool handleRightMouseDown(S32 x, S32 y, MASK mask) override;
58-
bool handleScrollWheel(S32 x, S32 y, S32 clicks) override;
58+
bool handleScrollWheel(S32 x, S32 y, LLScrollDelta delta) override;
5959
void draw() override;
6060
void setValue(const LLSD& value) override;
6161

indra/llui/llaccordionctrl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,11 @@ void LLAccordionCtrl::arrange()
536536

537537
//---------------------------------------------------------------------------------
538538

539-
bool LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, S32 clicks)
539+
bool LLAccordionCtrl::handleScrollWheel(S32 x, S32 y, LLScrollDelta delta)
540540
{
541-
if (LLPanel::handleScrollWheel(x, y, clicks))
541+
if (LLPanel::handleScrollWheel(x, y, delta))
542542
return true;
543-
if (mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, clicks))
543+
if (mScrollbar->getVisible() && mScrollbar->handleScrollWheel(0, 0, delta))
544544
return true;
545545
return false;
546546
}

0 commit comments

Comments
 (0)