Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge SDL2 upstream #66

Merged
merged 57 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
19c3e12
wayland: Check the relative pointer handle before destroying
Kontrabant Oct 29, 2023
60e8ff1
wayland: Sanity check pointers and protocols before confining
Kontrabant Oct 29, 2023
7774de0
cmake: file(RELATIVE_PATH) needs 2 absolute paths
madebr Oct 30, 2023
20630b2
cmake: check -fobjc-arc compiler flag on Apple platforms
madebr Oct 30, 2023
517db6d
cmake: reset check state before testing -fobjc-arc
madebr Oct 30, 2023
20ecd2a
Check to make sure the Windows joystick device has buttons and axes
slouken Nov 2, 2023
97c2bdf
Added patch note for SDL_GDKGetDefaultUser()
slouken Nov 2, 2023
8b1b673
cmake: fold HAVE_INPUT_EVENTS into HAVE_LINUX_INPUT_H
madebr Nov 2, 2023
e226008
configure: move HAVE_LINUX_INPUT_H to CheckInputEvents()
sezero Nov 2, 2023
4c2eb6b
Use the default UCS2/UCS4 conversion rather than non-portable INTERNA…
slouken Nov 4, 2023
aa129c9
Fixed potential uninitialized memory access (thanks Mathieu!)
slouken Nov 5, 2023
e8f4045
Use XINPUT_STATE instead of XINPUT_STATE_EX (thanks Andrew!)
slouken Nov 5, 2023
93e51dd
fix a possible memory leak in SDL_vasprintf()
sezero Nov 5, 2023
64a7e75
Only save ibus_addr_file after we've successfully read an address fro…
slouken Nov 6, 2023
d5896f9
Fixed memory leak in XInput code
slouken Nov 6, 2023
9d7feaa
coreaudio: If paused, clear any pending stream data.
icculus Nov 6, 2023
065d807
hidapi: Avoid memcpy'ing to NULL.
icculus Nov 6, 2023
7555701
autotools: fix linux joystick breakage after commit 221d6ea8a8ca
sezero Nov 6, 2023
0c85173
Fixed connecting and disconnecting real-joysticks closing virtual joy…
slouken Nov 7, 2023
d6c725d
Removed misleading comment
slouken Nov 7, 2023
171e306
Enable the 5th player LED on the DualSense controller
slouken Nov 7, 2023
7526a87
Handle subsystem dependencies recursively
ivan-mogilko Nov 7, 2023
d9559ce
Added subsystem refcount tests to testautomation
ivan-mogilko Nov 7, 2023
fb92d15
Removed unused SDL_OSEvent
slouken Nov 7, 2023
70adacf
Make sure we include the null terminator in XLookupStringAsUTF8()
slouken Nov 8, 2023
4ace02d
Added a mapping for the Atari VCS controller connected over Bluetooth…
slouken Nov 8, 2023
624905a
Destroy the window surface if we've created it for the software renderer
slouken Nov 8, 2023
b07e5d3
Added missing calls to SDL_InvalidParamError("surface")
slouken Nov 8, 2023
b180779
Make sure joysticks are locked when adding and removing them
slouken Nov 8, 2023
524ccf0
Assume all 8BitDo Xbox controllers have a share button
slouken Nov 8, 2023
af7fe2c
Actually we need to enumerate the 8BitDo Xbox SKUs
slouken Nov 8, 2023
7e11bd1
Removed useless branch test
slouken Nov 8, 2023
f9baa30
sdlchecks.cmake: Clarified the reason why shared X11 mode doesn't work
Wohlstand Nov 8, 2023
87bb0f5
Don't mute the console input if we can't read the keyboard
slouken Nov 8, 2023
5d29f22
Store the requested muted state
slouken Nov 8, 2023
76ff25e
Fixed FreeBSD build
slouken Nov 8, 2023
3900fca
Fixed FreeBSD build
slouken Nov 8, 2023
509c70c
Allow the application to draw while Windows is in a modal move/resize…
slouken Nov 8, 2023
adc0880
cmake: also install pdb files of static libraries
madebr Nov 9, 2023
dfc38ef
Implemented VT switching for KMSDRM on Linux
slouken Nov 8, 2023
f0d6543
ci: re-enable Intel compilers on ci
madebr Nov 9, 2023
d38ccfa
x11: Ignore deprecated declaration of XKeycodeToKeysym
madebr Nov 9, 2023
4a3a9f3
Older gcc does not support #pragma GCC diagnostic inside functions
madebr Nov 9, 2023
a14b948
[SDL2] pointer boolean (#8523)
1bsyl Nov 10, 2023
03f29c1
Added support for the Dragonrise GameCube adapter with VID 0x1843
slouken Nov 11, 2023
4a0bd06
Added support for the GameSir-G7 Controller for Xbox
slouken May 12, 2023
c29df16
Added shortened name for "Nintendo Co., Ltd."
slouken Nov 11, 2023
f3419d8
Re-add SDL_assert() with non boolean ptr syntax (#8531)
1bsyl Nov 11, 2023
63e9827
wayland: Fix DPI calculation with scaled outputs
pp3345 Nov 12, 2023
92d70f4
cpuinfo: Fix detection of physical memory above 2GB on NetBSD
alarixnia Nov 12, 2023
8c82b73
Fixed the ROG PUGIO II showing up as a game controller
slouken Nov 14, 2023
cc20d01
Revert "Check to make sure the Windows joystick device has buttons an…
slouken Nov 14, 2023
1de8549
Fixed mouse wheel scrolling direction on iOS
slouken Nov 14, 2023
925362a
Replacing SDL_SCANCODE_AUDIOMUTE by SDL_SCANCODE_MUTE on Windows
tioui Nov 13, 2023
0ec1209
Fixed a memory leak at window creation.
slouken Nov 8, 2023
76cc24e
Added SDL_HINT_JOYSTICK_IOKIT and SDL_HINT_JOYSTICK_MFI to control wh…
slouken Nov 14, 2023
cc7c0a2
Fixed IOS_SupportedHIDDevice() returning SDL_FALSE before initialization
slouken Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
- { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh }
- { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true }
#- { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true,
# source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'}
#- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF',
# source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '}
- { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true,
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'}
- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF',
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '}

- { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
- { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
Expand Down Expand Up @@ -70,10 +70,14 @@ jobs:
- name: Setup Intel oneAPI
if: matrix.platform.intel
run: |
# Setup oneAPI repo
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null

# Add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list

# Update package list
sudo apt-get update -y

# Install oneAPI
Expand Down
48 changes: 30 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,6 @@ if(SDL_LIBC)
string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER})
check_include_file("${_HEADER}" ${_HAVE_H})
endforeach()
check_include_file(linux/input.h HAVE_LINUX_INPUT_H)

set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h")
check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS)
Expand Down Expand Up @@ -1507,7 +1506,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
#ifndef EVIOCGNAME
#error EVIOCGNAME() ioctl not available
#endif
int main(int argc, char** argv) { return 0; }" HAVE_INPUT_EVENTS)
int main(int argc, char** argv) { return 0; }" HAVE_LINUX_INPUT_H)

if(LINUX)
check_c_source_compiles("
Expand Down Expand Up @@ -1543,11 +1542,11 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
}" HAVE_INPUT_WSCONS)
endif()

if(HAVE_INPUT_EVENTS)
if(HAVE_LINUX_INPUT_H)
set(SDL_INPUT_LINUXEV 1)
endif()

if(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
if(SDL_HAPTIC AND HAVE_LINUX_INPUT_H)
set(SDL_HAPTIC_LINUX 1)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c)
list(APPEND SOURCE_FILES ${HAPTIC_SOURCES})
Expand Down Expand Up @@ -1633,7 +1632,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c")
endif()

if(HAVE_INPUT_EVENTS)
if(HAVE_LINUX_INPUT_H)
list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c")
list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c")
endif()
Expand Down Expand Up @@ -1825,16 +1824,6 @@ elseif(WINDOWS)
#include <windows.h>
#include <xinput.h>
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H)
check_c_source_compiles("
#include <windows.h>
#include <xinput.h>
XINPUT_GAMEPAD_EX x1;
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX)
check_c_source_compiles("
#include <windows.h>
#include <xinput.h>
XINPUT_STATE_EX s1;
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX)
check_c_source_compiles("
#define COBJMACROS
#include <windows.gaming.input.h>
Expand Down Expand Up @@ -3108,9 +3097,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}")
Expand Down Expand Up @@ -3354,6 +3351,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()

Expand Down Expand Up @@ -3507,8 +3510,8 @@ if(NOT SDL2_DISABLE_INSTALL)
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC AND NOT CMAKE_VERSION VERSION_LESS "3.1")
install(FILES $<TARGET_PDB_FILE:SDL2> DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
if(MSVC)
SDL_install_pdb(SDL2 "${CMAKE_INSTALL_BINDIR}")
endif()
endif()

Expand All @@ -3517,20 +3520,29 @@ if(NOT SDL2_DISABLE_INSTALL)
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2main "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()

if(SDL_STATIC)
install(TARGETS SDL2-static EXPORT SDL2staticTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2-static "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()

if(SDL_TEST)
install(TARGETS SDL2_test EXPORT SDL2testTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(MSVC)
SDL_install_pdb(SDL2_test "${CMAKE_INSTALL_LIBDIR}")
endif()
endif()

##### Export files #####
Expand Down
6 changes: 3 additions & 3 deletions VisualC-GDK/tests/testgdk/src/testgdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ main(int argc, char *argv[])

/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
if (state == NULL) {
if (!state) {
return 1;
}

Expand Down Expand Up @@ -446,7 +446,7 @@ main(int argc, char *argv[])
/* Create the windows, initialize the renderers, and load the textures */
sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
if (sprites == NULL) {
if (!sprites) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2);
}
Expand All @@ -461,7 +461,7 @@ main(int argc, char *argv[])

soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");

if (soundname == NULL) {
if (!soundname) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
quit(1);
}
Expand Down
3 changes: 2 additions & 1 deletion VisualC/tests/testautomation/testautomation.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@
<ClCompile Include="..\..\..\test\testautomation_syswm.c" />
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
<ClCompile Include="..\..\..\test\testautomation_video.c" />
<ClCompile Include="..\..\..\test\testautomation_subsystems.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\test\testautomation_suites.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
9 changes: 9 additions & 0 deletions WhatsNew.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@

This is a list of major changes in SDL's version history.

---------------------------------------------------------------------------
2.30.0:
---------------------------------------------------------------------------

Xbox:
* Added the function SDL_GDKGetDefaultUser()


---------------------------------------------------------------------------
2.28.2:
---------------------------------------------------------------------------

General:
* Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers

Expand Down
10 changes: 5 additions & 5 deletions Xcode-iOS/Demos/src/accelerometer.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ initializeTextures(SDL_Renderer *renderer)

/* load the ship */
bmp_surface = SDL_LoadBMP("ship.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not ship.bmp");
}
/* set blue to transparent on the ship */
Expand All @@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)

/* create ship texture from surface */
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (ship == NULL) {
if (!ship) {
fatalError("could not create ship texture");
}
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
Expand All @@ -140,12 +140,12 @@ initializeTextures(SDL_Renderer *renderer)

/* load the space background */
bmp_surface = SDL_LoadBMP("space.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load space.bmp");
}
/* create space texture from surface */
space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (space == NULL) {
if (!space) {
fatalError("could not create space texture");
}
SDL_FreeSurface(bmp_surface);
Expand Down Expand Up @@ -179,7 +179,7 @@ main(int argc, char *argv[])
printf("There are %d joysticks available\n", SDL_NumJoysticks());
printf("Default joystick (index 0) is %s\n", SDL_JoystickName(0));
accelerometer = SDL_JoystickOpen(0);
if (accelerometer == NULL) {
if (!accelerometer) {
fatalError("Could not open joystick (accelerometer)");
}
printf("joystick number of axis = %d\n",
Expand Down
2 changes: 1 addition & 1 deletion Xcode-iOS/Demos/src/fireworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ initializeTexture()
to format passed into OpenGL */

bmp_surface = SDL_LoadBMP("stroke.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load stroke.bmp");
}

Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/happy.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ initializeTexture(SDL_Renderer *renderer)
SDL_Surface *bmp_surface;
/* load the bmp */
bmp_surface = SDL_LoadBMP("icon.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load bmp");
}
/* set white to transparent on the happyface */
Expand All @@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)

/* convert RGBA surface to texture */
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (texture == NULL) {
if (!texture) {
fatalError("could not create texture");
}
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ loadFont(void)
{
SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");

if (surface == NULL) {
if (!surface) {
printf("Error loading bitmap: %s\n", SDL_GetError());
return 0;
} else {
Expand All @@ -183,7 +183,7 @@ loadFont(void)
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted);
if (texture == NULL) {
if (!texture) {
printf("texture creation failed: %s\n", SDL_GetError());
} else {
/* set blend mode for our texture */
Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/rectangles.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ main(int argc, char *argv[])

/* create window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
if (window == NULL) {
if (!window) {
fatalError("Could not initialize Window");
}
renderer = SDL_CreateRenderer(window, -1, 0);
if (renderer == NULL) {
if (!renderer) {
fatalError("Could not create renderer");
}

Expand Down
4 changes: 2 additions & 2 deletions Xcode-iOS/Demos/src/touch.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ initializeTexture(SDL_Renderer *renderer)
{
SDL_Surface *bmp_surface;
bmp_surface = SDL_LoadBMP("stroke.bmp");
if (bmp_surface == NULL) {
if (!bmp_surface) {
fatalError("could not load stroke.bmp");
}
brush =
SDL_CreateTextureFromSurface(renderer, bmp_surface);
SDL_FreeSurface(bmp_surface);
if (brush == NULL) {
if (!brush) {
fatalError("could not create brush texture");
}
/* additive blending -- laying strokes on top of eachother makes them brighter */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ private boolean isXboxOneController(UsbDevice usbDevice, UsbInterface usbInterfa
0x24c6, // PowerA
0x2dc8, // 8BitDo
0x2e24, // Hyperkin
0x3537, // GameSir
};

if (usbInterface.getId() == 0 &&
Expand Down
20 changes: 20 additions & 0 deletions cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,23 @@ if(CMAKE_VERSION VERSION_LESS 3.13.0)
link_directories(${ARGN})
endmacro()
endif()

# CMP0087: install(CODE) and install(SCRIPT) support generator expressions.
cmake_policy(SET CMP0087 NEW)
function(SDL_install_pdb TARGET DIRECTORY)
get_property(type TARGET ${TARGET} PROPERTY TYPE)
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
if(NOT CMAKE_VERSION VERSION_LESS 3.1)
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
endif()
elseif(type STREQUAL "STATIC_LIBRARY")
if(NOT CMAKE_VERSION VERSION_LESS 3.15)
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
else()
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
endif()
endif()
endif()
endfunction()
4 changes: 3 additions & 1 deletion cmake/sdlchecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@ macro(CheckX11)
list(APPEND SOURCE_FILES ${X11_SOURCES})
set(SDL_VIDEO_DRIVER_X11 1)

# !!! FIXME: why is this disabled for Apple?
# Note: Disabled on Apple because the dynamic mode backend for X11 doesn't
# work properly on Apple during several issues like inconsistent paths
# among platforms. See #6778 (https://github.com/libsdl-org/SDL/issues/6778)
if(APPLE)
set(SDL_X11_SHARED OFF)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/test/main_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) {
640, 480,
SDL_WINDOW_SHOWN
);
if (window == NULL) {
if (!window) {
fprintf(stderr, "could not create window: %s\n", SDL_GetError());
return 1;
}
Expand Down
Loading