mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-27 19:21:06 +01:00
Compare commits
18 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb1497566c | ||
|
|
cc6c0fe230 | ||
|
|
f9a46a319b | ||
|
|
48a0592a45 | ||
|
|
1c74a8b5ae | ||
|
|
3d18043005 | ||
|
|
6e1e00701e | ||
|
|
5570d846ea | ||
|
|
f5dcb8f7ad | ||
|
|
f6f1b09b69 | ||
|
|
bf540985aa | ||
|
|
c39f86c28a | ||
|
|
b5da8ad00d | ||
|
|
f62b86263a | ||
|
|
3449c734d5 | ||
|
|
3f29d985fe | ||
|
|
2f4a7bbced | ||
|
|
a0522e4c21 |
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
@@ -64,6 +64,7 @@ jobs:
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install \
|
||||
autoconf \
|
||||
ninja \
|
||||
pkg-config
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ endif()
|
||||
# See docs/release_checklist.md
|
||||
set(SDL_MAJOR_VERSION 2)
|
||||
set(SDL_MINOR_VERSION 30)
|
||||
set(SDL_MICRO_VERSION 2)
|
||||
set(SDL_MICRO_VERSION 3)
|
||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
@@ -926,22 +926,6 @@ if(SDL_ASSEMBLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_LASX)
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_FLAGS "-mlasx")
|
||||
check_c_source_compiles("
|
||||
#ifndef __loongarch_asx
|
||||
#error Assembler CPP flag not enabled
|
||||
#endif
|
||||
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_LASX)
|
||||
check_include_file("lasxintrin.h" HAVE_LASXINTRIN_H)
|
||||
cmake_pop_check_state()
|
||||
if(CPU_SUPPORTS_LASX AND HAVE_LASXINTRIN_H)
|
||||
list(APPEND EXTRA_CFLAGS "-mlasx")
|
||||
set(HAVE_LASX TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_ARMSIMD)
|
||||
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 30
|
||||
MICRO_VERSION = 2
|
||||
MICRO_VERSION = 3
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 30
|
||||
MICRO_VERSION = 2
|
||||
MICRO_VERSION = 3
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
LIBHOME = .
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">
|
||||
@@ -211,7 +211,7 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">
|
||||
@@ -409,7 +409,7 @@
|
||||
<CopyFileToFolders Include="..\..\logos\Logo480x480.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll">
|
||||
<CopyFileToFolders Include="$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.GDK.C.Thunks.dll">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.30.2</string>
|
||||
<string>2.30.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.30.2</string>
|
||||
<string>2.30.3</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -9729,7 +9729,7 @@
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.2.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.3.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
@@ -9770,7 +9770,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.30.2;
|
||||
MARKETING_VERSION = 2.30.3;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Release;
|
||||
@@ -9814,7 +9814,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.2.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.3.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -9856,7 +9856,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.30.2;
|
||||
MARKETING_VERSION = 2.30.3;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -10063,7 +10063,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.2.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.3.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
@@ -10115,7 +10115,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.2.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.3.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title SDL 2.30.2
|
||||
Title SDL 2.30.3
|
||||
Version 1
|
||||
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
private static final String TAG = "SDL";
|
||||
private static final int SDL_MAJOR_VERSION = 2;
|
||||
private static final int SDL_MINOR_VERSION = 30;
|
||||
private static final int SDL_MICRO_VERSION = 2;
|
||||
private static final int SDL_MICRO_VERSION = 3;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
||||
78
configure
vendored
78
configure
vendored
@@ -873,7 +873,6 @@ enable_sse2
|
||||
enable_sse3
|
||||
enable_altivec
|
||||
enable_lsx
|
||||
enable_lasx
|
||||
enable_oss
|
||||
enable_alsa
|
||||
with_alsa_prefix
|
||||
@@ -1675,7 +1674,6 @@ Optional Features:
|
||||
--enable-sse3 use SSE3 assembly routines [default=maybe]
|
||||
--enable-altivec use Altivec assembly routines [default=yes]
|
||||
--enable-lsx use LSX assembly routines [default=yes]
|
||||
--enable-lasx use LASX assembly routines [default=yes]
|
||||
--enable-oss support the OSS audio API [default=maybe]
|
||||
--enable-alsa support the ALSA audio API [default=yes]
|
||||
--disable-alsatest Do not try to compile and run a test Alsa program
|
||||
@@ -3510,7 +3508,7 @@ orig_CFLAGS="$CFLAGS"
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=30
|
||||
SDL_MICRO_VERSION=2
|
||||
SDL_MICRO_VERSION=3
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
@@ -21112,80 +21110,6 @@ printf "%s\n" "#define HAVE_LSXINTRIN_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Check whether --enable-lasx was given.
|
||||
if test ${enable_lasx+y}
|
||||
then :
|
||||
enableval=$enable_lasx;
|
||||
else $as_nop
|
||||
enable_LASX=yes
|
||||
fi
|
||||
|
||||
if test x$enable_LASX = xyes; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
have_gcc_lasx=no
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlasx option" >&5
|
||||
printf %s "checking for GCC -mlasx option... " >&6; }
|
||||
lasx_CFLAGS="-mlasx"
|
||||
CFLAGS="$save_CFLAGS $lasx_CFLAGS"
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef __loongarch_asx
|
||||
#error Assembler CPP flag not enabled
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
have_gcc_lasx=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lasx" >&5
|
||||
printf "%s\n" "$have_gcc_lasx" >&6; }
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test x$have_gcc_lasx = xyes; then
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS"
|
||||
SUMMARY_math="${SUMMARY_math} lasx"
|
||||
fi
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lasxintrin.h" >&5
|
||||
printf %s "checking for lasxintrin.h... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <lasxintrin.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
have_lasxintrin_h_hdr=yes
|
||||
else $as_nop
|
||||
have_lasxintrin_h_hdr=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lasxintrin_h_hdr" >&5
|
||||
printf "%s\n" "$have_lasxintrin_h_hdr" >&6; }
|
||||
if test x$have_lasxintrin_h_hdr = xyes; then
|
||||
|
||||
printf "%s\n" "#define HAVE_LASXINTRIN_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
CheckOSS()
|
||||
{
|
||||
# Check whether --enable-oss was given.
|
||||
|
||||
34
configure.ac
34
configure.ac
@@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=30
|
||||
SDL_MICRO_VERSION=2
|
||||
SDL_MICRO_VERSION=3
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
@@ -938,38 +938,6 @@ fi
|
||||
AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(lasx,
|
||||
[AS_HELP_STRING([--enable-lasx], [use LASX assembly routines [default=yes]])],
|
||||
, enable_LASX=yes)
|
||||
if test x$enable_LASX = xyes; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
have_gcc_lasx=no
|
||||
AC_MSG_CHECKING(for GCC -mlasx option)
|
||||
lasx_CFLAGS="-mlasx"
|
||||
CFLAGS="$save_CFLAGS $lasx_CFLAGS"
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#ifndef __loongarch_asx
|
||||
#error Assembler CPP flag not enabled
|
||||
#endif
|
||||
]], [])], [have_gcc_lasx=yes], [])
|
||||
AC_MSG_RESULT($have_gcc_lasx)
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
if test x$have_gcc_lasx = xyes; then
|
||||
EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS"
|
||||
SUMMARY_math="${SUMMARY_math} lasx"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for lasxintrin.h)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lasxintrin.h>]])],
|
||||
[have_lasxintrin_h_hdr=yes],[have_lasxintrin_h_hdr=no])
|
||||
AC_MSG_RESULT($have_lasxintrin_h_hdr)
|
||||
if test x$have_lasxintrin_h_hdr = xyes; then
|
||||
AC_DEFINE(HAVE_LASXINTRIN_H, 1, [ ])
|
||||
fi
|
||||
|
||||
dnl See if the OSS audio interface is supported
|
||||
CheckOSS()
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
# elif defined(__MRC__)
|
||||
void *alloca(unsigned);
|
||||
# else
|
||||
char *alloca();
|
||||
void *alloca(size_t);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct SDL_version
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 30
|
||||
#define SDL_PATCHLEVEL 2
|
||||
#define SDL_PATCHLEVEL 3
|
||||
|
||||
/**
|
||||
* Macro to determine SDL version program was compiled against.
|
||||
|
||||
@@ -36,6 +36,7 @@ extern "C" {
|
||||
static XTaskQueueHandle GDK_GlobalTaskQueue;
|
||||
|
||||
PAPPSTATE_REGISTRATION hPLM = {};
|
||||
PAPPCONSTRAIN_REGISTRATION hCPLM = {};
|
||||
HANDLE plmSuspendComplete = nullptr;
|
||||
|
||||
extern "C" DECLSPEC int
|
||||
@@ -177,6 +178,23 @@ SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Register constrain/unconstrain handling */
|
||||
auto raccn = [](BOOLEAN constrained, PVOID context) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppConstrainedChangeNotification handler");
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
if (_this) {
|
||||
if (constrained) {
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
} else {
|
||||
SDL_SetKeyboardFocus(_this->windows);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (RegisterAppConstrainedChangeNotification(raccn, NULL, &hCPLM)) {
|
||||
SDL_SetError("[GDK] Unable to call RegisterAppConstrainedChangeNotification");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Run the application main() code */
|
||||
result = mainFunction(argc, argv);
|
||||
|
||||
@@ -184,6 +202,9 @@ SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved)
|
||||
UnregisterAppStateChangeNotification(hPLM);
|
||||
CloseHandle(plmSuspendComplete);
|
||||
|
||||
/* Unregister constrain/unconstrain handling */
|
||||
UnregisterAppConstrainedChangeNotification(hCPLM);
|
||||
|
||||
/* !!! FIXME: This follows the docs exactly, but for some reason still leaks handles on exit? */
|
||||
/* Terminate the task queue and dispatch any pending tasks */
|
||||
XTaskQueueTerminate(taskQueue, false, nullptr, nullptr);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef SDL_FILESYSTEM_XBOX
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
@@ -135,6 +134,5 @@ SDL_GetPrefPath(const char *org, const char *app)
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_XBOX */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -370,6 +370,8 @@ static Uint32 initial_wheel_devices[] = {
|
||||
MAKE_VIDPID(0x044f, 0xb65e), /* Thrustmaster T500RS */
|
||||
MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */
|
||||
MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */
|
||||
MAKE_VIDPID(0x044f, 0xb691), /* Thrustmaster TS-XW (initial mode) */
|
||||
MAKE_VIDPID(0x044f, 0xb692), /* Thrustmaster TS-XW (active mode) */
|
||||
MAKE_VIDPID(0x0483, 0x0522), /* Simagic Wheelbase (including M10, Alpha Mini, Alpha, Alpha U) */
|
||||
MAKE_VIDPID(0x0eb7, 0x0001), /* Fanatec ClubSport Wheel Base V2 */
|
||||
MAKE_VIDPID(0x0eb7, 0x0004), /* Fanatec ClubSport Wheel Base V2.5 */
|
||||
|
||||
@@ -273,7 +273,7 @@ static int GuessIsSensor(int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int IsJoystick(const char *path, int fd, char **name_return, Uint16 *vendor_return, Uint16 *product_return, SDL_JoystickGUID *guid)
|
||||
static int IsJoystick(const char *path, int *fd, char **name_return, Uint16 *vendor_return, Uint16 *product_return, SDL_JoystickGUID *guid)
|
||||
{
|
||||
struct input_id inpid;
|
||||
char *name;
|
||||
@@ -282,21 +282,32 @@ static int IsJoystick(const char *path, int fd, char **name_return, Uint16 *vend
|
||||
|
||||
SDL_zero(inpid);
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class);
|
||||
/* Opening input devices can generate synchronous device I/O, so avoid it if we can */
|
||||
if (SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class) &&
|
||||
!(class & SDL_UDEV_DEVICE_JOYSTICK)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (ioctl(fd, JSIOCGNAME(sizeof(product_string)), product_string) <= 0) {
|
||||
/* When udev is enabled we only get joystick devices here, so there's no need to test them */
|
||||
if (enumeration_method != ENUMERATION_LIBUDEV &&
|
||||
!(class & SDL_UDEV_DEVICE_JOYSTICK) && ( class || !GuessIsJoystick(fd))) {
|
||||
|
||||
if (fd && *fd < 0) {
|
||||
*fd = open(path, O_RDONLY | O_CLOEXEC, 0);
|
||||
}
|
||||
if (!fd || *fd < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(*fd, JSIOCGNAME(sizeof(product_string)), product_string) <= 0) {
|
||||
/* When udev enumeration or classification, we only got joysticks here, so no need to test */
|
||||
if (enumeration_method != ENUMERATION_LIBUDEV && !class && !GuessIsJoystick(*fd)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Could have vendor and product already from udev, but should agree with evdev */
|
||||
if (ioctl(fd, EVIOCGID, &inpid) < 0) {
|
||||
if (ioctl(*fd, EVIOCGID, &inpid) < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(fd, EVIOCGNAME(sizeof(product_string)), product_string) < 0) {
|
||||
if (ioctl(*fd, EVIOCGNAME(sizeof(product_string)), product_string) < 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -315,7 +326,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, Uint16 *vend
|
||||
}
|
||||
#endif
|
||||
|
||||
FixupDeviceInfoForMapping(fd, &inpid);
|
||||
FixupDeviceInfoForMapping(*fd, &inpid);
|
||||
|
||||
#ifdef DEBUG_JOYSTICK
|
||||
SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
|
||||
@@ -333,11 +344,32 @@ static int IsJoystick(const char *path, int fd, char **name_return, Uint16 *vend
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int IsSensor(const char *path, int fd)
|
||||
static int IsSensor(const char *path, int *fd)
|
||||
{
|
||||
struct input_id inpid;
|
||||
int class = 0;
|
||||
|
||||
if (ioctl(fd, EVIOCGID, &inpid) < 0) {
|
||||
SDL_zero(inpid);
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
/* Opening input devices can generate synchronous device I/O, so avoid it if we can */
|
||||
if (SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class) &&
|
||||
!(class & SDL_UDEV_DEVICE_ACCELEROMETER)) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fd && *fd < 0) {
|
||||
*fd = open(path, O_RDONLY | O_CLOEXEC, 0);
|
||||
}
|
||||
if (!fd || *fd < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!class && !GuessIsSensor(*fd)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(*fd, EVIOCGID, &inpid) < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -347,7 +379,7 @@ static int IsSensor(const char *path, int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GuessIsSensor(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
@@ -434,16 +466,11 @@ static void MaybeAddDevice(const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
fd = open(path, O_RDONLY | O_CLOEXEC, 0);
|
||||
if (fd < 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_INPUT_EVENTS
|
||||
SDL_Log("Checking %s\n", path);
|
||||
#endif
|
||||
|
||||
if (IsJoystick(path, fd, &name, &vendor, &product, &guid)) {
|
||||
if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) {
|
||||
#ifdef DEBUG_INPUT_EVENTS
|
||||
SDL_Log("found joystick: %s\n", path);
|
||||
#endif
|
||||
@@ -484,7 +511,7 @@ static void MaybeAddDevice(const char *path)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (IsSensor(path, fd)) {
|
||||
if (IsSensor(path, &fd)) {
|
||||
#ifdef DEBUG_INPUT_EVENTS
|
||||
SDL_Log("found sensor: %s\n", path);
|
||||
#endif
|
||||
@@ -880,11 +907,24 @@ static void LINUX_ScanSteamVirtualGamepads(void)
|
||||
int num_virtual_gamepads = 0;
|
||||
int virtual_gamepad_slot;
|
||||
VirtualGamepadEntry *virtual_gamepads = NULL;
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
int class;
|
||||
#endif
|
||||
|
||||
count = scandir("/dev/input", &entries, filter_entries, NULL);
|
||||
for (i = 0; i < count; ++i) {
|
||||
(void)SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", entries[i]->d_name);
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
/* Opening input devices can generate synchronous device I/O, so avoid it if we can */
|
||||
class = 0;
|
||||
SDL_zero(inpid);
|
||||
if (SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class) &&
|
||||
(inpid.vendor != USB_VENDOR_VALVE || inpid.product != USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) {
|
||||
free(entries[i]); /* This should NOT be SDL_free() */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
fd = open(path, O_RDONLY | O_CLOEXEC, 0);
|
||||
if (fd >= 0) {
|
||||
if (ioctl(fd, EVIOCGID, &inpid) == 0 &&
|
||||
@@ -986,6 +1026,9 @@ static void LINUX_JoystickDetect(void)
|
||||
static int LINUX_JoystickInit(void)
|
||||
{
|
||||
const char *devices = SDL_GetHint(SDL_HINT_JOYSTICK_DEVICE);
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
int udev_status = SDL_UDEV_Init();
|
||||
#endif
|
||||
|
||||
SDL_classic_joysticks = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_CLASSIC, SDL_FALSE);
|
||||
|
||||
@@ -1036,7 +1079,7 @@ static int LINUX_JoystickInit(void)
|
||||
}
|
||||
|
||||
if (enumeration_method == ENUMERATION_LIBUDEV) {
|
||||
if (SDL_UDEV_Init() == 0) {
|
||||
if (udev_status == 0) {
|
||||
/* Set up the udev callback */
|
||||
if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) {
|
||||
SDL_UDEV_Quit();
|
||||
|
||||
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,30,2,0
|
||||
PRODUCTVERSION 2,30,2,0
|
||||
FILEVERSION 2,30,3,0
|
||||
PRODUCTVERSION 2,30,3,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 30, 2, 0\0"
|
||||
VALUE "FileVersion", "2, 30, 3, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2024 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 30, 2, 0\0"
|
||||
VALUE "ProductVersion", "2, 30, 3, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -77,6 +77,7 @@ static int get_driindex(void)
|
||||
int devindex = -1;
|
||||
DIR *folder;
|
||||
const char *hint;
|
||||
struct dirent *res;
|
||||
|
||||
hint = SDL_GetHint(SDL_HINT_KMSDRM_DEVICE_INDEX);
|
||||
if (hint && *hint) {
|
||||
@@ -96,7 +97,7 @@ static int get_driindex(void)
|
||||
|
||||
SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname,
|
||||
sizeof(device) - kmsdrm_dri_devnamesize);
|
||||
for (struct dirent *res; (res = readdir(folder));) {
|
||||
while((res = readdir(folder)) != NULL) {
|
||||
if (SDL_memcmp(res->d_name, kmsdrm_dri_devname,
|
||||
kmsdrm_dri_devnamesize) == 0) {
|
||||
SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize,
|
||||
|
||||
@@ -1166,7 +1166,8 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
|
||||
const SDL_Scancode scancode = Wayland_get_scancode_from_key(input, *key + 8);
|
||||
|
||||
if (scancode != SDL_SCANCODE_UNKNOWN) {
|
||||
for (uint32_t i = 0; i < SDL_arraysize(mod_scancodes); ++i) {
|
||||
uint32_t i;
|
||||
for (i = 0; i < SDL_arraysize(mod_scancodes); ++i) {
|
||||
if (mod_scancodes[i] == scancode) {
|
||||
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
||||
break;
|
||||
@@ -1814,7 +1815,8 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
|
||||
char **paths = SDL_DBus_DocumentsPortalRetrieveFiles(buffer, &path_count);
|
||||
/* If dropped files contain a directory the list is empty */
|
||||
if (paths && path_count > 0) {
|
||||
for (int i = 0; i < path_count; i++) {
|
||||
int i;
|
||||
for (i = 0; i < path_count; i++) {
|
||||
SDL_SendDropFile(data_device->dnd_window, paths[i]);
|
||||
}
|
||||
dbus->free_string_array(paths);
|
||||
|
||||
@@ -128,6 +128,10 @@ static SDL_Scancode VKeytoScancodeFallback(WPARAM vkey)
|
||||
return SDL_SCANCODE_RIGHT;
|
||||
case VK_DOWN:
|
||||
return SDL_SCANCODE_DOWN;
|
||||
case VK_CONTROL:
|
||||
return SDL_SCANCODE_LCTRL;
|
||||
case VK_V:
|
||||
return SDL_SCANCODE_V;
|
||||
|
||||
default:
|
||||
return SDL_SCANCODE_UNKNOWN;
|
||||
@@ -137,6 +141,11 @@ static SDL_Scancode VKeytoScancodeFallback(WPARAM vkey)
|
||||
static SDL_Scancode VKeytoScancode(WPARAM vkey)
|
||||
{
|
||||
switch (vkey) {
|
||||
case VK_BACK:
|
||||
return SDL_SCANCODE_BACKSPACE;
|
||||
case VK_CAPITAL:
|
||||
return SDL_SCANCODE_CAPSLOCK;
|
||||
|
||||
case VK_MODECHANGE:
|
||||
return SDL_SCANCODE_MODE;
|
||||
case VK_SELECT:
|
||||
@@ -1957,13 +1966,26 @@ static void WIN_CleanRegisterApp(WNDCLASSEX wcex)
|
||||
SDL_Appname = NULL;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK WIN_ResourceNameCallback(HMODULE hModule, LPCTSTR lpType, LPTSTR lpName, LONG_PTR lParam)
|
||||
{
|
||||
WNDCLASSEX *wcex = (WNDCLASSEX *)lParam;
|
||||
|
||||
(void)lpType; /* We already know that the resource type is RT_GROUP_ICON. */
|
||||
|
||||
/* We leave hIconSm as NULL as it will allow Windows to automatically
|
||||
choose the appropriate small icon size to suit the current DPI. */
|
||||
wcex->hIcon = LoadIcon(hModule, lpName);
|
||||
|
||||
/* Do not bother enumerating any more. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Register the class for this application */
|
||||
int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
const char *hint;
|
||||
TCHAR path[MAX_PATH];
|
||||
#endif
|
||||
|
||||
/* Only do this once... */
|
||||
@@ -2006,9 +2028,8 @@ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
|
||||
wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint)));
|
||||
}
|
||||
} else {
|
||||
/* Use the first icon as a default icon, like in the Explorer */
|
||||
GetModuleFileName(SDL_Instance, path, MAX_PATH);
|
||||
ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1);
|
||||
/* Use the first icon as a default icon, like in the Explorer. */
|
||||
EnumResourceNames(SDL_Instance, RT_GROUP_ICON, WIN_ResourceNameCallback, (LONG_PTR)&wcex);
|
||||
}
|
||||
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
|
||||
|
||||
|
||||
@@ -317,8 +317,19 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y)
|
||||
{
|
||||
SDL_VideoData *videodata = (SDL_VideoData *)SDL_GetVideoDevice()->driverdata;
|
||||
Display *display = videodata->display;
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
int deviceid = 0;
|
||||
SDL_bool warp_hack = SDL_FALSE;
|
||||
|
||||
/* XWayland will only warp the cursor if it is hidden, so this workaround is required. */
|
||||
if (videodata->is_xwayland && mouse && mouse->cursor_shown) {
|
||||
warp_hack = SDL_TRUE;
|
||||
}
|
||||
|
||||
if (warp_hack) {
|
||||
X11_ShowCursor(NULL);
|
||||
}
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
if (X11_Xinput2IsInitialized()) {
|
||||
/* It seems XIWarpPointer() doesn't work correctly on multi-head setups:
|
||||
* https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea
|
||||
@@ -335,6 +346,10 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y)
|
||||
{
|
||||
X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y);
|
||||
}
|
||||
|
||||
if (warp_hack) {
|
||||
X11_ShowCursor(SDL_GetCursor());
|
||||
}
|
||||
X11_XSync(display, False);
|
||||
videodata->global_mouse_changed = SDL_TRUE;
|
||||
}
|
||||
|
||||
@@ -145,6 +145,12 @@ static int X11_SafetyNetErrHandler(Display *d, XErrorEvent *e)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SDL_bool X11_IsXWayland(Display *d)
|
||||
{
|
||||
int opcode, event, error;
|
||||
return X11_XQueryExtension(d, "XWAYLAND", &opcode, &event, &error) == True;
|
||||
}
|
||||
|
||||
static SDL_VideoDevice *X11_CreateDevice(void)
|
||||
{
|
||||
SDL_VideoDevice *device;
|
||||
@@ -322,6 +328,8 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
||||
device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface;
|
||||
#endif
|
||||
|
||||
data->is_xwayland = X11_IsXWayland(x11_display);
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,8 @@ typedef struct SDL_VideoData
|
||||
SDL_bool is_steam_deck;
|
||||
SDL_bool steam_keyboard_open;
|
||||
|
||||
SDL_bool is_xwayland;
|
||||
|
||||
} SDL_VideoData;
|
||||
|
||||
extern SDL_bool X11_UseDirectColorVisuals(void);
|
||||
|
||||
@@ -108,14 +108,14 @@ testutils.lib: testutils.obj
|
||||
check: .SYMBOLIC $(TESTS)
|
||||
@set SDL_AUDIODRIVER=dummy
|
||||
@set SDL_VIDEODRIVER=dummy
|
||||
@copy "../SDL2.dll" .
|
||||
@copy ..\SDL2.dll .
|
||||
@for %exe in ($(TESTS)) do %exe
|
||||
|
||||
check-quick: .SYMBOLIC $(TESTS)
|
||||
@set SDL_TESTS_QUICK=1
|
||||
@set SDL_AUDIODRIVER=dummy
|
||||
@set SDL_VIDEODRIVER=dummy
|
||||
@copy "../SDL2.dll" .
|
||||
@copy ..\SDL2.dll .
|
||||
@for %exe in ($(TESTS)) do %exe
|
||||
|
||||
clean: .SYMBOLIC
|
||||
|
||||
Reference in New Issue
Block a user