Here is an update to SDL 2.0.16. More testing and feedback welcome.
--------------------------------------------------------------------------- 2.0.16: --------------------------------------------------------------------------- General: * Added SDL_FlashWindow() to get a user's attention * Added SDL_GetAudioDeviceSpec() to get the preferred audio format of a device * Added SDL_SetWindowAlwaysOnTop() to dynamically change the SDL_WINDOW_ALWAYS_ON_TOP flag for a window * Added SDL_SetWindowKeyboardGrab() to support grabbing the keyboard independently of the mouse * Added SDL_SoftStretchLinear() to do bilinear scaling between 32-bit software surfaces * Added SDL_UpdateNVTexture() to update streaming NV12/21 textures * Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow sending custom trigger effects to the DualSense controller * Added SDL_GameControllerGetSensorDataRate() to get the sensor data rate for PlayStation and Nintendo Switch controllers * Added support for the Amazon Luna game controller * Added rumble support for the Google Stadia controller using the HIDAPI driver * Added SDL_GameControllerType constants for the Amazon Luna and Google Stadia controllers * Added analog rumble for Nintendo Switch Pro controllers using the HIDAPI driver * Reduced CPU usage when using SDL_WaitEvent() and SDL_WaitEventTimeout() Linux: * Greatly improved Wayland support * Added support for audio output and capture using Pipewire * Added the hint SDL_HINT_AUDIO_INCLUDE_MONITORS to control whether PulseAudio recording should include monitor devices * Added the hint SDL_HINT_AUDIO_DEVICE_STREAM_ROLE to describe the role of your application for audio control panels Index: Makefile =================================================================== RCS file: /home/cvs/ports/devel/sdl2/Makefile,v retrieving revision 1.35 diff -u -p -u -p -r1.35 Makefile --- Makefile 19 Jun 2021 20:37:52 -0000 1.35 +++ Makefile 11 Aug 2021 00:23:15 -0000 @@ -2,14 +2,13 @@ COMMENT= cross-platform multimedia library -V= 2.0.14 +V= 2.0.16 DISTNAME= SDL2-${V} PKGNAME= sdl2-${V} -REVISION= 2 CATEGORIES= devel MASTER_SITES= https://www.libsdl.org/release/ -SHARED_LIBS= SDL2 0.9 # 0.12 +SHARED_LIBS= SDL2 0.10 # 0.12 HOMEPAGE= https://www.libsdl.org/ Index: distinfo =================================================================== RCS file: /home/cvs/ports/devel/sdl2/distinfo,v retrieving revision 1.11 diff -u -p -u -p -r1.11 distinfo --- distinfo 6 Jan 2021 22:32:08 -0000 1.11 +++ distinfo 10 Aug 2021 23:37:07 -0000 @@ -1,2 +1,2 @@ -SHA256 (SDL2-2.0.14.tar.gz) = 2CFbVxpYG+EzLSEG+ANvywPRKnC64B4g9CSXbSdUMrw= -SIZE (SDL2-2.0.14.tar.gz) = 6089974 +SHA256 (SDL2-2.0.16.tar.gz) = Zb6f9gBANLWyzpkntaTbGBSTDxacSy2uCh5GlwdfKHs= +SIZE (SDL2-2.0.16.tar.gz) = 7227262 Index: patches/patch-Makefile_in =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-Makefile_in,v retrieving revision 1.9 diff -u -p -u -p -r1.9 patch-Makefile_in --- patches/patch-Makefile_in 6 Jan 2021 22:32:08 -0000 1.9 +++ patches/patch-Makefile_in 11 Aug 2021 00:18:47 -0000 @@ -3,7 +3,7 @@ $OpenBSD: patch-Makefile_in,v 1.9 2021/0 Index: Makefile.in --- Makefile.in.orig +++ Makefile.in -@@ -129,7 +129,7 @@ LT_AGE = @LT_AGE@ +@@ -132,7 +132,7 @@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ Index: patches/patch-sdl2-config_cmake_in =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-sdl2-config_cmake_in,v retrieving revision 1.2 diff -u -p -u -p -r1.2 patch-sdl2-config_cmake_in --- patches/patch-sdl2-config_cmake_in 6 Jan 2021 22:32:08 -0000 1.2 +++ patches/patch-sdl2-config_cmake_in 11 Aug 2021 00:18:45 -0000 @@ -3,35 +3,76 @@ $OpenBSD: patch-sdl2-config_cmake_in,v 1 Index: sdl2-config.cmake.in --- sdl2-config.cmake.in.orig +++ sdl2-config.cmake.in -@@ -9,31 +9,3 @@ set(SDL2_LIBDIR "@libdir@") - set(SDL2_INCLUDE_DIRS "@includedir@/SDL2") +@@ -10,72 +10,3 @@ set(SDL2_LIBDIR "${libdir}") + set(SDL2_INCLUDE_DIRS "${includedir}/SDL2") set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) - -if(NOT TARGET SDL2::SDL2) +- # provide SDL2::SDL2, SDL2::SDL2main and SDL2::SDL2-static targets, like SDL2Config.cmake does, for compatibility +- - # Remove -lSDL2 as that is handled by CMake, note the space at the end so it does not replace e.g. -lSDL2main - # This may require "libdir" beeing set (from above) - string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS "@SDL_RLD_FLAGS@ @SDL_LIBS@ ") +- # also get rid of -lSDL2main, if you want to link against that use both SDL2::SDL2main and SDL2::SDL2 (in that order) +- # (SDL2Config.cmake has the same behavior) +- string(REPLACE "-lSDL2main" "" SDL2_EXTRA_LINK_FLAGS ${SDL2_EXTRA_LINK_FLAGS}) - string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS) - string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ") - string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC) - +-if(WIN32 AND NOT MSVC) +- # MINGW needs very special handling, because the link order must be exactly -lmingw32 -lSDL2main -lSDL2 +- # for it to work at all (and -mwindows somewhere); a normal SHARED IMPORTED or STATIC IMPORTED library always puts itself first +- # so handle this like a header-only lib and put everything in INTERFACE_LINK_LIBRARIES +- +- add_library(SDL2::SDL2 INTERFACE IMPORTED) +- set_target_properties(SDL2::SDL2 PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" +- INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2") +- +- add_library(SDL2::SDL2main INTERFACE IMPORTED) +- set_target_properties(SDL2::SDL2main PROPERTIES +- INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -mwindows") +- +-else() # (not WIN32) or MSVC +- - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2" +- INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}" -- INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") +- IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") +- +- if(MSVC) +- # This file is generated when building SDL2 with autotools and MinGW, and MinGW/dlltool +- # isn't able to generate .lib files that are usable by recent MSVC versions +- # (something about "module unsafe for SAFESEH"; SAFESEH is enabled by default in MSVC). +- # The .lib file for SDL2.dll *could* be generated with `gendef SDL2.dll` and then +- # `lib.exe /machine:x86 /def:SDL2.def /out:SDL2.lib` (or /machine:amd64) +- # but that requires lib.exe from a Visual Studio installation - and that still doesn't +- # give you a static SDL2main.lib with SAFESEH support that you'll need (unless you don't use SDL2main) +- # Note that when building SDL2 with CMake and MSVC, the result works with both MinGW and MSVC. +- +- message(FATAL_ERROR, "This build of libSDL2 only supports MinGW, not MSVC (Visual C++), because it lacks .lib files!") +- # MSVC needs SDL2.lib set as IMPORTED_IMPLIB to link against (comment out message() call above if you added SDL2.lib yourself) +- set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "${SDL2_LIBDIR}/SDL2.lib") +- else() +- # this mustn't be set for MSVC, so do it here in an extra call here +- set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") +- endif() +- +- add_library(SDL2::SDL2main STATIC IMPORTED) +- set_target_properties(SDL2::SDL2main PROPERTIES +- IMPORTED_LINK_INTERFACE_LANGUAGES "C" +- IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}") +- +-endif() # (not WIN32) or MSVC - - add_library(SDL2::SDL2-static STATIC IMPORTED) - set_target_properties(SDL2::SDL2-static PROPERTIES -- INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2" +- INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" +- IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" - INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}") - -- add_library(SDL2::SDL2main STATIC IMPORTED) -- set_target_properties(SDL2::SDL2main PROPERTIES -- IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}") --endif() +-endif() # NOT TARGET SDL2::SDL2 Index: patches/patch-sdl2_pc_in =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-sdl2_pc_in,v retrieving revision 1.3 diff -u -p -u -p -r1.3 patch-sdl2_pc_in --- patches/patch-sdl2_pc_in 6 Jan 2021 22:32:08 -0000 1.3 +++ patches/patch-sdl2_pc_in 11 Aug 2021 00:18:45 -0000 @@ -7,7 +7,7 @@ Index: sdl2.pc.in Version: @SDL_VERSION@ Requires: Conflicts: --Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKG_CONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@ +-Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@ -Cflags: -I${includedir}/SDL2 @SDL_CFLAGS@ +Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @X_LIBS@ +Cflags: -I${includedir}/SDL2 @SDL_CFLAGS@ @X_CFLAGS@ Index: patches/patch-src_SDL_c =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-src_SDL_c,v retrieving revision 1.5 diff -u -p -u -p -r1.5 patch-src_SDL_c --- patches/patch-src_SDL_c 6 Jan 2021 22:32:08 -0000 1.5 +++ patches/patch-src_SDL_c 11 Aug 2021 00:18:45 -0000 @@ -7,7 +7,7 @@ until OpenBSD support has been rolled ou Index: src/SDL.c --- src/SDL.c.orig +++ src/SDL.c -@@ -273,8 +273,6 @@ SDL_InitSubSystem(Uint32 flags) +@@ -280,8 +280,6 @@ SDL_InitSubSystem(Uint32 flags) } } SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC); @@ -16,7 +16,7 @@ Index: src/SDL.c #endif } -@@ -506,7 +504,7 @@ SDL_GetPlatform() +@@ -517,7 +515,7 @@ SDL_GetPlatform() #elif __NETBSD__ return "NetBSD"; #elif __OPENBSD__ Index: patches/patch-src_filesystem_unix_SDL_sysfilesystem_c =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-src_filesystem_unix_SDL_sysfilesystem_c,v retrieving revision 1.2 diff -u -p -u -p -r1.2 patch-src_filesystem_unix_SDL_sysfilesystem_c --- patches/patch-src_filesystem_unix_SDL_sysfilesystem_c 7 Jan 2018 22:56:46 -0000 1.2 +++ patches/patch-src_filesystem_unix_SDL_sysfilesystem_c 11 Aug 2021 00:18:45 -0000 @@ -5,26 +5,52 @@ Disable SDL_GetBasePath implementation, Index: src/filesystem/unix/SDL_sysfilesystem.c --- src/filesystem/unix/SDL_sysfilesystem.c.orig +++ src/filesystem/unix/SDL_sysfilesystem.c -@@ -95,24 +95,6 @@ SDL_GetBasePath(void) +@@ -149,50 +149,6 @@ SDL_GetBasePath(void) } } #endif -#if defined(__OPENBSD__) -- char **retvalargs; +- /* Please note that this will fail if the process was launched with a relative path and the cwd has changed, or argv is altered. So don't do that. Or add a new sysctl to OpenBSD. */ +- char **cmdline; - size_t len; - const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; - if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { -- retvalargs = SDL_malloc(len); -- if (!retvalargs) { +- char *exe; +- char *realpathbuf = (char *) SDL_malloc(PATH_MAX + 1); +- if (!realpathbuf) { - SDL_OutOfMemory(); - return NULL; - } -- sysctl(mib, 4, retvalargs, &len, NULL, 0); -- retval = SDL_malloc(PATH_MAX + 1); -- if (retval) -- realpath(retvalargs[0], retval); - -- SDL_free(retvalargs); +- cmdline = SDL_malloc(len); +- if (!cmdline) { +- SDL_free(realpathbuf); +- SDL_OutOfMemory(); +- return NULL; +- } +- +- sysctl(mib, 4, cmdline, &len, NULL, 0); +- +- exe = cmdline[0]; +- if (SDL_strchr(exe, '/') == NULL) { /* not a relative or absolute path, check $PATH for it */ +- exe = search_path_for_binary(cmdline[0]); +- } +- +- if (exe) { +- if (realpath(exe, realpathbuf) != NULL) { +- retval = realpathbuf; +- } +- +- if (exe != cmdline[0]) { +- SDL_free(exe); +- } +- } +- +- if (!retval) { +- SDL_free(realpathbuf); +- } +- +- SDL_free(cmdline); - } -#endif #if defined(__SOLARIS__) Index: patches/patch-src_joystick_SDL_gamecontrollerdb_h =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontrollerdb_h,v retrieving revision 1.1 diff -u -p -u -p -r1.1 patch-src_joystick_SDL_gamecontrollerdb_h --- patches/patch-src_joystick_SDL_gamecontrollerdb_h 23 Jan 2021 17:47:43 -0000 1.1 +++ patches/patch-src_joystick_SDL_gamecontrollerdb_h 11 Aug 2021 00:18:45 -0000 @@ -6,7 +6,7 @@ use both LINUX and MACOSX guids to match Index: src/joystick/SDL_gamecontrollerdb.h --- src/joystick/SDL_gamecontrollerdb.h.orig +++ src/joystick/SDL_gamecontrollerdb.h -@@ -338,7 +338,7 @@ static const char *s_ControllerMappings [] = +@@ -347,7 +347,7 @@ static const char *s_ControllerMappings [] = "030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", #endif @@ -15,12 +15,12 @@ Index: src/joystick/SDL_gamecontrollerdb "03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", -@@ -479,7 +479,7 @@ static const char *s_ControllerMappings [] = +@@ -493,7 +493,7 @@ static const char *s_ControllerMappings [] = "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif -#if defined(__LINUX__) +#if defined(__LINUX__) || defined(__OpenBSD__) + "xinput,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", - "05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", Index: patches/patch-src_joystick_bsd_SDL_bsdjoystick_c =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-src_joystick_bsd_SDL_bsdjoystick_c,v retrieving revision 1.2 diff -u -p -u -p -r1.2 patch-src_joystick_bsd_SDL_bsdjoystick_c --- patches/patch-src_joystick_bsd_SDL_bsdjoystick_c 23 Jan 2021 17:47:43 -0000 1.2 +++ patches/patch-src_joystick_bsd_SDL_bsdjoystick_c 11 Aug 2021 00:18:45 -0000 @@ -80,7 +80,7 @@ Index: src/joystick/bsd/SDL_bsdjoystick. + int actualbutton; #endif - #if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_) + #if defined(__FREEBSD__) || SDL_HAVE_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__) || defined(__DragonFly_) @@ -618,6 +642,18 @@ BSD_JoystickUpdate(SDL_Joystick *joy) naxe = joy->hwdata->axis_map[joyaxe]; /* scaleaxe */