mirror of https://github.com/encounter/SDL.git
Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
This commit is contained in:
parent
a70bb58d4b
commit
77c9d73b63
|
@ -37,6 +37,8 @@ LOCAL_SRC_FILES := \
|
||||||
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
|
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
|
||||||
$(wildcard $(LOCAL_PATH)/src/locale/*.c) \
|
$(wildcard $(LOCAL_PATH)/src/locale/*.c) \
|
||||||
$(wildcard $(LOCAL_PATH)/src/locale/android/*.c) \
|
$(wildcard $(LOCAL_PATH)/src/locale/android/*.c) \
|
||||||
|
$(wildcard $(LOCAL_PATH)/src/misc/*.c) \
|
||||||
|
$(wildcard $(LOCAL_PATH)/src/misc/android/*.c) \
|
||||||
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
|
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
|
||||||
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
|
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
|
||||||
$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
|
$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
|
||||||
|
|
|
@ -407,6 +407,7 @@ file(GLOB SOURCE_FILES
|
||||||
${SDL2_SOURCE_DIR}/src/haptic/*.c
|
${SDL2_SOURCE_DIR}/src/haptic/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/libm/*.c
|
${SDL2_SOURCE_DIR}/src/libm/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/locale/*.c
|
${SDL2_SOURCE_DIR}/src/locale/*.c
|
||||||
|
${SDL2_SOURCE_DIR}/src/misc/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/power/*.c
|
${SDL2_SOURCE_DIR}/src/power/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/render/*.c
|
${SDL2_SOURCE_DIR}/src/render/*.c
|
||||||
${SDL2_SOURCE_DIR}/src/render/*/*.c
|
${SDL2_SOURCE_DIR}/src/render/*/*.c
|
||||||
|
@ -941,6 +942,10 @@ if(ANDROID)
|
||||||
file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
|
file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||||
|
|
||||||
|
file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MISC_SOURCES})
|
||||||
|
set(HAVE_SDL_MISC TRUE)
|
||||||
|
|
||||||
# SDL_spinlock.c Needs to be compiled in ARM mode.
|
# SDL_spinlock.c Needs to be compiled in ARM mode.
|
||||||
# There seems to be no better way currently to set the ARM mode.
|
# There seems to be no better way currently to set the ARM mode.
|
||||||
# see: https://issuetracker.google.com/issues/62264618
|
# see: https://issuetracker.google.com/issues/62264618
|
||||||
|
@ -1301,6 +1306,10 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
|
||||||
|
set(HAVE_SDL_MISC TRUE)
|
||||||
|
|
||||||
if(SDL_POWER)
|
if(SDL_POWER)
|
||||||
if(LINUX)
|
if(LINUX)
|
||||||
set(SDL_POWER_LINUX 1)
|
set(SDL_POWER_LINUX 1)
|
||||||
|
@ -1366,6 +1375,10 @@ elseif(WINDOWS)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
|
||||||
|
set(HAVE_SDL_MISC TRUE)
|
||||||
|
|
||||||
# Check for DirectX
|
# Check for DirectX
|
||||||
if(DIRECTX)
|
if(DIRECTX)
|
||||||
if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700)
|
if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700)
|
||||||
|
@ -1606,6 +1619,10 @@ elseif(APPLE)
|
||||||
message_error("SDL_FILE must be enabled to build on MacOS X")
|
message_error("SDL_FILE must be enabled to build on MacOS X")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
|
||||||
|
set(HAVE_SDL_MISC TRUE)
|
||||||
|
|
||||||
if(SDL_AUDIO)
|
if(SDL_AUDIO)
|
||||||
set(SDL_AUDIO_DRIVER_COREAUDIO 1)
|
set(SDL_AUDIO_DRIVER_COREAUDIO 1)
|
||||||
file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m)
|
file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m)
|
||||||
|
@ -1860,6 +1877,10 @@ elseif(APPLE)
|
||||||
CheckPTHREAD()
|
CheckPTHREAD()
|
||||||
|
|
||||||
elseif(HAIKU)
|
elseif(HAIKU)
|
||||||
|
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
|
||||||
|
set(HAVE_SDL_MISC TRUE)
|
||||||
|
|
||||||
if(SDL_VIDEO)
|
if(SDL_VIDEO)
|
||||||
set(SDL_VIDEO_DRIVER_HAIKU 1)
|
set(SDL_VIDEO_DRIVER_HAIKU 1)
|
||||||
file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.c)
|
file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.c)
|
||||||
|
@ -1961,6 +1982,11 @@ if(NOT HAVE_SDL_LOCALE)
|
||||||
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c)
|
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c)
|
||||||
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
|
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT HAVE_SDL_MISC)
|
||||||
|
set(SDL_MISC_DISABLED 1)
|
||||||
|
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c)
|
||||||
|
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
|
||||||
|
endif()
|
||||||
|
|
||||||
# We always need to have threads and timers around
|
# We always need to have threads and timers around
|
||||||
if(NOT HAVE_SDL_THREADS)
|
if(NOT HAVE_SDL_THREADS)
|
||||||
|
|
|
@ -87,6 +87,7 @@ HDRS = \
|
||||||
SDL_main.h \
|
SDL_main.h \
|
||||||
SDL_messagebox.h \
|
SDL_messagebox.h \
|
||||||
SDL_metal.h \
|
SDL_metal.h \
|
||||||
|
SDL_misc.h \
|
||||||
SDL_mouse.h \
|
SDL_mouse.h \
|
||||||
SDL_mutex.h \
|
SDL_mutex.h \
|
||||||
SDL_name.h \
|
SDL_name.h \
|
||||||
|
|
|
@ -17313,6 +17313,7 @@ SOURCES="$SOURCES $srcdir/src/file/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
|
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/libm/*.c"
|
SOURCES="$SOURCES $srcdir/src/libm/*.c"
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/power/*.c"
|
SOURCES="$SOURCES $srcdir/src/power/*.c"
|
||||||
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
|
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/render/*.c"
|
SOURCES="$SOURCES $srcdir/src/render/*.c"
|
||||||
|
@ -24685,6 +24686,9 @@ case "$host" in
|
||||||
CheckRPATH
|
CheckRPATH
|
||||||
CheckVivanteVideo
|
CheckVivanteVideo
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
|
||||||
|
@ -24865,6 +24869,9 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||||
# Set up the core platform files
|
# Set up the core platform files
|
||||||
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Use the Windows locale APIs.
|
# Use the Windows locale APIs.
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -25121,6 +25128,9 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
|
||||||
have_filesystem=yes
|
have_filesystem=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Set up files for the locale library
|
# Set up files for the locale library
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
|
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -25167,6 +25177,9 @@ fi
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Set up files for the locale library
|
# Set up files for the locale library
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -25295,6 +25308,9 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
CheckHIDAPI
|
CheckHIDAPI
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Set up files for the locale library
|
# Set up files for the locale library
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -25514,6 +25530,9 @@ INSTALL_SDL2_CONFIG=$enable_sdl2_config
|
||||||
|
|
||||||
# Verify that we have all the platform specific files we need
|
# Verify that we have all the platform specific files we need
|
||||||
|
|
||||||
|
if test x$have_misc != xyes; then
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
|
||||||
|
fi
|
||||||
if test x$have_locale != xyes; then
|
if test x$have_locale != xyes; then
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
|
||||||
fi
|
fi
|
||||||
|
|
19
configure.ac
19
configure.ac
|
@ -413,6 +413,7 @@ SOURCES="$SOURCES $srcdir/src/file/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
|
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
|
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/libm/*.c"
|
SOURCES="$SOURCES $srcdir/src/libm/*.c"
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/power/*.c"
|
SOURCES="$SOURCES $srcdir/src/power/*.c"
|
||||||
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
|
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
|
||||||
SOURCES="$SOURCES $srcdir/src/render/*.c"
|
SOURCES="$SOURCES $srcdir/src/render/*.c"
|
||||||
|
@ -3533,6 +3534,9 @@ case "$host" in
|
||||||
CheckRPATH
|
CheckRPATH
|
||||||
CheckVivanteVideo
|
CheckVivanteVideo
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
|
||||||
|
@ -3685,6 +3689,9 @@ case "$host" in
|
||||||
# Set up the core platform files
|
# Set up the core platform files
|
||||||
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Use the Windows locale APIs.
|
# Use the Windows locale APIs.
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -3861,6 +3868,9 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
have_filesystem=yes
|
have_filesystem=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Set up files for the locale library
|
# Set up files for the locale library
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
|
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -3885,6 +3895,9 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
CheckVulkan
|
CheckVulkan
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Set up files for the locale library
|
# Set up files for the locale library
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -3991,6 +4004,9 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
||||||
CheckPTHREAD
|
CheckPTHREAD
|
||||||
CheckHIDAPI
|
CheckHIDAPI
|
||||||
|
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
|
||||||
|
have_misc=yes
|
||||||
|
|
||||||
# Set up files for the locale library
|
# Set up files for the locale library
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
|
||||||
have_locale=yes
|
have_locale=yes
|
||||||
|
@ -4173,6 +4189,9 @@ AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
|
||||||
|
|
||||||
# Verify that we have all the platform specific files we need
|
# Verify that we have all the platform specific files we need
|
||||||
|
|
||||||
|
if test x$have_misc != xyes; then
|
||||||
|
SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
|
||||||
|
fi
|
||||||
if test x$have_locale != xyes; then
|
if test x$have_locale != xyes; then
|
||||||
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
|
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#include "SDL_version.h"
|
#include "SDL_version.h"
|
||||||
#include "SDL_video.h"
|
#include "SDL_video.h"
|
||||||
#include "SDL_locale.h"
|
#include "SDL_locale.h"
|
||||||
|
#include "SDL_misc.h"
|
||||||
|
|
||||||
#include "begin_code.h"
|
#include "begin_code.h"
|
||||||
/* Set up for C function definitions, even when using C++ */
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file SDL_misc.h
|
||||||
|
*
|
||||||
|
* \brief Include file for SDL API functions that don't fit elsewhere.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SDL_misc_h_
|
||||||
|
#define SDL_misc_h_
|
||||||
|
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
|
|
||||||
|
#include "begin_code.h"
|
||||||
|
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Open an URL / URI in the browser or other
|
||||||
|
*
|
||||||
|
* Open a URL in a separate, system-provided application. How this works will
|
||||||
|
* vary wildly depending on the platform. This will likely launch what
|
||||||
|
* makes sense to handle a specific URL's protocol (a web browser for http://,
|
||||||
|
* etc), but it might also be able to launch file managers for directories
|
||||||
|
* and other things.
|
||||||
|
*
|
||||||
|
* What happens when you open a URL varies wildly as well: your game window
|
||||||
|
* may lose focus (and may or may not lose focus if your game was fullscreen
|
||||||
|
* or grabbing input at the time). On mobile devices, your app will likely
|
||||||
|
* move to the background or your process might be paused. Any given platform
|
||||||
|
* may or may not handle a given URL.
|
||||||
|
*
|
||||||
|
* If this is unimplemented (or simply unavailable) for a platform, this will
|
||||||
|
* fail with an error. A successful result does not mean the URL loaded, just
|
||||||
|
* that we launched something to handle it (or at least believe we did).
|
||||||
|
*
|
||||||
|
* All this to say: this function can be useful, but you should definitely
|
||||||
|
* test it on every platform you target.
|
||||||
|
*
|
||||||
|
* \param url A valid URL to open.
|
||||||
|
* \return 0 on success, or -1 on error.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url);
|
||||||
|
|
||||||
|
/* Ends C function definitions when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "close_code.h"
|
||||||
|
|
||||||
|
#endif /* SDL_filesystem_h_ */
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -206,13 +206,6 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
|
extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission);
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Open an URL / URI in the browser or other
|
|
||||||
|
|
||||||
\return 0 on success, or -1 on error.
|
|
||||||
*/
|
|
||||||
extern DECLSPEC int SDLCALL SDL_AndroidOpenURL(const char *url);
|
|
||||||
|
|
||||||
#endif /* __ANDROID__ */
|
#endif /* __ANDROID__ */
|
||||||
|
|
||||||
/* Platform specific functions for WinRT */
|
/* Platform specific functions for WinRT */
|
||||||
|
|
|
@ -2469,19 +2469,6 @@ SDL_bool SDL_AndroidRequestPermission(const char *permission)
|
||||||
return Android_JNI_RequestPermission(permission);
|
return Android_JNI_RequestPermission(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_AndroidOpenURL(const char *url)
|
|
||||||
{
|
|
||||||
JNIEnv *env = Android_JNI_GetEnv();
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (url) {
|
|
||||||
jstring jurl = (*env)->NewStringUTF(env, url);
|
|
||||||
ret = (*env)->CallStaticIntMethod(env, mActivityClass, midOpenURL, jurl);
|
|
||||||
(*env)->DeleteLocalRef(env, jurl);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Android_JNI_GetManifestEnvironmentVariables(void)
|
void Android_JNI_GetManifestEnvironmentVariables(void)
|
||||||
{
|
{
|
||||||
if (!mActivityClass || !midGetManifestEnvironmentVariables) {
|
if (!mActivityClass || !midGetManifestEnvironmentVariables) {
|
||||||
|
|
|
@ -766,4 +766,4 @@
|
||||||
#define SDL_truncf SDL_truncf_REAL
|
#define SDL_truncf SDL_truncf_REAL
|
||||||
#define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL
|
#define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL
|
||||||
#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL
|
#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL
|
||||||
#define SDL_AndroidOpenURL SDL_AndroidOpenURL_REAL
|
#define SDL_OpenURL SDL_OpenURL_REAL
|
||||||
|
|
|
@ -826,5 +826,5 @@ SDL_DYNAPI_PROC(float,SDL_truncf,(float a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Locale *,SDL_GetPreferredLocales,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_Locale *,SDL_GetPreferredLocales,(void),(),return)
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_AndroidRequestPermission,(const char *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_AndroidRequestPermission,(const char *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_AndroidOpenURL,(const char *a),(a),return)
|
|
||||||
#endif
|
#endif
|
||||||
|
SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return)
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "SDL_error.h"
|
||||||
|
|
||||||
|
extern int SDL_SYS_OpenURL(const char *url);
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
if (!url) {
|
||||||
|
return SDL_InvalidParamError("url");
|
||||||
|
}
|
||||||
|
return SDL_SYS_OpenURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "../../core/android/SDL_android.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
JNIEnv *env = Android_JNI_GetEnv();
|
||||||
|
jstring jurl = (*env)->NewStringUTF(env, url);
|
||||||
|
const int ret = (*env)->CallStaticIntMethod(env, mActivityClass, midOpenURL, jurl);
|
||||||
|
(*env)->DeleteLocalRef(env, jurl);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "SDL_error.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
return SDL_Unimplemented();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "SDL_error.h"
|
||||||
|
#include <Url.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
BUrl burl(url);
|
||||||
|
const status_t rc = burl.OpenWithPreferredApplication(false);
|
||||||
|
return (rc == B_NO_ERROR) ? 0 : SDL_SetError("URL open failed (err=%d)", (int) rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{ @autoreleasepool {
|
||||||
|
|
||||||
|
NSString *nsstr = [NSString stringWithUTF8String:url];
|
||||||
|
NSURL *nsurl = [NSURL URLWithString:nsstr];
|
||||||
|
return [[UIApplication sharedApplication] openURL:nsurl] ? 0 : -1;
|
||||||
|
}}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{ @autoreleasepool
|
||||||
|
{
|
||||||
|
NSString *nsstr = [NSString stringWithUTF8String:url];
|
||||||
|
NSURL *nsurl = [NSURL URLWithString:nsstr];
|
||||||
|
return [[NSWorkspace sharedWorkspace] openURL:nsurl] ? 0 : -1;
|
||||||
|
}}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "SDL_error.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
const pid_t pid1 = fork();
|
||||||
|
if (pid1 == 0) { /* child process */
|
||||||
|
/* Notice this is vfork and not fork! */
|
||||||
|
const pid_t pid2 = vfork();
|
||||||
|
if (pid2 == 0) { /* Grandchild process will try to launch the url */
|
||||||
|
execlp("xdg-open", "xdg-open", url, NULL);
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
} else if (pid2 < 0) { /* There was an error forking */
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
} else {
|
||||||
|
/* Child process doesn't wait for possibly-blocking grandchild. */
|
||||||
|
_exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
} else if (pid1 < 0) {
|
||||||
|
return SDL_SetError("fork() failed: %s", strerror(errno));
|
||||||
|
} else {
|
||||||
|
int status;
|
||||||
|
if (waitpid(pid1, &status, 0) == pid1) {
|
||||||
|
if (WIFEXITED(status)) {
|
||||||
|
if (WEXITSTATUS(status) == 0) {
|
||||||
|
return 0; /* success! */
|
||||||
|
} else {
|
||||||
|
return SDL_SetError("xdg-open reported error or failed to launch: %d", WEXITSTATUS(status));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return SDL_SetError("xdg-open failed for some reason");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return SDL_SetError("Waiting on xdg-open failed: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../SDL_internal.h"
|
||||||
|
#include "../../core/windows/SDL_windows.h"
|
||||||
|
|
||||||
|
/* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */
|
||||||
|
int
|
||||||
|
SDL_SYS_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
WCHAR* wurl = WIN_UTF8ToString(url);
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (wurl == NULL) {
|
||||||
|
return SDL_OutOfMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success returns value greater than 32. Less is an error. */
|
||||||
|
rc = (int) ShellExecuteW(NULL, L"open", wurl, NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
SDL_free(wurl);
|
||||||
|
return (rc > 32) ? 0 : WIN_SetError("Couldn't open given URL.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -37,6 +37,8 @@ extern "C" {
|
||||||
#include "SDL_bframebuffer.h"
|
#include "SDL_bframebuffer.h"
|
||||||
#include "SDL_bevents.h"
|
#include "SDL_bevents.h"
|
||||||
|
|
||||||
|
#include <Url.h>
|
||||||
|
|
||||||
/* FIXME: Undefined functions */
|
/* FIXME: Undefined functions */
|
||||||
// #define HAIKU_PumpEvents NULL
|
// #define HAIKU_PumpEvents NULL
|
||||||
#define HAIKU_StartTextInput NULL
|
#define HAIKU_StartTextInput NULL
|
||||||
|
@ -193,6 +195,15 @@ void HAIKU_VideoQuit(_THIS)
|
||||||
SDL_QuitBeApp();
|
SDL_QuitBeApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// just sticking this function in here so it's in a C++ source file.
|
||||||
|
extern "C" { int HAIKU_OpenURL(const char *url); }
|
||||||
|
int HAIKU_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
BUrl burl(url);
|
||||||
|
const status_t rc = burl.OpenWithPreferredApplication(false);
|
||||||
|
return (rc == B_NO_ERROR) ? 0 : SDL_SetError("URL open failed (err=%d)", (int) rc);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,6 +60,7 @@ TARGETS = \
|
||||||
teststreaming$(EXE) \
|
teststreaming$(EXE) \
|
||||||
testthread$(EXE) \
|
testthread$(EXE) \
|
||||||
testtimer$(EXE) \
|
testtimer$(EXE) \
|
||||||
|
testurl$(EXE) \
|
||||||
testver$(EXE) \
|
testver$(EXE) \
|
||||||
testviewport$(EXE) \
|
testviewport$(EXE) \
|
||||||
testvulkan$(EXE) \
|
testvulkan$(EXE) \
|
||||||
|
@ -265,6 +266,9 @@ teststreaming$(EXE): $(srcdir)/teststreaming.c
|
||||||
testtimer$(EXE): $(srcdir)/testtimer.c
|
testtimer$(EXE): $(srcdir)/testtimer.c
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||||
|
|
||||||
|
testurl$(EXE): $(srcdir)/testurl.c
|
||||||
|
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||||
|
|
||||||
testver$(EXE): $(srcdir)/testver.c
|
testver$(EXE): $(srcdir)/testver.c
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely.
|
||||||
|
*/
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (SDL_Init(SDL_INIT_VIDEO) == -1) {
|
||||||
|
fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
const char *url = argv[i];
|
||||||
|
SDL_Log("Opening '%s' ...", url);
|
||||||
|
if (SDL_OpenURL(url) == 0) {
|
||||||
|
SDL_Log(" success!");
|
||||||
|
} else {
|
||||||
|
SDL_Log(" failed! %s", SDL_GetError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Quit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vi: set ts=4 sw=4 expandtab: */
|
Loading…
Reference in New Issue