Commit Graph

127 Commits

Author SHA1 Message Date
Sam Lantinga
af823cc1d9 Fixed building on tvOS 2018-09-10 23:00:09 -07:00
Sam Lantinga
088070e5a8 Moved display orientation handling on iOS out to a separate function for Qt apps 2018-08-22 23:47:29 -07:00
Sam Lantinga
f225af0c1e Added SDL_GetDisplayOrientation() to get the display orientation, and added a new event SDL_DISPLAYEVENT to notify the application when the orientation changes.
Documented the values returned by the accelerometer and gyroscope sensors
2018-08-22 21:48:28 -07:00
Sam Lantinga
6f758ad25f Moved SDL_IsTablet() to a cross-platform API function 2018-08-21 20:03:54 -07:00
Sam Lantinga
109544ca04 Add SDL_IsTablet() to Android and iOS SDL. 2018-08-21 11:23:47 -07:00
Ryan C. Gordon
3d3870982c metal: contrary to documentation, we need to set the drawableSize explicitly.
Fixes Bugzilla #4149.
2018-05-27 20:30:03 -04:00
Sam Lantinga
999af8099b Merged latest changes from Steam Link app 2018-05-18 13:09:30 -07:00
Sam Lantinga
ac2d1f6773 Fixed setting the layer drawable size
Without this change the drawable had a size of 0 and the metal renderer asserted because the projection matrix wasn't set.
2018-03-02 12:08:18 -08:00
Mark Callow
69958441be Fix high-dpi support on macOS and simplify it and iOS variant.
The detault drawableSize for a CAMetalLayer is its bounds x its scale.
So it is sufficient to set the *layer's* scale to the desired value.
2018-02-21 09:58:21 -08:00
sezero
40b27fd51b revert the recent typecast assignment changes (see bug #4079)
also change the void* typedefs for the two vulkan function
pointers added in vulkan_internal.h  into generic function
pointer typedefs.
2018-02-12 17:00:00 +03:00
Sam Lantinga
73c26c204c Send Apple TV remote input as key events unless it's opened as a joystick, to match Android behavior. 2018-02-06 16:43:31 -08:00
Sam Lantinga
f59b9c8b13 Replaced SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS with SDL_HINT_TV_REMOTE_AS_JOYSTICK which controls whether remotes on iOS and Android are interpreted as joysticks (the default) or as return/escape/arrow keys. 2018-02-06 15:03:38 -08:00
Sam Lantinga
35322ed847 Fixed building on tvOS 2018-02-01 15:46:51 -08:00
Sam Lantinga
85c34e9a39 Added SDL_HINT_IOS_HIDE_HOME_INDICATOR to determine how the home indicator on the iPhone X is handled.
This variable can be set to the following values:
   "0"       - The indicator bar is not hidden (default for windowed applications)
   "1"       - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications)
   "2"       - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications)
2018-02-01 15:21:01 -08:00
Sam Lantinga
90e72bf4e2 Fixed ISO C99 compatibility
SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
2018-01-30 18:08:34 -08:00
Sam Lantinga
9338a619f8 Added a hint SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS to prevent turning Apple TV remote swipes into arrow key events 2018-01-17 17:24:15 -08:00
Sam Lantinga
e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
b92e2f027a Fixed bug 4004 - iOS: don't hide keyboard on RETURN
Dominik Reichardt

As discussed in 2012 the iOS onscreen keyboard hides when you hit RETURN (see https://discourse.libsdl.org/t/on-screen-keyboard-change/19216).
IMO this is a bad idea to not be able to influence this behavior and just recently this was fixed for Android by adding the hint SDL_HINT_ANDROID_RETURN_HIDES_IME in changeset 11768	6ce3bb5e38a5.
2017-12-19 10:57:21 -08:00
Sam Lantinga
127841f315 Fixed compiler warning 2017-12-08 11:33:27 -08:00
Sam Lantinga
ba9c336e04 Fixed building for simulators or older iOS SDKs 2017-12-07 17:47:01 -08:00
Sam Lantinga
6deb1e7595 Fixed compiling Metal renderer on iOS 2017-12-07 17:12:03 -08:00
Sam Lantinga
cadf3e44ca The Metal view is a full SDL_uikitview to support multi-touch 2017-12-07 09:35:28 -08:00
Alex Szpakowski
e5cfb58f4a iOS MoltenVK code style cleanup. 2017-09-21 20:30:25 -03:00
Sam Lantinga
f0a324f8eb Reverted Alex's commit 131cba1768a5 - we're about to release 2.0.6, don't remove support for the iOS 7 SDK yet. 2017-09-20 19:59:34 -07:00
Alex Szpakowski
d452b89f9b iOS: I don't think SDL compiles with the iOS 7 SDK anymore, so we might as well drop the #ifdefs trying to guard for that. 2017-09-20 11:01:32 -03:00
Alex Szpakowski
12fb004fba iOS: remove an unused static variable 2017-09-20 10:53:41 -03:00
Sam Lantinga
cfe72c76e2 Fixed iOS keyboard positioning, based on the final position rather than the initial one 2017-09-14 09:55:27 -07:00
Alex Szpakowski
b959be2569 Code style cleanup in the Cocoa and UIKit vulkan files. 2017-08-31 21:26:13 -03:00
Sam Lantinga
50efbda736 Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
Sam Lantinga
0d011ec66d Renaming of guard header names to quiet -Wreserved-id-macro 2017-08-28 00:22:23 -07:00
Sam Lantinga
ce2b16445e Be clear that disabling Vulkan surface support disables the entire SDL Vulkan integration 2017-08-28 00:11:38 -07:00
Ryan C. Gordon
25e3a1ec90 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.
2017-08-27 22:15:57 -04:00
Alex Szpakowski
3d0f521be5 iOS 10: Work around screen bounds orientation bug. Fixes bugs #3465 and #3505. 2017-08-18 23:23:30 -03:00
Alex Szpakowski
a0a09f646c Improve iOS keyboard demo code a bit. 2017-08-15 22:53:57 -03:00
Sam Lantinga
de91b1248f Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks
Patches contributed by Ozkan Sezer
2017-08-14 06:28:21 -07:00
Alex Szpakowski
9be597a0d6 iOS: Fix app orientation when creating a landscape fullscreen window with the device currently in portrait orientation. 2017-08-12 22:16:04 -03:00
Alex Szpakowski
01050d4ed1 iOS: Use modern replacements for deprecated functions, when available. 2017-07-15 17:41:58 -03:00
Alex Szpakowski
bb100d3bab Expose display refresh rate on iOS/tvOS 10.3+. 2017-06-10 21:29:37 -03:00
Sam Lantinga
9ac3bb7011 Added support for mixing Qt and SDL on iOS
You should call SDL_SetMainReady(), and then customize the QIOSApplicationDelegate like this, in your application code:

/* Additional support for applications mixing Qt and SDL */
@interface QIOSApplicationDelegate : UIResponder <UIApplicationDelegate>
@end

extern "C"
{
void SDL_OnApplicationWillResignActive();
void SDL_OnApplicationDidEnterBackground();
void SDL_OnApplicationWillEnterForeground();
void SDL_OnApplicationDidBecomeActive();
}

@interface QIOSApplicationDelegate (SDL)

- (void)applicationWillResignActive:(UIApplication*)application;
- (void)applicationDidEnterBackground:(UIApplication*)application;
- (void)applicationWillEnterForeground:(UIApplication*)application;
- (void)applicationDidBecomeActive:(UIApplication*)application;

@end

@implementation QIOSApplicationDelegate (SDL)

- (void)applicationWillResignActive:(UIApplication*)application
{
    SDL_OnApplicationWillResignActive();
}

- (void)applicationDidEnterBackground:(UIApplication*)application
{
    SDL_OnApplicationDidEnterBackground();
}

- (void)applicationWillEnterForeground:(UIApplication*)application
{
    SDL_OnApplicationWillEnterForeground();
}

- (void)applicationDidBecomeActive:(UIApplication*)application
{
    SDL_OnApplicationDidBecomeActive();
}

@end // QIOSApplicationDelegate
2017-05-09 10:10:42 -07:00
Philipp Wiesemann
266816b4aa Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
Sam Lantinga
45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
b4e069e7f8 Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes
felix

Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like:

/usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes]
 extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
 ^~~~~~

It seems there is a missing 'void' between the parentheses.
2016-12-26 02:12:21 -08:00
Alex Szpakowski
eda74fda96 tvOS: Expose remote swipe gestures as arrow key presses (thanks oviano!) 2016-12-18 13:05:14 -04:00
Alex Szpakowski
787a54c84b iOS bug #3377: work around bugs in some third party iOS libraries (e.g. Google admob) where they assume the optional UIApplicationDelegate ?window? property always exists and will crash if it doesn?t. 2016-12-18 12:28:28 -04:00
Sam Lantinga
524bf3c282 Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
2016-12-09 01:47:43 -08:00
Sam Lantinga
84c0780e25 Fixed bug 3305 - Fixed TextInput status when the keyboard was dismissed with the dismiss key on the iPad
Diego

I was previously unaware that rotating the device to a different orientation when the keyboard is shown causes a keyboardWillHide followed by a keyboardWillShow notification. The previous patch would then mistakenly StopTextInput when rotating. This patch fixes that by checking if the device is rotating before stopping text input.
2016-12-02 02:21:35 -08:00
Sam Lantinga
27d4f09929 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Sam Lantinga
765d8bea01 Fixed bug 3305 - Fixed TextInput status when the keyboard was dismissed with the dismiss key on the iPad
Diego

The keyboard on iPads has a dismiss button that hides the keyboard. When the keyboard was hidden using that button, instead of the return key, SDL was still reporting IsTextInputActive as true. This patch adds an extra SDL_StopTextInput when iOS reports the keyboard will hide.
2016-10-01 12:46:36 -07:00
Alex Szpakowski
f31c7086d8 Enable SDL_LoadObject on iOS 8+ and tvOS. 2016-09-25 15:02:06 -03:00
Alex Szpakowski
77bacfd72d tvOS launch images are now properly supported. 2016-09-25 11:46:25 -03:00
Alex Szpakowski
40ecac8e60 Don't try to load a launch storyboard on tvOS (it doesn't use them). 2016-09-25 00:21:12 -03:00
Alex Szpakowski
666d3fecc8 iOS/tvOS: Try to load the launch screen as a storyboard. Xcode 8 compiles it as a storyboard instead of a nib. 2016-09-24 23:33:49 -03:00
Alex Szpakowski
9165ba7ebd iOS/tvOS: Always send SDL_WINDOWEVENT_FOCUS_GAINED when a window is created on the main screen (fixes bug #3395). 2016-09-24 20:12:57 -03:00
Alex Szpakowski
450fa8cdf9 Use OS-provided click counts on macOS and iOS for mouse press and release events. 2016-09-24 18:46:34 -03:00
Alex Szpakowski
4bcce330d1 tvOS: Add drop-file support 2016-09-15 21:49:29 -03:00
Alex Szpakowski
f050576665 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.
2016-09-13 22:18:06 -03:00
Sam Lantinga
1096f32309 Reverted previous commit which breaks game controller input processing. 2016-09-09 15:12:09 -07:00
Sam Lantinga
61c0f2cf64 Suggestion from Apple: use kCFRunLoopCommonModes which does more complete event processing 2016-09-08 20:38:23 -07:00
Alex Szpakowski
d0bd0e4855 iOS: Fix an OpenGL ES error when rotating the device if MSAA is used (thanks Cole Campbell!)
Fixes bug #3378.
2016-07-02 13:38:31 -03:00
Alex Szpakowski
34f095e098 iOS: Fixed SDL_GL_CreateContext crashing instead of returning null when a GLES3 context is requested on iOS 6 and older. 2016-04-10 22:07:10 -03:00
Alex Szpakowski
6cfa71a10e iOS: Also do the Dictation crash workaround before executing the animation callback. 2016-04-02 13:21:01 -03:00
Alex Szpakowski
5520ed9cc2 iOS: Workaround for a crash after Dictation is used. 2016-04-01 19:18:50 -03:00
Philipp Wiesemann
7da168db0a Fixed spaces in license comments. 2016-02-10 19:31:23 +01:00
Alex Szpakowski
8e7cd6b5da iOS: Implemented clipboard support. 2016-02-03 20:32:55 -04:00
Alex Szpakowski
87ea39be84 Removed dead code (caught by Clang's static analyzer). 2016-01-09 17:41:09 -04:00
Ryan C. Gordon
49e47688b4 Patched to compile on iOS. 2016-01-05 05:38:55 -05:00
Ryan C. Gordon
eeb899999f Patched to compile. 2016-01-05 05:22:35 -05:00
Ryan C. Gordon
c3114975db Added SDL_GetDisplayUsableBounds(). 2016-01-04 23:52:40 -05:00
Sam Lantinga
42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Alex Szpakowski
9c51c4a639 Mac: Detect the d-pad and pause buttons on Steelseries MFi gamepads (bug #3124.) 2015-11-12 22:44:32 -04:00
Alex Szpakowski
7267835842 iOS: Fixed crashes when rotating the screen after destroying a window. 2015-11-12 20:58:11 -04:00
Alex Szpakowski
ab2a350033 iOS: show message boxes using the new UIAlertController APIs when supported, rather than the deprecated UIAlertView.
UIAlertController is also supported on tvOS, whereas UIAlertView is not.
2015-09-25 15:17:20 -03:00
Alex Szpakowski
ecfdb10cfa iOS SDL_GL_CreateContext: Clamp the multisample sample count when the requested value is too high, rather than failing to create the context.
This matches the SDL_GL_CreateContext behavior in OS X.
2015-09-15 00:25:07 -03:00
Alex Szpakowski
82c8825cb5 iOS: Added support for force-touch on capable devices. 2015-09-09 19:08:52 -03:00
Alex Szpakowski
c344b734f4 iOS: Avoid generating an OpenGL error (but still fail to create the context) if the specified MSAA sample count is unsupported. 2015-07-19 19:56:16 -03:00
Alex Szpakowski
6ea942dae3 Added MSAA support for OpenGL ES contexts on iOS.
Note that extra steps must be taken when using glReadPixels to read the contents of the main OpenGL ES framebuffer on iOS, if multisampling is used. See the OpenGL ES section of README-ios.md for details.
2015-07-19 19:44:40 -03:00
Philipp Wiesemann
0e45984fa0 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().
2015-06-21 17:33:46 +02:00