Compare commits

...
Author SHA1 Message Date
Sam Lantinga 9519b9916c Updated to version 2.30.7 for release 2024-09-01 08:11:12 -07:00
Ozkan Sezer 00494df2f1 RAWINPUT_JoystickOpen: add missing SDL_stack_free() calls.
Fixes https://github.com/libsdl-org/SDL/issues/10574.
(cherry picked from commit 845212388e)
(cherry picked from commit 4eac44bed4)
2024-08-25 11:05:56 +03:00
Sam Lantinga 948196448f Added support for the Retro-bit Controller in PS3 mode
Fixes https://github.com/libsdl-org/SDL/issues/10557

(cherry picked from commit e75175129f)
(cherry picked from commit 0de601dc64)
2024-08-19 16:50:00 -07:00
Ozkan Sezer 7ca3d26e7a SDL_x11mouse.c: avoid -Wunused-variable if xinput2 is not available
(cherry picked from commit 30972d7e7f)
2024-08-17 11:23:32 +03:00
Frank Praznik f79d28085d wayland: Send fake warp coordinates when emulating warps with relative mode
Send the fake warp coordinates when emulating warps with relative mode to ensure that it appears that the cursor is always reset to where the application expects it to be.

Fixes cases where games can continue moving the camera if the mouse is lifted during motion.

(cherry picked from commit 8fcbf972c6)
2024-08-16 11:27:44 -04:00
Frank Praznik 74a005f73f x11: Track cursor visibility internally
Cursor visibility in the SDL input layer only reflects whether ShowCursor/HideCursor was called. In the case of relative mode, the cursor can be hidden, but the SDL_Mouse visibility flag will be true.

Track cursor visibility separately in the X11 driver. Fixes the cursor becoming visible when using the warping relative mode with XWayland.

(cherry picked from commit b0713a7d30)
(cherry picked from commit 5b57573439)
2024-08-16 10:36:33 -04:00
Sam Lantinga 6f7aa1e755 Use drmModeAddFB() if drmModeAddFB2WithModifiers() fails
Fixes https://github.com/libsdl-org/SDL/issues/10276

(cherry picked from commit 8e99ec34bb)
(cherry picked from commit b360214950)
2024-08-15 11:54:06 -07:00
Wohlstand 847a6cce96 SDL_vitatouch.c: Fixed the incorrect touch device IDs
- Begining of device ID with 0 violates the SDL's specification that means the 0 is an error, invalid, failure, etc. But on Vita here it's an actual device...
- Replacing 0 and 1 with 1 and 2 to resolve this violation.

(cherry picked from commit dd6c663918)
2024-08-14 08:39:58 -07:00
Sam Lantinga 95aed34a69 Fixed build
(cherry picked from commit 70890b175e)
2024-08-13 09:36:36 -07:00
Ilya Mizus 21e0382edd Fixed secondary screens on KMSDRM (#10535)
* Removed window movement to left top corner that breaks secondary screens on KMSDRM

(cherry picked from commit ce98550cbb)
(cherry picked from commit 586a2dc721)
2024-08-13 09:36:36 -07:00
KaJe 0cdfdb9970 Add Cammus C12 VID & PID to wheel device list.
Add Cammus C12 in the SDL wheel list to enable wheel detection for them.

(cherry picked from commit e1571d704d)
(cherry picked from commit 5ecbc00f36)
2024-08-09 06:49:06 -07:00
Sam Lantinga f75b0aa814 kmsdrm: free the connector when looking for available devices
Fixes https://github.com/libsdl-org/SDL/issues/10499

(cherry picked from commit 1a57ea7fba)
(cherry picked from commit a5bff78d81)
2024-08-08 09:30:33 -07:00
Sam Lantinga 403f87340f Fixed crash when the current mouse capture window is destroyed
Fixes https://github.com/libsdl-org/SDL/issues/10494

(cherry picked from commit 91d97a367e)
(cherry picked from commit 5ca0639a42)
2024-08-07 12:36:04 -07:00
Sam Lantinga 07cfc34a2e Added detail about why a file couldn't be opened (thanks mgerhardy!)
Fixes https://github.com/libsdl-org/SDL/issues/10484

(cherry picked from commit 1512013320)
2024-08-06 05:46:37 -07:00
Anonymous Maarten 4222cebef6 Use SDL_test + don't use macros
The structure of the existing loop makes the inner loop of the previous commit unnecessary.

Manual backport of 558630d59c

(cherry picked from commit 62f35ab1b6)
2024-08-05 07:25:35 -07:00
Sam Lantinga 1e2aa2363b Implemented left-justification in SDL_PrintString()
Fixes https://github.com/libsdl-org/SDL/issues/10310

(cherry picked from commit f59d66f4b1)
(cherry picked from commit 2efbe7fa3f)
2024-08-04 20:07:06 -07:00
vanfanel 0b25cd2196 Fix KMSDRM double buffering.
(cherry picked from commit 5ab1151508)
2024-08-04 15:53:44 -07:00
Anonymous Maarten b7457ff61b cmake: SDL2 target is not always available
(cherry picked from commit 7cf3234efe)
2024-08-04 15:53:17 +02:00
Sam Lantinga ba2f78a006 Updated to version 2.30.6 for release 2024-08-01 14:16:41 -07:00
Sam Lantinga dcbdf09709 Fixed macOS build
(cherry picked from commit 230f1debd0)
2024-08-01 14:15:16 -07:00
Sam Lantinga a9b11980d2 Fixed building on macOS with OpenGL disabled
Fixes https://github.com/libsdl-org/SDL/issues/6226

(cherry picked from commit 0b6eff4167)
2024-08-01 14:04:27 -07:00
Sam Lantinga 906d0e9c03 Fixed crash with joystick rumble after disconnection
This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected.

Thanks to @AntTheAlchemist for the key bug report that showed what was happening here.

Fixes https://github.com/libsdl-org/SDL/issues/10422

(cherry picked from commit 0a924b185d)
(cherry picked from commit 7fdf794377)
2024-07-29 13:51:22 -07:00
Sam Lantinga 0952ab1ab9 Fixed whitespace
(cherry picked from commit 67b973b5fa)
(cherry picked from commit 15c73f5bfe)
2024-07-29 12:52:54 -07:00
Charles Cross 7635776ca4 Updates CheckLibUDev() to match main, fixing missing HAVE_LIBUDEV
(cherry picked from commit e306cbcbee)
2024-07-29 07:22:29 -07:00
Ozkan Sezer 76a3457ad5 SDL_mslibc.c: revert PR/10303 changes
(cherry picked from commit 2cb2897e50)
2024-07-28 22:50:00 +03:00
Frank Praznik 881c4cb49e wayland: Don't fail to retrieve a system cursor if no window is focused
Doing this can leave the cursor data in a weird, corrupt state.

(cherry picked from commit 5617ce277d)
(cherry picked from commit 5d1ca1c8c7)
2024-07-27 20:32:33 -04:00
Ozkan Sezer 0406d1c316 testshader.c: include stdlib.h for exit() 2024-07-22 17:40:56 +03:00
Ozkan Sezer 1ca76a29d9 SDL_stdinc.h (SDL_COMPILE_TIME_ASSERT): Keep C++ case alone (after PR/10331)
Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.
Reference issue: https://github.com/libsdl-org/SDL/issues/6078 which was fixed by
https://github.com/libsdl-org/SDL/commit/f6b81125b340e00129978f2c9eebfba6a4d25692

(cherry picked from commit 70c1012e8c)
(cherry picked from commit 86b4d035db)
2024-07-22 16:02:50 +03:00
Anonymous Maarten e53df5b07e stdinc: c23 deprecated _Static_assert in favor of static_assert
(cherry picked from commit 22bfbdbc02)
(cherry picked from commit 5d606eaae2)
2024-07-21 13:18:55 -07:00
Amir e7a47e783b Fix warning for Android NDK compiler: "function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]"
https://stackoverflow.com/questions/42125/warning-error-function-declaration-isnt-a-prototype
In C int foo() and int foo(void) are different functions. int foo() accepts an arbitrary number of arguments, while int foo(void) accepts 0 arguments. In C++ they mean the same thing.

(cherry picked from commit ccade50587)
2024-07-17 14:48:06 -07:00
Ryan C. Gordon 279eb89ce5 README-macos: Typo fixes.
(Manually cherry-picked from 199e6929e5284b8573f02dcb655d3803ed436615.)
2024-07-16 08:32:29 -04:00
Anonymous Maarten fe9020dcb8 pthread: timespec.tv_nsec must be less then 1000000000 ns
(cherry picked from commit 1ef041a2ca)
2024-07-14 17:29:33 +02:00
ceski 4927836b2d Add a Windows mapping for SplitFish Game Controller
(cherry picked from commit 68cf17d0d4)
(cherry picked from commit 3b7eafedb3)
2024-07-12 22:04:47 -07:00
Anonymous Maarten 5a072d38db cmake: only add SDL_LIBC=0 compile options to SDL2 libraries 2024-07-12 23:18:06 +02:00
Sam Lantinga 2d1ebf4850 Make sure SDL subsystems are initialized before starting threads
(cherry picked from commit b057159db7)
2024-07-12 09:11:38 -07:00
Sam Lantinga 44ec2027f3 Make sure timers are initialized before any threads start
This prevents race conditions and divide by zero if multiple threads start using the time functions simultaneously.

(cherry picked from commit b378bc5c83)
2024-07-12 08:02:09 -07:00
Sam Lantinga 000da98663 Fixed OS/2 build
(cherry picked from commit b13dcf24d6)
2024-07-11 13:56:11 -07:00
Sam Lantinga 87ba287f81 Added TLS initialization and shutdown functions
Fixes https://github.com/libsdl-org/SDL/issues/8576

(cherry picked from commit b517043936)
(cherry picked from commit 551164812a)
2024-07-11 13:10:40 -07:00
Ozkan Sezer d133701a72 ci: bump FreeBSD
Reference issue: https://github.com/libsdl-org/SDL/issues/10224.

(cherry picked from commit 956a8bf6c0)
2024-07-11 18:55:56 +03:00
Substring 4635f8597d KMSDRM: fix unsupported modifiers
(cherry picked from commit 9548bba63a)
(cherry picked from commit a2215ff81c)
2024-07-10 14:43:06 -07:00
Sam Lantinga 802351be25 Fixed build
(cherry picked from commit 026dfc6305)
2024-07-08 11:39:25 -07:00
Sam Lantinga d3765b27c2 Make sure we're actually running on Windows before using D3D renderers
(cherry picked from commit e22c89536a)
2024-07-08 11:29:29 -07:00
mariob92 7b11fff2ee wgl/glx: Fix attribute list for SDL_GL_FLOATBUFFERS
This commit fixes the attribute list in the WGL and GLX code when requesting a floating point pixel format. The name of the attribute was missing in the list.

Fixes libsdl-org#10189

(cherry picked from commit 9389712917)
(cherry picked from commit 58e179c8b5)
2024-07-06 11:57:23 -07:00
Sam Lantinga de4573275a Improved detection of Nintendo Switch Pro controller report mode
Fixes https://github.com/libsdl-org/SDL/issues/10182

(cherry picked from commit 4ba2e9f4f4)
(cherry picked from commit 4c44450258)
2024-07-06 05:30:41 -07:00
Ozkan Sezer 275c94c900 SDL_hidapi.c: work-around watcom build error when libusb is enabled
(cherry picked from commit 6a10309568)
2024-07-05 18:56:20 +03:00
Max Maisel c084e647ed Drain HIDAPI buffer in SDL_hidapi_steamdeck.c.
Add a loop around SDL_hid_read() in the Steam Deck HIDAPI driver as it
is done in other HIDAPI drivers. This loop reads data from the device and
processes it until the input buffer is empty which ensures that clients
always get the latest data.

This fixes an input latency issue if the application polls the events
slower than the hardware generates them.

(cherry picked from commit 22770e6496)
2024-07-05 08:29:01 -07:00
Sam Lantinga 2cdb419a21 Try to create an accelerated renderer for the window surface even if SDL_HINT_RENDER_DRIVER is "software"
This case is properly handled inside SDL_CreateWindowTexture()

Fixes https://github.com/libsdl-org/SDL/issues/10155

(cherry picked from commit c7ed78a9ef)
(cherry picked from commit a4cbba1276)
2024-07-05 08:23:39 -07:00
141 changed files with 776 additions and 541 deletions

No files matched your search

+2 -2
View File
@@ -10,10 +10,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build - name: Build
uses: cross-platform-actions/action@v0.23.0 uses: cross-platform-actions/action@v0.24.0
with: with:
operating_system: freebsd operating_system: freebsd
version: '13.2' version: '13.3'
shell: bash shell: bash
run: | run: |
sudo pkg update sudo pkg update
+18 -9
View File
@@ -87,7 +87,7 @@ endif()
# See docs/release_checklist.md # See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2) set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 30) set(SDL_MINOR_VERSION 30)
set(SDL_MICRO_VERSION 5) set(SDL_MICRO_VERSION 7)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
# Set defaults preventing destination file conflicts # Set defaults preventing destination file conflicts
@@ -1777,14 +1777,6 @@ elseif(WINDOWS)
list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES}) list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES})
endif() endif()
if(MSVC AND NOT SDL_LIBC)
# Prevent codegen that would use the VC runtime libraries.
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576")
if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE")
endif()
endif()
if(SDL_MISC) if(SDL_MISC)
if(WINDOWS_STORE) if(WINDOWS_STORE)
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp)
@@ -3527,6 +3519,23 @@ if(SDL_TEST)
set_property(TARGET SDL2_test PROPERTY INTERFACE_SDL_VERSION "SDL2") set_property(TARGET SDL2_test PROPERTY INTERFACE_SDL_VERSION "SDL2")
endif() endif()
if(MSVC AND NOT SDL_LIBC)
set(targets )
if(TARGET SDL2)
list(APPEND targets SDL2)
endif()
if(TARGET SDL2-static)
list(APPEND targets SDL2-static)
endif()
if(TARGET SDL2_test)
list(APPEND targets SDL2_test)
endif()
set_property(TARGET ${targets} APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576")
if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set_property(TARGET ${targets} APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE")
endif()
endif()
##### Installation targets ##### ##### Installation targets #####
if(NOT SDL2_DISABLE_INSTALL) if(NOT SDL2_DISABLE_INSTALL)
if(SDL_SHARED) if(SDL_SHARED)
+1 -1
View File
@@ -15,7 +15,7 @@
LIBNAME = SDL2 LIBNAME = SDL2
MAJOR_VERSION = 2 MAJOR_VERSION = 2
MINOR_VERSION = 30 MINOR_VERSION = 30
MICRO_VERSION = 5 MICRO_VERSION = 7
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2 DESCRIPTION = Simple DirectMedia Layer 2
+1 -1
View File
@@ -6,7 +6,7 @@
LIBNAME = SDL2 LIBNAME = SDL2
MAJOR_VERSION = 2 MAJOR_VERSION = 2
MINOR_VERSION = 30 MINOR_VERSION = 30
MICRO_VERSION = 5 MICRO_VERSION = 7
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
LIBHOME = . LIBHOME = .
+4 -4
View File
@@ -52,9 +52,9 @@ void spawnTrailFromEmitter(struct particle *emitter);
void spawnEmitterParticle(GLfloat x, GLfloat y); void spawnEmitterParticle(GLfloat x, GLfloat y);
void explodeEmitter(struct particle *emitter); void explodeEmitter(struct particle *emitter);
void initializeParticles(void); void initializeParticles(void);
void initializeTexture(); void initializeTexture(void);
int nextPowerOfTwo(int x); int nextPowerOfTwo(int x);
void drawParticles(); void drawParticles(void);
void stepParticles(double deltaTime); void stepParticles(double deltaTime);
/* helper function (used in texture loading) /* helper function (used in texture loading)
@@ -159,7 +159,7 @@ stepParticles(double deltaTime)
This draws all the particles shown on screen This draws all the particles shown on screen
*/ */
void void
drawParticles() drawParticles(void)
{ {
/* draw the background */ /* draw the background */
@@ -324,7 +324,7 @@ initializeParticles(void)
loads the particle texture loads the particle texture
*/ */
void void
initializeTexture() initializeTexture(void)
{ {
int bpp; /* texture bits per pixel */ int bpp; /* texture bits per pixel */
+1 -1
View File
@@ -196,7 +196,7 @@ loadFont(void)
} }
void void
draw() draw(void)
{ {
SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a); SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a);
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.30.5</string> <string>2.30.7</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>SDLX</string> <string>SDLX</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2.30.5</string> <string>2.30.7</string>
</dict> </dict>
</plist> </plist>
+6 -6
View File
@@ -9729,7 +9729,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES; DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 3001.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.5.0; DYLIB_CURRENT_VERSION = 3001.7.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES; GCC_ALTIVEC_EXTENSIONS = YES;
@@ -9770,7 +9770,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO; CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.30.5; MARKETING_VERSION = 2.30.7;
OTHER_LDFLAGS = "-liconv"; OTHER_LDFLAGS = "-liconv";
}; };
name = Release; name = Release;
@@ -9814,7 +9814,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 3001.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.5.0; DYLIB_CURRENT_VERSION = 3001.7.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@@ -9856,7 +9856,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO; CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.30.5; MARKETING_VERSION = 2.30.7;
OTHER_LDFLAGS = "-liconv"; OTHER_LDFLAGS = "-liconv";
}; };
name = Debug; name = Debug;
@@ -10063,7 +10063,7 @@
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3001.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.5.0; DYLIB_CURRENT_VERSION = 3001.7.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
@@ -10115,7 +10115,7 @@
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3001.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3001.5.0; DYLIB_CURRENT_VERSION = 3001.7.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 2.30.5 Title SDL 2.30.7
Version 1 Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org) Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks DefaultLocation /Library/Frameworks
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL"; private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 30; private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 5; private static final int SDL_MICRO_VERSION = 7;
/* /*
// Display InputType.SOURCE/CLASS of events and devices // Display InputType.SOURCE/CLASS of events and devices
// //
+3 -2
View File
@@ -1352,12 +1352,13 @@ endmacro()
macro(CheckLibUDev) macro(CheckLibUDev)
if(SDL_LIBUDEV) if(SDL_LIBUDEV)
check_include_file("libudev.h" have_libudev_header) check_include_file("libudev.h" HAVE_LIBUDEV_HEADER)
if(have_libudev_header) if(HAVE_LIBUDEV_HEADER)
set(HAVE_LIBUDEV_H TRUE) set(HAVE_LIBUDEV_H TRUE)
FindLibraryAndSONAME(udev) FindLibraryAndSONAME(udev)
if(UDEV_LIB_SONAME) if(UDEV_LIB_SONAME)
set(SDL_UDEV_DYNAMIC "\"${UDEV_LIB_SONAME}\"") set(SDL_UDEV_DYNAMIC "\"${UDEV_LIB_SONAME}\"")
set(HAVE_LIBUDEV TRUE)
endif() endif()
endif() endif()
endif() endif()
Vendored
+1 -1
View File
@@ -3508,7 +3508,7 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md # See docs/release_checklist.md
SDL_MAJOR_VERSION=2 SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=30 SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=5 SDL_MICRO_VERSION=7
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
+1 -1
View File
@@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources
# See docs/release_checklist.md # See docs/release_checklist.md
SDL_MAJOR_VERSION=2 SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=30 SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=5 SDL_MICRO_VERSION=7
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
+4 -4
View File
@@ -261,10 +261,10 @@ Some things that may be of interest about how it all works...
## Working directory ## Working directory
In SDL 1.2, the working directory of your SDL app is by default set to its In SDL 1.2, the working directory of your SDL app is by default set to its
parent, but this is no longer the case in SDL 2.0. SDL2 does change the parent, but this is no longer the case in SDL 2.0 and later. SDL2 does not
working directory, which means it'll be whatever the command line prompt change the working directory, which means it'll be whatever the command line
that launched the program was using, or if launched by double-clicking in prompt that launched the program was using, or if launched by double-clicking
the finger, it will be "/", the _root of the filesystem_. Plan accordingly! in the Finder, it will be "/", the _root of the filesystem_. Plan accordingly!
You can use SDL_GetBasePath() to find where the program is running from and You can use SDL_GetBasePath() to find where the program is running from and
chdir() there directly. chdir() there directly.
+3
View File
@@ -377,9 +377,12 @@ typedef uint64_t Uint64;
#ifndef SDL_COMPILE_TIME_ASSERT #ifndef SDL_COMPILE_TIME_ASSERT
#if defined(__cplusplus) #if defined(__cplusplus)
/* Keep C++ case alone: Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. */
#if (__cplusplus >= 201103L) #if (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) #define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#endif #endif
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x) #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
#endif #endif
+1 -1
View File
@@ -59,7 +59,7 @@ typedef struct SDL_version
*/ */
#define SDL_MAJOR_VERSION 2 #define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 30 #define SDL_MINOR_VERSION 30
#define SDL_PATCHLEVEL 5 #define SDL_PATCHLEVEL 7
/** /**
* Macro to determine SDL version program was compiled against. * Macro to determine SDL version program was compiled against.
+33 -23
View File
@@ -29,9 +29,6 @@
#endif #endif
#if defined(__OS2__) #if defined(__OS2__)
#include "core/os2/SDL_os2.h" #include "core/os2/SDL_os2.h"
#ifdef SDL_THREAD_OS2
#include "thread/os2/SDL_systls_c.h"
#endif
#endif #endif
/* this checks for HAVE_DBUS_DBUS_H internally. */ /* this checks for HAVE_DBUS_DBUS_H internally. */
@@ -52,6 +49,7 @@
#include "haptic/SDL_haptic_c.h" #include "haptic/SDL_haptic_c.h"
#include "joystick/SDL_joystick_c.h" #include "joystick/SDL_joystick_c.h"
#include "sensor/SDL_sensor_c.h" #include "sensor/SDL_sensor_c.h"
#include "thread/SDL_thread_c.h"
/* Initialization/Cleanup routines */ /* Initialization/Cleanup routines */
#ifndef SDL_TIMERS_DISABLED #ifndef SDL_TIMERS_DISABLED
@@ -116,6 +114,7 @@ static SDL_bool SDL_MainIsReady = SDL_FALSE;
#else #else
static SDL_bool SDL_MainIsReady = SDL_TRUE; static SDL_bool SDL_MainIsReady = SDL_TRUE;
#endif #endif
static SDL_bool SDL_main_thread_initialized = SDL_FALSE;
static SDL_bool SDL_bInMainQuit = SDL_FALSE; static SDL_bool SDL_bInMainQuit = SDL_FALSE;
static Uint8 SDL_SubsystemRefCount[32]; static Uint8 SDL_SubsystemRefCount[32];
@@ -181,6 +180,36 @@ void SDL_SetMainReady(void)
SDL_MainIsReady = SDL_TRUE; SDL_MainIsReady = SDL_TRUE;
} }
void SDL_InitMainThread(void)
{
if (SDL_main_thread_initialized) {
return;
}
SDL_InitTLSData();
#ifndef SDL_TIMERS_DISABLED
SDL_TicksInit();
#endif
SDL_LogInit();
SDL_main_thread_initialized = SDL_TRUE;
}
static void SDL_QuitMainThread(void)
{
if (!SDL_main_thread_initialized) {
return;
}
SDL_LogQuit();
#ifndef SDL_TIMERS_DISABLED
SDL_TicksQuit();
#endif
SDL_QuitTLSData();
SDL_main_thread_initialized = SDL_FALSE;
}
int SDL_InitSubSystem(Uint32 flags) int SDL_InitSubSystem(Uint32 flags)
{ {
Uint32 flags_initialized = 0; Uint32 flags_initialized = 0;
@@ -189,8 +218,6 @@ int SDL_InitSubSystem(Uint32 flags)
return SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); return SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
} }
SDL_LogInit();
/* Clear the error message */ /* Clear the error message */
SDL_ClearError(); SDL_ClearError();
@@ -198,10 +225,6 @@ int SDL_InitSubSystem(Uint32 flags)
SDL_DBus_Init(); SDL_DBus_Init();
#endif #endif
#ifdef SDL_THREAD_OS2
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
#endif
#ifdef SDL_VIDEO_DRIVER_WINDOWS #ifdef SDL_VIDEO_DRIVER_WINDOWS
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) { if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
if (SDL_HelperWindowCreate() < 0) { if (SDL_HelperWindowCreate() < 0) {
@@ -210,10 +233,6 @@ int SDL_InitSubSystem(Uint32 flags)
} }
#endif #endif
#ifndef SDL_TIMERS_DISABLED
SDL_TicksInit();
#endif
/* Initialize the event subsystem */ /* Initialize the event subsystem */
if (flags & SDL_INIT_EVENTS) { if (flags & SDL_INIT_EVENTS) {
#ifndef SDL_EVENTS_DISABLED #ifndef SDL_EVENTS_DISABLED
@@ -378,9 +397,6 @@ int SDL_Init(Uint32 flags)
void SDL_QuitSubSystem(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags)
{ {
#if defined(__OS2__) #if defined(__OS2__)
#ifdef SDL_THREAD_OS2
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
#endif
SDL_OS2Quit(); SDL_OS2Quit();
#endif #endif
@@ -504,10 +520,6 @@ void SDL_Quit(void)
#endif #endif
SDL_QuitSubSystem(SDL_INIT_EVERYTHING); SDL_QuitSubSystem(SDL_INIT_EVERYTHING);
#ifndef SDL_TIMERS_DISABLED
SDL_TicksQuit();
#endif
#ifdef SDL_USE_LIBDBUS #ifdef SDL_USE_LIBDBUS
SDL_DBus_Quit(); SDL_DBus_Quit();
#endif #endif
@@ -515,14 +527,12 @@ void SDL_Quit(void)
SDL_ClearHints(); SDL_ClearHints();
SDL_AssertionsQuit(); SDL_AssertionsQuit();
SDL_LogQuit();
/* Now that every subsystem has been quit, we reset the subsystem refcount /* Now that every subsystem has been quit, we reset the subsystem refcount
* and the list of initialized subsystems. * and the list of initialized subsystems.
*/ */
SDL_memset(SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount)); SDL_memset(SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount));
SDL_TLSCleanup(); SDL_QuitMainThread();
SDL_bInMainQuit = SDL_FALSE; SDL_bInMainQuit = SDL_FALSE;
} }
+2
View File
@@ -208,6 +208,8 @@
#include "SDL_assert.h" #include "SDL_assert.h"
#include "SDL_log.h" #include "SDL_log.h"
extern void SDL_InitMainThread(void);
#endif /* SDL_internal_h_ */ #endif /* SDL_internal_h_ */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
+2 -2
View File
@@ -86,7 +86,7 @@ static struct
#undef SDL_ARTS_SYM #undef SDL_ARTS_SYM
static void UnloadARTSLibrary() static void UnloadARTSLibrary(void)
{ {
if (arts_handle) { if (arts_handle) {
SDL_UnloadObject(arts_handle); SDL_UnloadObject(arts_handle);
@@ -119,7 +119,7 @@ static int LoadARTSLibrary(void)
#else #else
static void UnloadARTSLibrary() static void UnloadARTSLibrary(void)
{ {
return; return;
} }
+2 -2
View File
@@ -64,7 +64,7 @@ static struct
#undef SDL_ESD_SYM #undef SDL_ESD_SYM
static void UnloadESDLibrary() static void UnloadESDLibrary(void)
{ {
if (esd_handle) { if (esd_handle) {
SDL_UnloadObject(esd_handle); SDL_UnloadObject(esd_handle);
@@ -96,7 +96,7 @@ static int LoadESDLibrary(void)
#else #else
static void UnloadESDLibrary() static void UnloadESDLibrary(void)
{ {
return; return;
} }
+2 -2
View File
@@ -77,7 +77,7 @@ static struct
#undef SDL_FS_SYM #undef SDL_FS_SYM
static void UnloadFusionSoundLibrary() static void UnloadFusionSoundLibrary(void)
{ {
if (fs_handle) { if (fs_handle) {
SDL_UnloadObject(fs_handle); SDL_UnloadObject(fs_handle);
@@ -110,7 +110,7 @@ static int LoadFusionSoundLibrary(void)
#else #else
static void UnloadFusionSoundLibrary() static void UnloadFusionSoundLibrary(void)
{ {
return; return;
} }
+14 -14
View File
@@ -142,13 +142,13 @@ static int pipewire_dlsym(const char *fn, void **addr)
return -1; \ return -1; \
} }
static int load_pipewire_library() static int load_pipewire_library(void)
{ {
pipewire_handle = SDL_LoadObject(pipewire_library); pipewire_handle = SDL_LoadObject(pipewire_library);
return pipewire_handle ? 0 : -1; return pipewire_handle ? 0 : -1;
} }
static void unload_pipewire_library() static void unload_pipewire_library(void)
{ {
if (pipewire_handle) { if (pipewire_handle) {
SDL_UnloadObject(pipewire_handle); SDL_UnloadObject(pipewire_handle);
@@ -160,18 +160,18 @@ static void unload_pipewire_library()
#define SDL_PIPEWIRE_SYM(x) PIPEWIRE_##x = x #define SDL_PIPEWIRE_SYM(x) PIPEWIRE_##x = x
static int load_pipewire_library() static int load_pipewire_library(void)
{ {
return 0; return 0;
} }
static void unload_pipewire_library() static void unload_pipewire_library(void)
{ /* Nothing to do */ { /* Nothing to do */
} }
#endif /* SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC */ #endif /* SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC */
static int load_pipewire_syms() static int load_pipewire_syms(void)
{ {
SDL_PIPEWIRE_SYM(pw_get_library_version); SDL_PIPEWIRE_SYM(pw_get_library_version);
SDL_PIPEWIRE_SYM(pw_init); SDL_PIPEWIRE_SYM(pw_init);
@@ -212,7 +212,7 @@ SDL_FORCE_INLINE SDL_bool pipewire_version_at_least(int major, int minor, int pa
(pipewire_version_major > major || pipewire_version_minor > minor || pipewire_version_patch >= patch); (pipewire_version_major > major || pipewire_version_minor > minor || pipewire_version_patch >= patch);
} }
static int init_pipewire_library() static int init_pipewire_library(void)
{ {
if (!load_pipewire_library()) { if (!load_pipewire_library()) {
if (!load_pipewire_syms()) { if (!load_pipewire_syms()) {
@@ -234,7 +234,7 @@ static int init_pipewire_library()
return -1; return -1;
} }
static void deinit_pipewire_library() static void deinit_pipewire_library(void)
{ {
PIPEWIRE_pw_deinit(); PIPEWIRE_pw_deinit();
unload_pipewire_library(); unload_pipewire_library();
@@ -340,7 +340,7 @@ static void io_list_remove(Uint32 id)
} }
} }
static void io_list_sort() static void io_list_sort(void)
{ {
struct io_node *default_sink = NULL, *default_source = NULL; struct io_node *default_sink = NULL, *default_source = NULL;
struct io_node *n, *temp; struct io_node *n, *temp;
@@ -365,7 +365,7 @@ static void io_list_sort()
} }
} }
static void io_list_clear() static void io_list_clear(void)
{ {
struct io_node *n, *temp; struct io_node *n, *temp;
@@ -426,7 +426,7 @@ static void pending_list_remove(Uint32 id)
} }
} }
static void pending_list_clear() static void pending_list_clear(void)
{ {
struct node_object *node, *temp; struct node_object *node, *temp;
@@ -751,7 +751,7 @@ static const struct pw_registry_events registry_events = { PW_VERSION_REGISTRY_E
.global_remove = registry_event_remove_callback }; .global_remove = registry_event_remove_callback };
/* The hotplug thread */ /* The hotplug thread */
static int hotplug_loop_init() static int hotplug_loop_init(void)
{ {
int res; int res;
@@ -794,7 +794,7 @@ static int hotplug_loop_init()
return 0; return 0;
} }
static void hotplug_loop_destroy() static void hotplug_loop_destroy(void)
{ {
if (hotplug_loop) { if (hotplug_loop) {
PIPEWIRE_pw_thread_loop_stop(hotplug_loop); PIPEWIRE_pw_thread_loop_stop(hotplug_loop);
@@ -836,7 +836,7 @@ static void hotplug_loop_destroy()
} }
} }
static void PIPEWIRE_DetectDevices() static void PIPEWIRE_DetectDevices(void)
{ {
struct io_node *io; struct io_node *io;
@@ -1342,7 +1342,7 @@ failed:
return ret; return ret;
} }
static void PIPEWIRE_Deinitialize() static void PIPEWIRE_Deinitialize(void)
{ {
if (pipewire_initialized) { if (pipewire_initialized) {
hotplug_loop_destroy(); hotplug_loop_destroy();
+1 -1
View File
@@ -885,7 +885,7 @@ static int SDLCALL HotplugThread(void *data)
return 0; return 0;
} }
static void PULSEAUDIO_DetectDevices() static void PULSEAUDIO_DetectDevices(void)
{ {
SDL_sem *ready_sem = SDL_CreateSemaphore(0); SDL_sem *ready_sem = SDL_CreateSemaphore(0);
+8 -8
View File
@@ -842,18 +842,18 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
} }
/* Lock / Unlock Mutex */ /* Lock / Unlock Mutex */
void Android_ActivityMutex_Lock() void Android_ActivityMutex_Lock(void)
{ {
SDL_LockMutex(Android_ActivityMutex); SDL_LockMutex(Android_ActivityMutex);
} }
void Android_ActivityMutex_Unlock() void Android_ActivityMutex_Unlock(void)
{ {
SDL_UnlockMutex(Android_ActivityMutex); SDL_UnlockMutex(Android_ActivityMutex);
} }
/* Lock the Mutex when the Activity is in its 'Running' state */ /* Lock the Mutex when the Activity is in its 'Running' state */
void Android_ActivityMutex_Lock_Running() void Android_ActivityMutex_Lock_Running(void)
{ {
int pauseSignaled = 0; int pauseSignaled = 0;
int resumeSignaled = 0; int resumeSignaled = 0;
@@ -1439,13 +1439,13 @@ void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint)
(*env)->DeleteLocalRef(env, jhint); (*env)->DeleteLocalRef(env, jhint);
} }
void Android_JNI_MinizeWindow() void Android_JNI_MinizeWindow(void)
{ {
JNIEnv *env = Android_JNI_GetEnv(); JNIEnv *env = Android_JNI_GetEnv();
(*env)->CallStaticVoidMethod(env, mActivityClass, midMinimizeWindow); (*env)->CallStaticVoidMethod(env, mActivityClass, midMinimizeWindow);
} }
SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss() SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void)
{ {
JNIEnv *env = Android_JNI_GetEnv(); JNIEnv *env = Android_JNI_GetEnv();
return (*env)->CallStaticBooleanMethod(env, mActivityClass, midShouldMinimizeOnFocusLoss); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midShouldMinimizeOnFocusLoss);
@@ -1879,7 +1879,7 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent)
return SDL_FALSE; return SDL_FALSE;
} }
static void Internal_Android_Create_AssetManager() static void Internal_Android_Create_AssetManager(void)
{ {
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
@@ -1918,7 +1918,7 @@ static void Internal_Android_Create_AssetManager()
LocalReferenceHolder_Cleanup(&refs); LocalReferenceHolder_Cleanup(&refs);
} }
static void Internal_Android_Destroy_AssetManager() static void Internal_Android_Destroy_AssetManager(void)
{ {
JNIEnv *env = Android_JNI_GetEnv(); JNIEnv *env = Android_JNI_GetEnv();
@@ -2153,7 +2153,7 @@ int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seco
} }
/* Add all touch devices */ /* Add all touch devices */
void Android_JNI_InitTouch() void Android_JNI_InitTouch(void)
{ {
JNIEnv *env = Android_JNI_GetEnv(); JNIEnv *env = Android_JNI_GetEnv();
(*env)->CallStaticVoidMethod(env, mActivityClass, midInitTouch); (*env)->CallStaticVoidMethod(env, mActivityClass, midInitTouch);
+1 -1
View File
@@ -134,7 +134,7 @@ static void kbd_cleanup_signal_action(int signum, siginfo_t *info, void *ucontex
SDL_EVDEV_kbd_reraise_signal(signum); SDL_EVDEV_kbd_reraise_signal(signum);
} }
static void kbd_unregister_emerg_cleanup() static void kbd_unregister_emerg_cleanup(void)
{ {
int tabidx, signum; int tabidx, signum;
+1 -1
View File
@@ -214,7 +214,7 @@ static void kbd_cleanup_signal_action(int signum, siginfo_t *info, void *ucontex
SDL_EVDEV_kbd_reraise_signal(signum); SDL_EVDEV_kbd_reraise_signal(signum);
} }
static void kbd_unregister_emerg_cleanup() static void kbd_unregister_emerg_cleanup(void)
{ {
int tabidx, signum; int tabidx, signum;
+3 -3
View File
@@ -55,7 +55,7 @@ typedef struct _FcitxClient
static FcitxClient fcitx_client; static FcitxClient fcitx_client;
static char *GetAppName() static char *GetAppName(void)
{ {
#if defined(__LINUX__) || defined(__FREEBSD__) #if defined(__LINUX__) || defined(__FREEBSD__)
char *spot; char *spot;
@@ -368,7 +368,7 @@ static Uint32 Fcitx_ModState(void)
return fcitx_mods; return fcitx_mods;
} }
SDL_bool SDL_Fcitx_Init() SDL_bool SDL_Fcitx_Init(void)
{ {
fcitx_client.dbus = SDL_DBus_GetContext(); fcitx_client.dbus = SDL_DBus_GetContext();
@@ -380,7 +380,7 @@ SDL_bool SDL_Fcitx_Init()
return FcitxClientCreateIC(&fcitx_client); return FcitxClientCreateIC(&fcitx_client);
} }
void SDL_Fcitx_Quit() void SDL_Fcitx_Quit(void)
{ {
FcitxClientICCallMethod(&fcitx_client, "DestroyIC"); FcitxClientICCallMethod(&fcitx_client, "DestroyIC");
if (fcitx_client.ic_path) { if (fcitx_client.ic_path) {
+2 -2
View File
@@ -40,7 +40,7 @@ static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL;
static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL; static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL;
static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL; static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL;
static void InitIME() static void InitIME(void)
{ {
static SDL_bool inited = SDL_FALSE; static SDL_bool inited = SDL_FALSE;
#ifdef HAVE_FCITX #ifdef HAVE_FCITX
@@ -142,7 +142,7 @@ void SDL_IME_UpdateTextRect(const SDL_Rect *rect)
} }
} }
void SDL_IME_PumpEvents() void SDL_IME_PumpEvents(void)
{ {
if (SDL_IME_PumpEvents_Real) { if (SDL_IME_PumpEvents_Real) {
SDL_IME_PumpEvents_Real(); SDL_IME_PumpEvents_Real();
+3 -3
View File
@@ -79,7 +79,7 @@ static SDL_bool realtime_portal_supported(DBusConnection *conn)
"RTTimeUSecMax", DBUS_TYPE_INT64, &res); "RTTimeUSecMax", DBUS_TYPE_INT64, &res);
} }
static void set_rtkit_interface() static void set_rtkit_interface(void)
{ {
SDL_DBusContext *dbus = SDL_DBus_GetContext(); SDL_DBusContext *dbus = SDL_DBus_GetContext();
@@ -108,7 +108,7 @@ static DBusConnection *get_rtkit_dbus_connection()
return NULL; return NULL;
} }
static void rtkit_initialize() static void rtkit_initialize(void)
{ {
DBusConnection *dbus_conn; DBusConnection *dbus_conn;
@@ -134,7 +134,7 @@ static void rtkit_initialize()
} }
} }
static SDL_bool rtkit_initialize_realtime_thread() static SDL_bool rtkit_initialize_realtime_thread(void)
{ {
// Following is an excerpt from rtkit README that outlines the requirements // Following is an excerpt from rtkit README that outlines the requirements
// a thread must meet before making rtkit requests: // a thread must meet before making rtkit requests:
+3 -3
View File
@@ -449,7 +449,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev)
return input; return input;
} }
void SDL_WSCONS_Init() void SDL_WSCONS_Init(void)
{ {
inputs[0] = SDL_WSCONS_Init_Keyboard("/dev/wskbd0"); inputs[0] = SDL_WSCONS_Init_Keyboard("/dev/wskbd0");
inputs[1] = SDL_WSCONS_Init_Keyboard("/dev/wskbd1"); inputs[1] = SDL_WSCONS_Init_Keyboard("/dev/wskbd1");
@@ -460,7 +460,7 @@ void SDL_WSCONS_Init()
return; return;
} }
void SDL_WSCONS_Quit() void SDL_WSCONS_Quit(void)
{ {
int i = 0; int i = 0;
SDL_WSCONS_input_data *input = NULL; SDL_WSCONS_input_data *input = NULL;
@@ -921,7 +921,7 @@ static void updateKeyboard(SDL_WSCONS_input_data *input)
} }
} }
void SDL_WSCONS_PumpEvents() void SDL_WSCONS_PumpEvents(void)
{ {
int i = 0; int i = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
+1 -1
View File
@@ -1239,7 +1239,7 @@ void SDL_SIMDFree(void *ptr)
#include <stdio.h> #include <stdio.h>
int main() int main(void)
{ {
printf("CPU count: %d\n", SDL_GetCPUCount()); printf("CPU count: %d\n", SDL_GetCPUCount());
printf("CPU type: %s\n", SDL_GetCPUType()); printf("CPU type: %s\n", SDL_GetCPUType());
+2 -1
View File
@@ -36,6 +36,7 @@
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
@@ -632,7 +633,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
FILE *fp = fopen(file, mode); FILE *fp = fopen(file, mode);
#endif #endif
if (!fp) { if (!fp) {
SDL_SetError("Couldn't open %s", file); SDL_SetError("Couldn't open %s: %s", file, strerror(errno));
} else if (!IsRegularFileOrPipe(fp)) { } else if (!IsRegularFileOrPipe(fp)) {
fclose(fp); fclose(fp);
fp = NULL; fp = NULL;
+2 -2
View File
@@ -906,9 +906,9 @@ IsInWhitelist(Uint16 vendor, Uint16 product)
} }
#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND #if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND
static const SDL_bool use_libusb_whitelist_default = SDL_TRUE; #define use_libusb_whitelist_default SDL_TRUE
#else #else
static const SDL_bool use_libusb_whitelist_default = SDL_FALSE; #define use_libusb_whitelist_default SDL_FALSE
#endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND */ #endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND */
static SDL_bool use_libusb_whitelist = use_libusb_whitelist_default; static SDL_bool use_libusb_whitelist = use_libusb_whitelist_default;
+2 -2
View File
@@ -519,7 +519,7 @@ static struct usb_string_cache_entry *usb_string_cache = NULL;
static size_t usb_string_cache_size = 0; static size_t usb_string_cache_size = 0;
static size_t usb_string_cache_insert_pos = 0; static size_t usb_string_cache_insert_pos = 0;
static int usb_string_cache_grow() static int usb_string_cache_grow(void)
{ {
struct usb_string_cache_entry *new_cache; struct usb_string_cache_entry *new_cache;
size_t allocSize; size_t allocSize;
@@ -537,7 +537,7 @@ static int usb_string_cache_grow()
return 0; return 0;
} }
static void usb_string_cache_destroy() static void usb_string_cache_destroy(void)
{ {
size_t i; size_t i;
for (i = 0; i < usb_string_cache_insert_pos; i++) { for (i = 0; i < usb_string_cache_insert_pos; i++) {
+1 -1
View File
@@ -504,7 +504,7 @@ int HID_API_EXPORT hid_exit(void)
return 0; return 0;
} }
static void process_pending_events() { static void process_pending_events(void) {
SInt32 res; SInt32 res;
do { do {
res = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.001, FALSE); res = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.001, FALSE);
+1 -1
View File
@@ -264,7 +264,7 @@ static void register_error(hid_device *device, const char *op)
} }
#ifndef HIDAPI_USE_DDK #ifndef HIDAPI_USE_DDK
static int lookup_functions() static int lookup_functions(void)
{ {
lib_handle = LoadLibrary(TEXT("hid.dll")); lib_handle = LoadLibrary(TEXT("hid.dll"));
if (lib_handle) { if (lib_handle) {
+1
View File
@@ -324,6 +324,7 @@ static const char *s_ControllerMappings[] = {
"030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", "030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,",
"030000008f0e00000800000000000000,SpeedLink Strike FX,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,", "030000008f0e00000800000000000000,SpeedLink Strike FX,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,",
"03000000c01100000591000000000000,Speedlink Torid,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,", "03000000c01100000591000000000000,Speedlink Torid,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,",
"030000004c0500006802000000000000,SplitFish Game Controller,crc:5628,a:b0,b:b16,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b17,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b10,",
"03000000de280000ff11000000000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000de280000ff11000000000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"03000000110100003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000110100003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
"03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,", "03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,",
+10 -3
View File
@@ -395,6 +395,7 @@ static Uint32 initial_wheel_devices[] = {
MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */ MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */
MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */ MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */
MAKE_VIDPID(0x3416, 0x0301), /* Cammus C5 Wheelbase */ MAKE_VIDPID(0x3416, 0x0301), /* Cammus C5 Wheelbase */
MAKE_VIDPID(0x3416, 0x0302), /* Cammus C12 Wheelbase */
MAKE_VIDPID(0x346e, 0x0000), /* Moza R16/R21 Wheelbase */ MAKE_VIDPID(0x346e, 0x0000), /* Moza R16/R21 Wheelbase */
MAKE_VIDPID(0x346e, 0x0002), /* Moza R9 Wheelbase */ MAKE_VIDPID(0x346e, 0x0002), /* Moza R9 Wheelbase */
MAKE_VIDPID(0x346e, 0x0004), /* Moza R5 Wheelbase */ MAKE_VIDPID(0x346e, 0x0004), /* Moza R5 Wheelbase */
@@ -1412,10 +1413,14 @@ int SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint
retval = 0; retval = 0;
} else { } else {
retval = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); retval = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble);
if (retval == 0) {
joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS; joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS;
if (!joystick->rumble_resend) { if (joystick->rumble_resend == 0) {
joystick->rumble_resend = 1; joystick->rumble_resend = 1;
} }
} else {
joystick->rumble_resend = 0;
}
} }
if (retval == 0) { if (retval == 0) {
@@ -2177,13 +2182,15 @@ void SDL_JoystickUpdate(void)
#endif /* SDL_JOYSTICK_HIDAPI */ #endif /* SDL_JOYSTICK_HIDAPI */
for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
if (joystick->attached) { if (!joystick->attached) {
continue;
}
joystick->driver->Update(joystick); joystick->driver->Update(joystick);
if (joystick->delayed_guide_button) { if (joystick->delayed_guide_button) {
SDL_GameControllerHandleDelayedGuideButton(joystick); SDL_GameControllerHandleDelayedGuideButton(joystick);
} }
}
now = SDL_GetTicks(); now = SDL_GetTicks();
if (joystick->rumble_expiration && if (joystick->rumble_expiration &&
+1 -1
View File
@@ -69,7 +69,7 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller, NULL }, // Power A PS3 { MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller, NULL }, // Power A PS3
{ MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL
{ MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller, NULL }, // Digiflip GP006 { MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller, NULL }, // Digiflip GP006
{ MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, "Retro-bit Controller" }, // SWITCH CO., LTD. Retro-bit Controller
{ MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2 { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2
{ MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, // { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, //
{ MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone
+32 -5
View File
@@ -50,6 +50,7 @@ typedef struct
SDL_HIDAPI_Device *device; SDL_HIDAPI_Device *device;
SDL_Joystick *joystick; SDL_Joystick *joystick;
SDL_bool is_shanwan; SDL_bool is_shanwan;
SDL_bool has_analog_buttons;
SDL_bool report_sensors; SDL_bool report_sensors;
SDL_bool effects_updated; SDL_bool effects_updated;
int player_index; int player_index;
@@ -145,6 +146,7 @@ static SDL_bool HIDAPI_DriverPS3_InitDevice(SDL_HIDAPI_Device *device)
} }
ctx->device = device; ctx->device = device;
ctx->is_shanwan = is_shanwan; ctx->is_shanwan = is_shanwan;
ctx->has_analog_buttons = SDL_TRUE;
device->context = ctx; device->context = ctx;
@@ -247,7 +249,10 @@ static SDL_bool HIDAPI_DriverPS3_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy
/* Initialize the joystick capabilities */ /* Initialize the joystick capabilities */
joystick->nbuttons = 15; joystick->nbuttons = 15;
joystick->naxes = 16; joystick->naxes = 6;
if (ctx->has_analog_buttons) {
joystick->naxes += 10;
}
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 100.0f); SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 100.0f);
@@ -432,7 +437,7 @@ static void HIDAPI_DriverPS3_HandleStatePacket(SDL_Joystick *joystick, SDL_Drive
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
/* Buttons are mapped as axes in the order they appear in the button enumeration */ /* Buttons are mapped as axes in the order they appear in the button enumeration */
{ if (ctx->has_analog_buttons) {
static int button_axis_offsets[] = { static int button_axis_offsets[] = {
24, /* SDL_CONTROLLER_BUTTON_A */ 24, /* SDL_CONTROLLER_BUTTON_A */
23, /* SDL_CONTROLLER_BUTTON_B */ 23, /* SDL_CONTROLLER_BUTTON_B */
@@ -617,6 +622,11 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_InitDevice(SDL_HIDAPI_Device *device)
return SDL_FALSE; return SDL_FALSE;
} }
ctx->device = device; ctx->device = device;
if (device->vendor_id == USB_VENDOR_SWITCH && device->product_id == USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER) {
ctx->has_analog_buttons = SDL_FALSE;
} else {
ctx->has_analog_buttons = SDL_TRUE;
}
device->context = ctx; device->context = ctx;
@@ -650,8 +660,17 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_OpenJoystick(SDL_HIDAPI_Device *devic
/* Initialize the joystick capabilities */ /* Initialize the joystick capabilities */
joystick->nbuttons = 15; joystick->nbuttons = 15;
joystick->naxes = 16; joystick->naxes = 6;
if (ctx->has_analog_buttons) {
joystick->naxes += 10;
}
if (device->vendor_id == USB_VENDOR_SWITCH && device->product_id == USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER) {
// This is a wireless controller using a USB dongle
joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
} else {
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
}
return SDL_TRUE; return SDL_TRUE;
} }
@@ -762,7 +781,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(SDL_Joystick *joystic
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
/* Buttons are mapped as axes in the order they appear in the button enumeration */ /* Buttons are mapped as axes in the order they appear in the button enumeration */
{ if (ctx->has_analog_buttons) {
static int button_axis_offsets[] = { static int button_axis_offsets[] = {
12, /* SDL_GAMEPAD_BUTTON_A */ 12, /* SDL_GAMEPAD_BUTTON_A */
11, /* SDL_GAMEPAD_BUTTON_B */ 11, /* SDL_GAMEPAD_BUTTON_B */
@@ -871,9 +890,17 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket19(SDL_Joystick *joystic
} }
} }
if (data[0] & 0x40) {
axis = 32767;
} else {
axis = ((int)data[17] * 257) - 32768; axis = ((int)data[17] * 257) - 32768;
}
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
if (data[0] & 0x80) {
axis = 32767;
} else {
axis = ((int)data[18] * 257) - 32768; axis = ((int)data[18] * 257) - 32768;
}
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
axis = ((int)data[3] * 257) - 32768; axis = ((int)data[3] * 257) - 32768;
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
@@ -885,7 +912,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket19(SDL_Joystick *joystic
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
/* Buttons are mapped as axes in the order they appear in the button enumeration */ /* Buttons are mapped as axes in the order they appear in the button enumeration */
{ if (ctx->has_analog_buttons) {
static int button_axis_offsets[] = { static int button_axis_offsets[] = {
13, /* SDL_CONTROLLER_BUTTON_A */ 13, /* SDL_CONTROLLER_BUTTON_A */
12, /* SDL_CONTROLLER_BUTTON_B */ 12, /* SDL_CONTROLLER_BUTTON_B */
+119 -111
View File
@@ -134,119 +134,12 @@ static SDL_bool FeedDeckLizardWatchdog(SDL_hid_device *dev)
return SDL_TRUE; return SDL_TRUE;
} }
/*****************************************************************************************************/ static void HIDAPI_DriverSteamDeck_HandleState(SDL_HIDAPI_Device *device,
SDL_Joystick *joystick,
static void HIDAPI_DriverSteamDeck_RegisterHints(SDL_HintCallback callback, void *userdata) ValveInReport_t *pInReport)
{ {
SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, callback, userdata);
}
static void HIDAPI_DriverSteamDeck_UnregisterHints(SDL_HintCallback callback, void *userdata)
{
SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, callback, userdata);
}
static SDL_bool HIDAPI_DriverSteamDeck_IsEnabled(void)
{
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK,
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool HIDAPI_DriverSteamDeck_IsSupportedDevice(
SDL_HIDAPI_Device *device,
const char *name,
SDL_GameControllerType type,
Uint16 vendor_id,
Uint16 product_id,
Uint16 version,
int interface_number,
int interface_class,
int interface_subclass,
int interface_protocol)
{
return SDL_IsJoystickSteamDeck(vendor_id, product_id);
}
static SDL_bool HIDAPI_DriverSteamDeck_InitDevice(SDL_HIDAPI_Device *device)
{
int size;
Uint8 data[64];
SDL_DriverSteamDeck_Context *ctx;
ctx = (SDL_DriverSteamDeck_Context *)SDL_calloc(1, sizeof(*ctx));
if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
// Always 1kHz according to USB descriptor
ctx->update_rate_us = 1000;
device->context = ctx;
// Read a report to see if this is the correct endpoint.
// Mouse, Keyboard and Controller have the same VID/PID but
// only the controller hidraw device receives hid reports.
size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 16);
if (size == 0)
return SDL_FALSE;
if (!DisableDeckLizardMode(device->dev))
return SDL_FALSE;
HIDAPI_SetDeviceName(device, "Steam Deck");
return HIDAPI_JoystickConnected(device, NULL);
}
static int HIDAPI_DriverSteamDeck_GetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id)
{
return -1;
}
static void HIDAPI_DriverSteamDeck_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index)
{
}
static SDL_bool HIDAPI_DriverSteamDeck_UpdateDevice(SDL_HIDAPI_Device *device)
{
SDL_DriverSteamDeck_Context *ctx = (SDL_DriverSteamDeck_Context *)device->context;
SDL_Joystick *joystick = NULL;
int r;
uint8_t data[64];
float values[3]; float values[3];
ValveInReport_t *pInReport = (ValveInReport_t *)data; SDL_DriverSteamDeck_Context *ctx = (SDL_DriverSteamDeck_Context *)device->context;
if (device->num_joysticks > 0) {
joystick = SDL_JoystickFromInstanceID(device->joysticks[0]);
if (joystick == NULL) {
return SDL_FALSE;
}
} else {
return SDL_FALSE;
}
if (ctx->watchdog_counter++ > 200) {
ctx->watchdog_counter = 0;
if (!FeedDeckLizardWatchdog(device->dev))
return SDL_FALSE;
}
SDL_memset(data, 0, sizeof(data));
r = SDL_hid_read(device->dev, data, sizeof(data));
if (r == 0) {
return SDL_FALSE;
} else if (r <= 0) {
/* Failed to read from controller */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
return SDL_FALSE;
}
if (!(r == 64 && pInReport->header.unReportVersion == k_ValveInReportMsgVersion && pInReport->header.ucType == ID_CONTROLLER_DECK_STATE && pInReport->header.ucLength == 64)) {
return SDL_FALSE;
}
// Uint64 timestamp = SDL_GetTicksNS();
if (pInReport->payload.deckState.ulButtons != ctx->last_button_state) { if (pInReport->payload.deckState.ulButtons != ctx->last_button_state) {
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A,
@@ -322,6 +215,121 @@ static SDL_bool HIDAPI_DriverSteamDeck_UpdateDevice(SDL_HIDAPI_Device *device)
values[1] = (pInReport->payload.deckState.sAccelZ / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY; values[1] = (pInReport->payload.deckState.sAccelZ / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY;
values[2] = (-pInReport->payload.deckState.sAccelY / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY; values[2] = (-pInReport->payload.deckState.sAccelY / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY;
SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, ctx->sensor_timestamp_us, values, 3); SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, ctx->sensor_timestamp_us, values, 3);
}
/*****************************************************************************************************/
static void HIDAPI_DriverSteamDeck_RegisterHints(SDL_HintCallback callback, void *userdata)
{
SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, callback, userdata);
}
static void HIDAPI_DriverSteamDeck_UnregisterHints(SDL_HintCallback callback, void *userdata)
{
SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, callback, userdata);
}
static SDL_bool HIDAPI_DriverSteamDeck_IsEnabled(void)
{
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK,
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT));
}
static SDL_bool HIDAPI_DriverSteamDeck_IsSupportedDevice(
SDL_HIDAPI_Device *device,
const char *name,
SDL_GameControllerType type,
Uint16 vendor_id,
Uint16 product_id,
Uint16 version,
int interface_number,
int interface_class,
int interface_subclass,
int interface_protocol)
{
return SDL_IsJoystickSteamDeck(vendor_id, product_id);
}
static SDL_bool HIDAPI_DriverSteamDeck_InitDevice(SDL_HIDAPI_Device *device)
{
int size;
Uint8 data[64];
SDL_DriverSteamDeck_Context *ctx;
ctx = (SDL_DriverSteamDeck_Context *)SDL_calloc(1, sizeof(*ctx));
if (ctx == NULL) {
SDL_OutOfMemory();
return SDL_FALSE;
}
// Always 1kHz according to USB descriptor, but actually about 4 ms.
ctx->update_rate_us = 4000;
device->context = ctx;
// Read a report to see if this is the correct endpoint.
// Mouse, Keyboard and Controller have the same VID/PID but
// only the controller hidraw device receives hid reports.
size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 16);
if (size == 0)
return SDL_FALSE;
if (!DisableDeckLizardMode(device->dev))
return SDL_FALSE;
HIDAPI_SetDeviceName(device, "Steam Deck");
return HIDAPI_JoystickConnected(device, NULL);
}
static int HIDAPI_DriverSteamDeck_GetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id)
{
return -1;
}
static void HIDAPI_DriverSteamDeck_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index)
{
}
static SDL_bool HIDAPI_DriverSteamDeck_UpdateDevice(SDL_HIDAPI_Device *device)
{
SDL_DriverSteamDeck_Context *ctx = (SDL_DriverSteamDeck_Context *)device->context;
SDL_Joystick *joystick = NULL;
int r;
uint8_t data[64];
ValveInReport_t *pInReport = (ValveInReport_t *)data;
if (device->num_joysticks > 0) {
joystick = SDL_JoystickFromInstanceID(device->joysticks[0]);
if (joystick == NULL) {
return SDL_FALSE;
}
} else {
return SDL_FALSE;
}
if (ctx->watchdog_counter++ > 200) {
ctx->watchdog_counter = 0;
if (!FeedDeckLizardWatchdog(device->dev))
return SDL_FALSE;
}
SDL_memset(data, 0, sizeof(data));
do {
r = SDL_hid_read(device->dev, data, sizeof(data));
if (r < 0) {
/* Failed to read from controller */
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
return SDL_FALSE;
} else if (r == 64 &&
pInReport->header.unReportVersion == k_ValveInReportMsgVersion &&
pInReport->header.ucType == ID_CONTROLLER_DECK_STATE &&
pInReport->header.ucLength == 64) {
HIDAPI_DriverSteamDeck_HandleState(device, joystick, pInReport);
}
} while (r > 0);
return SDL_TRUE; return SDL_TRUE;
} }
+22 -8
View File
@@ -332,12 +332,28 @@ typedef struct
static int ReadInput(SDL_DriverSwitch_Context *ctx) static int ReadInput(SDL_DriverSwitch_Context *ctx)
{ {
int result;
/* Make sure we don't try to read at the same time a write is happening */ /* Make sure we don't try to read at the same time a write is happening */
if (SDL_AtomicGet(&ctx->device->rumble_pending) > 0) { if (SDL_AtomicGet(&ctx->device->rumble_pending) > 0) {
return 0; return 0;
} }
return SDL_hid_read_timeout(ctx->device->dev, ctx->m_rgucReadBuffer, sizeof(ctx->m_rgucReadBuffer), 0); result = SDL_hid_read_timeout(ctx->device->dev, ctx->m_rgucReadBuffer, sizeof(ctx->m_rgucReadBuffer), 0);
/* See if we can guess the initial input mode */
if (result > 0 && !ctx->m_bInputOnly && !ctx->m_nInitialInputMode) {
switch (ctx->m_rgucReadBuffer[0]) {
case k_eSwitchInputReportIDs_FullControllerState:
case k_eSwitchInputReportIDs_FullControllerAndMcuState:
case k_eSwitchInputReportIDs_SimpleControllerState:
ctx->m_nInitialInputMode = ctx->m_rgucReadBuffer[0];
break;
default:
break;
}
}
return result;
} }
static int WriteOutput(SDL_DriverSwitch_Context *ctx, const Uint8 *data, int size) static int WriteOutput(SDL_DriverSwitch_Context *ctx, const Uint8 *data, int size)
@@ -727,14 +743,12 @@ static void SDLCALL SDL_PlayerLEDHintChanged(void *userdata, const char *name, c
} }
} }
static Uint8 GetInitialInputMode(SDL_DriverSwitch_Context *ctx) static void GetInitialInputMode(SDL_DriverSwitch_Context *ctx)
{ {
Uint8 input_mode = 0; if (!ctx->m_nInitialInputMode) {
/* This will set the initial input mode if it can */
if (ReadInput(ctx) > 0) { ReadInput(ctx);
input_mode = ctx->m_rgucReadBuffer[0];
} }
return input_mode;
} }
static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx) static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx)
@@ -1412,7 +1426,7 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
ctx->m_bSyncWrite = SDL_TRUE; ctx->m_bSyncWrite = SDL_TRUE;
if (!ctx->m_bInputOnly) { if (!ctx->m_bInputOnly) {
ctx->m_nInitialInputMode = GetInitialInputMode(ctx); GetInitialInputMode(ctx);
ctx->m_nCurrentInputMode = ctx->m_nInitialInputMode; ctx->m_nCurrentInputMode = ctx->m_nInitialInputMode;
/* Initialize rumble data */ /* Initialize rumble data */
+1 -1
View File
@@ -1008,7 +1008,7 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device)
} }
} }
static SDL_bool HIDAPI_CreateCombinedJoyCons() static SDL_bool HIDAPI_CreateCombinedJoyCons(void)
{ {
SDL_HIDAPI_Device *device, *combined; SDL_HIDAPI_Device *device, *combined;
SDL_HIDAPI_Device *joycons[2] = { NULL, NULL }; SDL_HIDAPI_Device *joycons[2] = { NULL, NULL };
+2 -2
View File
@@ -133,13 +133,13 @@ static int PS2_JoystickInit(void)
} }
/* Function to return the number of joystick devices plugged in right now */ /* Function to return the number of joystick devices plugged in right now */
static int PS2_JoystickGetCount() static int PS2_JoystickGetCount(void)
{ {
return (int)enabled_pads; return (int)enabled_pads;
} }
/* Function to cause any queued joystick insertions to be processed */ /* Function to cause any queued joystick insertions to be processed */
static void PS2_JoystickDetect() static void PS2_JoystickDetect(void)
{ {
} }
+2
View File
@@ -54,6 +54,7 @@
#define USB_VENDOR_SONY 0x054c #define USB_VENDOR_SONY 0x054c
#define USB_VENDOR_THRUSTMASTER 0x044f #define USB_VENDOR_THRUSTMASTER 0x044f
#define USB_VENDOR_TURTLE_BEACH 0x10f5 #define USB_VENDOR_TURTLE_BEACH 0x10f5
#define USB_VENDOR_SWITCH 0x2563
#define USB_VENDOR_VALVE 0x28de #define USB_VENDOR_VALVE 0x28de
#define USB_VENDOR_ZEROPLUS 0x0c12 #define USB_VENDOR_ZEROPLUS 0x0c12
@@ -116,6 +117,7 @@
#define USB_PRODUCT_SONY_DS4_STRIKEPAD 0x05c5 #define USB_PRODUCT_SONY_DS4_STRIKEPAD 0x05c5
#define USB_PRODUCT_SONY_DS5 0x0ce6 #define USB_PRODUCT_SONY_DS5 0x0ce6
#define USB_PRODUCT_SONY_DS5_EDGE 0x0df2 #define USB_PRODUCT_SONY_DS5_EDGE 0x0df2
#define USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER 0x0575
#define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO 0xd012 #define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO 0xd012
#define USB_PRODUCT_TURTLE_BEACH_SERIES_X_REACT_R 0x7013 #define USB_PRODUCT_TURTLE_BEACH_SERIES_X_REACT_R 0x7013
#define USB_PRODUCT_TURTLE_BEACH_SERIES_X_RECON 0x7009 #define USB_PRODUCT_TURTLE_BEACH_SERIES_X_RECON 0x7009
+2 -2
View File
@@ -145,12 +145,12 @@ int VITA_JoystickInit(void)
return SDL_numjoysticks; return SDL_numjoysticks;
} }
int VITA_JoystickGetCount() int VITA_JoystickGetCount(void)
{ {
return SDL_numjoysticks; return SDL_numjoysticks;
} }
void VITA_JoystickDetect() void VITA_JoystickDetect(void)
{ {
} }
+15 -6
View File
@@ -331,7 +331,7 @@ static struct
static SDL_bool xinput_device_change = SDL_TRUE; static SDL_bool xinput_device_change = SDL_TRUE;
static SDL_bool xinput_state_dirty = SDL_TRUE; static SDL_bool xinput_state_dirty = SDL_TRUE;
static void RAWINPUT_UpdateXInput() static void RAWINPUT_UpdateXInput(void)
{ {
DWORD user_index; DWORD user_index;
if (xinput_device_change) { if (xinput_device_change) {
@@ -371,7 +371,7 @@ static void RAWINPUT_MarkXInputSlotFree(Uint8 xinput_slot)
xinput_state[xinput_slot].used = SDL_FALSE; xinput_state[xinput_slot].used = SDL_FALSE;
} }
} }
static SDL_bool RAWINPUT_MissingXInputSlot() static SDL_bool RAWINPUT_MissingXInputSlot(void)
{ {
int ii; int ii;
for (ii = 0; ii < SDL_arraysize(xinput_state); ii++) { for (ii = 0; ii < SDL_arraysize(xinput_state); ii++) {
@@ -556,7 +556,7 @@ static void RAWINPUT_MarkWindowsGamingInputSlotFree(WindowsGamingInputGamepadSta
wgi_slot->correlated_context = NULL; wgi_slot->correlated_context = NULL;
} }
static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot() static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot(void)
{ {
int ii; int ii;
for (ii = 0; ii < wgi_state.per_gamepad_count; ii++) { for (ii = 0; ii < wgi_state.per_gamepad_count; ii++) {
@@ -567,7 +567,7 @@ static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot()
return SDL_FALSE; return SDL_FALSE;
} }
static void RAWINPUT_UpdateWindowsGamingInput() static void RAWINPUT_UpdateWindowsGamingInput(void)
{ {
int ii; int ii;
if (!wgi_state.gamepad_statics) { if (!wgi_state.gamepad_statics) {
@@ -1050,7 +1050,7 @@ static int RAWINPUT_JoystickGetCount(void)
return SDL_RAWINPUT_numjoysticks; return SDL_RAWINPUT_numjoysticks;
} }
SDL_bool RAWINPUT_IsEnabled() SDL_bool RAWINPUT_IsEnabled(void)
{ {
return SDL_RAWINPUT_inited && !SDL_RAWINPUT_remote_desktop; return SDL_RAWINPUT_inited && !SDL_RAWINPUT_remote_desktop;
} }
@@ -1290,6 +1290,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
value_caps = SDL_stack_alloc(HIDP_VALUE_CAPS, caps.NumberInputValueCaps); value_caps = SDL_stack_alloc(HIDP_VALUE_CAPS, caps.NumberInputValueCaps);
if (SDL_HidP_GetValueCaps(HidP_Input, value_caps, &caps.NumberInputValueCaps, ctx->preparsed_data) != HIDP_STATUS_SUCCESS) { if (SDL_HidP_GetValueCaps(HidP_Input, value_caps, &caps.NumberInputValueCaps, ctx->preparsed_data) != HIDP_STATUS_SUCCESS) {
RAWINPUT_JoystickClose(joystick); RAWINPUT_JoystickClose(joystick);
SDL_stack_free(button_caps);
return SDL_SetError("Couldn't get device value capabilities"); return SDL_SetError("Couldn't get device value capabilities");
} }
@@ -1318,6 +1319,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
ctx->button_indices = (USHORT *)SDL_malloc(joystick->nbuttons * sizeof(*ctx->button_indices)); ctx->button_indices = (USHORT *)SDL_malloc(joystick->nbuttons * sizeof(*ctx->button_indices));
if (!ctx->button_indices) { if (!ctx->button_indices) {
RAWINPUT_JoystickClose(joystick); RAWINPUT_JoystickClose(joystick);
SDL_stack_free(value_caps);
SDL_stack_free(button_caps);
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
@@ -1342,6 +1345,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
joystick->nbuttons += 1; joystick->nbuttons += 1;
} }
SDL_stack_free(button_caps);
for (i = 0; i < caps.NumberInputValueCaps; ++i) { for (i = 0; i < caps.NumberInputValueCaps; ++i) {
HIDP_VALUE_CAPS *cap = &value_caps[i]; HIDP_VALUE_CAPS *cap = &value_caps[i];
@@ -1371,6 +1376,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
ctx->axis_indices = (USHORT *)SDL_malloc(joystick->naxes * sizeof(*ctx->axis_indices)); ctx->axis_indices = (USHORT *)SDL_malloc(joystick->naxes * sizeof(*ctx->axis_indices));
if (!ctx->axis_indices) { if (!ctx->axis_indices) {
RAWINPUT_JoystickClose(joystick); RAWINPUT_JoystickClose(joystick);
SDL_stack_free(value_caps);
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
@@ -1404,6 +1410,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
ctx->hat_indices = (USHORT *)SDL_malloc(joystick->nhats * sizeof(*ctx->hat_indices)); ctx->hat_indices = (USHORT *)SDL_malloc(joystick->nhats * sizeof(*ctx->hat_indices));
if (!ctx->hat_indices) { if (!ctx->hat_indices) {
RAWINPUT_JoystickClose(joystick); RAWINPUT_JoystickClose(joystick);
SDL_stack_free(value_caps);
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
@@ -1422,6 +1429,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
} }
} }
SDL_stack_free(value_caps);
joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
return 0; return 0;
@@ -2087,7 +2096,7 @@ int RAWINPUT_RegisterNotifications(HWND hWnd)
return 0; return 0;
} }
int RAWINPUT_UnregisterNotifications() int RAWINPUT_UnregisterNotifications(void)
{ {
int i; int i;
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)]; RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
@@ -216,7 +216,7 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
return SDL_FALSE; return SDL_FALSE;
} }
static void WGI_LoadRawGameControllerStatics() static void WGI_LoadRawGameControllerStatics(void)
{ {
WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL; WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL;
RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL; RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL;
@@ -247,7 +247,7 @@ static void WGI_LoadRawGameControllerStatics()
} }
} }
static void WGI_LoadOtherControllerStatics() static void WGI_LoadOtherControllerStatics(void)
{ {
WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL; WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL;
RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL; RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL;
+1 -1
View File
@@ -41,7 +41,7 @@ extern "C" {
*/ */
static SDL_bool s_bXInputEnabled = SDL_TRUE; static SDL_bool s_bXInputEnabled = SDL_TRUE;
static SDL_bool SDL_XInputUseOldJoystickMapping() static SDL_bool SDL_XInputUseOldJoystickMapping(void)
{ {
#ifdef __WINRT__ #ifdef __WINRT__
/* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
+4 -4
View File
@@ -23,7 +23,7 @@
#undef main #undef main
#endif #endif
__attribute__((weak)) void reset_IOP() __attribute__((weak)) void reset_IOP(void)
{ {
SifInitRpc(0); SifInitRpc(0);
while (!SifIopReset(NULL, 0)) { while (!SifIopReset(NULL, 0)) {
@@ -32,7 +32,7 @@ __attribute__((weak)) void reset_IOP()
} }
} }
static void prepare_IOP() static void prepare_IOP(void)
{ {
reset_IOP(); reset_IOP();
SifInitRpc(0); SifInitRpc(0);
@@ -41,12 +41,12 @@ static void prepare_IOP()
sbv_patch_fileio(); sbv_patch_fileio();
} }
static void init_drivers() static void init_drivers(void)
{ {
init_ps2_filesystem_driver(); init_ps2_filesystem_driver();
} }
static void deinit_drivers() static void deinit_drivers(void)
{ {
deinit_ps2_filesystem_driver(); deinit_ps2_filesystem_driver();
} }
+4 -4
View File
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,30,5,0 FILEVERSION 2,30,7,0
PRODUCTVERSION 2,30,5,0 PRODUCTVERSION 2,30,7,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L FILEFLAGS 0x0L
FILEOS 0x40004L FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "\0" VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0" VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "2, 30, 5, 0\0" VALUE "FileVersion", "2, 30, 7, 0\0"
VALUE "InternalName", "SDL\0" VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2024 Sam Lantinga\0" VALUE "LegalCopyright", "Copyright (C) 2024 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL2.dll\0" VALUE "OriginalFilename", "SDL2.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0" VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "2, 30, 5, 0\0" VALUE "ProductVersion", "2, 30, 7, 0\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
+6 -1
View File
@@ -1610,7 +1610,12 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
renderer->driverdata = data; renderer->driverdata = data;
SDL_VERSION(&windowinfo.version); SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(window, &windowinfo); if (!SDL_GetWindowWMInfo(window, &windowinfo) ||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
SDL_free(data);
SDL_SetError("Couldn't get window handle");
return NULL;
}
window_flags = SDL_GetWindowFlags(window); window_flags = SDL_GetWindowFlags(window);
SDL_GetWindowSizeInPixels(window, &w, &h); SDL_GetWindowSizeInPixels(window, &w, &h);
+6 -1
View File
@@ -813,7 +813,12 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
#if defined(__WIN32__) || defined(__WINGDK__) #if defined(__WIN32__) || defined(__WINGDK__)
SDL_SysWMinfo windowinfo; SDL_SysWMinfo windowinfo;
SDL_VERSION(&windowinfo.version); SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(renderer->window, &windowinfo); if (!SDL_GetWindowWMInfo(renderer->window, &windowinfo) ||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
SDL_SetError("Couldn't get window handle");
result = E_FAIL;
goto done;
}
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory, result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
(IUnknown *)data->d3dDevice, (IUnknown *)data->d3dDevice,
+1 -1
View File
@@ -55,7 +55,7 @@ typedef struct
static int vsync_sema_id = 0; static int vsync_sema_id = 0;
/* PRIVATE METHODS */ /* PRIVATE METHODS */
static int vsync_handler() static int vsync_handler(void)
{ {
iSignalSema(vsync_sema_id); iSignalSema(vsync_sema_id);
+1 -1
View File
@@ -161,7 +161,7 @@ static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
ASensorEvent event; ASensorEvent event;
struct android_poll_source *source; struct android_poll_source *source;
if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) { if (ALooper_pollOnce(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
SDL_zero(event); SDL_zero(event);
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) { while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data)); SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data));
+1 -1
View File
@@ -4472,7 +4472,7 @@ struct mallinfo dlmallinfo(void) {
} }
#endif /* NO_MALLINFO */ #endif /* NO_MALLINFO */
void dlmalloc_stats() { void dlmalloc_stats(void) {
internal_malloc_stats(gm); internal_malloc_stats(gm);
} }
+13 -5
View File
@@ -1529,7 +1529,7 @@ typedef enum
typedef struct typedef struct
{ {
SDL_bool left_justify; /* for now: ignored. */ SDL_bool left_justify;
SDL_bool force_sign; SDL_bool force_sign;
SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */ SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */
SDL_bool pad_zeroes; SDL_bool pad_zeroes;
@@ -1541,6 +1541,9 @@ typedef struct
static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string) static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
{ {
const char fill = (info && info->pad_zeroes) ? '0' : ' ';
size_t width = 0;
size_t filllen = 0;
size_t length = 0; size_t length = 0;
size_t slen, sz; size_t slen, sz;
@@ -1550,24 +1553,29 @@ static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, c
sz = SDL_strlen(string); sz = SDL_strlen(string);
if (info && info->width > 0 && (size_t)info->width > sz) { if (info && info->width > 0 && (size_t)info->width > sz) {
const char fill = info->pad_zeroes ? '0' : ' '; width = info->width - sz;
size_t width = info->width - sz;
size_t filllen;
if (info->precision >= 0 && (size_t)info->precision < sz) { if (info->precision >= 0 && (size_t)info->precision < sz) {
width += sz - (size_t)info->precision; width += sz - (size_t)info->precision;
} }
filllen = SDL_min(width, maxlen); filllen = SDL_min(width, maxlen);
if (!info->left_justify) {
SDL_memset(text, fill, filllen); SDL_memset(text, fill, filllen);
text += filllen; text += filllen;
maxlen -= filllen; maxlen -= filllen;
length += width; length += width;
filllen = 0;
}
} }
SDL_strlcpy(text, string, maxlen); SDL_strlcpy(text, string, maxlen);
length += sz; length += sz;
if (filllen > 0) {
SDL_memset(text + sz, fill, filllen);
length += width;
}
if (info) { if (info) {
if (info->precision >= 0 && (size_t)info->precision < sz) { if (info->precision >= 0 && (size_t)info->precision < sz) {
slen = (size_t)info->precision; slen = (size_t)info->precision;
+3 -3
View File
@@ -107,7 +107,7 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,
/* /*
* Resets the assert summary counters to zero. * Resets the assert summary counters to zero.
*/ */
void SDLTest_ResetAssertSummary() void SDLTest_ResetAssertSummary(void)
{ {
SDLTest_AssertsPassed = 0; SDLTest_AssertsPassed = 0;
SDLTest_AssertsFailed = 0; SDLTest_AssertsFailed = 0;
@@ -117,7 +117,7 @@ void SDLTest_ResetAssertSummary()
* Logs summary of all assertions (total, pass, fail) since last reset * Logs summary of all assertions (total, pass, fail) since last reset
* as INFO (failed==0) or ERROR (failed > 0). * as INFO (failed==0) or ERROR (failed > 0).
*/ */
void SDLTest_LogAssertSummary() void SDLTest_LogAssertSummary(void)
{ {
int totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed; int totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
if (SDLTest_AssertsFailed == 0) { if (SDLTest_AssertsFailed == 0) {
@@ -130,7 +130,7 @@ void SDLTest_LogAssertSummary()
/* /*
* Converts the current assert state into a test result * Converts the current assert state into a test result
*/ */
int SDLTest_AssertSummaryToTestResult() int SDLTest_AssertSummaryToTestResult(void)
{ {
if (SDLTest_AssertsFailed > 0) { if (SDLTest_AssertsFailed > 0) {
return TEST_RESULT_FAILED; return TEST_RESULT_FAILED;
+14 -14
View File
@@ -68,54 +68,54 @@ void SDLTest_FuzzerInit(Uint64 execKey)
fuzzerInvocationCounter = 0; fuzzerInvocationCounter = 0;
} }
int SDLTest_GetFuzzerInvocationCount() int SDLTest_GetFuzzerInvocationCount(void)
{ {
return fuzzerInvocationCounter; return fuzzerInvocationCounter;
} }
Uint8 SDLTest_RandomUint8() Uint8 SDLTest_RandomUint8(void)
{ {
fuzzerInvocationCounter++; fuzzerInvocationCounter++;
return (Uint8)SDLTest_RandomInt(&rndContext) & 0x000000FF; return (Uint8)SDLTest_RandomInt(&rndContext) & 0x000000FF;
} }
Sint8 SDLTest_RandomSint8() Sint8 SDLTest_RandomSint8(void)
{ {
fuzzerInvocationCounter++; fuzzerInvocationCounter++;
return (Sint8)SDLTest_RandomInt(&rndContext) & 0x000000FF; return (Sint8)SDLTest_RandomInt(&rndContext) & 0x000000FF;
} }
Uint16 SDLTest_RandomUint16() Uint16 SDLTest_RandomUint16(void)
{ {
fuzzerInvocationCounter++; fuzzerInvocationCounter++;
return (Uint16)SDLTest_RandomInt(&rndContext) & 0x0000FFFF; return (Uint16)SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
} }
Sint16 SDLTest_RandomSint16() Sint16 SDLTest_RandomSint16(void)
{ {
fuzzerInvocationCounter++; fuzzerInvocationCounter++;
return (Sint16)SDLTest_RandomInt(&rndContext) & 0x0000FFFF; return (Sint16)SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
} }
Sint32 SDLTest_RandomSint32() Sint32 SDLTest_RandomSint32(void)
{ {
fuzzerInvocationCounter++; fuzzerInvocationCounter++;
return (Sint32)SDLTest_RandomInt(&rndContext); return (Sint32)SDLTest_RandomInt(&rndContext);
} }
Uint32 SDLTest_RandomUint32() Uint32 SDLTest_RandomUint32(void)
{ {
fuzzerInvocationCounter++; fuzzerInvocationCounter++;
return (Uint32)SDLTest_RandomInt(&rndContext); return (Uint32)SDLTest_RandomInt(&rndContext);
} }
Uint64 SDLTest_RandomUint64() Uint64 SDLTest_RandomUint64(void)
{ {
union union
{ {
@@ -132,7 +132,7 @@ Uint64 SDLTest_RandomUint64()
return value.v64; return value.v64;
} }
Sint64 SDLTest_RandomSint64() Sint64 SDLTest_RandomSint64(void)
{ {
union union
{ {
@@ -425,24 +425,24 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL
validDomain); validDomain);
} }
float SDLTest_RandomUnitFloat() float SDLTest_RandomUnitFloat(void)
{ {
return SDLTest_RandomUint32() / (float)UINT_MAX; return SDLTest_RandomUint32() / (float)UINT_MAX;
} }
float SDLTest_RandomFloat() float SDLTest_RandomFloat(void)
{ {
return (float)(SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX)); return (float)(SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX));
} }
double double
SDLTest_RandomUnitDouble() SDLTest_RandomUnitDouble(void)
{ {
return (double)(SDLTest_RandomUint64() >> 11) * (1.0 / 9007199254740992.0); return (double)(SDLTest_RandomUint64() >> 11) * (1.0 / 9007199254740992.0);
} }
double double
SDLTest_RandomDouble() SDLTest_RandomDouble(void)
{ {
double r = 0.0; double r = 0.0;
double s = 1.0; double s = 1.0;
@@ -456,7 +456,7 @@ SDLTest_RandomDouble()
return r; return r;
} }
char *SDLTest_RandomAsciiString() char *SDLTest_RandomAsciiString(void)
{ {
return SDLTest_RandomAsciiStringWithMaximumLength(255); return SDLTest_RandomAsciiStringWithMaximumLength(255);
} }
+1 -1
View File
@@ -339,7 +339,7 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
#endif #endif
/* Gets a timer value in seconds */ /* Gets a timer value in seconds */
static float GetClock() static float GetClock(void)
{ {
float currentClock = SDL_GetPerformanceCounter() / (float)SDL_GetPerformanceFrequency(); float currentClock = SDL_GetPerformanceCounter() / (float)SDL_GetPerformanceFrequency();
return currentClock; return currentClock;
+3 -3
View File
@@ -540,7 +540,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
/** /**
* \brief Returns the Blit test image as SDL_Surface. * \brief Returns the Blit test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlit() SDL_Surface *SDLTest_ImageBlit(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlit.pixel_data, (void *)SDLTest_imageBlit.pixel_data,
@@ -1014,7 +1014,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
/** /**
* \brief Returns the BlitColor test image as SDL_Surface. * \brief Returns the BlitColor test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitColor() SDL_Surface *SDLTest_ImageBlitColor(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitColor.pixel_data, (void *)SDLTest_imageBlitColor.pixel_data,
@@ -1651,7 +1651,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
/** /**
* \brief Returns the BlitAlpha test image as SDL_Surface. * \brief Returns the BlitAlpha test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitAlpha() SDL_Surface *SDLTest_ImageBlitAlpha(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitAlpha.pixel_data, (void *)SDLTest_imageBlitAlpha.pixel_data,
+5 -5
View File
@@ -580,7 +580,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
/** /**
* \brief Returns the BlitBlendAdd test image as SDL_Surface. * \brief Returns the BlitBlendAdd test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitBlendAdd() SDL_Surface *SDLTest_ImageBlitBlendAdd(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitBlendAdd.pixel_data, (void *)SDLTest_imageBlitBlendAdd.pixel_data,
@@ -1171,7 +1171,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
/** /**
* \brief Returns the BlitBlend test image as SDL_Surface. * \brief Returns the BlitBlend test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitBlend() SDL_Surface *SDLTest_ImageBlitBlend(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitBlend.pixel_data, (void *)SDLTest_imageBlitBlend.pixel_data,
@@ -1592,7 +1592,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
/** /**
* \brief Returns the BlitBlendMod test image as SDL_Surface. * \brief Returns the BlitBlendMod test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitBlendMod() SDL_Surface *SDLTest_ImageBlitBlendMod(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitBlendMod.pixel_data, (void *)SDLTest_imageBlitBlendMod.pixel_data,
@@ -2396,7 +2396,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
/** /**
* \brief Returns the BlitBlendNone test image as SDL_Surface. * \brief Returns the BlitBlendNone test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitBlendNone() SDL_Surface *SDLTest_ImageBlitBlendNone(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitBlendNone.pixel_data, (void *)SDLTest_imageBlitBlendNone.pixel_data,
@@ -2932,7 +2932,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
/** /**
* \brief Returns the BlitBlendAll test image as SDL_Surface. * \brief Returns the BlitBlendAll test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageBlitBlendAll() SDL_Surface *SDLTest_ImageBlitBlendAll(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageBlitBlendAll.pixel_data, (void *)SDLTest_imageBlitBlendAll.pixel_data,
+1 -1
View File
@@ -223,7 +223,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imageFace = {
/** /**
* \brief Returns the Face test image as SDL_Surface. * \brief Returns the Face test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImageFace() SDL_Surface *SDLTest_ImageFace(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imageFace.pixel_data, (void *)SDLTest_imageFace.pixel_data,
+1 -1
View File
@@ -504,7 +504,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
/** /**
* \brief Returns the Primitives test image as SDL_Surface. * \brief Returns the Primitives test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImagePrimitives() SDL_Surface *SDLTest_ImagePrimitives(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imagePrimitives.pixel_data, (void *)SDLTest_imagePrimitives.pixel_data,
+1 -1
View File
@@ -677,7 +677,7 @@ static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
/** /**
* \brief Returns the PrimitivesBlend test image as SDL_Surface. * \brief Returns the PrimitivesBlend test image as SDL_Surface.
*/ */
SDL_Surface *SDLTest_ImagePrimitivesBlend() SDL_Surface *SDLTest_ImagePrimitivesBlend(void)
{ {
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
(void *)SDLTest_imagePrimitivesBlend.pixel_data, (void *)SDLTest_imagePrimitivesBlend.pixel_data,
+2 -2
View File
@@ -195,7 +195,7 @@ static void SDLCALL SDLTest_TrackedFree(void *ptr)
SDL_free_orig(ptr); SDL_free_orig(ptr);
} }
int SDLTest_TrackAllocations() int SDLTest_TrackAllocations(void)
{ {
if (SDL_malloc_orig) { if (SDL_malloc_orig) {
return 0; return 0;
@@ -220,7 +220,7 @@ int SDLTest_TrackAllocations()
return 0; return 0;
} }
void SDLTest_LogAllocations() void SDLTest_LogAllocations(void)
{ {
char *message = NULL; char *message = NULL;
size_t message_size = 0; size_t message_size = 0;
+6
View File
@@ -59,12 +59,18 @@ extern void SDL_SYS_WaitThread(SDL_Thread *thread);
/* Mark thread as cleaned up as soon as it exits, without joining. */ /* Mark thread as cleaned up as soon as it exits, without joining. */
extern void SDL_SYS_DetachThread(SDL_Thread *thread); extern void SDL_SYS_DetachThread(SDL_Thread *thread);
/* Initialize the global TLS data */
extern void SDL_SYS_InitTLSData(void);
/* Get the thread local storage for this thread */ /* Get the thread local storage for this thread */
extern SDL_TLSData *SDL_SYS_GetTLSData(void); extern SDL_TLSData *SDL_SYS_GetTLSData(void);
/* Set the thread local storage for this thread */ /* Set the thread local storage for this thread */
extern int SDL_SYS_SetTLSData(SDL_TLSData *data); extern int SDL_SYS_SetTLSData(SDL_TLSData *data);
/* Quit the global TLS data */
extern void SDL_SYS_QuitTLSData(void);
/* This is for internal SDL use, so we don't need #ifdefs everywhere. */ /* This is for internal SDL use, so we don't need #ifdefs everywhere. */
extern SDL_Thread * extern SDL_Thread *
SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name, SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
+68 -25
View File
@@ -28,6 +28,15 @@
#include "SDL_hints.h" #include "SDL_hints.h"
#include "../SDL_error_c.h" #include "../SDL_error_c.h"
/* The storage is local to the thread, but the IDs are global for the process */
static SDL_atomic_t SDL_tls_allocated;
void SDL_InitTLSData(void)
{
SDL_SYS_InitTLSData();
}
SDL_TLSID SDL_TLSCreate(void) SDL_TLSID SDL_TLSCreate(void)
{ {
static SDL_atomic_t SDL_tls_id; static SDL_atomic_t SDL_tls_id;
@@ -53,6 +62,13 @@ int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *
return SDL_InvalidParamError("id"); return SDL_InvalidParamError("id");
} }
/* Make sure TLS is initialized.
* There's a race condition here if you are calling this from non-SDL threads
* and haven't called SDL_Init() on your main thread, but such is life.
*/
SDL_InitTLSData();
/* Get the storage for the current thread */
storage = SDL_SYS_GetTLSData(); storage = SDL_SYS_GetTLSData();
if (!storage || (id > storage->limit)) { if (!storage || (id > storage->limit)) {
unsigned int i, oldlimit, newlimit; unsigned int i, oldlimit, newlimit;
@@ -69,8 +85,10 @@ int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void *
storage->array[i].destructor = NULL; storage->array[i].destructor = NULL;
} }
if (SDL_SYS_SetTLSData(storage) != 0) { if (SDL_SYS_SetTLSData(storage) != 0) {
SDL_free(storage);
return -1; return -1;
} }
SDL_AtomicIncRef(&SDL_tls_allocated);
} }
storage->array[id - 1].data = SDL_const_cast(void *, value); storage->array[id - 1].data = SDL_const_cast(void *, value);
@@ -82,6 +100,7 @@ void SDL_TLSCleanup(void)
{ {
SDL_TLSData *storage; SDL_TLSData *storage;
/* Cleanup the storage for the current thread */
storage = SDL_SYS_GetTLSData(); storage = SDL_SYS_GetTLSData();
if (storage) { if (storage) {
unsigned int i; unsigned int i;
@@ -92,6 +111,18 @@ void SDL_TLSCleanup(void)
} }
SDL_SYS_SetTLSData(NULL); SDL_SYS_SetTLSData(NULL);
SDL_free(storage); SDL_free(storage);
(void)SDL_AtomicDecRef(&SDL_tls_allocated);
}
}
void SDL_QuitTLSData(void)
{
SDL_TLSCleanup();
if (SDL_AtomicGet(&SDL_tls_allocated) == 0) {
SDL_SYS_QuitTLSData();
} else {
/* Some thread hasn't called SDL_CleanupTLS() */
} }
} }
@@ -113,40 +144,27 @@ typedef struct SDL_TLSEntry
static SDL_mutex *SDL_generic_TLS_mutex; static SDL_mutex *SDL_generic_TLS_mutex;
static SDL_TLSEntry *SDL_generic_TLS; static SDL_TLSEntry *SDL_generic_TLS;
void SDL_Generic_InitTLSData(void)
{
if (!SDL_generic_TLS_mutex) {
SDL_generic_TLS_mutex = SDL_CreateMutex();
}
}
SDL_TLSData *SDL_Generic_GetTLSData(void) SDL_TLSData *SDL_Generic_GetTLSData(void)
{ {
SDL_threadID thread = SDL_ThreadID(); SDL_threadID thread = SDL_ThreadID();
SDL_TLSEntry *entry; SDL_TLSEntry *entry;
SDL_TLSData *storage = NULL; SDL_TLSData *storage = NULL;
#ifndef SDL_THREADS_DISABLED
if (!SDL_generic_TLS_mutex) {
static SDL_SpinLock tls_lock;
SDL_AtomicLock(&tls_lock);
if (!SDL_generic_TLS_mutex) {
SDL_mutex *mutex = SDL_CreateMutex();
SDL_MemoryBarrierRelease();
SDL_generic_TLS_mutex = mutex;
if (!SDL_generic_TLS_mutex) {
SDL_AtomicUnlock(&tls_lock);
return NULL;
}
}
SDL_AtomicUnlock(&tls_lock);
}
SDL_MemoryBarrierAcquire();
SDL_LockMutex(SDL_generic_TLS_mutex); SDL_LockMutex(SDL_generic_TLS_mutex);
#endif /* SDL_THREADS_DISABLED */
for (entry = SDL_generic_TLS; entry; entry = entry->next) { for (entry = SDL_generic_TLS; entry; entry = entry->next) {
if (entry->thread == thread) { if (entry->thread == thread) {
storage = entry->storage; storage = entry->storage;
break; break;
} }
} }
#ifndef SDL_THREADS_DISABLED
SDL_UnlockMutex(SDL_generic_TLS_mutex); SDL_UnlockMutex(SDL_generic_TLS_mutex);
#endif
return storage; return storage;
} }
@@ -155,8 +173,8 @@ int SDL_Generic_SetTLSData(SDL_TLSData *data)
{ {
SDL_threadID thread = SDL_ThreadID(); SDL_threadID thread = SDL_ThreadID();
SDL_TLSEntry *prev, *entry; SDL_TLSEntry *prev, *entry;
int retval = 0;
/* SDL_Generic_GetTLSData() is always called first, so we can assume SDL_generic_TLS_mutex */
SDL_LockMutex(SDL_generic_TLS_mutex); SDL_LockMutex(SDL_generic_TLS_mutex);
prev = NULL; prev = NULL;
for (entry = SDL_generic_TLS; entry; entry = entry->next) { for (entry = SDL_generic_TLS; entry; entry = entry->next) {
@@ -175,21 +193,44 @@ int SDL_Generic_SetTLSData(SDL_TLSData *data)
} }
prev = entry; prev = entry;
} }
if (!entry) { if (!entry && data) {
entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry)); entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry));
if (entry) { if (entry) {
entry->thread = thread; entry->thread = thread;
entry->storage = data; entry->storage = data;
entry->next = SDL_generic_TLS; entry->next = SDL_generic_TLS;
SDL_generic_TLS = entry; SDL_generic_TLS = entry;
} else {
retval = SDL_OutOfMemory();
} }
} }
SDL_UnlockMutex(SDL_generic_TLS_mutex); SDL_UnlockMutex(SDL_generic_TLS_mutex);
if (!entry) { return retval;
return SDL_OutOfMemory(); }
void SDL_Generic_QuitTLSData(void)
{
SDL_TLSEntry *entry;
/* This should have been cleaned up by the time we get here */
SDL_assert(!SDL_generic_TLS);
if (SDL_generic_TLS) {
SDL_LockMutex(SDL_generic_TLS_mutex);
for (entry = SDL_generic_TLS; entry; ) {
SDL_TLSEntry *next = entry->next;
SDL_free(entry->storage);
SDL_free(entry);
entry = next;
}
SDL_generic_TLS = NULL;
SDL_UnlockMutex(SDL_generic_TLS_mutex);
}
if (SDL_generic_TLS_mutex) {
SDL_DestroyMutex(SDL_generic_TLS_mutex);
SDL_generic_TLS_mutex = NULL;
} }
return 0;
} }
/* Non-thread-safe global error variable */ /* Non-thread-safe global error variable */
@@ -328,6 +369,8 @@ SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
SDL_Thread *thread; SDL_Thread *thread;
int ret; int ret;
SDL_InitMainThread();
/* Allocate memory for the thread info structure */ /* Allocate memory for the thread info structure */
thread = (SDL_Thread *)SDL_calloc(1, sizeof(*thread)); thread = (SDL_Thread *)SDL_calloc(1, sizeof(*thread));
if (!thread) { if (!thread) {
+6 -6
View File
@@ -93,17 +93,17 @@ typedef struct
/* This is how many TLS entries we allocate at once */ /* This is how many TLS entries we allocate at once */
#define TLS_ALLOC_CHUNKSIZE 4 #define TLS_ALLOC_CHUNKSIZE 4
/* Get cross-platform, slow, thread local storage for this thread. extern void SDL_InitTLSData(void);
This is only intended as a fallback if getting real thread-local extern void SDL_QuitTLSData(void);
storage fails or isn't supported on this platform.
*/
extern SDL_TLSData *SDL_Generic_GetTLSData(void);
/* Set cross-platform, slow, thread local storage for this thread. /* Generic TLS support.
This is only intended as a fallback if getting real thread-local This is only intended as a fallback if getting real thread-local
storage fails or isn't supported on this platform. storage fails or isn't supported on this platform.
*/ */
extern void SDL_Generic_InitTLSData(void);
extern SDL_TLSData *SDL_Generic_GetTLSData(void);
extern int SDL_Generic_SetTLSData(SDL_TLSData *data); extern int SDL_Generic_SetTLSData(SDL_TLSData *data);
extern void SDL_Generic_QuitTLSData(void);
#endif /* SDL_thread_c_h_ */ #endif /* SDL_thread_c_h_ */
+10
View File
@@ -22,6 +22,11 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#include "../SDL_thread_c.h" #include "../SDL_thread_c.h"
void SDL_SYS_InitTLSData(void)
{
SDL_Generic_InitTLSData();
}
SDL_TLSData *SDL_SYS_GetTLSData(void) SDL_TLSData *SDL_SYS_GetTLSData(void)
{ {
return SDL_Generic_GetTLSData(); return SDL_Generic_GetTLSData();
@@ -32,4 +37,9 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data)
return SDL_Generic_SetTLSData(data); return SDL_Generic_SetTLSData(data);
} }
void SDL_SYS_QuitTLSData(void)
{
SDL_Generic_QuitTLSData();
}
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
+19 -27
View File
@@ -34,45 +34,22 @@
SDL_TLSData **ppSDLTLSData = NULL; SDL_TLSData **ppSDLTLSData = NULL;
static ULONG cTLSAlloc = 0; void SDL_SYS_InitTLSData(void)
/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */
void SDL_OS2TLSAlloc(void)
{ {
ULONG ulRC; ULONG ulRC;
if (cTLSAlloc == 0 || !ppSDLTLSData) { if (!ppSDLTLSData) {
/* First call - allocate the thread local memory (1 DWORD) */ /* Allocate the thread local memory (1 DWORD) */
ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData); ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData);
if (ulRC != NO_ERROR) { if (ulRC != NO_ERROR) {
debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC); debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC);
} }
} }
cTLSAlloc++;
}
/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */
void SDL_OS2TLSFree(void)
{
ULONG ulRC;
if (cTLSAlloc != 0)
cTLSAlloc--;
if (cTLSAlloc == 0 && ppSDLTLSData) {
/* Last call - free the thread local memory */
ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData);
if (ulRC != NO_ERROR) {
debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC);
} else {
ppSDLTLSData = NULL;
}
}
} }
SDL_TLSData *SDL_SYS_GetTLSData(void) SDL_TLSData *SDL_SYS_GetTLSData(void)
{ {
return (!ppSDLTLSData)? NULL : *ppSDLTLSData; return ppSDLTLSData ? *ppSDLTLSData : NULL;
} }
int SDL_SYS_SetTLSData(SDL_TLSData *data) int SDL_SYS_SetTLSData(SDL_TLSData *data)
@@ -84,6 +61,21 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data)
return 0; return 0;
} }
void SDL_SYS_QuitTLSData(void)
{
ULONG ulRC;
if (ppSDLTLSData) {
/* Free the thread local memory */
ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData);
if (ulRC != NO_ERROR) {
debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC);
} else {
ppSDLTLSData = NULL;
}
}
}
#endif /* SDL_THREAD_OS2 */ #endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
-8
View File
@@ -27,12 +27,4 @@
extern SDL_TLSData **ppSDLTLSData; extern SDL_TLSData **ppSDLTLSData;
/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */
void SDL_OS2TLSAlloc(void);
/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */
void SDL_OS2TLSFree(void);
#endif /* SDL_THREAD_OS2 */ #endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */
+1 -1
View File
@@ -114,7 +114,7 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
abstime.tv_sec = delta.tv_sec + (ms / 1000); abstime.tv_sec = delta.tv_sec + (ms / 1000);
abstime.tv_nsec = (long)(delta.tv_usec + (ms % 1000) * 1000) * 1000; abstime.tv_nsec = (long)(delta.tv_usec + (ms % 1000) * 1000) * 1000;
#endif #endif
if (abstime.tv_nsec > 1000000000) { if (abstime.tv_nsec >= 1000000000) {
abstime.tv_sec += 1; abstime.tv_sec += 1;
abstime.tv_nsec -= 1000000000; abstime.tv_nsec -= 1000000000;
} }
+1 -1
View File
@@ -141,7 +141,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
#endif #endif
/* Wrap the second if needed */ /* Wrap the second if needed */
if (ts_timeout.tv_nsec > 1000000000) { if (ts_timeout.tv_nsec >= 1000000000) {
ts_timeout.tv_sec += 1; ts_timeout.tv_sec += 1;
ts_timeout.tv_nsec -= 1000000000; ts_timeout.tv_nsec -= 1000000000;
} }
+25 -11
View File
@@ -30,38 +30,52 @@
static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY; static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY;
static SDL_bool generic_local_storage = SDL_FALSE; static SDL_bool generic_local_storage = SDL_FALSE;
SDL_TLSData *SDL_SYS_GetTLSData(void) void SDL_SYS_InitTLSData(void)
{ {
if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) {
static SDL_SpinLock lock; if (pthread_key_create(&thread_local_storage, NULL) != 0) {
SDL_AtomicLock(&lock); thread_local_storage = INVALID_PTHREAD_KEY;
if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { SDL_Generic_InitTLSData();
pthread_key_t storage;
if (pthread_key_create(&storage, NULL) == 0) {
SDL_MemoryBarrierRelease();
thread_local_storage = storage;
} else {
generic_local_storage = SDL_TRUE; generic_local_storage = SDL_TRUE;
} }
} }
SDL_AtomicUnlock(&lock);
} }
SDL_TLSData *SDL_SYS_GetTLSData(void)
{
if (generic_local_storage) { if (generic_local_storage) {
return SDL_Generic_GetTLSData(); return SDL_Generic_GetTLSData();
} }
SDL_MemoryBarrierAcquire();
if (thread_local_storage != INVALID_PTHREAD_KEY) {
return (SDL_TLSData *)pthread_getspecific(thread_local_storage); return (SDL_TLSData *)pthread_getspecific(thread_local_storage);
} }
return NULL;
}
int SDL_SYS_SetTLSData(SDL_TLSData *data) int SDL_SYS_SetTLSData(SDL_TLSData *data)
{ {
if (generic_local_storage) { if (generic_local_storage) {
return SDL_Generic_SetTLSData(data); return SDL_Generic_SetTLSData(data);
} }
if (pthread_setspecific(thread_local_storage, data) != 0) { if (pthread_setspecific(thread_local_storage, data) != 0) {
return SDL_SetError("pthread_setspecific() failed"); return SDL_SetError("pthread_setspecific() failed");
} }
return 0; return 0;
} }
void SDL_SYS_QuitTLSData(void)
{
if (generic_local_storage) {
SDL_Generic_QuitTLSData();
generic_local_storage = SDL_FALSE;
} else {
if (thread_local_storage != INVALID_PTHREAD_KEY) {
pthread_key_delete(thread_local_storage);
thread_local_storage = INVALID_PTHREAD_KEY;
}
}
}
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
+19 -6
View File
@@ -157,16 +157,29 @@ SDL_SYS_DetachThread(SDL_Thread *thread)
} }
} }
extern "C" SDL_TLSData * static thread_local SDL_TLSData *thread_local_storage;
SDL_SYS_GetTLSData(void)
extern "C"
void SDL_SYS_InitTLSData(void)
{ {
return SDL_Generic_GetTLSData();
} }
extern "C" int extern "C"
SDL_SYS_SetTLSData(SDL_TLSData *data) SDL_TLSData * SDL_SYS_GetTLSData(void)
{
return thread_local_storage;
}
extern "C"
int SDL_SYS_SetTLSData(SDL_TLSData *data)
{
thread_local_storage = data;
return 0;
}
extern "C"
void SDL_SYS_QuitTLSData(void)
{ {
return SDL_Generic_SetTLSData(data);
} }
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
+26 -12
View File
@@ -43,40 +43,54 @@
static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
static SDL_bool generic_local_storage = SDL_FALSE; static SDL_bool generic_local_storage = SDL_FALSE;
SDL_TLSData *SDL_SYS_GetTLSData(void) void SDL_SYS_InitTLSData(void)
{ {
if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) {
static SDL_SpinLock lock; thread_local_storage = TlsAlloc();
SDL_AtomicLock(&lock); if (thread_local_storage == TLS_OUT_OF_INDEXES) {
if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { SDL_Generic_InitTLSData();
DWORD storage = TlsAlloc();
if (storage != TLS_OUT_OF_INDEXES) {
SDL_MemoryBarrierRelease();
thread_local_storage = storage;
} else {
generic_local_storage = SDL_TRUE; generic_local_storage = SDL_TRUE;
} }
} }
SDL_AtomicUnlock(&lock);
} }
SDL_TLSData *SDL_SYS_GetTLSData(void)
{
if (generic_local_storage) { if (generic_local_storage) {
return SDL_Generic_GetTLSData(); return SDL_Generic_GetTLSData();
} }
SDL_MemoryBarrierAcquire();
if (thread_local_storage != TLS_OUT_OF_INDEXES) {
return (SDL_TLSData *)TlsGetValue(thread_local_storage); return (SDL_TLSData *)TlsGetValue(thread_local_storage);
} }
return NULL;
}
int SDL_SYS_SetTLSData(SDL_TLSData *data) int SDL_SYS_SetTLSData(SDL_TLSData *data)
{ {
if (generic_local_storage) { if (generic_local_storage) {
return SDL_Generic_SetTLSData(data); return SDL_Generic_SetTLSData(data);
} }
if (!TlsSetValue(thread_local_storage, data)) { if (!TlsSetValue(thread_local_storage, data)) {
return SDL_SetError("TlsSetValue() failed"); return WIN_SetError("TlsSetValue()");
} }
return 0; return 0;
} }
void SDL_SYS_QuitTLSData(void)
{
if (generic_local_storage) {
SDL_Generic_QuitTLSData();
generic_local_storage = SDL_FALSE;
} else {
if (thread_local_storage != TLS_OUT_OF_INDEXES) {
TlsFree(thread_local_storage);
thread_local_storage = TLS_OUT_OF_INDEXES;
}
}
}
#endif /* SDL_THREAD_WINDOWS */ #endif /* SDL_THREAD_WINDOWS */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
+1 -1
View File
@@ -103,7 +103,7 @@ static int SDLCALL SDL_SoftBlit(SDL_Surface *src, SDL_Rect *srcrect,
#ifdef __MACOSX__ #ifdef __MACOSX__
#include <sys/sysctl.h> #include <sys/sysctl.h>
static SDL_bool SDL_UseAltivecPrefetch() static SDL_bool SDL_UseAltivecPrefetch(void)
{ {
const char key[] = "hw.l3cachesize"; const char key[] = "hw.l3cachesize";
u_int64_t result = 0; u_int64_t result = 0;
+1 -1
View File
@@ -367,7 +367,7 @@ static void printf_128(const char *str, __m128i var)
} }
#endif #endif
static SDL_INLINE int hasSSE2() static SDL_INLINE int hasSSE2(void)
{ {
static int val = -1; static int val = -1;
if (val != -1) { if (val != -1) {
+3 -8
View File
@@ -2688,14 +2688,6 @@ static SDL_bool ShouldAttemptTextureFramebuffer(void)
attempt_texture_framebuffer = SDL_FALSE; attempt_texture_framebuffer = SDL_FALSE;
#endif #endif
} }
if (attempt_texture_framebuffer) {
/* Using a software renderer will try to display on a window surface, so avoid recursion here */
hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
if (hint && SDL_strcasecmp(hint, "software") == 0) {
attempt_texture_framebuffer = SDL_FALSE;
}
}
return attempt_texture_framebuffer; return attempt_texture_framebuffer;
} }
@@ -3311,6 +3303,9 @@ void SDL_DestroyWindow(SDL_Window *window)
if (SDL_GetKeyboardFocus() == window) { if (SDL_GetKeyboardFocus() == window) {
SDL_SetKeyboardFocus(NULL); SDL_SetKeyboardFocus(NULL);
} }
if ((window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
SDL_UpdateMouseCapture(SDL_TRUE);
}
if (SDL_GetMouseFocus() == window) { if (SDL_GetMouseFocus() == window) {
SDL_SetMouseFocus(NULL); SDL_SetMouseFocus(NULL);
} }
+3 -3
View File
@@ -78,7 +78,7 @@ static SDL_Cursor *Android_WrapCursor(int custom_cursor, int system_cursor)
return cursor; return cursor;
} }
static SDL_Cursor *Android_CreateDefaultCursor() static SDL_Cursor *Android_CreateDefaultCursor(void)
{ {
return Android_WrapCursor(0, SDL_SYSTEM_CURSOR_ARROW); return Android_WrapCursor(0, SDL_SYSTEM_CURSOR_ARROW);
} }
@@ -116,7 +116,7 @@ static void Android_FreeCursor(SDL_Cursor *cursor)
SDL_free(cursor); SDL_free(cursor);
} }
static SDL_Cursor *Android_CreateEmptyCursor() static SDL_Cursor *Android_CreateEmptyCursor(void)
{ {
if (!empty_cursor) { if (!empty_cursor) {
SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(0, 1, 1, 32, SDL_PIXELFORMAT_ARGB8888); SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(0, 1, 1, 32, SDL_PIXELFORMAT_ARGB8888);
@@ -129,7 +129,7 @@ static SDL_Cursor *Android_CreateEmptyCursor()
return empty_cursor; return empty_cursor;
} }
static void Android_DestroyEmptyCursor() static void Android_DestroyEmptyCursor(void)
{ {
if (empty_cursor) { if (empty_cursor) {
Android_FreeCursor(empty_cursor); Android_FreeCursor(empty_cursor);
+5 -2
View File
@@ -933,11 +933,13 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
- (void)windowDidChangeScreen:(NSNotification *)aNotification - (void)windowDidChangeScreen:(NSNotification *)aNotification
{ {
/*printf("WINDOWDIDCHANGESCREEN\n");*/ /*printf("WINDOWDIDCHANGESCREEN\n");*/
#ifdef SDL_VIDEO_OPENGL
if (_data && _data.nscontexts) { if (_data && _data.nscontexts) {
for (SDLOpenGLContext *context in _data.nscontexts) { for (SDLOpenGLContext *context in _data.nscontexts) {
[context movedToNewScreen]; [context movedToNewScreen];
} }
} }
#endif /* SDL_VIDEO_OPENGL */
} }
- (void)windowWillEnterFullScreen:(NSNotification *)aNotification - (void)windowWillEnterFullScreen:(NSNotification *)aNotification
@@ -2346,7 +2348,10 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata);
if (data) { if (data) {
#ifdef SDL_VIDEO_OPENGL
NSArray *contexts; NSArray *contexts;
#endif
if ([data.listener isInFullscreenSpace]) { if ([data.listener isInFullscreenSpace]) {
[NSMenu setMenuBarVisible:YES]; [NSMenu setMenuBarVisible:YES];
} }
@@ -2359,13 +2364,11 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window)
} }
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL
contexts = [data.nscontexts copy]; contexts = [data.nscontexts copy];
for (SDLOpenGLContext *context in contexts) { for (SDLOpenGLContext *context in contexts) {
/* Calling setWindow:NULL causes the context to remove itself from the context list. */ /* Calling setWindow:NULL causes the context to remove itself from the context list. */
[context setWindow:NULL]; [context setWindow:NULL];
} }
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL */
if (window->shaper) { if (window->shaper) {
+1 -1
View File
@@ -561,7 +561,7 @@ static void DirectFB_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * textur
} }
} }
static void DirectFB_SetTextureScaleMode() static void DirectFB_SetTextureScaleMode(void)
{ {
} }
+1 -1
View File
@@ -131,7 +131,7 @@ VideoBootStrap DUMMY_evdev_bootstrap = {
NULL /* no ShowMessageBox implementation */ NULL /* no ShowMessageBox implementation */
}; };
void SDL_EVDEV_Init(void); void SDL_EVDEV_Init(void);
void SDL_EVDEV_Poll(); void SDL_EVDEV_Poll(void);
void SDL_EVDEV_Quit(void); void SDL_EVDEV_Quit(void);
static void DUMMY_EVDEV_Poll(_THIS) static void DUMMY_EVDEV_Poll(_THIS)
{ {
+2 -2
View File
@@ -222,7 +222,7 @@ static int Emscripten_SetRelativeMouseMode(SDL_bool enabled)
return -1; return -1;
} }
void Emscripten_InitMouse() void Emscripten_InitMouse(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
@@ -236,7 +236,7 @@ void Emscripten_InitMouse()
SDL_SetDefaultCursor(Emscripten_CreateDefaultCursor()); SDL_SetDefaultCursor(Emscripten_CreateDefaultCursor());
} }
void Emscripten_FiniMouse() void Emscripten_FiniMouse(void)
{ {
} }
+1 -1
View File
@@ -194,7 +194,7 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window)
we have waited here, there won't be a pending pageflip so the we have waited here, there won't be a pending pageflip so the
WaitPageflip at the beginning of this function will be a no-op. WaitPageflip at the beginning of this function will be a no-op.
Just leave it here and don't worry. Just leave it here and don't worry.
Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 <program_name>" Run your SDL2 program with "SDL_VIDEO_DOUBLE_BUFFER=1 <program_name>"
to enable this. */ to enable this. */
if (windata->double_buffer) { if (windata->double_buffer) {
if (!KMSDRM_WaitPageflip(_this, windata)) { if (!KMSDRM_WaitPageflip(_this, windata)) {
+1
View File
@@ -133,6 +133,7 @@ SDL_KMSDRM_SYM(uint64_t,gbm_bo_get_modifier,(struct gbm_bo *bo))
SDL_KMSDRM_SYM(int,gbm_bo_get_plane_count,(struct gbm_bo *bo)) SDL_KMSDRM_SYM(int,gbm_bo_get_plane_count,(struct gbm_bo *bo))
SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_offset,(struct gbm_bo *bo, int plane)) SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_offset,(struct gbm_bo *bo, int plane))
SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride_for_plane,(struct gbm_bo *bo, int plane)) SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride_for_plane,(struct gbm_bo *bo, int plane))
SDL_KMSDRM_SYM(union gbm_bo_handle,gbm_bo_get_handle_for_plane,(struct gbm_bo *bo, int plane);)
#undef SDL_KMSDRM_MODULE #undef SDL_KMSDRM_MODULE
#undef SDL_KMSDRM_SYM #undef SDL_KMSDRM_SYM
+31 -13
View File
@@ -97,7 +97,7 @@ static int get_driindex(void)
SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname, SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname,
sizeof(device) - kmsdrm_dri_devnamesize); sizeof(device) - kmsdrm_dri_devnamesize);
while((res = readdir(folder)) != NULL) { while((res = readdir(folder)) != NULL && available < 0) {
if (SDL_memcmp(res->d_name, kmsdrm_dri_devname, if (SDL_memcmp(res->d_name, kmsdrm_dri_devname,
kmsdrm_dri_devnamesize) == 0) { kmsdrm_dri_devnamesize) == 0) {
SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize, SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize,
@@ -123,7 +123,7 @@ static int get_driindex(void)
resources->count_encoders > 0 && resources->count_encoders > 0 &&
resources->count_crtcs > 0) { resources->count_crtcs > 0) {
available = -ENOENT; available = -ENOENT;
for (i = 0; i < resources->count_connectors; i++) { for (i = 0; i < resources->count_connectors && available < 0; i++) {
drmModeConnector *conn = drmModeConnector *conn =
KMSDRM_drmModeGetConnector( KMSDRM_drmModeGetConnector(
drm_fd, resources->connectors[i]); drm_fd, resources->connectors[i]);
@@ -134,20 +134,21 @@ static int get_driindex(void)
if (conn->connection == DRM_MODE_CONNECTED && if (conn->connection == DRM_MODE_CONNECTED &&
conn->count_modes) { conn->count_modes) {
SDL_bool access_denied = SDL_FALSE;
if (SDL_GetHintBoolean( if (SDL_GetHintBoolean(
SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER,
SDL_TRUE)) { SDL_TRUE)) {
/* Skip this device if we can't obtain /* Skip this device if we can't obtain
* DRM master */ * DRM master */
KMSDRM_drmSetMaster(drm_fd); KMSDRM_drmSetMaster(drm_fd);
if (KMSDRM_drmAuthMagic(drm_fd, 0) == if (KMSDRM_drmAuthMagic(drm_fd, 0) == -EACCES) {
-EACCES) { access_denied = SDL_TRUE;
continue;
} }
} }
if (!access_denied) {
available = devindex; available = devindex;
break; }
} }
KMSDRM_drmModeFreeConnector(conn); KMSDRM_drmModeFreeConnector(conn);
@@ -158,11 +159,10 @@ static int get_driindex(void)
SDL_KMSDRM_UnloadSymbols(); SDL_KMSDRM_UnloadSymbols();
} }
close(drm_fd); close(drm_fd);
} } else {
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO,
"Failed to open KMSDRM device %s, errno: %d\n", device, "Failed to open KMSDRM device %s, errno: %d\n", device, errno);
errno); }
} }
} }
@@ -368,16 +368,23 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
num_planes = KMSDRM_gbm_bo_get_plane_count(bo); num_planes = KMSDRM_gbm_bo_get_plane_count(bo);
for (int i = 0; i < num_planes; i++) { for (int i = 0; i < num_planes; i++) {
strides[i] = KMSDRM_gbm_bo_get_stride_for_plane(bo, i); strides[i] = KMSDRM_gbm_bo_get_stride_for_plane(bo, i);
handles[i] = KMSDRM_gbm_bo_get_handle(bo).u32; handles[i] = KMSDRM_gbm_bo_get_handle_for_plane(bo, i).u32;
offsets[i] = KMSDRM_gbm_bo_get_offset(bo, i); offsets[i] = KMSDRM_gbm_bo_get_offset(bo, i);
modifiers[i] = modifiers[0]; modifiers[i] = modifiers[0];
} }
if (modifiers[0]) { if (modifiers[0] && modifiers[0] != DRM_FORMAT_MOD_INVALID) {
flags = DRM_MODE_FB_MODIFIERS; flags = DRM_MODE_FB_MODIFIERS;
} }
ret = KMSDRM_drmModeAddFB2WithModifiers(viddata->drm_fd, w, h, format, handles, strides, offsets, modifiers, &fb_info->fb_id, flags); ret = KMSDRM_drmModeAddFB2WithModifiers(viddata->drm_fd, w, h, format, handles, strides, offsets, modifiers, &fb_info->fb_id, flags);
if (ret) {
strides[0] = KMSDRM_gbm_bo_get_stride(bo);
handles[0] = KMSDRM_gbm_bo_get_handle(bo).u32;
ret = KMSDRM_drmModeAddFB(viddata->drm_fd, w, h, 24, 32, strides[0], handles[0], &fb_info->fb_id);
}
if (ret) { if (ret) {
SDL_free(fb_info); SDL_free(fb_info);
return NULL; return NULL;
@@ -1465,6 +1472,12 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
windata->viddata = viddata; windata->viddata = viddata;
window->driverdata = windata; window->driverdata = windata;
/* Do we want a double buffering scheme to get low video lag? */
windata->double_buffer = SDL_FALSE;
if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) {
windata->double_buffer = SDL_TRUE;
}
if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */ if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */
/* Maybe you didn't ask for an OPENGL window, but that's what you will get. /* Maybe you didn't ask for an OPENGL window, but that's what you will get.
@@ -1570,7 +1583,12 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
SDL_SetKeyboardFocus(window); SDL_SetKeyboardFocus(window);
/* Tell the app that the window has moved to top-left. */ /* Tell the app that the window has moved to top-left. */
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0); {
SDL_Rect display_bounds;
SDL_zero(display_bounds);
SDL_GetDisplayBounds(SDL_GetWindowDisplayIndex(window), &display_bounds);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, display_bounds.x, display_bounds.y);
}
/* Allocated windata will be freed in KMSDRM_DestroyWindow, /* Allocated windata will be freed in KMSDRM_DestroyWindow,
and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow() and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow()
+4
View File
@@ -33,6 +33,10 @@
#include <gbm.h> #include <gbm.h>
#include <EGL/egl.h> #include <EGL/egl.h>
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID 0x00ffffffffffffffULL
#endif
#ifndef DRM_MODE_FB_MODIFIERS #ifndef DRM_MODE_FB_MODIFIERS
#define DRM_MODE_FB_MODIFIERS 2 #define DRM_MODE_FB_MODIFIERS 2
#endif #endif
+3 -3
View File
@@ -30,17 +30,17 @@
static SwkbdState sw_keyboard; static SwkbdState sw_keyboard;
const static size_t BUFFER_SIZE = 256; const static size_t BUFFER_SIZE = 256;
void N3DS_SwkbInit() void N3DS_SwkbInit(void)
{ {
swkbdInit(&sw_keyboard, SWKBD_TYPE_NORMAL, 2, -1); swkbdInit(&sw_keyboard, SWKBD_TYPE_NORMAL, 2, -1);
} }
void N3DS_SwkbPoll() void N3DS_SwkbPoll(void)
{ {
return; return;
} }
void N3DS_SwkbQuit() void N3DS_SwkbQuit(void)
{ {
return; return;
} }
+1 -1
View File
@@ -56,7 +56,7 @@ static void RPI_Destroy(SDL_VideoDevice *device)
SDL_free(device); SDL_free(device);
} }
static int RPI_GetRefreshRate() static int RPI_GetRefreshRate(void)
{ {
TV_DISPLAY_STATE_T tvstate; TV_DISPLAY_STATE_T tvstate;
if (vc_tv_get_display_state(&tvstate) == 0) { if (vc_tv_get_display_state(&tvstate) == 0) {
+2 -2
View File
@@ -70,8 +70,8 @@ void VITA_InitTouch(void)
} }
// Support passing both front and back touch devices in events // Support passing both front and back touch devices in events
SDL_AddTouch((SDL_TouchID)0, SDL_TOUCH_DEVICE_DIRECT, "Front"); SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_DIRECT, "Front");
SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back"); SDL_AddTouch((SDL_TouchID)2, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back");
} }
void VITA_QuitTouch(void) void VITA_QuitTouch(void)
+9 -8
View File
@@ -192,7 +192,6 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa
int size = 0; int size = 0;
SDL_Window *focus; SDL_Window *focus;
SDL_WindowData *focusdata;
int i; int i;
/* /*
@@ -216,16 +215,17 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa
} }
/* First, find the appropriate theme based on the current scale... */ /* First, find the appropriate theme based on the current scale... */
focus = SDL_GetMouse()->focus; focus = SDL_GetMouse()->focus;
if (!focus) { if (focus) {
/* Nothing to see here, bail. */ SDL_WindowData *focusdata = (SDL_WindowData*)focus->driverdata;
return SDL_FALSE;
}
focusdata = focus->driverdata;
/* Cursors use integer scaling. */ /* Cursors use integer scaling. */
*scale = SDL_ceilf(focusdata->scale_factor); *scale = SDL_ceilf(focusdata->scale_factor);
size *= *scale; } else {
for (i = 0; i < vdata->num_cursor_themes; i += 1) { *scale = 1.0f;
}
size *= (int)*scale;
for (i = 0; i < vdata->num_cursor_themes; ++i) {
if (vdata->cursor_themes[i].size == size) { if (vdata->cursor_themes[i].size == size) {
theme = vdata->cursor_themes[i].theme; theme = vdata->cursor_themes[i].theme;
break; break;
@@ -595,6 +595,7 @@ static void Wayland_WarpMouse(SDL_Window *window, int x, int y)
Wayland_input_lock_pointer(input); Wayland_input_lock_pointer(input);
input->relative_mode_override = SDL_TRUE; input->relative_mode_override = SDL_TRUE;
} }
SDL_SendMouseMotion(window, 0, 0, x, y);
} }
} }
+1 -1
View File
@@ -78,7 +78,7 @@ static void Wayland_VideoQuit(_THIS);
/* Find out what class name we should use /* Find out what class name we should use
* Based on src/video/x11/SDL_x11video.c */ * Based on src/video/x11/SDL_x11video.c */
static char *get_classname() static char *get_classname(void)
{ {
/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec: /* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
"The surface class identifies the general class of applications "The surface class identifies the general class of applications
+4 -4
View File
@@ -327,7 +327,7 @@ static SDL_Scancode WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam)
} }
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
static SDL_bool WIN_ShouldIgnoreFocusClick() static SDL_bool WIN_ShouldIgnoreFocusClick(void)
{ {
return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE);
} }
@@ -1794,7 +1794,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} }
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
static void WIN_UpdateClipCursorForWindows() static void WIN_UpdateClipCursorForWindows(void)
{ {
SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_Window *window; SDL_Window *window;
@@ -1816,7 +1816,7 @@ static void WIN_UpdateClipCursorForWindows()
} }
} }
static void WIN_UpdateMouseCapture() static void WIN_UpdateMouseCapture(void)
{ {
SDL_Window *focusWindow = SDL_GetKeyboardFocus(); SDL_Window *focusWindow = SDL_GetKeyboardFocus();
@@ -2090,7 +2090,7 @@ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst)
} }
/* Unregisters the windowclass registered in SDL_RegisterApp above. */ /* Unregisters the windowclass registered in SDL_RegisterApp above. */
void SDL_UnregisterApp() void SDL_UnregisterApp(void)
{ {
WNDCLASSEX wcex; WNDCLASSEX wcex;
+2 -2
View File
@@ -166,7 +166,7 @@ void WIN_QuitKeyboard(_THIS)
#endif /* !SDL_DISABLE_WINDOWS_IME */ #endif /* !SDL_DISABLE_WINDOWS_IME */
} }
void WIN_ResetDeadKeys() void WIN_ResetDeadKeys(void)
{ {
/* /*
if a deadkey has been typed, but not the next character (which the deadkey might modify), if a deadkey has been typed, but not the next character (which the deadkey might modify),
@@ -367,7 +367,7 @@ static void UILess_ReleaseSinks(SDL_VideoData *videodata);
static void UILess_EnableUIUpdates(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata);
static void UILess_DisableUIUpdates(SDL_VideoData *videodata); static void UILess_DisableUIUpdates(SDL_VideoData *videodata);
static SDL_bool WIN_ShouldShowNativeUI() static SDL_bool WIN_ShouldShowNativeUI(void)
{ {
return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE); return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE);
} }
+1 -1
View File
@@ -474,7 +474,7 @@ static void WIN_SetLinearMouseScale(int mouse_speed)
} }
} }
void WIN_UpdateMouseSystemScale() void WIN_UpdateMouseSystemScale(void)
{ {
int mouse_speed; int mouse_speed;
int params[3] = { 0, 0, 0 }; int params[3] = { 0, 0, 0 };
+1
View File
@@ -642,6 +642,7 @@ static int WIN_GL_SetupWindowInternal(_THIS, SDL_Window *window)
} }
if (_this->gl_config.floatbuffers) { if (_this->gl_config.floatbuffers) {
*iAttr++ = WGL_PIXEL_TYPE_ARB;
*iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB; *iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB;
} }
+6 -4
View File
@@ -30,6 +30,7 @@
/* FIXME: Find a better place to put this... */ /* FIXME: Find a better place to put this... */
static Cursor x11_empty_cursor = None; static Cursor x11_empty_cursor = None;
static SDL_bool x11_cursor_visible = SDL_TRUE;
static Display *GetDisplay(void) static Display *GetDisplay(void)
{ {
@@ -298,6 +299,8 @@ static int X11_ShowCursor(SDL_Cursor *cursor)
Display *display = GetDisplay(); Display *display = GetDisplay();
SDL_Window *window; SDL_Window *window;
x11_cursor_visible = !!cursor;
for (window = video->windows; window; window = window->next) { for (window = video->windows; window; window = window->next) {
SDL_WindowData *data = (SDL_WindowData *)window->driverdata; SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
if (data) { if (data) {
@@ -317,12 +320,13 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y)
{ {
SDL_VideoData *videodata = (SDL_VideoData *)SDL_GetVideoDevice()->driverdata; SDL_VideoData *videodata = (SDL_VideoData *)SDL_GetVideoDevice()->driverdata;
Display *display = videodata->display; Display *display = videodata->display;
SDL_Mouse *mouse = SDL_GetMouse(); #ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
int deviceid = 0; int deviceid = 0;
#endif
SDL_bool warp_hack = SDL_FALSE; SDL_bool warp_hack = SDL_FALSE;
/* XWayland will only warp the cursor if it is hidden, so this workaround is required. */ /* XWayland will only warp the cursor if it is hidden, so this workaround is required. */
if (videodata->is_xwayland && mouse && mouse->cursor_shown) { if (videodata->is_xwayland && x11_cursor_visible) {
warp_hack = SDL_TRUE; warp_hack = SDL_TRUE;
} }
@@ -490,5 +494,3 @@ void X11_QuitMouse(_THIS)
} }
#endif /* SDL_VIDEO_DRIVER_X11 */ #endif /* SDL_VIDEO_DRIVER_X11 */
/* vi: set ts=4 sw=4 expandtab: */
+1
View File
@@ -575,6 +575,7 @@ static int X11_GL_GetAttributes(_THIS, Display *display, int screen, int *attrib
} }
if (_this->gl_config.floatbuffers) { if (_this->gl_config.floatbuffers) {
attribs[i++] = GLX_RENDER_TYPE;
attribs[i++] = GLX_RGBA_FLOAT_TYPE_ARB; attribs[i++] = GLX_RGBA_FLOAT_TYPE_ARB;
} }
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more