Commit Graph

288 Commits (7bd72219977906b05fdd4820b6ba9f25458ad161)

Author SHA1 Message Date
Alex Szpakowski c4035654a9 Added framebuffer and colorbuffer members to the uikit portion of the SDL_SysWMinfo struct, removed SDL_iOSGetViewRenderbuffer and SDL_iOSGetViewFramebuffer. 2015-04-09 19:28:00 -03:00
Alex Szpakowski fcd0f06a88 Renamed SDL_iPhoneGetViewFramebuffer/Renderbuffer to SDL_iOSGetViewFramebuffer/Renderbuffer. Added #defines for SDL_iOSSetAnimationCallback and SDL_iOSSetEventPump, which point to SDL_iPhoneSetAnimationCallback and SDL_iPhoneSetEventPump. 2015-04-08 15:59:29 -03:00
Alex Szpakowski 26c28114ee Merged default into iOS-improvements 2015-04-08 15:35:07 -03:00
Ryan C. Gordon 1339ce71f6 Make SDL_stdinc.h work when compiling with -Wundef (thanks, Ben!).
Fixes Bugzilla #2664.
2015-04-08 01:42:47 -04:00
Ryan C. Gordon 6a126a48df Do the "fix" for asserts with MSVC's /W4 warnings only on MSVC.
Naturally, this way generates a warning on GCC and Clang instead.  :)
2015-04-07 23:40:01 -04:00
Alex Szpakowski df98b11c47 Merged default into iOS-improvements 2015-04-06 15:26:37 -03:00
Ryan C. Gordon a0e878aafb Minor input grab clarifications.
Clarify that grabbing the mouse only works with one window at a time; this was
always true at the system level, though SDL could previously get confused
by multiple simultaneous grabs, so now we explicitly break any existing
grab before starting a new one and document it as such.

Also track the window that is currently grabbed, and provide an API to query
for that window. This makes it easy to automate mouse ungrabbing at
breakpoints with gdb7's scripting, since the scripts can now know which window
to ungrab.

In 2.1, we should probably change this API to SDL_GrabInput(win) and
SDL_UngrabInput(void), or something.
2015-03-28 00:48:03 -04:00
Joseba Garc?a Etxebarria 387fa5dcfb * Improve mouse support in Android. These changes require Android API v12 to compile 2015-03-24 20:45:29 +01:00
Ryan C. Gordon 672ccb4f54 Make the signal handler hint more generic. 2015-03-24 14:36:36 -04:00
Ryan C. Gordon a91a5604cd Added a hint to prevent SDL from installing signal handlers.
Fixes Bugzilla #2431.
2015-03-24 14:29:25 -04:00
Ryan C. Gordon 331a434fa1 Windows: Report window HDC in SDL_SysWMinfo.
Fixes Bugzilla #2668.
2015-03-23 19:47:08 -04:00
Philipp Wiesemann 49f33b41a7 Added missing SDL_DOLLARRECORD event type documentation in header. 2015-03-21 22:42:53 +01:00
Philipp Wiesemann 716ef0d5f2 Fixed confusing audio and touch events because of shared enumeration values. 2015-03-21 08:01:43 +01:00
Ryan C. Gordon 3e9c2e7512 Another attempt to make MSVC's /W4 warning level cooperate with SDL_assert.
Fixes Bugzilla #2733.
2015-04-07 00:39:16 -04:00
Marc Di Luzio f5d96416ad Allow setting of GL_CONTEXT_RELEASE_BEHAVIOR when creating the GL context when GLX_ARB_context_flush_control is available.
This extension allows the user to specify whether a full flush is performed when making a context not current.
The only way to set this currently is at context creation, so this patch provides that functionality.
Defualt behaviour is set at FLUSH, as per the spec.

This patch does not contain the changes to WGL, appleGL or other platforms as I do not have access to GL 4.5 hardware on those platforms.

Full details on the use of KHR_context_flush_control can be found here:
https://www.opengl.org/registry/specs/KHR/context_flush_control.txt
2015-03-06 16:03:40 +00:00
Ryan C. Gordon c1091f32fb CMake project files no longer force you to link against Wayland or Mir libs. 2015-03-20 10:35:42 -04:00
Ryan C. Gordon 0e02ce0856 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.
2015-03-16 02:11:39 -04:00
Ryan C. Gordon 483ea8b7b0 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.
2015-03-02 21:36:45 -05:00
Ryan C. Gordon e4be934f5d Fixed naming conventions in some SDL_assert types, added compat #defines.
Fixes Bugzilla #1997.
2015-02-21 00:33:25 -05:00
Edward Rudd b88ca1b4a6 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
2015-02-10 16:28:56 -05:00
Alex Szpakowski ea5d1a8a3f Merged default into iOS-improvements 2015-01-15 01:15:24 -04:00
Alex Szpakowski 01bfc2158a 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.
2015-01-15 01:06:14 -04:00
Philipp Wiesemann 775a5aa554 Added and fixed doxygen markup in header file. 2015-01-12 23:20:52 +01:00
Ryan C. Gordon 80ba854749 Corrected documentation about triggers values in SDL_GameControllerGetAxis().
Fixes Bugzilla #2319.
2015-02-18 16:25:15 -05:00
Philipp Wiesemann 0781b5f9ee Fix typos in header file documentation comments. 2015-01-30 23:20:15 +01:00
Philipp Wiesemann b48e54aafe 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.
2015-01-26 22:00:29 +01:00
Ryan C. Gordon a823982e02 Clang static analysis builds should use C runtime directly.
This is a little macro magic to use malloc() directly instead of SDL_malloc(),
 etc, so static analysis tests that know about the C runtime can function
 properly, and understand that we are dealing with heap allocations, etc.

This changed our static analysis report from 5 outstanding bugs to 30.

5x as many bugs were hidden by SDL_malloc() not being recognized as malloc()
 by the static analyzer!
2015-01-05 01:41:42 -05:00
Philipp Wiesemann 3cfe0abe7b Fixed copyright date. 2014-12-28 22:10:24 +01:00
David Ludwig bbaaa77751 WinRT: hiding SDL_WinRTRunApp's XAML functionality, until it's ready for use
SDL_WinRTRunApp() is used on WinRT to launch a main(int, char **)-style
function.  It has optional, and experimental support for launching content
inside a XAML control, backed by a main() function running on a separate thread.
This is provided via it's 2nd parameter, which can be a pointer to a XAML
control.  (If NULL, XAML support will not be used.)

This change renames the experimental feature's parameter (to SDL_WinRTRunApp())
as "reserved", until such time as the functionality is ready for use.  It will
likely be renamed again in the future, when running SDL on top of a XAML control
via a separate thread, becomes reasonably usable.
2014-12-24 11:33:42 -05:00
Philipp Wiesemann 80d19b7ee3 Fixed typo in header file documentation comment. 2014-12-25 22:05:48 +01:00
Ryan C. Gordon fe40a17224 Initial merge of Emscripten port!
With this commit, you can compile SDL2 with Emscripten
( http://emscripten.org/ ), and make your SDL-based C/C++ program
into a web app.

This port was due to the efforts of several people, including: Charlie Birks,
Sathyanarayanan Gunasekaran, Jukka Jyl?nki, Alon Zakai, Edward Rudd,
Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
2014-12-18 00:19:52 -05:00
Edward Rudd 623b9d6d91 ugh.. stray character 2014-12-03 12:47:39 -05:00
Edward Rudd 06d357fb17 fix SDL_PRIs64 on windows compilers.. (should end in d) 2014-12-03 12:45:04 -05:00
Edward Rudd 73daadb74e switch to use SDL_PRI* macros for long long formatting everywhere. 2014-12-03 12:23:17 -05:00
Alex Szpakowski cc0631a095 Merged default into iOS-improvements 2014-12-02 02:52:45 -04:00
Andreas Schiffler 52760dcdf1 Fix assert format strings/parameters in testautomation modules; improve output of SDL_CompareSurfaces to aid debugging; update platform_testSetErrorInvalidInput for SDL changes 2014-11-30 20:55:27 -08:00
Sam Lantinga a5ce9c1113 Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification
Elias Vanderstuyft

"Horizontal" is not very precise, use "Positive phase" instead.
"Positive" because it's actually waveform(2*pi*t + phase) instead of waveform(2*pi*t - phase).
2014-11-29 11:49:58 -08:00
Sam Lantinga ef8c3d89ce Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification
Elias Vanderstuyft

It's not obvious from the general "haptic direction" description what the SDL direction actually means in terms of force magnitude sign,
currently its meaning is only reflected by the example.
2014-11-29 11:48:43 -08:00
Sam Lantinga 48481c8e55 Improved the pitch variable description 2014-11-29 11:18:49 -08:00
David Ludwig ce64b4ad3a WinRT: bug and data-integrity fixes for SDL_GetPrefPath()
This change does a few things, all with regards to the WinRT implementation of
SDL_GetPrefPath():

1. it fixes a bug whereby SDL_GetPrefPath() did not create the directory it
returned.  On other SDL platforms, SDL_GetPrefPath() will create separate
directories for its 'org' and 'app' folders.  Without this, attempts to create
files in the pref-path would fail, unless those directories were first created
by the app, or by some other library the app used.  This change makes sure
that these directories get created, before SDL_GetPrefPath() returns to its
caller(s).


2. it defaults to having SDL_GetPrefPath() return a WinRT 'Local' folder
on all platforms.  Previously, for Windows Store apps, it would have used a
different, 'Roaming' folder.  Files in Roaming folders can be automatically,
and synchronized across multiple devices by Windows.  This synchronization can
happen while the app runs, with new files being copied into a running app's
pref-path.  Unless an app is specifically designed to handle this scenario,
there is a chance that save-data could be overwritten in unwanted or
unexpected ways.

The default is now to use a Local folder, which does not get synchronized, and
which is arguably a bit safer to use.  Apps that wish to use Roaming folders
can do so by setting SDL_HINT_WINRT_PREF_PATH_ROOT to "roaming", however it
is recommended that one first read Microsoft's documentation for Roaming
files, a link to which is provided in README-winrt.md.

To preserve older pref-path selection behavior (found in SDL 2.0.3, as well as
many pre-2.0.4 versions of SDL from hg.libsdl.org), which uses a Roaming path
in Windows Store apps, and a Local path in Windows Phone, set
SDL_HINT_WINRT_PREF_PATH_ROOT to "old".

Please note that Roaming paths are not supported on Windows Phone 8.0, due to
limitations in the OS itself.  Attempts to use this will fail.
(Windows Phone 8.1 does not have this limitation, however.)


3. It makes SDL_GetPrefPath(), when on Windows Phone 8.0, and when
SDL_HINT_WINRT_PREF_PATH_ROOT is set to "roaming", return NULL, rather than
silently defaulting to a Local path (then switching to a Roaming path if and
when the user upgraded to Windows Phone 8.1).
2014-11-29 10:09:30 -05:00
Edward Rudd 5b5823eeb5 add in support for passing down the "natural" (or flipped) scrolling direction in the MouseWheelEvent event 2014-11-23 21:09:54 -05:00
David Ludwig 70438be272 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!
2014-12-03 10:55:23 -05:00
Alex Szpakowski 0b02de757d Merged default into iOS-improvements 2014-11-15 22:59:16 -04:00
David Ludwig ecc014740a WinRT: added SDL_HINT_WINRT_PREF_PATH_ROOT
SDL_HINT_WINRT_PREF_PATH_ROOT allows WinRT apps to alter the path that
SDL_GetPrefPath() returns.  Setting it to "local" uses the app's
OS-defined Local folder, setting it to "roaming" uses the app's OS-defined
Roaming folder.

Roaming folder support is not available in Windows Phone 8.0.  Attempts to
make SDL_GetPrefPath() return a Roaming folder on this OS will be ignored.

Various bits of documentation on this were added to SDL_hints.h, and to
README-winrt.md
2014-11-27 09:55:34 -05:00
Philipp Wiesemann 5bdc9913ac Corrected header file guard comments. 2014-11-25 22:37:12 +01:00
Philipp Wiesemann 43e5c9ee00 Fixed doxygen tags in header file documentation comments. 2014-11-23 20:46:34 +01:00
Philipp Wiesemann c0165972c3 Fixed typos in header file documentation comments. 2014-11-23 20:40:48 +01:00
Philipp Wiesemann a690944e44 Fixed typo in header file documentation comment. 2014-11-23 11:26:46 +01:00
Philipp Wiesemann 9c398852e6 Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
David Ludwig bbe1df0d51 WinRT: enabled OpenGL ES 2 support on Windows Phone
The "future-dev" branch of MSOpenTech's ANGLE/WinRT repository (at
https://github.com/msopentech/angle) includes support for Windows Phone 8.1.
This change allows it to be used in conjunction with SDL's OpenGL functions.
2014-11-02 10:32:25 -05:00