Compare commits

...

18 Commits

Author SHA1 Message Date
Sam Lantinga
fb1497566c Updated to version 2.30.3 for release 2024-05-01 09:14:37 -07:00
Ozkan Sezer
cc6c0fe230 test, watcom.mif: revert f9a46a319b
%copy isn't recognized by older wmake versions.
2024-05-01 17:37:10 +03:00
Ozkan Sezer
f9a46a319b test, watcom.mif: revert 48a0592a4 and use %copy instead
Ref.: https://github.com/open-watcom/open-watcom-v2/issues/1281.
2024-05-01 17:02:28 +03:00
Ozkan Sezer
48a0592a45 test, watcom makefile: change copy command to use a dos path separator
fixes copy failure with recent open watcom wmake changes. (Issue reported
mainstream as https://github.com/open-watcom/open-watcom-v2/issues/1281)
2024-05-01 11:02:04 +03:00
Sam Lantinga
1c74a8b5ae Fixed building with GDK (thanks @Romans-I-XVI!)
(cherry picked from commit 1caa427035)
2024-04-30 10:21:38 -07:00
Austin Sojka
3d18043005 Added GDK app constrained/unconstrained events (#9608)
(cherry picked from commit 7554e82ec3)
2024-04-30 10:21:32 -07:00
Tyson Whitehead
6e1e00701e Initialize udev before joystick manual scan so class lookup works
LINUX_JoystickInit does a manual scan first so devices are sorted.
If SDL_UDEV_Init hasn't run by then, then the product info cannot
be looked up by SDL_UDEV_GetProductInfo and the initial-plugged-
in-device classification falls back to heuristic guessing.

(cherry picked from commit 0963c11af8)
2024-04-26 12:15:52 -07:00
yuanhecai
5570d846ea loongarch: Delete the configuration of the compilation option "mlasx"
(cherry picked from commit 75340b827d)
2024-04-25 20:33:53 -07:00
Anonymous Maarten
f5dcb8f7ad stdinc: modify default alloca prototype
For compatibilty with TinyCC.

Backport of 06758685a5

(cherry picked from commit 9216b7a5ee)
2024-04-25 21:39:23 +03:00
Sam Lantinga
f6f1b09b69 Fixed build error (thanks @sezero!)
(cherry picked from commit ac5a61cd60)
(cherry picked from commit 67c60e0b9c)
2024-04-25 09:45:52 -07:00
Tyson Whitehead
bf540985aa Avoid opening non-joystick devices if possible to speedup scanning
Closing a device file takes 0.01 to 0.5s, which can add up to
significant startup delays. The udev classification does not
require opening the actual device files, so, use it if possible,
and only fall back to opening the device and probing otherwise.

(cherry picked from commit 45b804c158)
2024-04-25 08:48:57 -07:00
Frank Praznik
c39f86c28a x11: Fix pointer warp on XWayland
XWayland seems to require that the pointer be hidden when it is warped, so hide and show the pointer when warping, if required.

Note that XWayland still only allows warping within the window, so attempts to warp to global coordinates outside the window won't work.

(cherry picked from commit a845c7027e)
(cherry picked from commit 863d4a0f2a)
2024-04-25 08:42:04 -07:00
Sam Lantinga
b5da8ad00d Fixed Win+V handling (pasting from clipboard history) on Windows (thanks @ocornut!)
Fixes https://github.com/libsdl-org/SDL/issues/9613

(cherry picked from commit 33af02ae68)
2024-04-24 09:24:41 -07:00
Ozkan Sezer
f62b86263a CI, macOS: install autoconf.
Reference issue: https://github.com/libsdl-org/SDL/issues/9606 .

(cherry picked from commit 26e3d65ea8)
2024-04-24 00:39:00 +03:00
yassineimounachen
3449c734d5 Add USB IDs for the Thrustmaster TS-XW racing wheel
To be of use, this depends on https://github.com/berarma/oversteer/pull/200 and https://github.com/Kimplul/hid-tmff2/pull/94.

(cherry picked from commit 5ffb2f47d1)
(cherry picked from commit 8f18e2f52d)
2024-04-22 11:36:52 -07:00
Sam Lantinga
3f29d985fe Fixed compilation with C89 (thanks @d-s-a!)
Closes https://github.com/libsdl-org/SDL/pull/9564

(cherry picked from commit 4e29be814e)
2024-04-17 07:50:28 -07:00
Clownacy
2f4a7bbced Fix default Windows window icon not suiting the DPI.
For whatever reason, `ExtractIconEx` returns icons whose sizes are
inappropriate for the current DPI, resulting in terribly-blurry
window icons at higher DPIs.

To solve this, the window icon is now set to the first icon group
that is present in the executable. This behaviour should match what
Explorer does. By selecting an icon group instead of a specific icon,
Windows is free to select the icon within the group that best suits
the current DPI.

(cherry picked from commit 1fa6142903)
2024-04-02 12:05:09 -07:00
Zhuoran
a0522e4c21 Fix Caps Lock and Backspace mapping for Colemak
(cherry picked from commit 906ad64d7b)
2024-04-02 07:49:41 -07:00
25 changed files with 170 additions and 180 deletions

View File

@@ -64,6 +64,7 @@ jobs:
if: runner.os == 'macOS'
run: |
brew install \
autoconf \
ninja \
pkg-config

View File

@@ -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")

View File

@@ -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

View File

@@ -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 = .

View File

@@ -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>

View File

@@ -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>

View File

@@ -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;

View File

@@ -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

View File

@@ -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
View File

@@ -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.

View File

@@ -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()
{

View File

@@ -107,7 +107,7 @@
# elif defined(__MRC__)
void *alloca(unsigned);
# else
char *alloca();
void *alloca(size_t);
# endif
#endif

View File

@@ -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.

View File

@@ -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);

View File

@@ -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: */

View File

@@ -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 */

View File

@@ -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();

View File

@@ -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"

View File

@@ -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,

View File

@@ -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);

View File

@@ -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__)*/

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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