Commit Graph

707 Commits

Author SHA1 Message Date
Frank Praznik 9e850bdcfa
docs: Update the migration doc with SDL_SetWindowModalFor() changes 2024-09-05 16:20:16 -04:00
Sam Lantinga 575d9cda6f The parameter to SDL_AppEvent() should be non-const
This allows functions like SDL_ConvertEventToRenderCoordinates() to work without having to copy the event.

Fixes https://github.com/libsdl-org/SDL/issues/10691
2024-09-03 08:18:36 -07:00
Sam Lantinga f11e7cd06f Add annotations to README-migration.md for functions that changed return type 2024-09-02 17:17:48 -07:00
Sam Lantinga eacf119923 Renamed SDL_size_add_overflow() and SDL_size_mul_overflow() 2024-09-02 17:17:48 -07:00
Sam Lantinga f827c1322c Renamed SDL_Del* to SDL_Remove* 2024-08-31 07:46:28 -07:00
Sam Lantinga cf1d8e2dfd Renamed SDL_AtomicSetPtr() and SDL_AtomicGetPtr()
Fixes https://github.com/libsdl-org/SDL/issues/10601
2024-08-31 07:46:28 -07:00
Frank Praznik 5d5a685a80 wayland: Add support for setting window icons via the xdg-toplevel-icon-v1 protocol 2024-08-31 09:38:43 -04:00
Anonymous Maarten c57cf716af Document the SDL-specific custom ci commands 2024-08-31 13:16:51 +02:00
Sam Lantinga b602c449e5 Remove SDL_SCALEMODE_BEST
Fixes https://github.com/libsdl-org/SDL/issues/10619
2024-08-30 10:30:14 -07:00
Sam Lantinga f08ac438ed Use stdbool for SDL_bool
This helps the compiler warn people when they're doing something like "if (SDL_Init(0) < 0)"
2024-08-27 10:31:46 -07:00
Sam Lantinga 9ff3446f03 Use SDL_bool instead an int return code in the SDL API
Most SDL functions used to indicate success or failure using an int return code. These functions have been changed to return SDL_bool.

Here is a coccinelle patch to change code that previously compared the return value to 0 and changes it to a boolean test:
@ bool_return_type  @
identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat)$";
@@
(
  func(
  ...
  )
- == 0
|
- func(
+ !func(
  ...
  )
- < 0
|
- func(
+ !func(
  ...
  )
- != 0
|
- func(
+ !func(
  ...
  )
- == -1
)
2024-08-27 10:31:46 -07:00
Anonymous Maarten 5415909f2d docs/emscripten: --embed-file does not accept a '=' 2024-08-20 16:04:58 +00:00
SDL Wiki Bot a7bed810b3 Sync SDL3 wiki -> header 2024-08-17 06:30:02 +00:00
Sam Lantinga 627cb8acd0 SDL_EventFilter functions now return SDL_bool 2024-08-06 07:59:45 -07:00
Sam Lantinga 57f9c6f7bb Renamed SDL_Get/SetRelativeMouseMode to SDL_Get/SetWindowRelativeMouseMode()
Fixes https://github.com/libsdl-org/SDL/issues/10041
2024-08-06 07:59:45 -07:00
Sam Lantinga 6161c437c7 Added SDL_SetLogPriorityPrefix()
SDL_Log() no longer prints a log prefix by default for SDL_LOG_PRIORITY_INFO and below. The log prefixes can be customized with SDL_SetLogPriorityPrefix().
2024-08-05 09:02:50 -07:00
Ryan C. Gordon 074dd8c35f
hints: Change hints to be backed by Properties, add documentation. (#9892)
This makes the subsystem thread-safe, more performant, and cleans up the code a little.

Also removed SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, since setting this hint programmatically initializes properties, which creates a lock, so we can't check hints while creating locks. The slim reader-writer locks have been the default for ages and are solid, so we'll just use those when available.
2024-08-05 09:02:28 -07:00
Sam Lantinga dfd96ff50f Updated SDL_HINT_VIDEODRIVER documentation 2024-08-05 08:54:10 -07:00
Sam Lantinga 746b8eb14b Added SDL_HINT_MUTE_CONSOLE_KEYBOARD 2024-08-05 08:54:10 -07:00
Sam Lantinga 6f399c3beb Note that SDL_HAPTIC_GAIN_MAX should remain an environment variable. 2024-08-05 08:54:10 -07:00
Sam Lantinga 0da346f129 Added SDL_HINT_HIDAPI_LIBUSB, SDL_HINT_HIDAPI_LIBUSB_WHITELIST, and SDL_HINT_HIDAPI_UDEV 2024-08-05 08:54:10 -07:00
Sam Lantinga a97dadf779 Added hints to replace environment variables on the PlayStation Vita 2024-08-05 08:54:10 -07:00
Sam Lantinga c9b2bfa7c1 Added SDL_HINT_AUDIO_DISK_INPUT_FILE, SDL_HINT_AUDIO_DISK_OUTPUT_FILE, and SDL_HINT_AUDIO_DISK_TIMESCALE 2024-08-05 08:54:10 -07:00
Sam Lantinga 897610d317 Updated migration documentation for the AUDIODEV environment variable 2024-08-05 08:54:10 -07:00
Sam Lantinga a4dc130d7e Removed the SDL_PATH_DSP environment variable from the NetBSD and OSS audio driver
The AUDIODEV environment variable is no longer used by other audio drivers, and can be used exclusively to specify the DSP audio device.
2024-08-05 08:54:10 -07:00
Sam Lantinga ff0e42c51c Removed the SDL_AUDIO_ALSA_DEBUG environment variable
The debug info is available if you set SDL_HINT_LOGGING to "audio=debug"
2024-08-05 08:54:10 -07:00
Sam Lantinga 71574ac985 Added SDL_HINT_AUDIO_DUMMY_TIMESCALE 2024-08-05 08:54:10 -07:00
Sam Lantinga 571a4b4b32 Updated macOS build requirements
Building the latest SDL requires at least Xcode 12.2 and the macOS 11.0 SDK.
2024-08-04 20:24:19 -07:00
Anonymous Maarten 349540f73f Document the new SDL3 Android archive artifact 2024-08-01 17:48:49 +00:00
Ryan C. Gordon 614a88ca3b SDL_IOFromFile: Apple targets no longer use the app bundle's resources dir.
Fixes #8403.
2024-07-29 15:44:51 -04:00
Sam Lantinga 61a88077a7 Re-added SDL_HINT_APP_ID and SDL_HINT_APP_NAME 2024-07-29 07:26:03 -04:00
Sam Lantinga a36fe632fd
Added SDL_SetAppMetadata() (#10404)
Removed duplicate hints SDL_HINT_APP_NAME, SDL_HINT_APP_ID, and
SDL_HINT_AUDIO_DEVICE_APP_NAME.

Wired up a few things to use the metadata; more to come!

Fixes https://github.com/libsdl-org/SDL/issues/4703
2024-07-28 07:22:46 -07:00
Sam Lantinga 4f55271571 Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this.

So, we're largely going back to the original system, where the API returns allocated results and you free them.

In addition, to solve the problems we originally wanted temporary memory for:
* Short strings with a finite count, like device names, get stored in a per-thread string pool.
* Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
2024-07-26 20:59:14 -07:00
Sam Lantinga 5e513ecc7f Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.
Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings.

Fixes https://github.com/libsdl-org/SDL/issues/10378
2024-07-26 10:05:03 -07:00
Frank Praznik 66eb2ea443 mouse: Make pointer warp emulation via relative mode available to all platforms
Move the Wayland pointer warp emulation code up to the SDL mouse layer, and activate it when a client attempts to warp a hidden mouse cursor when the hint is set.

testrelative adds the ability to test the warp emulation activation/deactivation with the --warp parameter and 'c' key for toggling cursor visibility.
2024-07-25 19:57:39 -04:00
Sam Lantinga a7c0192017 Renamed SDL_PostSemaphore() to SDL_SignalSemphore() 2024-07-24 13:37:40 -07:00
Sam Lantinga ca4bd4b63c Android life cycle behavior more closely matches iOS
This change also decouples the pause/resume handling from the video subsystem on Android, so applications that don't use SDL for video can get application life cycle events.

The semantics for the life cycle events are that they need to be handled in an event watch callback, and once they've been delivered, the application will block until it's been resumed. SDL_HINT_ANDROID_BLOCK_ON_PAUSE can be used to control that behavior, and if that's set to "0", then the application will continue to run in the background at low CPU usage until being resumed or stopped.

SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO has been removed, and the audio will be paused when the application is paused.

Fixes https://github.com/libsdl-org/SDL/issues/3193
2024-07-24 05:11:13 -07:00
Sam Lantinga fa0918a686 Renamed SDL life cycle functions
This maps better to how SDL delivers the events, and the iOS delegate methods are in the documentation for reference.
2024-07-24 05:11:13 -07:00
Sam Lantinga 1c4cc2b024 Updated Android minimum API level to 21 (Android 5.0)
This is necessary for the window safe area support, and is a reasonable default for SDL 3.0
2024-07-23 17:06:04 -07:00
Ryan C. Gordon 16535b7ee2
examples: Add CMake glue to optionally build examples, as we do for the tests.
In fact, most of the CMake code was stolen from the test directory.
2024-07-23 00:58:57 -04:00
Sam Lantinga ef21e31a9a SDL_GUIDFromString() renamed SDL_StringToGUID() 2024-07-22 12:39:15 -07:00
Sam Lantinga 12e50d17a2 Removed SDL_SoftStretch() from the public API
SDL_BlitSurfaceScaled() is more flexible and uses the SDL_SoftStretch() fast path when possible. Having two surface scaling APIs was confusing, especially when one of them has unexpected limitations.
2024-07-20 18:21:19 -07:00
Sam Lantinga 67fa7a9138 SDL_BlitSurface() and SDL_BlitSurfaceScaled() now have a const dstrect parameter
This was originally to avoid duplicating clipping work in Maelstrom on a 486 computer. This has been confusing for users and computers are a little faster these days, so we'll make it work the way people expect.
2024-07-20 18:21:19 -07:00
Sam Lantinga 64cb431ead Updated migration documentation for functions that now return temporary memory 2024-07-19 14:45:47 -07:00
SDL Wiki Bot 975457cfb6 Sync SDL3 wiki -> header 2024-07-19 19:23:24 +00:00
Sam Lantinga 71a60d4c0e Updated documentation for functions that return temporary memory 2024-07-19 12:22:03 -07:00
Sam Lantinga 61a7a0e579 SDL_GUIDToString() follows the SDL_GetStringRule
Also removed the distinction between SDL_GUID and SDL_JoystickGUID
2024-07-19 12:22:03 -07:00
Sam Lantinga 856d598d6e SDL_GetSensors() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga 4961af4569 SDL_GetJoysticks() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00
Sam Lantinga b32c9615a7 SDL_GetHaptics() follows the SDL_GetStringRule 2024-07-19 12:22:03 -07:00