mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-23 09:11:09 +01:00
Compare commits
48 Commits
prerelease
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f070c83a60 | ||
|
|
d992d4f23e | ||
|
|
81975cc2d0 | ||
|
|
278c78e34c | ||
|
|
2462262e0c | ||
|
|
162f8e6ee7 | ||
|
|
d0f8e63ed6 | ||
|
|
690e2f21f2 | ||
|
|
52176e25e1 | ||
|
|
40698ee33c | ||
|
|
6b5610752b | ||
|
|
2d86b4ef76 | ||
|
|
f17058b562 | ||
|
|
2879f2aeba | ||
|
|
45c7d838d4 | ||
|
|
79373c5a5c | ||
|
|
f4080637c4 | ||
|
|
92057e683e | ||
|
|
5edd6846db | ||
|
|
859cb13ef8 | ||
|
|
b97d2ed6c5 | ||
|
|
c76a31341c | ||
|
|
00731eb011 | ||
|
|
bf70a37606 | ||
|
|
da1bddd27c | ||
|
|
9925ee52d7 | ||
|
|
66620bd108 | ||
|
|
72823dd0cd | ||
|
|
479e972e56 | ||
|
|
3bf150e900 | ||
|
|
a8dd7a10fa | ||
|
|
0bfeed061b | ||
|
|
d167cd6715 | ||
|
|
8b20b568b0 | ||
|
|
8ae46a49ea | ||
|
|
802c624ab3 | ||
|
|
3bc4bad8fb | ||
|
|
fe396e306e | ||
|
|
509939b1b6 | ||
|
|
ff99e56d3a | ||
|
|
da9ba3a2a1 | ||
|
|
ea4ea27a59 | ||
|
|
81479d8784 | ||
|
|
6dc96aa745 | ||
|
|
16824865c2 | ||
|
|
3e70553c48 | ||
|
|
9209942949 | ||
|
|
769ae185d6 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,7 +15,7 @@ build
|
||||
gen
|
||||
Build
|
||||
buildbot
|
||||
/VERSION
|
||||
/VERSION.txt
|
||||
|
||||
*.so
|
||||
*.so.*
|
||||
|
||||
@@ -85,8 +85,8 @@ endif()
|
||||
|
||||
# See docs/release_checklist.md
|
||||
set(SDL_MAJOR_VERSION 2)
|
||||
set(SDL_MINOR_VERSION 25)
|
||||
set(SDL_MICRO_VERSION 1)
|
||||
set(SDL_MINOR_VERSION 26)
|
||||
set(SDL_MICRO_VERSION 2)
|
||||
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
|
||||
|
||||
# Set defaults preventing destination file conflicts
|
||||
@@ -1045,7 +1045,7 @@ if(SDL_LIBC)
|
||||
bsearch qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat
|
||||
_strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r
|
||||
itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
|
||||
atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
|
||||
atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr
|
||||
wcscmp _wcsdup wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr
|
||||
wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp
|
||||
sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 _Exit
|
||||
@@ -2960,8 +2960,9 @@ set(EXTRA_CFLAGS ${_EXTRA_CFLAGS})
|
||||
|
||||
# Compat helpers for the configuration files
|
||||
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION")
|
||||
file(READ "${PROJECT_SOURCE_DIR}/VERSION" SDL_SOURCE_VERSION)
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION.txt")
|
||||
file(READ "${PROJECT_SOURCE_DIR}/VERSION.txt" SDL_SOURCE_VERSION)
|
||||
string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION)
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
@@ -3240,11 +3241,10 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
|
||||
target_link_libraries(SDL2main PRIVATE shell32)
|
||||
endif()
|
||||
if(MINGW OR CYGWIN)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
target_link_options(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=_WinMain@16>")
|
||||
target_link_libraries(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=_WinMain@16>")
|
||||
else()
|
||||
target_link_options(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=WinMain>")
|
||||
target_link_libraries(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=WinMain>")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT ANDROID)
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 25
|
||||
MICRO_VERSION = 1
|
||||
MINOR_VERSION = 26
|
||||
MICRO_VERSION = 2
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
DESCRIPTION = Simple DirectMedia Layer 2
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
LIBNAME = SDL2
|
||||
MAJOR_VERSION = 2
|
||||
MINOR_VERSION = 25
|
||||
MICRO_VERSION = 1
|
||||
MINOR_VERSION = 26
|
||||
MICRO_VERSION = 2
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
|
||||
|
||||
LIBHOME = .
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.25.1</string>
|
||||
<string>2.26.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.25.1</string>
|
||||
<string>2.26.2</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -9528,8 +9528,8 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2502.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2502.0.0;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2601.2.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
@@ -9613,8 +9613,8 @@
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2502.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2502.0.0;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2601.2.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -9862,8 +9862,8 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 2502.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2502.0.0;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2601.2.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
@@ -9914,8 +9914,8 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 2502.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2502.0.0;
|
||||
DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
|
||||
DYLIB_CURRENT_VERSION = 2601.2.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
|
||||
@@ -60,8 +60,8 @@ import java.util.Locale;
|
||||
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
||||
private static final String TAG = "SDL";
|
||||
private static final int SDL_MAJOR_VERSION = 2;
|
||||
private static final int SDL_MINOR_VERSION = 25;
|
||||
private static final int SDL_MICRO_VERSION = 1;
|
||||
private static final int SDL_MINOR_VERSION = 26;
|
||||
private static final int SDL_MICRO_VERSION = 2;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
SDL_ROOT=$(dirname $0)/..
|
||||
cd $SDL_ROOT
|
||||
|
||||
if [ -e ./VERSION ]; then
|
||||
cat ./VERSION
|
||||
if [ -e ./VERSION.txt ]; then
|
||||
cat ./VERSION.txt
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ done
|
||||
rev=`sh showrev.sh 2>/dev/null`
|
||||
if [ "$rev" != "" ]; then
|
||||
if [ -n "$dist" ]; then
|
||||
echo "$rev" > "$outdir/VERSION"
|
||||
echo "$rev" > "$outdir/VERSION.txt"
|
||||
fi
|
||||
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
|
||||
if [ -n "$vendor" ]; then
|
||||
|
||||
@@ -400,6 +400,7 @@ endmacro()
|
||||
# - SDL_X11_SHARED opt
|
||||
# - HAVE_SDL_LOADSO opt
|
||||
macro(CheckX11)
|
||||
cmake_push_check_state(RESET)
|
||||
if(SDL_X11)
|
||||
foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss)
|
||||
FindLibraryAndSONAME("${_LIB}")
|
||||
@@ -422,6 +423,7 @@ macro(CheckX11)
|
||||
|
||||
if(X_INCLUDEDIR)
|
||||
list(APPEND EXTRA_CFLAGS "-I${X_INCLUDEDIR}")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${X_INCLUDEDIR})
|
||||
endif()
|
||||
|
||||
find_file(HAVE_XCURSOR_H NAMES "X11/Xcursor/Xcursor.h" HINTS "${X_INCLUDEDIR}")
|
||||
@@ -597,6 +599,7 @@ macro(CheckX11)
|
||||
# Prevent Mesa from including X11 headers
|
||||
list(APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11")
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
endmacro()
|
||||
|
||||
macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL)
|
||||
|
||||
10
configure
vendored
10
configure
vendored
@@ -3453,8 +3453,8 @@ orig_CFLAGS="$CFLAGS"
|
||||
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=25
|
||||
SDL_MICRO_VERSION=1
|
||||
SDL_MINOR_VERSION=26
|
||||
SDL_MICRO_VERSION=2
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
@@ -19535,6 +19535,12 @@ if test "x$ac_cv_func_strncasecmp" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr"
|
||||
if test "x$ac_cv_func_strcasestr" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_STRCASESTR 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_func "$LINENO" "vsscanf" "ac_cv_func_vsscanf"
|
||||
if test "x$ac_cv_func_vsscanf" = xyes
|
||||
|
||||
@@ -12,8 +12,8 @@ orig_CFLAGS="$CFLAGS"
|
||||
dnl Set various version strings - taken gratefully from the GTk sources
|
||||
# See docs/release_checklist.md
|
||||
SDL_MAJOR_VERSION=2
|
||||
SDL_MINOR_VERSION=25
|
||||
SDL_MICRO_VERSION=1
|
||||
SDL_MINOR_VERSION=26
|
||||
SDL_MICRO_VERSION=2
|
||||
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
|
||||
|
||||
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
|
||||
@@ -348,7 +348,7 @@ dnl Checks for library functions.
|
||||
AC_DEFINE(HAVE_MPROTECT, 1, [ ])
|
||||
],[]),
|
||||
)
|
||||
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit)
|
||||
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit)
|
||||
|
||||
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
||||
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
#cmakedefine HAVE_STRCASECMP 1
|
||||
#cmakedefine HAVE__STRNICMP 1
|
||||
#cmakedefine HAVE_STRNCASECMP 1
|
||||
#cmakedefine HAVE_STRCASESTR 1
|
||||
#cmakedefine HAVE_SSCANF 1
|
||||
#cmakedefine HAVE_VSSCANF 1
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
@@ -538,7 +539,7 @@
|
||||
#cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@
|
||||
#cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
|
||||
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
#undef HAVE_STRCASECMP
|
||||
#undef HAVE__STRNICMP
|
||||
#undef HAVE_STRNCASECMP
|
||||
#undef HAVE_STRCASESTR
|
||||
#undef HAVE_SSCANF
|
||||
#undef HAVE_VSSCANF
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_STRCASESTR 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_ACOS 1
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_STRCASESTR 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_STRCASESTR 1
|
||||
#define HAVE_VSSCANF 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
#define HAVE_M_PI 1
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDDEF_H 1
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
|
||||
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
/* This is a set of defines to configure the SDL features */
|
||||
|
||||
#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
|
||||
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
|
||||
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
|
||||
@@ -142,7 +142,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn,
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#endif
|
||||
|
||||
#elif defined(__OS2__)
|
||||
@@ -175,7 +175,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz
|
||||
#undef SDL_CreateThread
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#undef SDL_CreateThreadWithStackSize
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#else
|
||||
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread)
|
||||
|
||||
@@ -58,8 +58,8 @@ typedef struct SDL_version
|
||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||
*/
|
||||
#define SDL_MAJOR_VERSION 2
|
||||
#define SDL_MINOR_VERSION 25
|
||||
#define SDL_PATCHLEVEL 1
|
||||
#define SDL_MINOR_VERSION 26
|
||||
#define SDL_PATCHLEVEL 2
|
||||
|
||||
/**
|
||||
* Macro to determine SDL version program was compiled against.
|
||||
|
||||
@@ -19,11 +19,6 @@ if test $# -eq 0; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "sdl2-config: This script is deprecated" >&2
|
||||
echo "sdl2-config: In Autotools builds, use PKG_CHECK_MODULES([SDL], [sdl2 >= 2.x.y])" >&2
|
||||
echo "sdl2-config: In CMake builds, use find_package(SDL2 CONFIG)" >&2
|
||||
echo "sdl2-config: In other build systems, look for 'sdl2' with pkg-config(1) or pkgconf(1)" >&2
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
|
||||
3
sdl2.m4
3
sdl2.m4
@@ -10,7 +10,7 @@
|
||||
# * removed HP/UX 9 support.
|
||||
# * updated for newer autoconf.
|
||||
|
||||
# serial 3
|
||||
# serial 2
|
||||
|
||||
dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
@@ -19,7 +19,6 @@ AC_DEFUN([AM_PATH_SDL2],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl2-config script
|
||||
dnl
|
||||
AC_MSG_WARN([[$0 is deprecated, please use PKG_CHECK_MODULES([SDL], [sdl2 >= MINIMUM_VERSION]) instead]])
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
|
||||
10
src/SDL.c
10
src/SDL.c
@@ -519,13 +519,21 @@ SDL_Quit(void)
|
||||
void
|
||||
SDL_GetVersion(SDL_version * ver)
|
||||
{
|
||||
static SDL_bool check_hint = SDL_TRUE;
|
||||
static SDL_bool legacy_version = SDL_FALSE;
|
||||
|
||||
if (!ver) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_VERSION(ver);
|
||||
|
||||
if (SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE)) {
|
||||
if (check_hint) {
|
||||
check_hint = SDL_FALSE;
|
||||
legacy_version = SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE);
|
||||
}
|
||||
|
||||
if (legacy_version) {
|
||||
/* Prior to SDL 2.24.0, the patch version was incremented with every release */
|
||||
ver->patch = ver->minor;
|
||||
ver->minor = 0;
|
||||
|
||||
@@ -202,7 +202,6 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
|
||||
typedef float ResampleFloatType;
|
||||
|
||||
const ResampleFloatType finrate = (ResampleFloatType) inrate;
|
||||
const ResampleFloatType outtimeincr = ((ResampleFloatType) 1.0f) / ((ResampleFloatType) outrate);
|
||||
const ResampleFloatType ratio = ((float) outrate) / ((float) inrate);
|
||||
const int paddinglen = ResamplerPadding(inrate, outrate);
|
||||
const int framelen = chans * (int)sizeof (float);
|
||||
@@ -247,7 +246,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
|
||||
*(dst++) = outsample;
|
||||
}
|
||||
|
||||
outtime = outtimeincr * i;
|
||||
outtime = ((ResampleFloatType) i) / ((ResampleFloatType) outrate);
|
||||
}
|
||||
|
||||
return outframes * chans * sizeof (float);
|
||||
|
||||
@@ -189,14 +189,14 @@ SDL_WasapiDeviceEventHandler::OnEnumerationCompleted(DeviceWatcher^ sender, Plat
|
||||
void
|
||||
SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args)
|
||||
{
|
||||
SDL_assert(this->iscapture);
|
||||
SDL_assert(!this->iscapture);
|
||||
SDL_AtomicAdd(&SDL_IMMDevice_DefaultPlaybackGeneration, 1);
|
||||
}
|
||||
|
||||
void
|
||||
SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args)
|
||||
{
|
||||
SDL_assert(!this->iscapture);
|
||||
SDL_assert(this->iscapture);
|
||||
SDL_AtomicAdd(&SDL_IMMDevice_DefaultCaptureGeneration, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue)
|
||||
&GDK_GlobalTaskQueue
|
||||
);
|
||||
if (FAILED(hr)) {
|
||||
SDL_SetError("[GDK] Could not create global task queue");
|
||||
return -1;
|
||||
return SDL_SetError("[GDK] Could not create global task queue");
|
||||
}
|
||||
|
||||
/* The initial call gets the non-duplicated handle so they can clean it up */
|
||||
@@ -51,8 +50,7 @@ SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue)
|
||||
} else {
|
||||
/* Duplicate the global task queue handle into outTaskQueue */
|
||||
if (FAILED(XTaskQueueDuplicateHandle(GDK_GlobalTaskQueue, outTaskQueue))) {
|
||||
SDL_SetError("[GDK] Unable to acquire global task queue");
|
||||
return -1;
|
||||
return SDL_SetError("[GDK] Unable to acquire global task queue");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ LoadDBUSSyms(void)
|
||||
SDL_DBUS_SYM(connection_send);
|
||||
SDL_DBUS_SYM(connection_send_with_reply_and_block);
|
||||
SDL_DBUS_SYM(connection_close);
|
||||
SDL_DBUS_SYM(connection_ref);
|
||||
SDL_DBUS_SYM(connection_unref);
|
||||
SDL_DBUS_SYM(connection_flush);
|
||||
SDL_DBUS_SYM(connection_read_write);
|
||||
|
||||
@@ -46,6 +46,7 @@ typedef struct SDL_DBusContext {
|
||||
dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);
|
||||
DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *);
|
||||
void (*connection_close)(DBusConnection *);
|
||||
void (*connection_ref)(DBusConnection *);
|
||||
void (*connection_unref)(DBusConnection *);
|
||||
void (*connection_flush)(DBusConnection *);
|
||||
dbus_bool_t (*connection_read_write)(DBusConnection *, int);
|
||||
|
||||
@@ -477,6 +477,9 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
|
||||
result = SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, IBUS_PATH, ibus_interface, "CreateInputContext",
|
||||
DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
|
||||
} else {
|
||||
/* re-using dbus->session_conn */
|
||||
dbus->connection_ref(ibus_conn);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
|
||||
@@ -545,6 +545,10 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
|
||||
SDL_UDEV_CallbackList *item;
|
||||
SDL_UDEV_CallbackList *prev = NULL;
|
||||
|
||||
if (_this == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (item = _this->first; item != NULL; item = item->next) {
|
||||
/* found it, remove it. */
|
||||
if (item->callback == cb) {
|
||||
|
||||
@@ -133,10 +133,13 @@ using namespace XInputOnGameInput;
|
||||
#ifndef BATTERY_DEVTYPE_GAMEPAD
|
||||
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||
#endif
|
||||
|
||||
#ifndef BATTERY_TYPE_DISCONNECTED
|
||||
#define BATTERY_TYPE_DISCONNECTED 0x00
|
||||
#endif
|
||||
#ifndef BATTERY_TYPE_WIRED
|
||||
#define BATTERY_TYPE_WIRED 0x01
|
||||
#endif
|
||||
|
||||
#ifndef BATTERY_TYPE_UNKNOWN
|
||||
#define BATTERY_TYPE_UNKNOWN 0xFF
|
||||
#endif
|
||||
|
||||
@@ -238,8 +238,8 @@ static const Uint32 LinuxKeycodeKeysyms[] = {
|
||||
/* 176, 0x0b0 */ 0x0, /* NoSymbol */
|
||||
/* 177, 0x0b1 */ 0x1008FF78, /* XF86ScrollUp */
|
||||
/* 178, 0x0b2 */ 0x1008FF79, /* XF86ScrollDown */
|
||||
/* 179, 0x0b3 */ 0x28, /* parenleft */
|
||||
/* 180, 0x0b4 */ 0x29, /* parenright */
|
||||
/* 179, 0x0b3 */ 0x0, /* NoSymbol */
|
||||
/* 180, 0x0b4 */ 0x0, /* NoSymbol */
|
||||
/* 181, 0x0b5 */ 0x1008FF68, /* XF86New */
|
||||
/* 182, 0x0b6 */ 0xFF66, /* Redo */
|
||||
/* 183, 0x0b7 */ 0xFFCA, /* F13 */
|
||||
|
||||
@@ -456,10 +456,16 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window,
|
||||
void
|
||||
SDL_DelTouch(SDL_TouchID id)
|
||||
{
|
||||
int i;
|
||||
int index = SDL_GetTouchIndex(id);
|
||||
SDL_Touch *touch = SDL_GetTouch(id);
|
||||
int i, index;
|
||||
SDL_Touch *touch;
|
||||
|
||||
if (SDL_num_touch == 0) {
|
||||
/* We've already cleaned up, we won't find this device */
|
||||
return;
|
||||
}
|
||||
|
||||
index = SDL_GetTouchIndex(id);
|
||||
touch = SDL_GetTouch(id);
|
||||
if (!touch) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -752,9 +752,12 @@ static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_Joystic
|
||||
|
||||
if (SDL_memcmp(&guid, &mapping_guid, sizeof(guid)) == 0) {
|
||||
Uint16 mapping_crc = 0;
|
||||
const char *crc_string = SDL_strstr(mapping->mapping, SDL_CONTROLLER_CRC_FIELD);
|
||||
if (crc_string) {
|
||||
mapping_crc = (Uint16)SDL_strtol(crc_string + SDL_CONTROLLER_CRC_FIELD_SIZE, NULL, 16);
|
||||
|
||||
if (match_crc) {
|
||||
const char *crc_string = SDL_strstr(mapping->mapping, SDL_CONTROLLER_CRC_FIELD);
|
||||
if (crc_string) {
|
||||
mapping_crc = (Uint16)SDL_strtol(crc_string + SDL_CONTROLLER_CRC_FIELD_SIZE, NULL, 16);
|
||||
}
|
||||
}
|
||||
if (crc == mapping_crc) {
|
||||
return mapping;
|
||||
@@ -767,7 +770,7 @@ static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_Joystic
|
||||
/*
|
||||
* Helper function to scan the mappings database for a controller with the specified GUID
|
||||
*/
|
||||
static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID guid)
|
||||
static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID guid, SDL_bool create_mapping)
|
||||
{
|
||||
ControllerMapping_t *mapping;
|
||||
Uint16 vendor, product, crc;
|
||||
@@ -802,6 +805,10 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG
|
||||
}
|
||||
}
|
||||
|
||||
if (!create_mapping) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if SDL_JOYSTICK_XINPUT
|
||||
if (SDL_IsJoystickXInput(guid)) {
|
||||
/* This is an XInput device */
|
||||
@@ -1269,7 +1276,7 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString,
|
||||
}
|
||||
}
|
||||
|
||||
pControllerMapping = SDL_PrivateMatchControllerMappingForGUID(jGUID, SDL_TRUE, SDL_TRUE);
|
||||
pControllerMapping = SDL_PrivateGetControllerMappingForGUID(jGUID, SDL_FALSE);
|
||||
if (pControllerMapping) {
|
||||
/* Only overwrite the mapping if the priority is the same or higher. */
|
||||
if (pControllerMapping->priority <= priority) {
|
||||
@@ -1329,7 +1336,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const
|
||||
{
|
||||
ControllerMapping_t *mapping;
|
||||
|
||||
mapping = SDL_PrivateGetControllerMappingForGUID(guid);
|
||||
mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_TRUE);
|
||||
#ifdef __LINUX__
|
||||
if (!mapping && name) {
|
||||
if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
|
||||
@@ -1744,7 +1751,7 @@ SDL_GameControllerMappingForIndex(int mapping_index)
|
||||
char *
|
||||
SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid)
|
||||
{
|
||||
ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(guid);
|
||||
ControllerMapping_t *mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_TRUE);
|
||||
if (mapping) {
|
||||
return CreateMappingString(mapping, guid);
|
||||
} else {
|
||||
|
||||
@@ -654,8 +654,6 @@ static const char *s_ControllerMappings [] =
|
||||
"030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),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,",
|
||||
"030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,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:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
|
||||
"030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),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,",
|
||||
"030000006d0400004fc2000011010000,Logitech G29 Racing Wheel,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b24,leftshoulder:b5,leftstick:b11,lefttrigger:b7,rightshoulder:b4,rightstick:b10,righttrigger:b6,start:b9,x:b1,y:b3,",
|
||||
"030000006d04000060c2000010010000,Logitech G29 Racing Wheel,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:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,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:b0,y:b3,",
|
||||
"030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,",
|
||||
"03000000c62400002b89000011010000,MOGA XP5-A 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,",
|
||||
|
||||
@@ -1811,7 +1811,7 @@ void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *prod
|
||||
Uint16 *guid16 = (Uint16 *)guid.data;
|
||||
Uint16 bus = SDL_SwapLE16(guid16[0]);
|
||||
|
||||
if (bus < ' ' && guid16[3] == 0x0000 && guid16[5] == 0x0000) {
|
||||
if ((bus < ' ' || bus == SDL_HARDWARE_BUS_VIRTUAL) && guid16[3] == 0x0000 && guid16[5] == 0x0000) {
|
||||
/* This GUID fits the standard form:
|
||||
* 16-bit bus
|
||||
* 16-bit CRC16 of the joystick name (can be zero)
|
||||
@@ -2479,6 +2479,8 @@ static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid)
|
||||
MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */
|
||||
MAKE_VIDPID(0x044f, 0xb10a), /* ThrustMaster, Inc. T.16000M Joystick */
|
||||
MAKE_VIDPID(0x046d, 0xc215), /* Logitech Extreme 3D */
|
||||
MAKE_VIDPID(0x231d, 0x0126), /* Gunfighter Mk.III ‘Space Combat Edition’ (right) */
|
||||
MAKE_VIDPID(0x231d, 0x0127), /* Gunfighter Mk.III ‘Space Combat Edition’ (left) */
|
||||
};
|
||||
int i;
|
||||
|
||||
@@ -2683,14 +2685,14 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
|
||||
/* Additional entries */
|
||||
/*****************************************************************/
|
||||
|
||||
MAKE_VIDPID(0x04d9, 0x8008), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x1532, 0x0266), /* Razer Huntman V2 Analog, non-functional DInput device */
|
||||
MAKE_VIDPID(0x1532, 0x0282), /* Razer Huntman Mini Analog, non-functional DInput device */
|
||||
MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */
|
||||
MAKE_VIDPID(0x20d6, 0x0002), /* PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only) */
|
||||
MAKE_VIDPID(0x04d9, 0x8008), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */
|
||||
MAKE_VIDPID(0x1532, 0x0266), /* Razer Huntsman V2 Analog, non-functional DInput device */
|
||||
MAKE_VIDPID(0x1532, 0x0282), /* Razer Huntsman Mini Analog, non-functional DInput device */
|
||||
MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */
|
||||
MAKE_VIDPID(0x20d6, 0x0002), /* PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only) */
|
||||
};
|
||||
|
||||
static Uint32 rog_chakram_list[] = {
|
||||
@@ -2901,7 +2903,7 @@ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLe
|
||||
{
|
||||
CHECK_JOYSTICK_MAGIC(joystick, );
|
||||
|
||||
SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialisation */
|
||||
SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */
|
||||
if (ePowerLevel != joystick->epowerlevel) {
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) {
|
||||
|
||||
@@ -32,7 +32,7 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL
|
||||
{ MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3
|
||||
{ MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1
|
||||
{ MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL }, // Logitech G29 (PS3)
|
||||
//{ MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL }, // Logitech G29 (PS3)
|
||||
{ MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL
|
||||
{ MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller, NULL }, // JC-U4113SBK
|
||||
@@ -87,7 +87,7 @@ static const ControllerDescription_t arrControllers[] = {
|
||||
{ MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller
|
||||
|
||||
{ MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller, NULL }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller
|
||||
{ MAKE_CONTROLLER_ID( 0x046d, 0xc260 ), k_eControllerType_PS4Controller, NULL }, // Logitech G29 (PS4)
|
||||
//{ MAKE_CONTROLLER_ID( 0x046d, 0xc260 ), k_eControllerType_PS4Controller, NULL }, // Logitech G29 (PS4)
|
||||
{ MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller
|
||||
{ MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller, NULL }, // STRIKEPAD PS4 Grip Add-on
|
||||
{ MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Slim Controller
|
||||
|
||||
@@ -596,9 +596,13 @@ SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS3 =
|
||||
static SDL_bool
|
||||
HIDAPI_DriverPS3ThirdParty_IsEnabled(void)
|
||||
{
|
||||
#if 1 /* Not enabled by default, we don't know what the L3/R3 buttons are */
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS3, SDL_FALSE);
|
||||
#else
|
||||
return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_PS3,
|
||||
SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI,
|
||||
SDL_HIDAPI_DEFAULT));
|
||||
#endif
|
||||
}
|
||||
|
||||
static SDL_bool
|
||||
|
||||
@@ -639,11 +639,16 @@ static int
|
||||
IOS_JoystickInit(void)
|
||||
{
|
||||
#if defined(__MACOSX__)
|
||||
#if _SDL_HAS_BUILTIN(__builtin_available)
|
||||
if (@available(macOS 10.16, *)) {
|
||||
/* Continue with initialization on macOS 11+ */
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
/* No @available, must be an older macOS version */
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@autoreleasepool {
|
||||
@@ -951,6 +956,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
#endif
|
||||
|
||||
if (controller.extendedGamepad) {
|
||||
SDL_bool isstack;
|
||||
GCExtendedGamepad *gamepad = controller.extendedGamepad;
|
||||
|
||||
/* Axis order matches the XInput Windows mappings. */
|
||||
@@ -964,9 +970,14 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
};
|
||||
|
||||
/* Button order matches the XInput Windows mappings. */
|
||||
Uint8 buttons[joystick->nbuttons];
|
||||
Uint8 *buttons = SDL_small_alloc(Uint8, joystick->nbuttons, &isstack);
|
||||
int button_count = 0;
|
||||
|
||||
if (buttons == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
/* These buttons are part of the original MFi spec */
|
||||
buttons[button_count++] = gamepad.buttonA.isPressed;
|
||||
buttons[button_count++] = gamepad.buttonB.isPressed;
|
||||
@@ -1083,12 +1094,20 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
}
|
||||
#endif /* ENABLE_MFI_SENSORS */
|
||||
|
||||
SDL_small_free(buttons, isstack);
|
||||
} else if (controller.gamepad) {
|
||||
SDL_bool isstack;
|
||||
GCGamepad *gamepad = controller.gamepad;
|
||||
|
||||
/* Button order matches the XInput Windows mappings. */
|
||||
Uint8 buttons[joystick->nbuttons];
|
||||
Uint8 *buttons = SDL_small_alloc(Uint8, joystick->nbuttons, &isstack);
|
||||
int button_count = 0;
|
||||
|
||||
if (buttons == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
buttons[button_count++] = gamepad.buttonA.isPressed;
|
||||
buttons[button_count++] = gamepad.buttonB.isPressed;
|
||||
buttons[button_count++] = gamepad.buttonX.isPressed;
|
||||
@@ -1103,6 +1122,8 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
|
||||
for (i = 0; i < button_count; i++) {
|
||||
SDL_PrivateJoystickButton(joystick, i, buttons[i]);
|
||||
}
|
||||
|
||||
SDL_small_free(buttons, isstack);
|
||||
}
|
||||
#if TARGET_OS_TV
|
||||
else if (controller.microGamepad) {
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
#define USB_VENDOR_VALVE 0x28de
|
||||
#define USB_VENDOR_ZEROPLUS 0x0c12
|
||||
|
||||
// Most Razer devices are not game controllers, and some of them lock up or reset
|
||||
// when we send them the Sony third-party query feature report, so don't include that
|
||||
// vendor here. Instead add devices as appropriate to controller_type.c
|
||||
// Reference: https://github.com/libsdl-org/SDL/issues/6733
|
||||
// https://github.com/libsdl-org/SDL/issues/6799
|
||||
#define SONY_THIRDPARTY_VENDOR(X) \
|
||||
(X == USB_VENDOR_DRAGONRISE || \
|
||||
X == USB_VENDOR_HORI || \
|
||||
@@ -57,7 +62,6 @@
|
||||
X == USB_VENDOR_POWERA || \
|
||||
X == USB_VENDOR_POWERA_ALT || \
|
||||
X == USB_VENDOR_QANBA || \
|
||||
X == USB_VENDOR_RAZER || \
|
||||
X == USB_VENDOR_SHANWAN || \
|
||||
X == USB_VENDOR_SHANWAN_ALT || \
|
||||
X == USB_VENDOR_THRUSTMASTER || \
|
||||
|
||||
@@ -1775,7 +1775,8 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
|
||||
}
|
||||
has_trigger_data = SDL_TRUE;
|
||||
|
||||
if (battery_info->BatteryType != BATTERY_TYPE_UNKNOWN) {
|
||||
if (battery_info->BatteryType != BATTERY_TYPE_UNKNOWN &&
|
||||
battery_info->BatteryType != BATTERY_TYPE_DISCONNECTED) {
|
||||
SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN;
|
||||
if (battery_info->BatteryType == BATTERY_TYPE_WIRED) {
|
||||
ePowerLevel = SDL_JOYSTICK_POWER_WIRED;
|
||||
|
||||
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,25,1,0
|
||||
PRODUCTVERSION 2,25,1,0
|
||||
FILEVERSION 2,26,2,0
|
||||
PRODUCTVERSION 2,26,2,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "2, 25, 1, 0\0"
|
||||
VALUE "FileVersion", "2, 26, 2, 0\0"
|
||||
VALUE "InternalName", "SDL\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0"
|
||||
VALUE "OriginalFilename", "SDL2.dll\0"
|
||||
VALUE "ProductName", "Simple DirectMedia Layer\0"
|
||||
VALUE "ProductVersion", "2, 25, 1, 0\0"
|
||||
VALUE "ProductVersion", "2, 26, 2, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -92,8 +92,7 @@ SDL_LockMutex(SDL_mutex * mutex)
|
||||
{
|
||||
if (mutex == NULL)
|
||||
{
|
||||
SDL_SetError("Passed a NULL mutex.");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL mutex.");
|
||||
}
|
||||
|
||||
RMutex rmutex;
|
||||
@@ -109,8 +108,7 @@ SDL_UnlockMutex(SDL_mutex * mutex)
|
||||
{
|
||||
if ( mutex == NULL )
|
||||
{
|
||||
SDL_SetError("Passed a NULL mutex.");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL mutex.");
|
||||
}
|
||||
|
||||
RMutex rmutex;
|
||||
|
||||
@@ -119,8 +119,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
||||
{
|
||||
if (! sem)
|
||||
{
|
||||
SDL_SetError("Passed a NULL sem");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL sem");
|
||||
}
|
||||
|
||||
if (timeout == SDL_MUTEX_MAXWAIT)
|
||||
@@ -182,8 +181,7 @@ SDL_SemPost(SDL_sem * sem)
|
||||
{
|
||||
if (! sem)
|
||||
{
|
||||
SDL_SetError("Passed a NULL sem.");
|
||||
return -1;
|
||||
return SDL_SetError("Passed a NULL sem.");
|
||||
}
|
||||
sem->count++;
|
||||
RSemaphore sema;
|
||||
|
||||
@@ -574,9 +574,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
|
||||
if (src) {
|
||||
SDL_RWseek(src, fp_offset, RW_SEEK_SET);
|
||||
}
|
||||
if (surface) {
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
SDL_FreeSurface(surface);
|
||||
surface = NULL;
|
||||
}
|
||||
if (freesrc && src) {
|
||||
|
||||
@@ -292,8 +292,8 @@ SDL_EGL_UnloadLibrary(_THIS)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
|
||||
static int
|
||||
SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path)
|
||||
{
|
||||
void *egl_dll_handle = NULL, *opengl_dll_handle = NULL;
|
||||
const char *path = NULL;
|
||||
@@ -304,15 +304,6 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
|
||||
SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
|
||||
#endif
|
||||
|
||||
if (_this->egl_data) {
|
||||
return SDL_SetError("EGL context already created");
|
||||
}
|
||||
|
||||
_this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData));
|
||||
if (!_this->egl_data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
|
||||
d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER);
|
||||
if (d3dcompiler) {
|
||||
@@ -473,6 +464,26 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
|
||||
{
|
||||
if (_this->egl_data) {
|
||||
return SDL_SetError("EGL context already created");
|
||||
}
|
||||
|
||||
_this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData));
|
||||
if (!_this->egl_data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
if (SDL_EGL_LoadLibraryInternal(_this, egl_path) < 0) {
|
||||
SDL_free(_this->egl_data);
|
||||
_this->egl_data = NULL;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_EGL_GetVersion(_THIS) {
|
||||
if (_this->egl_data->eglQueryString) {
|
||||
|
||||
@@ -1157,25 +1157,27 @@ GetRectDisplayIndex(int x, int y, int w, int h)
|
||||
center.x = x + w / 2;
|
||||
center.y = y + h / 2;
|
||||
|
||||
for (i = 0; i < _this->num_displays; ++i) {
|
||||
SDL_Rect display_rect;
|
||||
SDL_GetDisplayBounds(i, &display_rect);
|
||||
if (_this) {
|
||||
for (i = 0; i < _this->num_displays; ++i) {
|
||||
SDL_Rect display_rect;
|
||||
SDL_GetDisplayBounds(i, &display_rect);
|
||||
|
||||
/* Check if the window is fully enclosed */
|
||||
if (SDL_EnclosePoints(¢er, 1, &display_rect, NULL)) {
|
||||
return i;
|
||||
}
|
||||
/* Check if the window is fully enclosed */
|
||||
if (SDL_EnclosePoints(¢er, 1, &display_rect, NULL)) {
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Snap window center to the display rect */
|
||||
closest_point_on_display = center;
|
||||
SDL_GetClosestPointOnRect(&display_rect, &closest_point_on_display);
|
||||
/* Snap window center to the display rect */
|
||||
closest_point_on_display = center;
|
||||
SDL_GetClosestPointOnRect(&display_rect, &closest_point_on_display);
|
||||
|
||||
delta.x = center.x - closest_point_on_display.x;
|
||||
delta.y = center.y - closest_point_on_display.y;
|
||||
dist = (delta.x*delta.x + delta.y*delta.y);
|
||||
if (dist < closest_dist) {
|
||||
closest = i;
|
||||
closest_dist = dist;
|
||||
delta.x = center.x - closest_point_on_display.x;
|
||||
delta.y = center.y - closest_point_on_display.y;
|
||||
dist = (delta.x * delta.x + delta.y * delta.y);
|
||||
if (dist < closest_dist) {
|
||||
closest = i;
|
||||
closest_dist = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,6 +333,7 @@ GetApplicationName(void)
|
||||
static bool
|
||||
LoadMainMenuNibIfAvailable(void)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
NSDictionary *infoDict;
|
||||
NSString *mainNibFileName;
|
||||
bool success = false;
|
||||
@@ -350,6 +351,9 @@ LoadMainMenuNibIfAvailable(void)
|
||||
}
|
||||
|
||||
return success;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "SDL_atomic.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <QuartzCore/CVDisplayLink.h>
|
||||
|
||||
/* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */
|
||||
#ifdef __clang__
|
||||
@@ -58,6 +59,9 @@ struct SDL_GLDriverData
|
||||
- (SDL_Window*)window;
|
||||
- (void)explicitUpdate;
|
||||
- (void)dealloc;
|
||||
|
||||
@property (retain, nonatomic) NSOpenGLPixelFormat* openglPixelFormat; // macOS 10.10 has -[NSOpenGLContext pixelFormat] but this handles older OS releases.
|
||||
|
||||
@end
|
||||
|
||||
/* OpenGL functions */
|
||||
|
||||
@@ -44,6 +44,16 @@
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
/* _Nullable is available starting Xcode 7 */
|
||||
#ifdef __has_feature
|
||||
#if __has_feature(nullability)
|
||||
#define HAS_FEATURE_NULLABLE
|
||||
#endif
|
||||
#endif
|
||||
#ifndef HAS_FEATURE_NULLABLE
|
||||
#define _Nullable
|
||||
#endif
|
||||
|
||||
static SDL_bool SDL_opengl_async_dispatch = SDL_FALSE;
|
||||
|
||||
static void SDLCALL
|
||||
@@ -76,6 +86,7 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const
|
||||
{
|
||||
self = [super initWithFormat:format shareContext:share];
|
||||
if (self) {
|
||||
self.openglPixelFormat = format;
|
||||
SDL_AtomicSet(&self->dirty, 0);
|
||||
self->window = NULL;
|
||||
SDL_AtomicSet(&self->swapIntervalSetting, 0);
|
||||
@@ -100,7 +111,7 @@ DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* now, const
|
||||
- (void)movedToNewScreen
|
||||
{
|
||||
if (self->displayLink) {
|
||||
CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [[self pixelFormat] CGLPixelFormatObj]);
|
||||
CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(self->displayLink, [self CGLContextObj], [[self openglPixelFormat] CGLPixelFormatObj]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,7 @@ int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
|
||||
// printf("HAIKU_GL_MakeCurrent(%llx), win = %llx, thread = %d\n", (uint64)context, (uint64)window, find_thread(NULL));
|
||||
if (glView != NULL) {
|
||||
if ((glView->Window() == NULL) || (window == NULL) || (_ToBeWin(window)->GetGLView() != glView)) {
|
||||
SDL_SetError("MakeCurrent failed");
|
||||
return -1;
|
||||
return SDL_SetError("MakeCurrent failed");
|
||||
}
|
||||
}
|
||||
_GetBeApp()->SetCurrentContext(glView);
|
||||
|
||||
@@ -26,6 +26,14 @@ extern "C" {
|
||||
typedef void CAMetalLayer;
|
||||
#endif
|
||||
|
||||
#define SDL_UNSAFE_UNRETAINED
|
||||
#if defined(__OBJC__) && defined(__has_feature)
|
||||
#if __has_feature(objc_arc)
|
||||
#undef SDL_UNSAFE_UNRETAINED
|
||||
#define SDL_UNSAFE_UNRETAINED __unsafe_unretained
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define VK_EXT_METAL_SURFACE_SPEC_VERSION 1
|
||||
#define VK_EXT_METAL_SURFACE_EXTENSION_NAME "VK_EXT_metal_surface"
|
||||
typedef VkFlags VkMetalSurfaceCreateFlagsEXT;
|
||||
@@ -33,7 +41,7 @@ typedef struct VkMetalSurfaceCreateInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkMetalSurfaceCreateFlagsEXT flags;
|
||||
const CAMetalLayer* pLayer;
|
||||
const CAMetalLayer SDL_UNSAFE_UNRETAINED *pLayer;
|
||||
} VkMetalSurfaceCreateInfoEXT;
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkCreateMetalSurfaceEXT)(VkInstance instance, const VkMetalSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||
@@ -111,27 +119,27 @@ typedef struct VkExportMetalObjectsInfoEXT {
|
||||
typedef struct VkExportMetalDeviceInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
MTLDevice_id mtlDevice;
|
||||
MTLDevice_id SDL_UNSAFE_UNRETAINED mtlDevice;
|
||||
} VkExportMetalDeviceInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalCommandQueueInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkQueue queue;
|
||||
MTLCommandQueue_id mtlCommandQueue;
|
||||
MTLCommandQueue_id SDL_UNSAFE_UNRETAINED mtlCommandQueue;
|
||||
} VkExportMetalCommandQueueInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalBufferInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkDeviceMemory memory;
|
||||
MTLBuffer_id mtlBuffer;
|
||||
MTLBuffer_id SDL_UNSAFE_UNRETAINED mtlBuffer;
|
||||
} VkExportMetalBufferInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalBufferInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
MTLBuffer_id mtlBuffer;
|
||||
MTLBuffer_id SDL_UNSAFE_UNRETAINED mtlBuffer;
|
||||
} VkImportMetalBufferInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalTextureInfoEXT {
|
||||
@@ -141,14 +149,14 @@ typedef struct VkExportMetalTextureInfoEXT {
|
||||
VkImageView imageView;
|
||||
VkBufferView bufferView;
|
||||
VkImageAspectFlagBits plane;
|
||||
MTLTexture_id mtlTexture;
|
||||
MTLTexture_id SDL_UNSAFE_UNRETAINED mtlTexture;
|
||||
} VkExportMetalTextureInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalTextureInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImageAspectFlagBits plane;
|
||||
MTLTexture_id mtlTexture;
|
||||
MTLTexture_id SDL_UNSAFE_UNRETAINED mtlTexture;
|
||||
} VkImportMetalTextureInfoEXT;
|
||||
|
||||
typedef struct VkExportMetalIOSurfaceInfoEXT {
|
||||
@@ -169,13 +177,13 @@ typedef struct VkExportMetalSharedEventInfoEXT {
|
||||
const void* pNext;
|
||||
VkSemaphore semaphore;
|
||||
VkEvent event;
|
||||
MTLSharedEvent_id mtlSharedEvent;
|
||||
MTLSharedEvent_id SDL_UNSAFE_UNRETAINED mtlSharedEvent;
|
||||
} VkExportMetalSharedEventInfoEXT;
|
||||
|
||||
typedef struct VkImportMetalSharedEventInfoEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
MTLSharedEvent_id mtlSharedEvent;
|
||||
MTLSharedEvent_id SDL_UNSAFE_UNRETAINED mtlSharedEvent;
|
||||
} VkImportMetalSharedEventInfoEXT;
|
||||
|
||||
typedef void (VKAPI_PTR *PFN_vkExportMetalObjectsEXT)(VkDevice device, VkExportMetalObjectsInfoEXT* pMetalObjectsInfo);
|
||||
|
||||
@@ -666,8 +666,8 @@ KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id)
|
||||
/* Gets a DRM connector, builds an SDL_Display with it, and adds it to the
|
||||
list of SDL Displays in _this->displays[] */
|
||||
static void
|
||||
KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) {
|
||||
|
||||
KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources)
|
||||
{
|
||||
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
|
||||
SDL_DisplayData *dispdata = NULL;
|
||||
SDL_VideoDisplay display = {0};
|
||||
@@ -770,14 +770,37 @@ KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) {
|
||||
drmModeModeInfo *mode = &connector->modes[i];
|
||||
|
||||
if (!SDL_memcmp(mode, &crtc->mode, sizeof(crtc->mode))) {
|
||||
mode_index = i;
|
||||
break;
|
||||
mode_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_index == -1) {
|
||||
ret = SDL_SetError("Failed to find index of mode attached to the CRTC.");
|
||||
goto cleanup;
|
||||
int current_area, largest_area = 0;
|
||||
|
||||
/* Find the preferred mode or the highest resolution mode */
|
||||
for (i = 0; i < connector->count_modes; i++) {
|
||||
drmModeModeInfo *mode = &connector->modes[i];
|
||||
|
||||
if (mode->type & DRM_MODE_TYPE_PREFERRED) {
|
||||
mode_index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
current_area = mode->hdisplay * mode->vdisplay;
|
||||
if (current_area > largest_area) {
|
||||
mode_index = i;
|
||||
largest_area = current_area;
|
||||
}
|
||||
}
|
||||
if (mode_index != -1) {
|
||||
crtc->mode = connector->modes[mode_index];
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_index == -1) {
|
||||
ret = SDL_SetError("Failed to find index of mode attached to the CRTC.");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
@@ -1433,28 +1456,34 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
|
||||
}
|
||||
}
|
||||
|
||||
/* Manually load the GL library. KMSDRM_EGL_LoadLibrary() has already
|
||||
been called by SDL_CreateWindow() but we don't do anything there,
|
||||
out KMSDRM_EGL_LoadLibrary() is a dummy precisely to be able to load it here.
|
||||
If we let SDL_CreateWindow() load the lib, it would be loaded
|
||||
before we call KMSDRM_GBMInit(), causing all GLES programs to fail. */
|
||||
if (!_this->egl_data) {
|
||||
egl_display = (NativeDisplayType)((SDL_VideoData *)_this->driverdata)->gbm_dev;
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA)) {
|
||||
return (SDL_SetError("Can't load EGL/GL library on window creation."));
|
||||
}
|
||||
/* Manually load the GL library. KMSDRM_EGL_LoadLibrary() has already
|
||||
been called by SDL_CreateWindow() but we don't do anything there,
|
||||
our KMSDRM_EGL_LoadLibrary() is a dummy precisely to be able to load it here.
|
||||
If we let SDL_CreateWindow() load the lib, it would be loaded
|
||||
before we call KMSDRM_GBMInit(), causing all GLES programs to fail. */
|
||||
if (!_this->egl_data) {
|
||||
egl_display = (NativeDisplayType)((SDL_VideoData *)_this->driverdata)->gbm_dev;
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) {
|
||||
/* Try again with OpenGL ES 2.0 */
|
||||
_this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
|
||||
_this->gl_config.major_version = 2;
|
||||
_this->gl_config.minor_version = 0;
|
||||
if (SDL_EGL_LoadLibrary(_this, NULL, egl_display, EGL_PLATFORM_GBM_MESA) < 0) {
|
||||
return (SDL_SetError("Can't load EGL/GL library on window creation."));
|
||||
}
|
||||
}
|
||||
|
||||
_this->gl_config.driver_loaded = 1;
|
||||
_this->gl_config.driver_loaded = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the cursor BO for the display of this window,
|
||||
now that we know this is not a VK window. */
|
||||
KMSDRM_CreateCursorBO(display);
|
||||
/* Create the cursor BO for the display of this window,
|
||||
now that we know this is not a VK window. */
|
||||
KMSDRM_CreateCursorBO(display);
|
||||
|
||||
/* Create and set the default cursor for the display
|
||||
/* Create and set the default cursor for the display
|
||||
of this window, now that we know this is not a VK window. */
|
||||
KMSDRM_InitMouse(_this, display);
|
||||
KMSDRM_InitMouse(_this, display);
|
||||
|
||||
/* The FULLSCREEN flags are cut out from window->flags at this point,
|
||||
so we can't know if a window is fullscreen or not, hence all windows
|
||||
|
||||
@@ -30,16 +30,7 @@
|
||||
#include <e32svr.h>
|
||||
#include <bitdev.h>
|
||||
#include <w32std.h>
|
||||
|
||||
class CFbsDrawDevice : public CBase
|
||||
{
|
||||
public:
|
||||
public:
|
||||
IMPORT_C static CFbsDrawDevice* NewScreenDeviceL(TScreenInfoV01 aInfo,TDisplayMode aDispMode);
|
||||
public:
|
||||
virtual void Update() {}
|
||||
virtual void UpdateRegion(const TRect&) {}
|
||||
};
|
||||
#include "bitdraw.h" // CFbsDrawDevice
|
||||
|
||||
#define _THIS SDL_VideoDevice *_this
|
||||
|
||||
|
||||
@@ -166,6 +166,13 @@ void SDL_WAYLAND_UnloadSymbols(void);
|
||||
|
||||
#else /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
|
||||
|
||||
/*
|
||||
* These must be included before libdecor.h, otherwise the libdecor header
|
||||
* pulls in the system Wayland protocol headers instead of ours.
|
||||
*/
|
||||
#include "wayland-client-protocol.h"
|
||||
#include "wayland-egl.h"
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
#include <libdecor.h>
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,10 @@ Wayland_StartTextInput(_THIS)
|
||||
if (input != NULL && input->text_input) {
|
||||
const SDL_Rect *rect = &input->text_input->cursor_rect;
|
||||
|
||||
/* Don't re-enable if we're already enabled. */
|
||||
if (input->text_input->is_enabled)
|
||||
return;
|
||||
|
||||
/* For some reason this has to be done twice, it appears to be a
|
||||
* bug in mutter? Maybe?
|
||||
* -flibit
|
||||
@@ -83,6 +87,7 @@ Wayland_StartTextInput(_THIS)
|
||||
rect->h);
|
||||
}
|
||||
zwp_text_input_v3_commit(input->text_input->text_input);
|
||||
input->text_input->is_enabled = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +102,7 @@ Wayland_StopTextInput(_THIS)
|
||||
if (input != NULL && input->text_input) {
|
||||
zwp_text_input_v3_disable(input->text_input->text_input);
|
||||
zwp_text_input_v3_commit(input->text_input->text_input);
|
||||
input->text_input->is_enabled = SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,13 +126,16 @@ Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
|
||||
if (driverdata->text_input_manager) {
|
||||
struct SDL_WaylandInput *input = driverdata->input;
|
||||
if (input != NULL && input->text_input) {
|
||||
SDL_copyp(&input->text_input->cursor_rect, rect);
|
||||
zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input,
|
||||
rect->x,
|
||||
rect->y,
|
||||
rect->w,
|
||||
rect->h);
|
||||
zwp_text_input_v3_commit(input->text_input->text_input);
|
||||
if (!SDL_RectEquals(rect, &input->text_input->cursor_rect))
|
||||
{
|
||||
SDL_copyp(&input->text_input->cursor_rect, rect);
|
||||
zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input,
|
||||
rect->x,
|
||||
rect->y,
|
||||
rect->w,
|
||||
rect->h);
|
||||
zwp_text_input_v3_commit(input->text_input->text_input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ typedef struct SDL_WaylandTextInput
|
||||
struct zwp_text_input_v3 *text_input;
|
||||
SDL_Rect cursor_rect;
|
||||
SDL_bool has_preedit;
|
||||
SDL_bool is_enabled;
|
||||
} SDL_WaylandTextInput;
|
||||
|
||||
extern int Wayland_InitKeyboard(_THIS);
|
||||
|
||||
@@ -211,7 +211,7 @@ SDL_WAYLAND_SYM(bool, libdecor_configuration_get_content_size, (struct libdecor_
|
||||
int *))
|
||||
SDL_WAYLAND_SYM(bool, libdecor_configuration_get_window_state, (struct libdecor_configuration *,\
|
||||
enum libdecor_window_state *))
|
||||
SDL_WAYLAND_SYM(bool, libdecor_dispatch, (struct libdecor *, int))
|
||||
SDL_WAYLAND_SYM(int, libdecor_dispatch, (struct libdecor *, int))
|
||||
#endif
|
||||
|
||||
#undef SDL_WAYLAND_MODULE
|
||||
|
||||
@@ -878,11 +878,17 @@ decoration_frame_configure(struct libdecor_frame *frame,
|
||||
wind->floating_resize_pending = SDL_FALSE;
|
||||
} else {
|
||||
/*
|
||||
* XXX: When hiding a floating window, libdecor can send bogus content sizes that
|
||||
* are +/- the height of the title bar, which distorts the window size.
|
||||
* Ignore any values from libdecor when hiding a floating window.
|
||||
* XXX: libdecor can send bogus content sizes that are +/- the height
|
||||
* of the title bar when hiding a window or transitioning from
|
||||
* non-floating to floating state, which distorts the window size.
|
||||
*
|
||||
* Ignore any size values from libdecor in these scenarios in
|
||||
* favor of the cached window size.
|
||||
*
|
||||
* https://gitlab.gnome.org/jadahl/libdecor/-/issues/40
|
||||
*/
|
||||
const SDL_bool use_cached_size = (window->is_hiding || !!(window->flags & SDL_WINDOW_HIDDEN));
|
||||
const SDL_bool use_cached_size = (floating && !wind->was_floating) ||
|
||||
(window->is_hiding || !!(window->flags & SDL_WINDOW_HIDDEN));
|
||||
|
||||
/* This will never set 0 for width/height unless the function returns false */
|
||||
if (use_cached_size || !libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {
|
||||
@@ -905,6 +911,8 @@ decoration_frame_configure(struct libdecor_frame *frame,
|
||||
wind->floating_height = height;
|
||||
}
|
||||
|
||||
wind->was_floating = floating;
|
||||
|
||||
/* Do the resize on the SDL side (this will set window->w/h)... */
|
||||
Wayland_HandleResize(window, width, height, scale_factor);
|
||||
wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE;
|
||||
|
||||
@@ -102,6 +102,7 @@ typedef struct {
|
||||
int window_width, window_height;
|
||||
SDL_bool needs_resize_event;
|
||||
SDL_bool floating_resize_pending;
|
||||
SDL_bool was_floating;
|
||||
SDL_bool is_fullscreen;
|
||||
SDL_bool in_fullscreen_transition;
|
||||
Uint32 fullscreen_flags;
|
||||
|
||||
@@ -143,9 +143,7 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
|
||||
}
|
||||
}
|
||||
if (temp) {
|
||||
SDL_FreeSurface(temp);
|
||||
}
|
||||
SDL_FreeSurface(temp);
|
||||
if (path) {
|
||||
SDL_free(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user