Skip to content

Commit ec17be9

Browse files
committed
Port gamepad from SDL2 to SDL3
I know this is a bit late, but wanted to get it out here for review while I continue testing. Following the SDL3 migration: https://wiki.libsdl.org/SDL3/README-migration Renamed SDL2 game controller API to SDL3 gamepad equivalents. Button names have changed but kept a/b/x/y shortcut names and aliased south/east/west/north. Updated build, CI, and packaging to depend on SDL3. Removed the libSDL3 copy from macOS packaging script.
1 parent 6c9a9e4 commit ec17be9

13 files changed

Lines changed: 75 additions & 70 deletions

File tree

.ci/Brewfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ brew 'osm-gps-map'
5454
brew 'portmidi'
5555
brew 'potrace'
5656
brew 'pugixml'
57-
brew 'sdl2'
5857
brew 'sdl3'
5958
brew 'shared-mime-info'
6059
brew 'curl'

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
libraw-dev \
155155
librsvg2-dev \
156156
libsaxon-java \
157-
libsdl2-dev \
157+
libsdl3-dev \
158158
libsecret-1-dev \
159159
libsqlite3-dev \
160160
libtiff5-dev \
@@ -275,7 +275,7 @@ jobs:
275275
portmidi:p
276276
potrace:p
277277
pugixml:p
278-
SDL2:p
278+
SDL3:p
279279
sqlite3:p
280280
zlib:p
281281
update: true

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
libpugixml-dev \
8181
librsvg2-dev \
8282
libsaxon-java \
83-
libsdl2-dev \
83+
libsdl3-dev \
8484
libsecret-1-dev \
8585
libsqlite3-dev \
8686
libtiff5-dev \
@@ -264,7 +264,7 @@ jobs:
264264
portmidi:p
265265
potrace:p
266266
pugixml:p
267-
SDL2:p
267+
SDL3:p
268268
sqlite3:p
269269
webp-pixbuf-loader:p
270270
zlib:p

.gitpod.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ RUN sudo apt-get update && \
5454
libpugixml-dev \
5555
librsvg2-dev \
5656
libsaxon-java \
57-
libsdl2-dev \
57+
libsdl3-dev \
5858
libsecret-1-dev \
5959
libsqlite3-dev \
6060
libtiff5-dev \

DefineOptions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ option(BUILD_CURVE_TOOLS "Build tools for generating base and tone curves" OFF)
3636
option(USE_GMIC "Use G'MIC image processing framework." ON)
3737
option(USE_ICU "Use ICU - International Components for Unicode." ON)
3838
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
39-
option(USE_SDL2 "Enable SDL2 support" ON)
39+
option(USE_SDL3 "Enable SDL3 support" ON)
4040

4141
if (USE_OPENCL)
4242
option(TESTBUILD_OPENCL_PROGRAMS "Test-compile OpenCL programs (needs LLVM and Clang 7+)" ON)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Optional dependencies (minimum version):
264264
Optional dependencies (no version requirement):
265265
* colord, Xatom *(for fetching the system display color profile)*
266266
* PortMidi *(for MIDI input support)*
267-
* SDL2 *(for gamepad input support)*
267+
* SDL3 *(for gamepad input support)*
268268
* CUPS *(for print mode support)*
269269
* OpenEXR *(for EXR import & export)*
270270
* OpenJPEG *(for JPEG 2000 import & export)*

packaging/macosx/3_make_hb_darktable_package.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,6 @@ for dtSharedObj in $dtSharedObjDirs; do
249249
cp -LR "$homebrewHome"/lib/"$dtSharedObj"/* "$dtResourcesDir"/lib/"$dtSharedObj"/
250250
done
251251

252-
# Homebrew's `sdl2` is sdl2-compat, which dlopen()s libSDL3 at runtime —
253-
# otool can't see that, so install_dependencies misses it; copy explicitly
254-
sdl3Source="$homebrewHome/opt/sdl3/lib/libSDL3.dylib"
255-
if [[ -f "$sdl3Source" ]]; then
256-
cp -L "$sdl3Source" "$dtResourcesDir"/lib/libSDL3.dylib
257-
install_name_tool -id "@executable_path/../Resources/lib/libSDL3.dylib" \
258-
"$dtResourcesDir"/lib/libSDL3.dylib || true
259-
fi
260-
261252
dtSharedObjDirs="libgphoto2 libgphoto2_port"
262253
for dtSharedObj in $dtSharedObjDirs; do
263254
mkdir "$dtResourcesDir"/lib/"$dtSharedObj"

packaging/macosx/BUILD-ARM64.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ How to make disk image with darktable application bundle (64 bit ARM only):
44
They will need some tuning, so before you install anything add this line to /opt/local/etc/macports/variants.conf:
55
+no_gnome +no_x11 +quartz -x11 -gnome -gfortran
66
Install required dependencies:
7-
$ sudo port install exiv2 libgphoto2 gtk-osx-application-gtk3 lensfun librsvg openexr json-glib GraphicsMagick openjpeg webp libsecret pugixml osm-gps-map adwaita-icon-theme intltool iso-codes libomp gmic-lib libheif portmidi libsdl2 libavif libjxl potrace
7+
$ sudo port install exiv2 libgphoto2 gtk-osx-application-gtk3 lensfun librsvg openexr json-glib GraphicsMagick openjpeg webp libsecret pugixml osm-gps-map adwaita-icon-theme intltool iso-codes libomp gmic-lib libheif portmidi libsdl3 libavif libjxl potrace
88
Clone darktable git repository (in this example into ~/src):
99
$ mkdir ~/src
1010
$ cd ~/src

packaging/macosx/BUILD.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ How to make disk image with darktable application bundle (64 bit Intel only):
1414
$ curl -Lo ~/ports/x11/pango/files/patch-meson-examples-tests.diff https://github.com/macports/macports-ports/raw/26241fac142ac2bbe2a9071918ff20b301c66f4b/x11/pango/files/patch-meson-examples-tests.diff
1515
$ portindex ~/ports
1616

17-
$ sudo port install exiv2 libgphoto2 gtk-osx-application-gtk3 lensfun librsvg openexr json-glib GraphicsMagick openjpeg webp libsecret pugixml osm-gps-map adwaita-icon-theme intltool iso-codes libomp gmic-lib libheif portmidi libsdl2 libavif libjxl potrace
17+
$ sudo port install exiv2 libgphoto2 gtk-osx-application-gtk3 lensfun librsvg openexr json-glib GraphicsMagick openjpeg webp libsecret pugixml osm-gps-map adwaita-icon-theme intltool iso-codes libomp gmic-lib libheif portmidi libsdl3 libavif libjxl potrace
1818
Clone darktable git repository (in this example into ~/src):
1919
$ mkdir ~/src
2020
$ cd ~/src

packaging/nix/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
buildInputs =
4444
with pkgs;
4545
[
46-
SDL2
46+
SDL3
4747
adwaita-icon-theme
4848
cairo
4949
curl

0 commit comments

Comments
 (0)