From 9cd2e9ec8fc0127393dfce9c0359d500c8c238be Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 09 Apr 2019 02:22:50 +0000
Subject: [PATCH] updae source to 2.0.9 source
---
source/src/SDL.c | 48 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/source/src/SDL.c b/source/src/SDL.c
index 0e55279..6d7e166 100644
--- a/source/src/SDL.c
+++ b/source/src/SDL.c
@@ -33,6 +33,7 @@
#include "events/SDL_events_c.h"
#include "haptic/SDL_haptic_c.h"
#include "joystick/SDL_joystick_c.h"
+#include "sensor/SDL_sensor_c.h"
/* Initialization/Cleanup routines */
#if !SDL_TIMERS_DISABLED
@@ -123,11 +124,11 @@
}
#if SDL_VIDEO_DRIVER_WINDOWS
- if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
- if (SDL_HelperWindowCreate() < 0) {
- return -1;
- }
- }
+ if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
+ if (SDL_HelperWindowCreate() < 0) {
+ return -1;
+ }
+ }
#endif
#if !SDL_TIMERS_DISABLED
@@ -232,6 +233,20 @@
#endif
}
+ /* Initialize the sensor subsystem */
+ if ((flags & SDL_INIT_SENSOR)){
+#if !SDL_SENSOR_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
+ if (SDL_SensorInit() < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_SENSOR);
+#else
+ return SDL_SetError("SDL not built with sensor support");
+#endif
+ }
+
return (0);
}
@@ -245,6 +260,15 @@
SDL_QuitSubSystem(Uint32 flags)
{
/* Shut down requested initialized subsystems */
+#if !SDL_SENSOR_DISABLED
+ if ((flags & SDL_INIT_SENSOR)) {
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
+ SDL_SensorQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
+ }
+#endif
+
#if !SDL_JOYSTICK_DISABLED
if ((flags & SDL_INIT_GAMECONTROLLER)) {
/* game controller implies joystick */
@@ -451,6 +475,20 @@
#endif
}
+SDL_bool
+SDL_IsTablet()
+{
+#if __ANDROID__
+ extern SDL_bool SDL_IsAndroidTablet(void);
+ return SDL_IsAndroidTablet();
+#elif __IPHONEOS__
+ extern SDL_bool SDL_IsIPad(void);
+ return SDL_IsIPad();
+#else
+ return SDL_FALSE;
+#endif
+}
+
#if defined(__WIN32__)
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
--
Gitblit v1.9.3