src/SDL.c


Log

Author Commit Date CI Message
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sam Lantinga c31a4024 2021-12-17T19:04:39 Fix audio memory leaks due to invalid init (thanks Janiszewski!) SDL_Init(SDL_INIT_AUDIO) did not take into account that functions like SDL_AddAudioDevice do register events, which will need final cleanup and only gets fired when events were actually initialised. Sample call stack of a malloc missing its free (Linux + PA): SDL_malloc_REAL (SDL_malloc.c:5328) SDL_AddEvent (SDL_events.c:445) SDL_PeepEvents_REAL (SDL_events.c:531) SDL_PushEvent_REAL (SDL_events.c:762) SDL_AddAudioDevice (SDL_audio.c:443) SourceInfoCallback (SDL_pulseaudio.c:681) context_get_source_info_callback (introspect.c:534) run_action (pdispatch.c:288) pa_pdispatch_run (pdispatch.c:341) pstream_packet_callback (context.c:349) do_read (pstream.c:1012) Fixes https://github.com/libsdl-org/SDL/issues/3005
Ozkan Sezer 504e7aa5 2021-11-20T21:51:10 minor tidy-up for ifdefs & co.
Erik Soma 0e294e90 2021-10-12T18:55:31 Ensure that SDL_InitSubSystem quits subsystems after an error. (#4834) * Ensure that SDL_InitSubSystem quits subsystems after an error. * Fix unnecessary change.
Ryan C. Gordon dbdbae44 2021-04-02T14:35:11 linux: (de)initialize d-bus at init and quit. Previously we had different subsystems quitting it, in conflict, and risked multiple threads racing to init it at the same time. Fixes #3643.
Ivan Epifanov 2d64e37e 2020-11-02T18:09:43 Initial rebase of xerpi's port
Ryan C. Gordon 4ff51d29 2021-02-12T14:15:29 Deprecate SDL_GetRevisionNumber and update things for git instead of hg. Fixes #4063
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Ozkan Sezer d2723875 2020-10-14T23:01:06 os2: integrate the port into main tree.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Ozkan Sezer 200d37da 2019-11-20T02:47:40 SDL.c (SDL_ExitProcess): unconstify its param to match its declaration.
Sylvain Becker 3d100df3 2019-10-30T15:43:49 Readability: remove const-qualifation from function declaration const-qualification of parameters only has an effect in function definitions
Sylvain Becker 336a7549 2019-10-19T09:23:40 remove warning prototype SDL_ExitProcess()
Ozkan Sezer 9c14c789 2019-10-18T23:10:00 updated includes for _exit()
Sam Lantinga 097b9c30 2019-10-17T17:51:49 Better fix for iOS build
Sam Lantinga a1349d46 2019-10-17T17:51:36 Build fix for the build fix
Sam Lantinga 8984d25b 2019-10-17T17:47:27 Fixed build on iOS
Ryan C. Gordon 6be83e61 2019-10-16T13:54:35 emscripten: Patched to compile (thanks, Caleb!). Fixes Bugzilla #4827.
Ryan C. Gordon ec04110d 2019-10-14T12:41:06 dynapi: Deal with failure cases better, other fixes. Fixes Bugzilla #4803.
Ryan C. Gordon 911bf624 2019-03-15T14:08:30 events: Make debug logging of the event queue a hint instead of an #ifdef. This makes it easy to toggle it on when debugging a new platform (or just getting more visibility into an app) without having to rebuild SDL.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sam Lantinga b73703b9 2018-11-19T21:17:00 Fixed bug 4391 - hid_enumerate() sometimes causes game to freeze for a few seconds Daniel Gibson Even though my game (dhewm3) doesn't use SDL_INIT_JOYSTICK, SDL_PumpEvent() calls SDL_JoystickUpdate() which ends up calling hid_enumerate() every three seconds, and sometimes on my Win7 box hid_enumerate() takes about 5 seconds, which causes the whole game to freeze for that time.
Sam Lantinga 5febdfce 2018-09-24T11:49:25 Fixed whitespace
Sam Lantinga 6f758ad2 2018-08-21T20:03:54 Moved SDL_IsTablet() to a cross-platform API function
Sam Lantinga 7c3040e0 2018-08-21T12:11:34 First pass on the new SDL sensor API
Sam Lantinga a0687a9c 2018-02-21T09:40:47 Fixed bug 4034 - Don't include _DllMainCRTStartup() if SDL_STATIC_LIB is defined.
Sam Lantinga 58f9be12 2018-02-18T09:09:56 Actually, this is needed for building with Visual Studio with both /MT and /MD. With the previous change, I get: 1> Creating library C:\projects\SDL\VisualC\Win32\Debug\SDL2.lib and object C:\projects\SDL\VisualC\Win32\Debug\SDL2.exp 1>LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
Sam Lantinga 3c9d3336 2018-02-18T08:57:01 Fixed bug 4034 - Do we really need _DllMainCRTStartup() in every Windows build? Andreas Falkenhahn In src/SDL.c there is this code: _DllMainCRTStartup(HANDLE hModule, ... The comment says that this is needed on Watcom C for some reason but why is it included then when building with Visual C as well? Shouldn't it be only included when compiling on Watcom C then? I'm asking because this code caused me a lot of headaches because I'm building a DLL that contains SDL and I link using /MT and the _DllMainCRTStartup() symbol obviously led to lots of trouble but it wasn't clear to me where the problem was because all I got from the linker was: LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup So I had to got through each and every object to see what the culprit was. See here for the full story: https://stackoverflow.com/questions/25067151/lnk2019-unresolved-external-symbol-main-referenced-in-function-tmaincrtstar/48177067#48177067 So if it isn't necessary on Visual C, please just leave that symbol out on Visual C so that it no longer leads to any trouble. Thanks.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Ryan C. Gordon c57fe6d7 2017-04-01T00:46:42 Backing out broken change from previous commit.
Ryan C. Gordon ed7f16e2 2017-04-01T00:46:15 Intentionally breaking buildbot to test email server change.
Ryan C. Gordon d526b8a1 2017-03-02T13:33:04 Some patches to make SDL compile with armcc (ARM's C compiler).
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Sam Lantinga 57d01d7d 2016-11-13T22:57:41 Patch from Sylvain to fix clang warnings
Sam Lantinga 0eb5c976 2016-10-17T21:44:32 Fixed bug 3456 - SDL_GameControllerOpen fails if the joystick subsystem isn't initialized Philipp Wiesemann Maybe the fault is in the SDL_VIDEO_DRIVER_WINDOWS section in SDL_InitSubSystem() of "src/SDL.c". Because there only SDL_INIT_JOYSTICK is checked. The flags are adapted for SDL_INIT_GAMECONTROLLER afterwards.
Alex Szpakowski f0505766 2016-09-13T22:18:06 Initial Apple TV / tvOS support. The Apple TV remote is currently exposed as a joystick with its touch surface treated as two axes. Key presses are also generated when its buttons and touch surface are used. A new hint has been added to help deal with deciding whether to background the app when the remote's menu button is pressed: SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Ryan C. Gordon baea64e6 2015-05-26T21:19:23 Stack hint should look for 0, not -1, and not care about environment variables.
Ryan C. Gordon a8fa7bd1 2015-05-26T21:13:27 Added a hint to specify new thread stack size (thanks, Gabriel!). Fixes Bugzilla #2019. (we'll do a better fix when we break the API in SDL 2.1.)
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Philipp Wiesemann 2bb73d17 2015-02-14T00:08:48 Emscripten: Fixed SDL_GetPlatform() returning "Unknown" instead of "Emscripten".
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
David Ludwig 646025b6 2014-11-15T10:19:39 WinRT: made SDL_GetPlatform() return "WinRT" and not 'Unknown' Thanks to Eric Wing for the heads-up on this!
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga 80e401ab 2014-06-21T11:48:12 Added NaCl to SDL_GetPlatform()
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga e663b4eb 2014-03-01T09:50:52 Fixed bug 2423 - timeBeginPeriod & timeEndPeriod mismatch Coriiander In src\timer\windows\SDL_systimer.c there is an error with regards to timeBeginPeriod and timeEndPeriod. These functions typically get called when no high resolution timer is available, and GetTickCount is not used. According to MSDN (link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757624(v=vs.85).aspx), for every call to timeBeginPeriod a subsequent call to timeEndPeriod is required. While SDL is currently doing this, it fails to call timeEndPeriod when cleaning up/shutting down SDL. Please note that these functions affect things on a system level. Failing to call timeEndPeriod, disables applications for using WINMM-timers after usage&shutdown of SDL, as effectively they the mechanism is now broken. Solution: Ensure this code gets called when shutting down the timer subsystem: #ifndef USE_GETTICKCOUNT if (!hires_timer_available) { timeSetPeriod(0); } #endif
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Ryan C. Gordon 00003e8c 2013-11-14T11:51:24 Renamed things named after BeOS to be named after Haiku instead.
Sam Lantinga 3523b409 2013-11-08T14:05:15 Made helper window creation depend on initializing the Haptics or Joystick subsystems.
Sam Lantinga ade13fd7 2013-10-20T10:39:26 It's okay to quit things more than once.
Sam Lantinga 12ca3ce3 2013-10-17T23:02:29 Fixed building using MinGW Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
Sam Lantinga a7b2db05 2013-10-13T19:48:45 Added an assert to catch init/quit call mismatch that might bite people.
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.