Commit graph

8066 commits

Author SHA1 Message Date
Ryan C. Gordon
9fd7d23246 Bunch of reworking to how we manage audio devices.
Device enumeration now happens at startup and then is managed exclusively
through hotplugging instead of full redetection. The device name list now has
a unique "handle" associated with each item and SDL will pass this to the
backend so they don't have to figure out how a human readable name maps to
real hardware for a second time.

Other cleanups, fixes, improvements, plus all the audio backends updated to
the new interface...largely untested at this point, though.

--HG--
extra : rebase_source : c9a4272788a67deb7a787304ef008188bb40184d
2015-03-18 02:01:17 -04:00
Ryan C. Gordon
e98dd173b7 Initial work on audio device hotplug support.
This fills in the core pieces and fully implements it for Mac OS X.

Most other platforms, at the moment, will report a disconnected device if
it fails to write audio, but don't notice if the system's device list changed
at all.

--HG--
extra : rebase_source : f7e7efbbeecfe58338b0f325340c358c2bdfc402
2015-03-16 02:11:39 -04:00
Ryan C. Gordon
390dd29faa Changed some SDL_memset() calls to SDL_zero().
--HG--
extra : rebase_source : b7fa90eeecb5272a753e4d1f395926023266f330
2015-03-18 10:09:39 -04:00
Ryan C. Gordon
8b4b24c103 Tweaked a couple comments, added some FIXMEs.
--HG--
extra : rebase_source : 57eb90da4411aba512a3df1af1d60bb6daa72aa6
2015-03-18 10:09:23 -04:00
David Ludwig
6a1d79c7cd WinRT: updated names, and references-to, various ANGLE/WinRT repositories 2015-03-18 12:03:32 -04:00
Ryan C. Gordon
466c8a104b Patched to compile on C89 compilers. 2015-03-18 10:05:36 -04:00
Ryan C. Gordon
f8af9d36b1 PulseAudio: Added multiple device support, other cleanups.
Thanks to Dominik Frizel for most of the effort on this!

Fixes Bugzilla #2730.
2015-03-18 09:59:22 -04:00
Ryan C. Gordon
317ab8a96a Fixed a compiler warning. 2015-03-18 00:56:33 -04:00
David Ludwig
0c003b66c4 WinRT: made OpenGL window-init work with latest round of ANGLE/WinRT updates
Various constants in ANGLE/WinRT, both in MSOpenTech's ms-master branch, and
in Google's branch, were changed again.  This change makes SDL/WinRT work with
them.

To note, the ms-master branch (of ANGLE) was updated via this merge:
bbd2eb0a9c (diff-d1377fbe747de154e1bfcf7221d3de67)
2015-03-17 19:45:47 -04:00
David Ludwig
7be22f39a9 WinRT: another ANGLE/OpenGL-initialization, error messaging tweak 2015-03-17 10:25:21 -04:00
David Ludwig
93fc5ce8a9 WinRT: ANGLE/OpenGLES-initialization, error message improvements 2015-03-17 10:22:36 -04:00
Philipp Wiesemann
37895d5fa7 Updated name of assert type in test program. 2015-03-15 19:25:10 +01:00
Ryan C. Gordon
3b609feebf Cleaning out a silly coding style I used to use.
Changed all the "return (x);" lines to "return x;"
2015-03-13 12:20:17 -04:00
Ryan C. Gordon
ad570bffcc Removed an unnecessary #ifdef. 2015-03-13 00:48:30 -04:00
Philipp Wiesemann
bde0ce0969 Updated internal documentation comments. 2015-03-11 21:14:21 +01:00
Philipp Wiesemann
b6737b215d Windows: Fixed ignoring return value of internal function.
If the function WIN_ConvertUTF32toUTF8() failed (should currently not be
possible) a not terminated string would have been sent as text input event.

This also fixed converting characters more often than needed on key repetition.
2015-03-06 21:34:10 +01:00
Philipp Wiesemann
cf9936654d Emscripten: Fixed ignoring return value of internal function.
If the function Emscripten_ConvertUTF32toUTF8() failed (should currently not be
possible) a not terminated string would have been sent as text input event.
2015-03-06 21:29:25 +01:00
Philipp Wiesemann
0eb350f9ec Emscripten: Partially fixed not removing key event callbacks if hint was used.
The key event callbacks were always removed from the same target although it is
possible to set them to different targets using the hint. This is only a partial
fix because it assumes that the hint is not changed to a different value later.
2015-03-06 21:26:37 +01:00
Ryan C. Gordon
12d065e7e1 Fixed SDL_PRI?64 for 64-bit Linux.
64-bit Linux uses a "long" instead of "long long" for 64-bit ints.

Added a special-case this so SDL_PRI?64 doesn't trigger compiler warnings
when used with SDL's 64-bit datatypes on 64-bit Linux.

--HG--
extra : rebase_source : 573ae86baa2648ab2b84479f2d8058e2c6dec009
2015-03-02 21:36:45 -05:00
Alfred Reynolds
f1bdf20e1d SDL
- fix crash on OSX when removing a device. If the remove happened due to the CFRunLoopRunInMode call in SDL_SYS_JoystickDetect then we would delete the device right away, before SDL_SYS_JoystickUpdate could clean it up. So move the CFRunLoopRunInMode to after the cleanup logic, preventing this case. This does mean that adds and removes of joysticks now take 1 extra frame to show up.
2015-03-02 11:43:24 -08:00
David Ludwig
2287c7b032 Fixed bug 2868 - SDL_FillRect can crash if surface's clip-rect is out-of-bounds
Thanks to John Skaller for the research into this, and for the fix!
2015-02-22 20:34:08 -05:00
Philipp Wiesemann
e4f4a0e0af Emscripten: Fixed out of range joystick device index after joystick disconnect.
After disconnecting a joystick the remaining kept their original device index.
This was not correct because the device index must be a number between 0 and
SDL_NumJoysticks(). It was fixed with ideas from SDL's joystick implementation
for Android. Some range checks were removed as the caller already checks them.
2015-02-22 23:21:32 +01:00
Philipp Wiesemann
eb9d379503 Emscripten: Fixed sending button and motion events for not opened joysticks.
SDL_SYS_JoystickUpdate() was implemented incorrectly. For every call to it all
attached joysticks were checked. But actually only the given SDL_Joystick should
be checked then. This allowed sending broken events for attached but not opened
joysticks. It also checked the opened joysticks more often than actually needed.
2015-02-22 21:00:35 +01:00
Ryan C. Gordon
79abb08b76 Fixed naming conventions in some SDL_assert types, added compat #defines.
Fixes Bugzilla #1997.
2015-02-21 00:33:25 -05:00
Ryan C. Gordon
984d72502d Mac OS X: Better way to stop duplicate joystick reports (thanks, Kyungdahm!).
Fixes Bugzilla #2822.
2015-02-19 23:52:10 -05:00
Ryan C. Gordon
3951d03c49 Windows: Added a FIXME.
--HG--
extra : amend_source : c4478dd58e8560a9636d8dd64c79f9b5c15e0621
2015-02-19 21:51:13 -05:00
Ryan C. Gordon
b549a0f797 Windows: Free the argv we allocated for console_wmain(). 2015-02-19 21:50:40 -05:00
Ryan C. Gordon
d0c74b7b23 Windows: Added a FIXME. 2015-02-19 21:49:30 -05:00
Ryan C. Gordon
f9cd47e187 Windows: Make a distinction between ANSI mainline and UTF-8 mainline. 2015-02-19 21:49:15 -05:00
Ryan C. Gordon
c2ba56ccb7 Windows: Support unicode arguments for console applications (thanks, Jorgen!).
Fixes Bugzilla #2864.
2015-02-19 21:44:41 -05:00
Ryan C. Gordon
a33b3fca95 Mac OS X: replace some deprecated APIs with modern equivalents (thanks, Alex!).
Fixes Bugzilla #2858.
2015-02-19 19:55:30 -05:00
Edward Rudd
05b4247f94 SDL_SetWindowPosition respects display num for SDL_WINDOWPOS_CENTERED_DISPLAY.
This allows for this kind of code in an application:

int monitorID = 1;  // the second monitor!
SDL_SetWindowPosition(sdlWin,
                      SDL_WINDOWPOS_CENTERED_DISPLAY(monitorID),
                      SDL_WINDOWPOS_CENTERED_DISPLAY(monitorID));

Fixes Bugzilla #2849.
2015-02-19 19:40:58 -05:00
Alex Szpakowski
5ed59597bb Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-01-24 23:58:07 -04:00
Alex Szpakowski
46ed3de4f7 Fixed the extended launch screen causing minor visual issues when rotating the screen in some circumstances.
--HG--
branch : iOS-improvements
2015-01-24 23:53:41 -04:00
Philipp Wiesemann
d2aee7d409 Fixed bug 2816 - [patch] Android: Expose screen refresh rate
Jonas Kulla

Display::getRefreshRate() is available on all API levels.
2015-01-23 20:29:08 +01:00
Ryan C. Gordon
9d2b5dd67d CMake: Removed unused variable (thanks, Felix!).
"MACOSX_COREAUDIO" is actually an internal #define set up elsewhere, and
this CMake var is never exported past the CMake script anyhow.

Partially fixes Bugzilla #2807.
2015-01-18 02:50:14 -05:00
Felix H. Dahlke
5bd19d340d Fixed bug 2807 - Not using CoreAudio on OS X when built via CMake 2015-01-17 04:36:15 +01:00
Philipp Wiesemann
29d25ec1b5 Fixed wrong documentation in joystick implementation source. 2015-01-16 23:07:10 +01:00
Philipp Wiesemann
97ce204e2f Fixed two warnings about initialized but unused local variables in tests. 2015-01-16 23:03:14 +01:00
Alex Szpakowski
f2452bba77 Merged default into iOS-improvements
--HG--
branch : iOS-improvements
2015-01-15 01:15:24 -04:00
Alex Szpakowski
b323ac5ca6 Several improvements to the iOS backend:
- Added new custom launch screen code. It uses the launch screen nib when available on iOS 8+, the launch images dictionary if the launch screen nib isn't available, and the old standard image names if the launch image dictionary isn't in the plist.
The launch screen is now hidden during the first call to SDL_PumpEvents rather than SDL_CreateWindow so apps can have the launch screen still visible if they do time-consuming loading after creating their window. It also fades out in roughly the same way as the system launch screen behavior.
It can be disabled by setting the SDL_IPHONE_LAUNCHSCREEN define in SDL_config_iphoneos.h to 0.

- A blank UIView is now created and displayed when the window is first created. The old behavior was to defer creating any view until SDL_GL_CreateContext, which prevented rotation, touch events, and other windowing-related things from working until then. This also makes it easier to use SDL_GetWindowWMInfo after creating a window.

- Moved the keyboard and animation callback code from SDL's UIView subclasses to its UIViewController subclass, which lets them work properly in all cases when a SDL window is valid, even before SDL_GL_CreateContext is called and after SDL_GL_DeleteContext is called.

- SDL_GL_CreateContext, SDL_GL_SwapWindow, SDL_GL_MakeCurrent, and SDL_GL_DeleteContext are more robust.

- Fixed some edge cases where SDL windows weren't rotating properly or their reported sizes were out of sync with their actual sizes.

- Removed all calls to [UIApplication setStatusBarOrientation:]. It doesn't seem to work as expected in all cases in recent iOS versions.

- Some code style cleanup.

--HG--
branch : iOS-improvements
2015-01-15 01:06:14 -04:00
Philipp Wiesemann
32bb7897e2 Added and fixed doxygen markup in header file. 2015-01-12 23:20:52 +01:00
Arne Janbu
551c20baf2 Fix build on Linux when wayland is enabled
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2838
2015-01-10 13:47:37 +01:00
Ryan C. Gordon
8b1b079795 Some corrections to the SDL2.spec.in (thanks, Simone!).
Fixes Bugzilla #2809.
2015-02-19 13:42:56 -05:00
Ryan C. Gordon
e08e2cd4eb Remove unnecessary parentheses and an unnecessary free() of a NULL pointer.
(Thanks, Simon!)

Fixes Bugzilla #2881.
2015-02-19 13:11:19 -05:00
Ryan C. Gordon
139252cb4e Corrected documentation about triggers values in SDL_GameControllerGetAxis().
Fixes Bugzilla #2319.
2015-02-18 16:25:15 -05:00
Ryan C. Gordon
25c786a0d9 We maintain the list of platforms on the wiki now.
Also, I don't really want people emailing community members directly with
problems, so I'm removing their email addresses.

Fixes Bugzilla #2304.

--HG--
extra : rebase_source : 3be8e4d6bb5c9fb121ffab0847e868cfce068e27
2015-02-18 16:17:53 -05:00
Philipp Wiesemann
1a2231c115 Emscripten: Fixed receiving joystick events after failed init or subsystem quit.
The callbacks used to receive the HTML events were not removed if the joystick
subsystem initialization failed or if the joystick subsystem was quit. Also, the
already connected joysticks were not deleted if the initialization failed later.
2015-02-18 21:34:07 +01:00
Philipp Wiesemann
f3b8ca2a36 Removed redundant include statements from test programs.
The needed header files are already included with SDL.h. Still including them in
the test programs is confusing because it somehow suggests they would be needed.
2015-02-18 21:31:21 +01:00
Ryan C. Gordon
1a17139cf1 X11: Don't create a window and GL context to look up the glX extension string.
It's not necessary.

--HG--
extra : rebase_source : 6b2111b284a971832ce6d1315481c4a888e4e39a
extra : amend_source : 95f007dae5432aa52c49861487756b9d7b0c9526
2015-02-17 23:00:46 -05:00