mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-22 16:51:07 +01:00
Compare commits
43 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9fd3ce83c | ||
|
|
7fa9f1559c | ||
|
|
b2ec286e35 | ||
|
|
05eb08053d | ||
|
|
c2ebe1024b | ||
|
|
1a722ef500 | ||
|
|
6303197b20 | ||
|
|
6c0a114efb | ||
|
|
e5ccc80aba | ||
|
|
00096baf18 | ||
|
|
1dbe85efd1 | ||
|
|
52bffcbcd5 | ||
|
|
89433c2339 | ||
|
|
b0fd3fad53 | ||
|
|
31dfc10c3b | ||
|
|
66399e4211 | ||
|
|
45075eec86 | ||
|
|
9b2c70c9c8 | ||
|
|
ac23faf0a6 | ||
|
|
221d6ea8a8 | ||
|
|
01eb305493 | ||
|
|
15ead9a40d | ||
|
|
7ebfaa0ea2 | ||
|
|
5f4ddebf76 | ||
|
|
0f8858cf2d | ||
|
|
98abc15769 | ||
|
|
746d74b140 | ||
|
|
7d9595b14f | ||
|
|
63d259edf0 | ||
|
|
fcd0c9843e | ||
|
|
74b3959e04 | ||
|
|
a5df48514e | ||
|
|
78d5fbf398 | ||
|
|
5d66429cc3 | ||
|
|
2ca041d294 | ||
|
|
b3f19b14d7 | ||
|
|
a85cf62c12 | ||
|
|
5be746acbc | ||
|
|
2abefb1c16 | ||
|
|
6fc17b0e2b | ||
|
|
1f7ec57d3b | ||
|
|
36eb4845b5 | ||
|
|
d5ba5bb05f |
@@ -1,19 +1,23 @@
|
||||
name: Build (VM Actions)
|
||||
name: Build (C/P Actions)
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
freebsd:
|
||||
runs-on: macos-12
|
||||
runs-on: ubuntu-latest
|
||||
name: FreeBSD
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
uses: vmactions/freebsd-vm@v0
|
||||
uses: cross-platform-actions/action@v0.19.1
|
||||
with:
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg install -y \
|
||||
operating_system: freebsd
|
||||
version: '13.2'
|
||||
shell: bash
|
||||
run: |
|
||||
sudo pkg update
|
||||
sudo pkg install -y \
|
||||
gmake \
|
||||
pkgconf \
|
||||
libXcursor \
|
||||
@@ -33,17 +37,15 @@ jobs:
|
||||
libinotify \
|
||||
alsa-lib \
|
||||
jackit \
|
||||
nas \
|
||||
pipewire \
|
||||
pulseaudio \
|
||||
sndio \
|
||||
dbus \
|
||||
zh-fcitx \
|
||||
ibus \
|
||||
libsamplerate \
|
||||
libudev-devd
|
||||
|
||||
run: |
|
||||
mkdir build_autotools
|
||||
(cd build_autotools && CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ../configure)
|
||||
export CPPFLAGS="-I/usr/local/include"
|
||||
export LDFLAGS="-L/usr/local/lib"
|
||||
(cd build_autotools && ../configure --disable-static)
|
||||
gmake -C build_autotools -j`sysctl -n hw.ncpu` V=1
|
||||
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
@@ -64,6 +64,7 @@ jobs:
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install \
|
||||
autoconf \
|
||||
ninja \
|
||||
pkg-config
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ endif()
|
||||
# See docs/release_checklist.md
|
||||
set(SDL_MAJOR_VERSION 2)
|
||||
set(SDL_MINOR_VERSION 28)
|
||||
set(SDL_MICRO_VERSION 4)
|
||||
set(SDL_MICRO_VERSION 5)
|
||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
@@ -3083,9 +3083,17 @@ else()
|
||||
set(sdl_static_libname "SDL2")
|
||||
endif()
|
||||
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
# CMAKE_PREFIX_PATH and CMAKE_INSTALL_FULL_BINDIR can be a non-absolute path
|
||||
# when a master-project does e.g. `set(CMAKE_INSTALL_PREFIX "libs/SDL2" CACHE PATH "prefix" FORCE)`.
|
||||
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||
set(CMAKE_INSTALL_FULL_BINDIR "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_FULL_BINDIR}")
|
||||
endif()
|
||||
file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
|
||||
@@ -3329,6 +3337,12 @@ if(ANDROID)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
cmake_push_check_state(RESET)
|
||||
check_c_compiler_flag(-fobjc-arc COMPILER_SUPPORTS_FOBJC_ARC)
|
||||
cmake_pop_check_state()
|
||||
if(NOT COMPILER_SUPPORTS_FOBJC_ARC)
|
||||
message(FATAL_ERROR "Compiler does not support -fobjc-arc: this is required on Apple platforms")
|
||||
endif()
|
||||
target_compile_options(sdl-build-options INTERFACE "-fobjc-arc")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 28
|
||||
MICRO_VERSION = 4
|
||||
MICRO_VERSION = 5
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 28
|
||||
MICRO_VERSION = 4
|
||||
MICRO_VERSION = 5
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
LIBHOME = .
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.28.4</string>
|
||||
<string>2.28.5</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.28.4</string>
|
||||
<string>2.28.5</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -9529,7 +9529,7 @@
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2801.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.4.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.5.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
@@ -9570,7 +9570,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.28.4;
|
||||
MARKETING_VERSION = 2.28.5;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Release;
|
||||
@@ -9614,7 +9614,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2801.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.4.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.5.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -9656,7 +9656,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.28.4;
|
||||
MARKETING_VERSION = 2.28.5;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -9863,7 +9863,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 2801.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.4.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.5.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
@@ -9915,7 +9915,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 2801.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.4.0;
|
||||
DYLIB_CURRENT_VERSION = 2801.5.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title SDL 2.28.4
|
||||
Title SDL 2.28.5
|
||||
Version 1
|
||||
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
|
||||
@@ -273,6 +273,7 @@ public class HIDDeviceManager {
|
||||
final int XB1_IFACE_SUBCLASS = 71;
|
||||
final int XB1_IFACE_PROTOCOL = 208;
|
||||
final int[] SUPPORTED_VENDORS = {
|
||||
0x03f0, // HP
|
||||
0x044f, // Thrustmaster
|
||||
0x045e, // Microsoft
|
||||
0x0738, // Mad Catz
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
private static final String TAG = "SDL";
|
||||
private static final int SDL_MAJOR_VERSION = 2;
|
||||
private static final int SDL_MINOR_VERSION = 28;
|
||||
private static final int SDL_MICRO_VERSION = 4;
|
||||
private static final int SDL_MICRO_VERSION = 5;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
||||
2
configure
vendored
2
configure
vendored
@@ -3507,7 +3507,7 @@ orig_CFLAGS="$CFLAGS"
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=28
|
||||
SDL_MICRO_VERSION=4
|
||||
SDL_MICRO_VERSION=5
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
|
||||
@@ -13,7 +13,7 @@ dnl Set various version strings - taken gratefully from the GTk sources
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=28
|
||||
SDL_MICRO_VERSION=4
|
||||
SDL_MICRO_VERSION=5
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
|
||||
@@ -965,6 +965,24 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"
|
||||
|
||||
/**
|
||||
* A variable controlling whether IOKit should be used for controller handling.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - IOKit is not used
|
||||
* "1" - IOKit is used (the default)
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT"
|
||||
|
||||
/**
|
||||
* A variable controlling whether GCController should be used for controller handling.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - GCController is not used
|
||||
* "1" - GCController is used (the default)
|
||||
*/
|
||||
#define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
|
||||
*
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct SDL_version
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 28
|
||||
#define SDL_PATCHLEVEL 4
|
||||
#define SDL_PATCHLEVEL 5
|
||||
|
||||
/**
|
||||
* Macro to determine SDL version program was compiled against.
|
||||
|
||||
@@ -300,12 +300,12 @@ static void ARTS_Deinitialize(void)
|
||||
}
|
||||
|
||||
|
||||
static SDL_bool ARTS_Init(SDL_AudioDriverImpl * impl)
|
||||
static SDL_bool ARTS_Init(SDL_AudioDriverImpl *impl)
|
||||
{
|
||||
if (LoadARTSLibrary() < 0) {
|
||||
return SDL_FALSE;
|
||||
} else {
|
||||
if (SDL_NAME(arts_init) () != NULL) {
|
||||
if (SDL_NAME(arts_init) () != 0) {
|
||||
UnloadARTSLibrary();
|
||||
SDL_SetError("ARTS: arts_init failed (no audio server?)");
|
||||
return SDL_FALSE;
|
||||
|
||||
@@ -1939,12 +1939,12 @@ int Android_JNI_FileOpen(SDL_RWops *ctx,
|
||||
}
|
||||
|
||||
if (asset_manager == NULL) {
|
||||
return -1;
|
||||
return SDL_SetError("Couldn't create asset manager");
|
||||
}
|
||||
|
||||
asset = AAssetManager_open(asset_manager, fileName, AASSET_MODE_UNKNOWN);
|
||||
if (asset == NULL) {
|
||||
return -1;
|
||||
return SDL_SetError("Couldn't open asset '%s'", fileName);
|
||||
}
|
||||
|
||||
ctx->hidden.androidio.asset = (void *)asset;
|
||||
|
||||
@@ -711,6 +711,7 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de
|
||||
static const int XB1_IFACE_SUBCLASS = 71;
|
||||
static const int XB1_IFACE_PROTOCOL = 208;
|
||||
static const int SUPPORTED_VENDORS[] = {
|
||||
0x03f0, /* HP */
|
||||
0x044f, /* Thrustmaster */
|
||||
0x045e, /* Microsoft */
|
||||
0x0738, /* Mad Catz */
|
||||
|
||||
@@ -593,6 +593,7 @@ static const char *s_ControllerMappings[] = {
|
||||
"05000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,",
|
||||
"03000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,",
|
||||
"05000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
|
||||
"05000000503200000210000000000000128804098,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
|
||||
"030000005e0400008e02000047010000,Atari Xbox 360 Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000c62400001b89000011010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
|
||||
@@ -2346,7 +2346,8 @@ SDL_bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id)
|
||||
}
|
||||
}
|
||||
if (vendor_id == USB_VENDOR_8BITDO) {
|
||||
if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER) {
|
||||
if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 ||
|
||||
product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER2) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -2507,6 +2508,10 @@ static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid)
|
||||
MAKE_VIDPID(0x0eb7, 0x038e), /* Fanatec ClubSport Wheel Base V1 */
|
||||
MAKE_VIDPID(0x0eb7, 0x0e03), /* Fanatec CSL Elite Wheel Base */
|
||||
MAKE_VIDPID(0x11ff, 0x0511), /* DragonRise Inc. Wired Wheel (initial mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) */
|
||||
MAKE_VIDPID(0x2433, 0xf300), /* Asetek SimSports Invicta Wheelbase */
|
||||
MAKE_VIDPID(0x2433, 0xf301), /* Asetek SimSports Forte Wheelbase */
|
||||
MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */
|
||||
MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */
|
||||
};
|
||||
int i;
|
||||
|
||||
@@ -2788,6 +2793,7 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
|
||||
};
|
||||
|
||||
static Uint32 rog_chakram_list[] = {
|
||||
MAKE_VIDPID(0x0b05, 0x1906), /* ROG Pugio II */
|
||||
MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */
|
||||
MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */
|
||||
MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */
|
||||
|
||||
@@ -294,6 +294,7 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 3
|
||||
{ MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller, NULL }, // Rock Candy Gamepad for Xbox 360
|
||||
|
||||
{ MAKE_CONTROLLER_ID( 0x03f0, 0x0495 ), k_eControllerType_XBoxOneController, NULL }, // HP HyperX Clutch Gladiate
|
||||
{ MAKE_CONTROLLER_ID( 0x044f, 0xd012 ), k_eControllerType_XBoxOneController, NULL }, // ThrustMaster eSwap PRO Controller Xbox
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad
|
||||
{ MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad (Firmware 2015)
|
||||
|
||||
@@ -657,8 +657,8 @@ static SDL_bool CreateHIDManager(void)
|
||||
|
||||
static int DARWIN_JoystickInit(void)
|
||||
{
|
||||
if (gpDeviceList) {
|
||||
return SDL_SetError("Joystick: Device list already inited.");
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_IOKIT, SDL_TRUE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!CreateHIDManager()) {
|
||||
@@ -694,10 +694,12 @@ static void DARWIN_JoystickDetect(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* run this after the checks above so we don't set device->removed and delete the device before
|
||||
DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */
|
||||
while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) {
|
||||
/* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
|
||||
if (hidman) {
|
||||
/* run this after the checks above so we don't set device->removed and delete the device before
|
||||
DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */
|
||||
while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) {
|
||||
/* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ static SDL_joylist_item *JoystickByIndex(int index);
|
||||
static SDL_joylist_item *SDL_joylist = NULL;
|
||||
static SDL_joylist_item *SDL_joylist_tail = NULL;
|
||||
static int numjoysticks = 0;
|
||||
static int instance_counter = 0;
|
||||
|
||||
static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)
|
||||
{
|
||||
@@ -72,7 +71,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
|
||||
|
||||
item->naxes = gamepadEvent->numAxes;
|
||||
item->nbuttons = gamepadEvent->numButtons;
|
||||
item->device_instance = instance_counter++;
|
||||
item->device_instance = SDL_GetNextJoystickInstanceID();
|
||||
|
||||
item->timestamp = gamepadEvent->timestamp;
|
||||
|
||||
@@ -168,7 +167,6 @@ static void EMSCRIPTEN_JoystickQuit(void)
|
||||
SDL_joylist = SDL_joylist_tail = NULL;
|
||||
|
||||
numjoysticks = 0;
|
||||
instance_counter = 0;
|
||||
|
||||
emscripten_set_gamepadconnected_callback(NULL, 0, NULL);
|
||||
emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL);
|
||||
|
||||
@@ -265,6 +265,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
|
||||
interface_protocol == XBONE_IFACE_PROTOCOL) {
|
||||
|
||||
static const int SUPPORTED_VENDORS[] = {
|
||||
0x03f0, /* HP */
|
||||
0x044f, /* Thrustmaster */
|
||||
0x045e, /* Microsoft */
|
||||
0x0738, /* Mad Catz */
|
||||
@@ -1436,6 +1437,12 @@ static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
device->updating = SDL_FALSE;
|
||||
SDL_UnlockMutex(device->dev_lock);
|
||||
|
||||
/* UpdateDevice() may have called HIDAPI_JoystickDisconnected() if the device went away */
|
||||
if (device->num_joysticks == 0) {
|
||||
SDL_free(hwdata);
|
||||
return SDL_SetError("HIDAPI device disconnected while opening");
|
||||
}
|
||||
|
||||
if (!device->driver->OpenJoystick(device, joystick)) {
|
||||
/* The open failed, mark this device as disconnected and update devices */
|
||||
HIDAPI_JoystickDisconnected(device, joystickID);
|
||||
|
||||
@@ -663,6 +663,10 @@ static void SDLCALL SDL_AppleTVRemoteRotationHintChanged(void *udata, const char
|
||||
|
||||
static int IOS_JoystickInit(void)
|
||||
{
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__MACOSX__)
|
||||
#if _SDL_HAS_BUILTIN(__builtin_available)
|
||||
if (@available(macOS 10.16, *)) {
|
||||
@@ -1680,6 +1684,10 @@ static SDL_bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMappi
|
||||
#if defined(SDL_JOYSTICK_MFI) && defined(__MACOSX__)
|
||||
SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
|
||||
{
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (@available(macOS 10.16, *)) {
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
|
||||
|
||||
@@ -52,7 +52,8 @@
|
||||
#define USB_VENDOR_VALVE 0x28de
|
||||
#define USB_VENDOR_ZEROPLUS 0x0c12
|
||||
|
||||
#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER 0x2002
|
||||
#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 0x2002 /* Ultimate Wired Controller for Xbox */
|
||||
#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER2 0x3106 /* Ultimate Wireless / Pro 2 Wired Controller */
|
||||
#define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419
|
||||
#define USB_PRODUCT_ASTRO_C40_XBOX360 0x0024
|
||||
#define USB_PRODUCT_BACKBONE_ONE_IOS 0x0103
|
||||
|
||||
@@ -453,7 +453,6 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta
|
||||
char *hidPath = NULL;
|
||||
char *name = NULL;
|
||||
LPDIRECTINPUTDEVICE8 device = NULL;
|
||||
DIDEVCAPS caps;
|
||||
|
||||
/* We are only supporting HID devices. */
|
||||
CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID);
|
||||
@@ -463,13 +462,6 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta
|
||||
CHECK(QueryDevicePath(device, &hidPath));
|
||||
CHECK(QueryDeviceInfo(device, &vendor, &product));
|
||||
|
||||
/* Check to make sure the device has buttons and axes.
|
||||
* This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10
|
||||
*/
|
||||
caps.dwSize = sizeof(caps);
|
||||
CHECK(SUCCEEDED(IDirectInputDevice8_GetCapabilities(device, &caps)));
|
||||
CHECK(caps.dwAxes > 0 && caps.dwButtons > 0);
|
||||
|
||||
CHECK(!SDL_IsXInputDevice(vendor, product, hidPath));
|
||||
|
||||
pNewJoystick = *(JoyStick_DeviceData **)pContext;
|
||||
|
||||
@@ -988,7 +988,8 @@ static void RAWINPUT_DetectDevices(void)
|
||||
|
||||
devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count);
|
||||
if (devices) {
|
||||
if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) != -1) {
|
||||
device_count = GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST));
|
||||
if (device_count != (UINT)-1) {
|
||||
for (i = 0; i < device_count; ++i) {
|
||||
RAWINPUT_AddDevice(devices[i].hDevice);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,8 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (GetRawInputDeviceList(raw_devices, &raw_device_count, sizeof(RAWINPUTDEVICELIST)) == -1) {
|
||||
raw_device_count = GetRawInputDeviceList(raw_devices, &raw_device_count, sizeof(RAWINPUTDEVICELIST));
|
||||
if (raw_device_count == (UINT)-1) {
|
||||
SDL_free(raw_devices);
|
||||
raw_devices = NULL;
|
||||
return SDL_FALSE; /* oh well. */
|
||||
|
||||
@@ -134,7 +134,8 @@ static void GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) {
|
||||
device_count = GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST));
|
||||
if (device_count == (UINT)-1) {
|
||||
SDL_free(devices);
|
||||
return; /* oh well. */
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,28,4,0
|
||||
PRODUCTVERSION 2,28,4,0
|
||||
FILEVERSION 2,28,5,0
|
||||
PRODUCTVERSION 2,28,5,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 28, 4, 0\0"
|
||||
VALUE "FileVersion", "2, 28, 5, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2023 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 28, 4, 0\0"
|
||||
VALUE "ProductVersion", "2, 28, 5, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -980,8 +980,12 @@ static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
static void SW_DestroyRenderer(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Window *window = renderer->window;
|
||||
SW_RenderData *data = (SW_RenderData *)renderer->driverdata;
|
||||
|
||||
if (window) {
|
||||
SDL_DestroyWindowSurface(window);
|
||||
}
|
||||
SDL_free(data);
|
||||
SDL_free(renderer);
|
||||
}
|
||||
@@ -1035,8 +1039,6 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
|
||||
renderer->info = SW_RenderDriver.info;
|
||||
renderer->driverdata = data;
|
||||
|
||||
SW_ActivateRenderer(renderer);
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
||||
@@ -339,12 +339,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
if (is_uniform) {
|
||||
Uint32 color;
|
||||
if (tmp) {
|
||||
if (dst->format->Amask) {
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
} else {
|
||||
// color = SDL_MapRGB(tmp->format, c0.r, c0.g, c0.b);
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
}
|
||||
color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);
|
||||
} else {
|
||||
color = SDL_MapRGBA(dst->format, c0.r, c0.g, c0.b, c0.a);
|
||||
}
|
||||
@@ -789,15 +784,20 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (FORMAT_HAS_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA);
|
||||
} else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB);
|
||||
dstA = 0xFF;
|
||||
if ((flags & (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL))) {
|
||||
if (FORMAT_HAS_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA);
|
||||
} else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB);
|
||||
dstA = 0xFF;
|
||||
} else {
|
||||
/* SDL_PIXELFORMAT_ARGB2101010 */
|
||||
dstpixel = *((Uint32 *) (dst));
|
||||
RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA);
|
||||
}
|
||||
} else {
|
||||
/* SDL_PIXELFORMAT_ARGB2101010 */
|
||||
dstpixel = *((Uint32 *)(dst));
|
||||
RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA);
|
||||
/* don't care */
|
||||
dstR = dstG = dstB = dstA = 0;
|
||||
}
|
||||
|
||||
if (!is_uniform) {
|
||||
|
||||
@@ -1114,6 +1114,39 @@ int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
|
||||
return vsscanf(text, fmt, ap);
|
||||
}
|
||||
#else
|
||||
static SDL_bool CharacterMatchesSet(char c, const char *set, size_t set_len)
|
||||
{
|
||||
SDL_bool invert = SDL_FALSE;
|
||||
SDL_bool result = SDL_FALSE;
|
||||
|
||||
if (*set == '^') {
|
||||
invert = SDL_TRUE;
|
||||
++set;
|
||||
--set_len;
|
||||
}
|
||||
while (set_len > 0 && !result) {
|
||||
if (set_len >= 3 && set[1] == '-') {
|
||||
char low_char = SDL_min(set[0], set[2]);
|
||||
char high_char = SDL_max(set[0], set[2]);
|
||||
if (c >= low_char && c <= high_char) {
|
||||
result = SDL_TRUE;
|
||||
}
|
||||
set += 3;
|
||||
set_len -= 3;
|
||||
} else {
|
||||
if (c == *set) {
|
||||
result = SDL_TRUE;
|
||||
}
|
||||
++set;
|
||||
--set_len;
|
||||
}
|
||||
}
|
||||
if (invert) {
|
||||
result = result ? SDL_FALSE : SDL_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* NOLINTNEXTLINE(readability-non-const-parameter) */
|
||||
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
|
||||
{
|
||||
@@ -1387,6 +1420,44 @@ int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
|
||||
}
|
||||
done = SDL_TRUE;
|
||||
break;
|
||||
case '[':
|
||||
{
|
||||
const char *set = fmt + 1;
|
||||
while (*fmt && *fmt != ']') {
|
||||
++fmt;
|
||||
}
|
||||
if (*fmt) {
|
||||
size_t set_len = (fmt - set);
|
||||
if (suppress) {
|
||||
while (CharacterMatchesSet(*text, set, set_len)) {
|
||||
++text;
|
||||
if (count) {
|
||||
if (--count == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SDL_bool had_match = SDL_FALSE;
|
||||
char *valuep = va_arg(ap, char *);
|
||||
while (CharacterMatchesSet(*text, set, set_len)) {
|
||||
had_match = SDL_TRUE;
|
||||
*valuep++ = *text++;
|
||||
if (count) {
|
||||
if (--count == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*valuep = '\0';
|
||||
if (had_match) {
|
||||
++retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
done = SDL_TRUE;
|
||||
break;
|
||||
default:
|
||||
done = SDL_TRUE;
|
||||
break;
|
||||
@@ -1918,6 +1989,7 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
|
||||
/* Check error code */
|
||||
if (retval < 0) {
|
||||
SDL_free(p);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1939,5 +2011,3 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -471,7 +471,9 @@ char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
|
||||
}
|
||||
|
||||
size = (SDLTest_RandomUint32() % (maxLength + 1));
|
||||
|
||||
if (size == 0) {
|
||||
size = 1;
|
||||
}
|
||||
return SDLTest_RandomAsciiStringOfSize(size);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <timer_alarm.h>
|
||||
#include <kernel_util.h>
|
||||
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_thread.h"
|
||||
@@ -38,11 +38,6 @@ struct SDL_semaphore
|
||||
s32 semid;
|
||||
};
|
||||
|
||||
static void usercb(struct timer_alarm_t *alarm, void *arg)
|
||||
{
|
||||
iReleaseWaitThread((int)arg);
|
||||
}
|
||||
|
||||
/* Create a semaphore */
|
||||
SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
|
||||
{
|
||||
@@ -85,8 +80,8 @@ void SDL_DestroySemaphore(SDL_sem *sem)
|
||||
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
{
|
||||
int ret;
|
||||
struct timer_alarm_t alarm;
|
||||
InitializeTimerAlarm(&alarm);
|
||||
u64 timeout_usec;
|
||||
u64 *timeout_ptr;
|
||||
|
||||
if (sem == NULL) {
|
||||
return SDL_InvalidParamError("sem");
|
||||
@@ -99,12 +94,14 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
timeout_ptr = NULL;
|
||||
|
||||
if (timeout != SDL_MUTEX_MAXWAIT) {
|
||||
SetTimerAlarm(&alarm, MSec2TimerBusClock(timeout), &usercb, (void *)GetThreadId());
|
||||
timeout_usec = timeout * 1000;
|
||||
timeout_ptr = &timeout_usec;
|
||||
}
|
||||
|
||||
ret = WaitSema(sem->semid);
|
||||
StopTimerAlarm(&alarm);
|
||||
ret = WaitSemaEx(sem->semid, 1, timeout_ptr);
|
||||
|
||||
if (ret < 0) {
|
||||
return SDL_MUTEX_TIMEDOUT;
|
||||
|
||||
@@ -106,15 +106,20 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (FORMAT_HAS_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA);
|
||||
} else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB);
|
||||
dstA = 0xFF;
|
||||
if ((flags & (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL))) {
|
||||
if (FORMAT_HAS_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA);
|
||||
} else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) {
|
||||
DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB);
|
||||
dstA = 0xFF;
|
||||
} else {
|
||||
/* SDL_PIXELFORMAT_ARGB2101010 */
|
||||
dstpixel = *((Uint32 *) (dst));
|
||||
RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA);
|
||||
}
|
||||
} else {
|
||||
/* SDL_PIXELFORMAT_ARGB2101010 */
|
||||
dstpixel = *((Uint32 *)(dst));
|
||||
RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA);
|
||||
/* don't care */
|
||||
dstR = dstG = dstB = dstA = 0;
|
||||
}
|
||||
|
||||
if (flags & SDL_COPY_MODULATE_COLOR) {
|
||||
|
||||
@@ -825,6 +825,9 @@ void SDL_SetCurrentDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode
|
||||
|
||||
void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
|
||||
{
|
||||
if (display->desktop_mode.driverdata) {
|
||||
SDL_free(display->desktop_mode.driverdata);
|
||||
}
|
||||
SDL_memcpy(&display->desktop_mode, mode, sizeof(*mode));
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ static void android_egl_context_restore(SDL_Window *window)
|
||||
if (window) {
|
||||
SDL_Event event;
|
||||
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
|
||||
SDL_GL_MakeCurrent(window, NULL);
|
||||
if (SDL_GL_MakeCurrent(window, (SDL_GLContext)data->egl_context) < 0) {
|
||||
/* The context is no longer valid, create a new one */
|
||||
data->egl_context = (EGLContext)SDL_GL_CreateContext(window);
|
||||
|
||||
@@ -2534,6 +2534,10 @@ static void lock_pointer_to_window(SDL_Window *window,
|
||||
SDL_VideoData *d = input->display;
|
||||
struct zwp_locked_pointer_v1 *locked_pointer;
|
||||
|
||||
if (!d->pointer_constraints || !input->pointer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (w->locked_pointer) {
|
||||
return;
|
||||
}
|
||||
@@ -2621,8 +2625,10 @@ int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input)
|
||||
w->locked_pointer = NULL;
|
||||
}
|
||||
|
||||
zwp_relative_pointer_v1_destroy(input->relative_pointer);
|
||||
input->relative_pointer = NULL;
|
||||
if (input->relative_pointer) {
|
||||
zwp_relative_pointer_v1_destroy(input->relative_pointer);
|
||||
input->relative_pointer = NULL;
|
||||
}
|
||||
|
||||
d->relative_mouse_mode = 0;
|
||||
|
||||
|
||||
@@ -1322,21 +1322,15 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
|
||||
/* Create the shell surface and map the toplevel/popup */
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
|
||||
if (data->shell_surface.libdecor.frame) {
|
||||
/* If the frame already exists, just set the visibility. */
|
||||
libdecor_frame_set_visibility(data->shell_surface.libdecor.frame, true);
|
||||
libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, c->classname);
|
||||
data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor,
|
||||
data->surface,
|
||||
&libdecor_frame_interface,
|
||||
data);
|
||||
if (data->shell_surface.libdecor.frame == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to create libdecor frame!");
|
||||
} else {
|
||||
data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor,
|
||||
data->surface,
|
||||
&libdecor_frame_interface,
|
||||
data);
|
||||
if (data->shell_surface.libdecor.frame == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to create libdecor frame!");
|
||||
} else {
|
||||
libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, c->classname);
|
||||
libdecor_frame_map(data->shell_surface.libdecor.frame);
|
||||
}
|
||||
libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, c->classname);
|
||||
libdecor_frame_map(data->shell_surface.libdecor.frame);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
@@ -1540,8 +1534,8 @@ void Wayland_HideWindow(_THIS, SDL_Window *window)
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
|
||||
if (wind->shell_surface.libdecor.frame) {
|
||||
libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, false);
|
||||
libdecor_frame_set_app_id(wind->shell_surface.libdecor.frame, data->classname);
|
||||
libdecor_frame_unref(wind->shell_surface.libdecor.frame);
|
||||
wind->shell_surface.libdecor.frame = NULL;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
|
||||
@@ -1321,9 +1321,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv)
|
||||
|
||||
STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
|
||||
{
|
||||
static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
|
||||
static const GUID SDL_TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } };
|
||||
SDL_VideoData *videodata = (SDL_VideoData *)sink->data;
|
||||
videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
|
||||
videodata->ime_candlistindexbase = WIN_IsEqualGUID(&SDL_TF_PROFILE_DAYI, guidProfile) ? 0 : 1;
|
||||
if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) {
|
||||
IME_InputLangChanged((SDL_VideoData *)sink->data);
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ static int XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int
|
||||
{
|
||||
int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out);
|
||||
if (IsHighLatin1(buffer_return, result)) {
|
||||
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result);
|
||||
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result + 1);
|
||||
if (utf8_text) {
|
||||
SDL_strlcpy(buffer_return, utf8_text, bytes_buffer);
|
||||
SDL_free(utf8_text);
|
||||
|
||||
@@ -330,13 +330,16 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y)
|
||||
Display *display = videodata->display;
|
||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
int deviceid = 0;
|
||||
/* It seems XIWarpPointer() doesn't work correctly on multi-head setups:
|
||||
* https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea
|
||||
*/
|
||||
if (ScreenCount(display) == 1) {
|
||||
X11_XIGetClientPointer(display, None, &deviceid);
|
||||
if (X11_Xinput2IsInitialized()) {
|
||||
/* It seems XIWarpPointer() doesn't work correctly on multi-head setups:
|
||||
* https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea
|
||||
*/
|
||||
if (ScreenCount(display) == 1) {
|
||||
X11_XIGetClientPointer(display, None, &deviceid);
|
||||
}
|
||||
}
|
||||
if (deviceid != 0) {
|
||||
SDL_assert(SDL_X11_HAVE_XINPUT2);
|
||||
X11_XIWarpPointer(display, deviceid, None, xwindow, 0.0, 0.0, 0, 0, (double)x, (double)y);
|
||||
} else
|
||||
#endif
|
||||
@@ -369,14 +372,7 @@ static int X11_WarpMouseGlobal(int x, int y)
|
||||
|
||||
static int X11_SetRelativeMouseMode(SDL_bool enabled)
|
||||
{
|
||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
if (X11_Xinput2IsInitialized()) {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
SDL_Unsupported();
|
||||
#endif
|
||||
return -1;
|
||||
return X11_Xinput2IsInitialized() ? 0 : SDL_Unsupported();
|
||||
}
|
||||
|
||||
static int X11_CaptureMouse(SDL_Window *window)
|
||||
@@ -414,12 +410,9 @@ static Uint32 X11_GetGlobalMouseState(int *x, int *y)
|
||||
|
||||
/* !!! FIXME: should we XSync() here first? */
|
||||
|
||||
#if !SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
videodata->global_mouse_changed = SDL_TRUE;
|
||||
#else
|
||||
if (!SDL_X11_HAVE_XINPUT2)
|
||||
if (!X11_Xinput2IsInitialized()) {
|
||||
videodata->global_mouse_changed = SDL_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check if we have this cached since XInput last saw the mouse move. */
|
||||
/* !!! FIXME: can we just calculate this from XInput's events? */
|
||||
|
||||
@@ -339,7 +339,7 @@ int stdlib_sscanf(void *arg)
|
||||
long long_output, expected_long_output;
|
||||
long long long_long_output, expected_long_long_output;
|
||||
size_t size_output, expected_size_output;
|
||||
char text[128];
|
||||
char text[128], text2[128];
|
||||
|
||||
expected_output = output = 123;
|
||||
expected_result = -1;
|
||||
@@ -403,6 +403,82 @@ int stdlib_sscanf(void *arg)
|
||||
SDLTest_AssertCheck(expected_size_output == size_output, "Check output, expected: %zu, got: %zu", expected_size_output, size_output);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc def", "%s", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc def\", \"%%s\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%s", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%s\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc,def") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%[cba]", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%[cba]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%[a-z]", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%[z-a]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%[^,]", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%[^,]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 0;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%[A-Z]", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%[A-Z]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "") == 0, "Check output, expected: \"\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 2;
|
||||
text[0] = '\0';
|
||||
text2[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%[abc],%[def]", text, text2);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%[abc],%%[def]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(SDL_strcmp(text2, "def") == 0, "Check output, expected: \"def\", got: \"%s\"", text2);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 2;
|
||||
text[0] = '\0';
|
||||
text2[0] = '\0';
|
||||
result = SDL_sscanf("abc,def", "%[abc]%*[,]%[def]", text, text2);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc,def\", \"%%[abc]%%*[,]%%[def]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(SDL_strcmp(text2, "def") == 0, "Check output, expected: \"def\", got: \"%s\"", text2);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 2;
|
||||
text[0] = '\0';
|
||||
text2[0] = '\0';
|
||||
result = SDL_sscanf("abc def", "%[abc] %[def]", text, text2);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc def\", \"%%[abc] %%[def]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc") == 0, "Check output, expected: \"abc\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(SDL_strcmp(text2, "def") == 0, "Check output, expected: \"def\", got: \"%s\"", text2);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
expected_result = 1;
|
||||
text[0] = '\0';
|
||||
result = SDL_sscanf("abc123XYZ", "%[a-zA-Z0-9]", text);
|
||||
SDLTest_AssertPass("Call to SDL_sscanf(\"abc123XYZ\", \"%%[a-zA-Z0-9]\", text)");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, "abc123XYZ") == 0, "Check output, expected: \"abc123XYZ\", got: \"%s\"", text);
|
||||
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user