mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-23 09:11:09 +01:00
Compare commits
18 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9519b9916c | ||
|
|
00494df2f1 | ||
|
|
948196448f | ||
|
|
7ca3d26e7a | ||
|
|
f79d28085d | ||
|
|
74a005f73f | ||
|
|
6f7aa1e755 | ||
|
|
847a6cce96 | ||
|
|
95aed34a69 | ||
|
|
21e0382edd | ||
|
|
0cdfdb9970 | ||
|
|
f75b0aa814 | ||
|
|
403f87340f | ||
|
|
07cfc34a2e | ||
|
|
4222cebef6 | ||
|
|
1e2aa2363b | ||
|
|
0b25cd2196 | ||
|
|
b7457ff61b |
@@ -87,7 +87,7 @@ endif()
|
||||
# See docs/release_checklist.md
|
||||
set(SDL_MAJOR_VERSION 2)
|
||||
set(SDL_MINOR_VERSION 30)
|
||||
set(SDL_MICRO_VERSION 6)
|
||||
set(SDL_MICRO_VERSION 7)
|
||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
@@ -3520,7 +3520,10 @@ if(SDL_TEST)
|
||||
endif()
|
||||
|
||||
if(MSVC AND NOT SDL_LIBC)
|
||||
set(targets SDL2)
|
||||
set(targets )
|
||||
if(TARGET SDL2)
|
||||
list(APPEND targets SDL2)
|
||||
endif()
|
||||
if(TARGET SDL2-static)
|
||||
list(APPEND targets SDL2-static)
|
||||
endif()
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 30
|
||||
MICRO_VERSION = 6
|
||||
MICRO_VERSION = 7
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 30
|
||||
MICRO_VERSION = 6
|
||||
MICRO_VERSION = 7
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
LIBHOME = .
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.30.6</string>
|
||||
<string>2.30.7</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.30.6</string>
|
||||
<string>2.30.7</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -9729,7 +9729,7 @@
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.7.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
@@ -9770,7 +9770,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.30.6;
|
||||
MARKETING_VERSION = 2.30.7;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Release;
|
||||
@@ -9814,7 +9814,7 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.7.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -9856,7 +9856,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_LINK_OBJC_RUNTIME = NO;
|
||||
MARKETING_VERSION = 2.30.6;
|
||||
MARKETING_VERSION = 2.30.7;
|
||||
OTHER_LDFLAGS = "-liconv";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -10063,7 +10063,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.7.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
@@ -10115,7 +10115,7 @@
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.6.0;
|
||||
DYLIB_CURRENT_VERSION = 3001.7.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title SDL 2.30.6
|
||||
Title SDL 2.30.7
|
||||
Version 1
|
||||
Description SDL Library for Mac OS X (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
private static final String TAG = "SDL";
|
||||
private static final int SDL_MAJOR_VERSION = 2;
|
||||
private static final int SDL_MINOR_VERSION = 30;
|
||||
private static final int SDL_MICRO_VERSION = 6;
|
||||
private static final int SDL_MICRO_VERSION = 7;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
||||
2
configure
vendored
2
configure
vendored
@@ -3508,7 +3508,7 @@ orig_CFLAGS="$CFLAGS"
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=30
|
||||
SDL_MICRO_VERSION=6
|
||||
SDL_MICRO_VERSION=7
|
||||
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=30
|
||||
SDL_MICRO_VERSION=6
|
||||
SDL_MICRO_VERSION=7
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef struct SDL_version
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 30
|
||||
#define SDL_PATCHLEVEL 6
|
||||
#define SDL_PATCHLEVEL 7
|
||||
|
||||
/**
|
||||
* Macro to determine SDL version program was compiled against.
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
@@ -632,7 +633,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
|
||||
FILE *fp = fopen(file, mode);
|
||||
#endif
|
||||
if (!fp) {
|
||||
SDL_SetError("Couldn't open %s", file);
|
||||
SDL_SetError("Couldn't open %s: %s", file, strerror(errno));
|
||||
} else if (!IsRegularFileOrPipe(fp)) {
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
|
||||
@@ -395,6 +395,7 @@ static Uint32 initial_wheel_devices[] = {
|
||||
MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */
|
||||
MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan 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, 0x0002), /* Moza R9 Wheelbase */
|
||||
MAKE_VIDPID(0x346e, 0x0004), /* Moza R5 Wheelbase */
|
||||
|
||||
@@ -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, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL
|
||||
{ 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, 0xc121 ), k_eControllerType_PS3Controller, NULL }, //
|
||||
{ MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef struct
|
||||
SDL_HIDAPI_Device *device;
|
||||
SDL_Joystick *joystick;
|
||||
SDL_bool is_shanwan;
|
||||
SDL_bool has_analog_buttons;
|
||||
SDL_bool report_sensors;
|
||||
SDL_bool effects_updated;
|
||||
int player_index;
|
||||
@@ -145,6 +146,7 @@ static SDL_bool HIDAPI_DriverPS3_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
ctx->device = device;
|
||||
ctx->is_shanwan = is_shanwan;
|
||||
ctx->has_analog_buttons = SDL_TRUE;
|
||||
|
||||
device->context = ctx;
|
||||
|
||||
@@ -247,7 +249,10 @@ static SDL_bool HIDAPI_DriverPS3_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = 15;
|
||||
joystick->naxes = 16;
|
||||
joystick->naxes = 6;
|
||||
if (ctx->has_analog_buttons) {
|
||||
joystick->naxes += 10;
|
||||
}
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
|
||||
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);
|
||||
|
||||
/* Buttons are mapped as axes in the order they appear in the button enumeration */
|
||||
{
|
||||
if (ctx->has_analog_buttons) {
|
||||
static int button_axis_offsets[] = {
|
||||
24, /* SDL_CONTROLLER_BUTTON_A */
|
||||
23, /* SDL_CONTROLLER_BUTTON_B */
|
||||
@@ -617,6 +622,11 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_InitDevice(SDL_HIDAPI_Device *device)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -650,8 +660,17 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_OpenJoystick(SDL_HIDAPI_Device *devic
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
joystick->nbuttons = 15;
|
||||
joystick->naxes = 16;
|
||||
joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
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;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
}
|
||||
@@ -762,7 +781,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(SDL_Joystick *joystic
|
||||
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis);
|
||||
|
||||
/* Buttons are mapped as axes in the order they appear in the button enumeration */
|
||||
{
|
||||
if (ctx->has_analog_buttons) {
|
||||
static int button_axis_offsets[] = {
|
||||
12, /* SDL_GAMEPAD_BUTTON_A */
|
||||
11, /* SDL_GAMEPAD_BUTTON_B */
|
||||
@@ -871,9 +890,17 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket19(SDL_Joystick *joystic
|
||||
}
|
||||
}
|
||||
|
||||
axis = ((int)data[17] * 257) - 32768;
|
||||
if (data[0] & 0x40) {
|
||||
axis = 32767;
|
||||
} else {
|
||||
axis = ((int)data[17] * 257) - 32768;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
|
||||
axis = ((int)data[18] * 257) - 32768;
|
||||
if (data[0] & 0x80) {
|
||||
axis = 32767;
|
||||
} else {
|
||||
axis = ((int)data[18] * 257) - 32768;
|
||||
}
|
||||
SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
|
||||
axis = ((int)data[3] * 257) - 32768;
|
||||
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);
|
||||
|
||||
/* Buttons are mapped as axes in the order they appear in the button enumeration */
|
||||
{
|
||||
if (ctx->has_analog_buttons) {
|
||||
static int button_axis_offsets[] = {
|
||||
13, /* SDL_CONTROLLER_BUTTON_A */
|
||||
12, /* SDL_CONTROLLER_BUTTON_B */
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define USB_VENDOR_SONY 0x054c
|
||||
#define USB_VENDOR_THRUSTMASTER 0x044f
|
||||
#define USB_VENDOR_TURTLE_BEACH 0x10f5
|
||||
#define USB_VENDOR_SWITCH 0x2563
|
||||
#define USB_VENDOR_VALVE 0x28de
|
||||
#define USB_VENDOR_ZEROPLUS 0x0c12
|
||||
|
||||
@@ -116,6 +117,7 @@
|
||||
#define USB_PRODUCT_SONY_DS4_STRIKEPAD 0x05c5
|
||||
#define USB_PRODUCT_SONY_DS5 0x0ce6
|
||||
#define USB_PRODUCT_SONY_DS5_EDGE 0x0df2
|
||||
#define USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER 0x0575
|
||||
#define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO 0xd012
|
||||
#define USB_PRODUCT_TURTLE_BEACH_SERIES_X_REACT_R 0x7013
|
||||
#define USB_PRODUCT_TURTLE_BEACH_SERIES_X_RECON 0x7009
|
||||
|
||||
@@ -1290,6 +1290,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
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) {
|
||||
RAWINPUT_JoystickClose(joystick);
|
||||
SDL_stack_free(button_caps);
|
||||
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));
|
||||
if (!ctx->button_indices) {
|
||||
RAWINPUT_JoystickClose(joystick);
|
||||
SDL_stack_free(value_caps);
|
||||
SDL_stack_free(button_caps);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -1342,6 +1345,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
joystick->nbuttons += 1;
|
||||
}
|
||||
|
||||
SDL_stack_free(button_caps);
|
||||
|
||||
for (i = 0; i < caps.NumberInputValueCaps; ++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));
|
||||
if (!ctx->axis_indices) {
|
||||
RAWINPUT_JoystickClose(joystick);
|
||||
SDL_stack_free(value_caps);
|
||||
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));
|
||||
if (!ctx->hat_indices) {
|
||||
RAWINPUT_JoystickClose(joystick);
|
||||
SDL_stack_free(value_caps);
|
||||
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;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,30,6,0
|
||||
PRODUCTVERSION 2,30,6,0
|
||||
FILEVERSION 2,30,7,0
|
||||
PRODUCTVERSION 2,30,7,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 30, 6, 0\0"
|
||||
VALUE "FileVersion", "2, 30, 7, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2024 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 30, 6, 0\0"
|
||||
VALUE "ProductVersion", "2, 30, 7, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -161,7 +161,7 @@ static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
ASensorEvent event;
|
||||
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);
|
||||
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
|
||||
SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data));
|
||||
|
||||
@@ -1529,7 +1529,7 @@ typedef enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_bool left_justify; /* for now: ignored. */
|
||||
SDL_bool left_justify;
|
||||
SDL_bool force_sign;
|
||||
SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */
|
||||
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)
|
||||
{
|
||||
const char fill = (info && info->pad_zeroes) ? '0' : ' ';
|
||||
size_t width = 0;
|
||||
size_t filllen = 0;
|
||||
size_t length = 0;
|
||||
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);
|
||||
if (info && info->width > 0 && (size_t)info->width > sz) {
|
||||
const char fill = info->pad_zeroes ? '0' : ' ';
|
||||
size_t width = info->width - sz;
|
||||
size_t filllen;
|
||||
|
||||
width = info->width - sz;
|
||||
if (info->precision >= 0 && (size_t)info->precision < sz) {
|
||||
width += sz - (size_t)info->precision;
|
||||
}
|
||||
|
||||
filllen = SDL_min(width, maxlen);
|
||||
SDL_memset(text, fill, filllen);
|
||||
text += filllen;
|
||||
maxlen -= filllen;
|
||||
length += width;
|
||||
if (!info->left_justify) {
|
||||
SDL_memset(text, fill, filllen);
|
||||
text += filllen;
|
||||
maxlen -= filllen;
|
||||
length += width;
|
||||
filllen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_strlcpy(text, string, maxlen);
|
||||
length += sz;
|
||||
|
||||
if (filllen > 0) {
|
||||
SDL_memset(text + sz, fill, filllen);
|
||||
length += width;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
if (info->precision >= 0 && (size_t)info->precision < sz) {
|
||||
slen = (size_t)info->precision;
|
||||
|
||||
@@ -3303,6 +3303,9 @@ void SDL_DestroyWindow(SDL_Window *window)
|
||||
if (SDL_GetKeyboardFocus() == window) {
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
}
|
||||
if ((window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
|
||||
SDL_UpdateMouseCapture(SDL_TRUE);
|
||||
}
|
||||
if (SDL_GetMouseFocus() == window) {
|
||||
SDL_SetMouseFocus(NULL);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
WaitPageflip at the beginning of this function will be a no-op.
|
||||
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. */
|
||||
if (windata->double_buffer) {
|
||||
if (!KMSDRM_WaitPageflip(_this, windata)) {
|
||||
|
||||
@@ -97,7 +97,7 @@ static int get_driindex(void)
|
||||
|
||||
SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname,
|
||||
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,
|
||||
kmsdrm_dri_devnamesize) == 0) {
|
||||
SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize,
|
||||
@@ -123,7 +123,7 @@ static int get_driindex(void)
|
||||
resources->count_encoders > 0 &&
|
||||
resources->count_crtcs > 0) {
|
||||
available = -ENOENT;
|
||||
for (i = 0; i < resources->count_connectors; i++) {
|
||||
for (i = 0; i < resources->count_connectors && available < 0; i++) {
|
||||
drmModeConnector *conn =
|
||||
KMSDRM_drmModeGetConnector(
|
||||
drm_fd, resources->connectors[i]);
|
||||
@@ -134,20 +134,21 @@ static int get_driindex(void)
|
||||
|
||||
if (conn->connection == DRM_MODE_CONNECTED &&
|
||||
conn->count_modes) {
|
||||
SDL_bool access_denied = SDL_FALSE;
|
||||
if (SDL_GetHintBoolean(
|
||||
SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER,
|
||||
SDL_TRUE)) {
|
||||
/* Skip this device if we can't obtain
|
||||
* DRM master */
|
||||
KMSDRM_drmSetMaster(drm_fd);
|
||||
if (KMSDRM_drmAuthMagic(drm_fd, 0) ==
|
||||
-EACCES) {
|
||||
continue;
|
||||
if (KMSDRM_drmAuthMagic(drm_fd, 0) == -EACCES) {
|
||||
access_denied = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
available = devindex;
|
||||
break;
|
||||
if (!access_denied) {
|
||||
available = devindex;
|
||||
}
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeConnector(conn);
|
||||
@@ -158,11 +159,10 @@ static int get_driindex(void)
|
||||
SDL_KMSDRM_UnloadSymbols();
|
||||
}
|
||||
close(drm_fd);
|
||||
} else {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO,
|
||||
"Failed to open KMSDRM device %s, errno: %d\n", device, errno);
|
||||
}
|
||||
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO,
|
||||
"Failed to open KMSDRM device %s, errno: %d\n", device,
|
||||
errno);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,15 +380,9 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
|
||||
ret = KMSDRM_drmModeAddFB2WithModifiers(viddata->drm_fd, w, h, format, handles, strides, offsets, modifiers, &fb_info->fb_id, flags);
|
||||
|
||||
if (ret) {
|
||||
handles[0] = KMSDRM_gbm_bo_get_handle(bo).u32;
|
||||
strides[0] = KMSDRM_gbm_bo_get_stride(bo);
|
||||
offsets[0] = 0;
|
||||
for (int i = 1; i<4; i++) {
|
||||
handles[i] = 0;
|
||||
strides[i] = 0;
|
||||
offsets[i] = 0;
|
||||
}
|
||||
ret = KMSDRM_drmModeAddFB2(viddata->drm_fd, w, h, format, handles, strides, offsets, &fb_info->fb_id, 0);
|
||||
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) {
|
||||
@@ -1478,6 +1472,12 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
|
||||
windata->viddata = viddata;
|
||||
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. */
|
||||
|
||||
/* Maybe you didn't ask for an OPENGL window, but that's what you will get.
|
||||
@@ -1583,7 +1583,12 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
|
||||
SDL_SetKeyboardFocus(window);
|
||||
|
||||
/* 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,
|
||||
and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow()
|
||||
|
||||
@@ -70,8 +70,8 @@ void VITA_InitTouch(void)
|
||||
}
|
||||
|
||||
// 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_INDIRECT_ABSOLUTE, "Back");
|
||||
SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_DIRECT, "Front");
|
||||
SDL_AddTouch((SDL_TouchID)2, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back");
|
||||
}
|
||||
|
||||
void VITA_QuitTouch(void)
|
||||
|
||||
@@ -595,6 +595,7 @@ static void Wayland_WarpMouse(SDL_Window *window, int x, int y)
|
||||
Wayland_input_lock_pointer(input);
|
||||
input->relative_mode_override = SDL_TRUE;
|
||||
}
|
||||
SDL_SendMouseMotion(window, 0, 0, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
/* FIXME: Find a better place to put this... */
|
||||
static Cursor x11_empty_cursor = None;
|
||||
static SDL_bool x11_cursor_visible = SDL_TRUE;
|
||||
|
||||
static Display *GetDisplay(void)
|
||||
{
|
||||
@@ -298,6 +299,8 @@ static int X11_ShowCursor(SDL_Cursor *cursor)
|
||||
Display *display = GetDisplay();
|
||||
SDL_Window *window;
|
||||
|
||||
x11_cursor_visible = !!cursor;
|
||||
|
||||
for (window = video->windows; window; window = window->next) {
|
||||
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
|
||||
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;
|
||||
Display *display = videodata->display;
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2
|
||||
int deviceid = 0;
|
||||
#endif
|
||||
SDL_bool warp_hack = SDL_FALSE;
|
||||
|
||||
/* XWayland will only warp the cursor if it is hidden, so this workaround is required. */
|
||||
if (videodata->is_xwayland && mouse && mouse->cursor_shown) {
|
||||
if (videodata->is_xwayland && x11_cursor_visible) {
|
||||
warp_hack = SDL_TRUE;
|
||||
}
|
||||
|
||||
@@ -490,5 +494,3 @@ void X11_QuitMouse(_THIS)
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -62,6 +62,18 @@ int stdlib_snprintf(void *arg)
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
|
||||
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result);
|
||||
|
||||
result = SDL_snprintf(text, sizeof(text), "%10sA", "foo");
|
||||
expected = " fooA";
|
||||
SDLTest_AssertPass("Call to SDL_snprintf(\"%%10sA\", \"foo\")");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
|
||||
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result);
|
||||
|
||||
result = SDL_snprintf(text, sizeof(text), "%-10sA", "foo");
|
||||
expected = "foo A";
|
||||
SDLTest_AssertPass("Call to SDL_snprintf(\"%%-10sA\", \"foo\")");
|
||||
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
|
||||
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result);
|
||||
|
||||
result = SDL_snprintf(text, sizeof(text), "%S", L"foo");
|
||||
expected = "foo";
|
||||
SDLTest_AssertPass("Call to SDL_snprintf(\"%%S\", \"foo\")");
|
||||
|
||||
Reference in New Issue
Block a user