From 43ced8fb5282bece41fa8a93448c90667b8ab837 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 31 Oct 2011 05:56:58 -0400 Subject: [PATCH] Lots of fixes importing SDL source wholesale into a new iOS project --- include/SDL_config.h.in | 1 - include/SDL_opengl.h | 4 + src/SDL_error_c.h | 3 + src/audio/alsa/SDL_alsa_audio.c | 10 +- src/audio/android/SDL_androidaudio.c | 4 + src/audio/arts/SDL_artsaudio.c | 8 +- src/audio/baudio/SDL_beaudio.cc | 4 + src/audio/bsd/SDL_bsdaudio.c | 4 + src/audio/directsound/SDL_directsound.c | 4 + src/audio/disk/SDL_diskaudio.c | 4 + src/audio/dsp/SDL_dspaudio.c | 4 + src/audio/esd/SDL_esdaudio.c | 8 +- src/audio/fusionsound/SDL_fsaudio.c | 8 +- src/audio/nas/SDL_nasaudio.c | 8 +- src/audio/nds/SDL_ndsaudio.c | 4 + src/audio/paudio/SDL_paudio.c | 4 + src/audio/pulseaudio/SDL_pulseaudio.c | 2 +- src/audio/qsa/SDL_qsa_audio.c | 4 + src/audio/sun/SDL_sunaudio.c | 14 +- src/audio/ums/SDL_umsaudio.c | 556 ------------------ src/audio/ums/SDL_umsaudio.h | 47 -- src/audio/winmm/SDL_winmm.c | 4 + src/audio/xaudio2/SDL_xaudio2.c | 5 +- src/core/android/SDL_android.cpp | 4 + src/core/windows/SDL_windows.c | 4 + src/events/SDL_gesture.c | 31 +- src/events/SDL_keyboard.c | 17 - src/events/SDL_touch.c | 3 +- src/libm/e_atan2.c | 2 +- src/libm/e_log.c | 2 +- src/libm/e_pow.c | 2 +- src/libm/e_rem_pio2.c | 2 +- src/libm/e_sqrt.c | 2 +- src/libm/k_cos.c | 2 +- src/libm/k_rem_pio2.c | 2 +- src/libm/k_sin.c | 2 +- src/libm/{math.h => math_libm.h} | 7 + src/libm/s_atan.c | 2 +- src/libm/s_copysign.c | 2 +- src/libm/s_cos.c | 2 +- src/libm/s_fabs.c | 2 +- src/libm/s_floor.c | 2 +- src/libm/s_scalbn.c | 2 +- src/libm/s_sin.c | 2 +- src/main/android/SDL_android_main.cpp | 6 + src/main/beos/SDL_BeApp.cc | 8 +- src/main/windows/SDL_windows_main.c | 5 + src/power/beos/SDL_syspower.c | 2 +- src/power/linux/SDL_syspower.c | 2 +- src/power/macosx/SDL_syspower.c | 2 +- src/power/nds/SDL_syspower.c | 2 +- .../uikit/SDL_syspower.h} | 9 +- src/power/uikit/SDL_syspower.m | 3 +- src/power/windows/SDL_syspower.c | 2 +- src/render/SDL_render.c | 2 +- src/render/opengles/SDL_render_gles.c | 3 - src/render/opengles2/SDL_render_gles2.c | 3 - src/render/software/SDL_render_sw.c | 1 + src/stdlib/SDL_string.c | 2 +- src/thread/SDL_thread.c | 1 + src/thread/SDL_thread_c.h | 3 +- src/thread/beos/SDL_syssem.c | 4 + src/thread/beos/SDL_systhread.c | 4 + src/thread/irix/SDL_syssem.c | 230 -------- src/thread/irix/SDL_systhread.c | 81 --- src/thread/nds/SDL_systhread.c | 6 - src/thread/windows/SDL_sysmutex.c | 4 + src/thread/windows/SDL_syssem.c | 4 + src/thread/windows/SDL_systhread.c | 4 + src/thread/windows/win_ce_semaphore.c | 8 +- src/video/SDL_rect.c | 1 + src/video/SDL_shape.c | 4 +- src/video/SDL_video.c | 10 +- src/video/android/SDL_androidevents.c | 4 + src/video/android/SDL_androidgl.c | 4 + src/video/android/SDL_androidkeyboard.c | 4 + src/video/android/SDL_androidtouch.c | 4 + src/video/android/SDL_androidvideo.c | 4 + src/video/android/SDL_androidwindow.c | 4 + src/video/bwindow/SDL_bclipboard.cc | 4 +- src/video/bwindow/SDL_bevents.cc | 5 + src/video/bwindow/SDL_bframebuffer.cc | 5 + src/video/bwindow/SDL_bkeyboard.cc | 5 + src/video/bwindow/SDL_bmodes.cc | 5 +- src/video/bwindow/SDL_bopengl.cc | 10 +- src/video/bwindow/SDL_bvideo.cc | 5 +- src/video/bwindow/SDL_bwindow.cc | 3 + src/video/cocoa/SDL_cocoaclipboard.m | 4 + src/video/cocoa/SDL_cocoaevents.m | 4 + src/video/cocoa/SDL_cocoakeyboard.m | 6 +- src/video/cocoa/SDL_cocoamodes.m | 6 +- src/video/cocoa/SDL_cocoamouse.m | 19 +- src/video/cocoa/SDL_cocoaopengl.m | 4 +- src/video/cocoa/SDL_cocoashape.m | 10 + src/video/cocoa/SDL_cocoavideo.m | 4 + src/video/cocoa/SDL_cocoawindow.m | 6 +- src/video/directfb/SDL_DirectFB_WM.c | 4 + src/video/directfb/SDL_DirectFB_dyn.c | 5 +- src/video/directfb/SDL_DirectFB_events.c | 4 + src/video/directfb/SDL_DirectFB_modes.c | 5 + src/video/directfb/SDL_DirectFB_mouse.c | 6 +- src/video/directfb/SDL_DirectFB_opengl.c | 5 + src/video/directfb/SDL_DirectFB_render.c | 5 + src/video/directfb/SDL_DirectFB_shape.c | 4 + src/video/directfb/SDL_DirectFB_video.c | 5 + src/video/directfb/SDL_DirectFB_window.c | 5 + src/video/dummy/SDL_nullevents.c | 4 + src/video/dummy/SDL_nullframebuffer.c | 5 + src/video/dummy/SDL_nullvideo.c | 4 + src/video/nds/SDL_ndsevents.c | 5 +- src/video/nds/SDL_ndsvideo.c | 4 + src/video/nds/SDL_ndswindow.c | 4 + src/video/pandora/SDL_pandora.c | 6 +- src/video/pandora/SDL_pandora_events.c | 4 + src/video/uikit/SDL_uikitappdelegate.m | 5 + src/video/uikit/SDL_uikitevents.m | 4 + src/video/uikit/SDL_uikitopengles.m | 9 +- src/video/uikit/SDL_uikitopenglview.m | 5 + src/video/uikit/SDL_uikitvideo.m | 8 +- src/video/uikit/SDL_uikitview.m | 8 +- src/video/uikit/SDL_uikitviewcontroller.m | 42 +- src/video/uikit/SDL_uikitwindow.m | 14 +- src/video/windows/SDL_windowsclipboard.c | 4 + src/video/windows/SDL_windowsevents.c | 5 +- src/video/windows/SDL_windowsframebuffer.c | 4 + src/video/windows/SDL_windowskeyboard.c | 4 + src/video/windows/SDL_windowsmodes.c | 4 + src/video/windows/SDL_windowsmouse.c | 5 +- src/video/windows/SDL_windowsopengl.c | 4 + src/video/windows/SDL_windowsshape.c | 6 +- src/video/windows/SDL_windowsvideo.c | 4 + src/video/windows/SDL_windowswindow.c | 4 + src/video/x11/SDL_x11opengl.c | 5 + src/video/x11/SDL_x11opengles.c | 4 +- src/video/x11/imKStoUCS.c | 5 + 135 files changed, 496 insertions(+), 1096 deletions(-) delete mode 100644 src/audio/ums/SDL_umsaudio.c delete mode 100644 src/audio/ums/SDL_umsaudio.h rename src/libm/{math.h => math_libm.h} (91%) rename src/{thread/irix/SDL_systhread_c.h => power/uikit/SDL_syspower.h} (83%) delete mode 100644 src/thread/irix/SDL_syssem.c delete mode 100644 src/thread/irix/SDL_systhread.c diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 60aade2c4..9eed823d7 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -233,7 +233,6 @@ #undef SDL_THREAD_PTHREAD #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP -#undef SDL_THREAD_SPROC #undef SDL_THREAD_WINDOWS /* Enable various timer systems */ diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 54836df76..fad97447b 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -30,6 +30,8 @@ #include "SDL_config.h" +#ifndef __IPHONEOS__ + #ifdef __WIN32__ #define WIN32_LEAN_AND_MEAN #ifndef NOMINMAX @@ -11123,6 +11125,8 @@ typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, cons /* *INDENT-ON* */ #endif /* NO_SDL_GLEXT */ +#endif /* !__IPHONEOS__ */ + #endif /* _SDL_opengl_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/SDL_error_c.h b/src/SDL_error_c.h index 1e63b705a..f346faa04 100644 --- a/src/SDL_error_c.h +++ b/src/SDL_error_c.h @@ -56,6 +56,9 @@ typedef struct SDL_error } args[ERR_MAX_ARGS]; } SDL_error; +/* Defined in SDL_thread.c */ +extern SDL_error *SDL_GetErrBuf(void); + #endif /* _SDL_error_c_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 523be6e28..eb754ec44 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_ALSA + /* Allow access to a raw mixing buffer */ #include @@ -33,7 +35,7 @@ #include "../SDL_audio_c.h" #include "SDL_alsa_audio.h" -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#if SDL_AUDIO_DRIVER_ALSA_DYNAMIC #include "SDL_loadso.h" #endif @@ -84,7 +86,7 @@ static int (*ALSA_snd_pcm_wait)(snd_pcm_t *, int); static int (*ALSA_snd_pcm_sw_params_set_avail_min) (snd_pcm_t *, snd_pcm_sw_params_t *, snd_pcm_uframes_t); -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#if SDL_AUDIO_DRIVER_ALSA_DYNAMIC #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof #define snd_pcm_sw_params_sizeof ALSA_snd_pcm_sw_params_sizeof @@ -147,7 +149,7 @@ load_alsa_syms(void) #undef SDL_ALSA_SYM -#ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#if SDL_AUDIO_DRIVER_ALSA_DYNAMIC static void UnloadALSALibrary(void) @@ -693,4 +695,6 @@ AudioBootStrap ALSA_bootstrap = { "alsa", "ALSA PCM audio", ALSA_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_ALSA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c index 425e51dac..f74985ca4 100644 --- a/src/audio/android/SDL_androidaudio.c +++ b/src/audio/android/SDL_androidaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_ANDROID + /* Output audio to Android */ #include "SDL_audio.h" @@ -154,4 +156,6 @@ Android_RunAudioThread() SDL_RunAudio(audioDevice); } +#endif /* SDL_AUDIO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c index 0abe283e7..25d7bd40f 100644 --- a/src/audio/arts/SDL_artsaudio.c +++ b/src/audio/arts/SDL_artsaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_ARTS + /* Allow access to a raw mixing buffer */ #ifdef HAVE_SIGNAL_H @@ -34,14 +36,14 @@ #include "../SDL_audio_c.h" #include "SDL_artsaudio.h" -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC +#if SDL_AUDIO_DRIVER_ARTS_DYNAMIC #include "SDL_name.h" #include "SDL_loadso.h" #else #define SDL_NAME(X) X #endif -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC +#if SDL_AUDIO_DRIVER_ARTS_DYNAMIC static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC; static void *arts_handle = NULL; @@ -372,4 +374,6 @@ AudioBootStrap ARTS_bootstrap = { "arts", "Analog RealTime Synthesizer", ARTS_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_ARTS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/baudio/SDL_beaudio.cc b/src/audio/baudio/SDL_beaudio.cc index 867125f93..310cb53bc 100644 --- a/src/audio/baudio/SDL_beaudio.cc +++ b/src/audio/baudio/SDL_beaudio.cc @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_BEOSAUDIO + /* Allow access to the audio stream on BeOS */ #include @@ -214,4 +216,6 @@ AudioBootStrap BEOSAUDIO_bootstrap = { "baudio", "BeOS BSoundPlayer", BEOSAUDIO_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_BEOSAUDIO */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/bsd/SDL_bsdaudio.c b/src/audio/bsd/SDL_bsdaudio.c index 7da1687ed..8d1b0895d 100644 --- a/src/audio/bsd/SDL_bsdaudio.c +++ b/src/audio/bsd/SDL_bsdaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_BSD + /* * Driver for native OpenBSD/NetBSD audio(4). * vedge@vedge.com.ar. @@ -364,4 +366,6 @@ AudioBootStrap BSD_AUDIO_bootstrap = { "bsd", "BSD audio", BSDAUDIO_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_BSD */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 4e2a48d66..cd5556c90 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_DSOUND + /* Allow access to a raw mixing buffer */ #include "SDL_timer.h" @@ -549,4 +551,6 @@ AudioBootStrap DSOUND_bootstrap = { "directsound", "DirectSound", DSOUND_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_DSOUND */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c index 283ef22d1..4e68a3951 100644 --- a/src/audio/disk/SDL_diskaudio.c +++ b/src/audio/disk/SDL_diskaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_DISK + /* Output raw audio data to a file. */ #if HAVE_STDIO_H @@ -159,4 +161,6 @@ AudioBootStrap DISKAUD_bootstrap = { "disk", "direct-to-disk audio", DISKAUD_Init, 1 }; +#endif /* SDL_AUDIO_DRIVER_DISK */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index f61b4aacd..5c4a76921 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_OSS + /* Allow access to a raw mixing buffer */ #include /* For perror() */ @@ -312,4 +314,6 @@ AudioBootStrap DSP_bootstrap = { "dsp", "OSS /dev/dsp standard audio", DSP_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_OSS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c index 4cc8e2914..e824e9564 100644 --- a/src/audio/esd/SDL_esdaudio.c +++ b/src/audio/esd/SDL_esdaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_ESD + /* Allow access to an ESD network stream mixing buffer */ #include @@ -34,14 +36,14 @@ #include "../SDL_audio_c.h" #include "SDL_esdaudio.h" -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#if SDL_AUDIO_DRIVER_ESD_DYNAMIC #include "SDL_name.h" #include "SDL_loadso.h" #else #define SDL_NAME(X) X #endif -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#if SDL_AUDIO_DRIVER_ESD_DYNAMIC static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC; static void *esd_handle = NULL; @@ -345,4 +347,6 @@ AudioBootStrap ESD_bootstrap = { "esd", "Enlightened Sound Daemon", ESD_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_ESD */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c index ebe2eb079..3ba9ba773 100644 --- a/src/audio/fusionsound/SDL_fsaudio.c +++ b/src/audio/fusionsound/SDL_fsaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_FUSIONSOUND + /* Allow access to a raw mixing buffer */ #ifdef HAVE_SIGNAL_H @@ -37,7 +39,7 @@ //#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#if SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC #include "SDL_name.h" #include "SDL_loadso.h" #else @@ -51,7 +53,7 @@ typedef DFBResult DirectResult; /* Buffers to use - more than 2 gives a lot of latency */ #define FUSION_BUFFERS (2) -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#if SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC; static void *fs_handle = NULL; @@ -345,4 +347,6 @@ AudioBootStrap FUSIONSOUND_bootstrap = { "fusionsound", "FusionSound", SDL_FS_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c index 0322e2329..a31faad39 100644 --- a/src/audio/nas/SDL_nasaudio.c +++ b/src/audio/nas/SDL_nasaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_NAS + /* Allow access to a raw mixing buffer */ #include @@ -50,7 +52,7 @@ static AuEventHandlerRec *(*NAS_AuRegisterEventHandler) (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer); -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC +#if SDL_AUDIO_DRIVER_NAS_DYNAMIC static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC; static void *nas_handle = NULL; @@ -89,7 +91,7 @@ load_nas_syms(void) #undef SDL_NAS_SYM -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC +#if SDL_AUDIO_DRIVER_NAS_DYNAMIC static void UnloadNASLibrary(void) @@ -397,4 +399,6 @@ AudioBootStrap NAS_bootstrap = { "nas", "Network Audio System", NAS_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_NAS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/nds/SDL_ndsaudio.c b/src/audio/nds/SDL_ndsaudio.c index abfe2591a..034e1726b 100644 --- a/src/audio/nds/SDL_ndsaudio.c +++ b/src/audio/nds/SDL_ndsaudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_NDS + /* Output audio to NDS */ #include @@ -122,4 +124,6 @@ AudioBootStrap NDSAUD_bootstrap = { "nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1? */ }; +#endif /* SDL_AUDIO_DRIVER_NDS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c index 2036c0c2f..821fa7718 100644 --- a/src/audio/paudio/SDL_paudio.c +++ b/src/audio/paudio/SDL_paudio.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_PAUDIO + /* Allow access to a raw mixing buffer */ #include @@ -545,4 +547,6 @@ AudioBootStrap PAUDIO_bootstrap = { "paud", "AIX Paudio", PAUDIO_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_PAUDIO */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 6b2333e02..b3e0b4e58 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -106,7 +106,7 @@ static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *); static int load_pulseaudio_syms(void); -#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC +#if SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC; static void *pulseaudio_handle = NULL; diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index 590b089e8..2cf4b8b54 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/src/audio/qsa/SDL_qsa_audio.c @@ -21,6 +21,8 @@ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_QSA + #include #include #include @@ -863,4 +865,6 @@ AudioBootStrap QSAAUDIO_bootstrap = { "qsa", "QNX QSA Audio", QSA_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_QSA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/sun/SDL_sunaudio.c b/src/audio/sun/SDL_sunaudio.c index 1ae9c7c4d..2768cf30e 100644 --- a/src/audio/sun/SDL_sunaudio.c +++ b/src/audio/sun/SDL_sunaudio.c @@ -1,8 +1,3 @@ -/* I'm gambling no one uses this audio backend...we'll see who emails. :) */ -#error this code has not been updated for SDL 1.3. -#error if no one emails icculus at icculus.org and tells him that this -#error code is needed, this audio backend will eventually be removed from SDL. - /* Simple DirectMedia Layer Copyright (C) 1997-2011 Sam Lantinga @@ -25,6 +20,13 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_SUNAUDIO + +/* I'm gambling no one uses this audio backend...we'll see who emails. :) */ +#error this code has not been updated for SDL 1.3. +#error if no one emails icculus at icculus.org and tells him that this +#error code is needed, this audio backend will eventually be removed from SDL. + /* Allow access to a raw mixing buffer */ #include @@ -450,4 +452,6 @@ snd2au(int sample) return (mask & sample); } +#endif /* SDL_AUDIO_DRIVER_SUNAUDIO */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/ums/SDL_umsaudio.c b/src/audio/ums/SDL_umsaudio.c deleted file mode 100644 index 999ad01e8..000000000 --- a/src/audio/ums/SDL_umsaudio.c +++ /dev/null @@ -1,556 +0,0 @@ -/* I'm gambling no one uses this audio backend...we'll see who emails. :) */ -#error this code has not been updated for SDL 1.3. -#error if no one emails icculus at icculus.org and tells him that this -#error code is needed, this audio backend will eventually be removed from SDL. - -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - 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_config.h" - -/* Allow access to a raw mixing buffer */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_umsaudio.h" - -#define DEBUG_AUDIO 1 - -/* Audio driver functions */ -static int UMS_OpenAudio(_THIS, SDL_AudioSpec * spec); -static void UMS_PlayAudio(_THIS); -static Uint8 *UMS_GetAudioBuf(_THIS); -static void UMS_CloseAudio(_THIS); - -static UMSAudioDevice_ReturnCode UADOpen(_THIS, string device, string mode, - long flags); -static UMSAudioDevice_ReturnCode UADClose(_THIS); -static UMSAudioDevice_ReturnCode UADGetBitsPerSample(_THIS, long *bits); -static UMSAudioDevice_ReturnCode UADSetBitsPerSample(_THIS, long bits); -static UMSAudioDevice_ReturnCode UADSetSampleRate(_THIS, long rate, - long *set_rate); -static UMSAudioDevice_ReturnCode UADSetByteOrder(_THIS, string byte_order); -static UMSAudioDevice_ReturnCode UADSetAudioFormatType(_THIS, string fmt); -static UMSAudioDevice_ReturnCode UADSetNumberFormat(_THIS, string fmt); -static UMSAudioDevice_ReturnCode UADInitialize(_THIS); -static UMSAudioDevice_ReturnCode UADStart(_THIS); -static UMSAudioDevice_ReturnCode UADStop(_THIS); -static UMSAudioDevice_ReturnCode UADSetTimeFormat(_THIS, - UMSAudioTypes_TimeFormat - fmt); -static UMSAudioDevice_ReturnCode UADWriteBuffSize(_THIS, long *buff_size); -static UMSAudioDevice_ReturnCode UADWriteBuffRemain(_THIS, long *buff_size); -static UMSAudioDevice_ReturnCode UADWriteBuffUsed(_THIS, long *buff_size); -static UMSAudioDevice_ReturnCode UADSetDMABufferSize(_THIS, long bytes, - long *bytes_ret); -static UMSAudioDevice_ReturnCode UADSetVolume(_THIS, long volume); -static UMSAudioDevice_ReturnCode UADSetBalance(_THIS, long balance); -static UMSAudioDevice_ReturnCode UADSetChannels(_THIS, long channels); -static UMSAudioDevice_ReturnCode UADPlayRemainingData(_THIS, boolean block); -static UMSAudioDevice_ReturnCode UADEnableOutput(_THIS, string output, - long *left_gain, - long *right_gain); -static UMSAudioDevice_ReturnCode UADWrite(_THIS, UMSAudioTypes_Buffer * buff, - long samples, - long *samples_written); - -/* Audio driver bootstrap functions */ -static int -Audio_Available(void) -{ - return 1; -} - -static void -Audio_DeleteDevice(_THIS) -{ - if (this->hidden->playbuf._buffer) - SDL_free(this->hidden->playbuf._buffer); - if (this->hidden->fillbuf._buffer) - SDL_free(this->hidden->fillbuf._buffer); - _somFree(this->hidden->umsdev); - SDL_free(this->hidden); - SDL_free(this); -} - -static SDL_AudioDevice * -Audio_CreateDevice(int devindex) -{ - SDL_AudioDevice *this; - - /* - * Allocate and initialize management storage and private management - * storage for this SDL-using library. - */ - this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice)); - if (this) { - SDL_memset(this, 0, (sizeof *this)); - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - } - if ((this == NULL) || (this->hidden == NULL)) { - SDL_OutOfMemory(); - if (this) { - SDL_free(this); - } - return (0); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); -#ifdef DEBUG_AUDIO - fprintf(stderr, "Creating UMS Audio device\n"); -#endif - - /* - * Calls for UMS env initialization and audio object construction. - */ - this->hidden->ev = somGetGlobalEnvironment(); - this->hidden->umsdev = UMSAudioDeviceNew(); - - /* - * Set the function pointers. - */ - this->OpenAudio = UMS_OpenAudio; - this->WaitAudio = NULL; /* we do blocking output */ - this->PlayAudio = UMS_PlayAudio; - this->GetAudioBuf = UMS_GetAudioBuf; - this->CloseAudio = UMS_CloseAudio; - this->free = Audio_DeleteDevice; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "done\n"); -#endif - return this; -} - -AudioBootStrap UMS_bootstrap = { - "ums", "AIX UMS audio", Audio_Available, Audio_CreateDevice, 0 -}; - -static Uint8 * -UMS_GetAudioBuf(_THIS) -{ -#ifdef DEBUG_AUDIO - fprintf(stderr, "enter UMS_GetAudioBuf\n"); -#endif - return this->hidden->fillbuf._buffer; -/* - long bufSize; - UMSAudioDevice_ReturnCode rc; - - rc = UADSetTimeFormat(this, UMSAudioTypes_Bytes ); - rc = UADWriteBuffSize(this, bufSize ); -*/ -} - -static void -UMS_CloseAudio(_THIS) -{ - UMSAudioDevice_ReturnCode rc; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "enter UMS_CloseAudio\n"); -#endif - rc = UADPlayRemainingData(this, TRUE); - rc = UADStop(this); - rc = UADClose(this); -} - -static void -UMS_PlayAudio(_THIS) -{ - UMSAudioDevice_ReturnCode rc; - long samplesToWrite; - long samplesWritten; - UMSAudioTypes_Buffer swpbuf; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "enter UMS_PlayAudio\n"); -#endif - samplesToWrite = - this->hidden->playbuf._length / this->hidden->bytesPerSample; - do { - rc = UADWrite(this, &this->hidden->playbuf, - samplesToWrite, &samplesWritten); - samplesToWrite -= samplesWritten; - - /* rc values: UMSAudioDevice_Success - * UMSAudioDevice_Failure - * UMSAudioDevice_Preempted - * UMSAudioDevice_Interrupted - * UMSAudioDevice_DeviceError - */ - if (rc == UMSAudioDevice_DeviceError) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Returning from PlayAudio with devices error\n"); -#endif - return; - } - } while (samplesToWrite > 0); - - SDL_LockAudio(); - SDL_memcpy(&swpbuf, &this->hidden->playbuf, sizeof(UMSAudioTypes_Buffer)); - SDL_memcpy(&this->hidden->playbuf, &this->hidden->fillbuf, - sizeof(UMSAudioTypes_Buffer)); - SDL_memcpy(&this->hidden->fillbuf, &swpbuf, sizeof(UMSAudioTypes_Buffer)); - SDL_UnlockAudio(); - -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote audio data and swapped buffer\n"); -#endif -} - -#if 0 -// /* Set the DSP frequency */ -// value = spec->freq; -// if ( ioctl(this->hidden->audio_fd, SOUND_PCM_WRITE_RATE, &value) < 0 ) { -// SDL_SetError("Couldn't set audio frequency"); -// return(-1); -// } -// spec->freq = value; -#endif - -static int -UMS_OpenAudio(_THIS, SDL_AudioSpec * spec) -{ - char *audiodev = "/dev/paud0"; - long lgain; - long rgain; - long outRate; - long outBufSize; - long bitsPerSample; - long samplesPerSec; - long success; - SDL_AudioFormat test_format; - int frag_spec; - UMSAudioDevice_ReturnCode rc; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "enter UMS_OpenAudio\n"); -#endif - rc = UADOpen(this, audiodev, "PLAY", UMSAudioDevice_BlockingIO); - if (rc != UMSAudioDevice_Success) { - SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); - return -1; - } - - rc = UADSetAudioFormatType(this, "PCM"); - - success = 0; - test_format = SDL_FirstAudioFormat(spec->format); - do { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: -/* from the mac code: better ? */ -/* sample_bits = spec->size / spec->samples / spec->channels * 8; */ - success = 1; - bitsPerSample = 8; - rc = UADSetSampleRate(this, spec->freq << 16, &outRate); - rc = UADSetByteOrder(this, "MSB"); /* irrelevant */ - rc = UADSetNumberFormat(this, "UNSIGNED"); - break; - case AUDIO_S8: - success = 1; - bitsPerSample = 8; - rc = UADSetSampleRate(this, spec->freq << 16, &outRate); - rc = UADSetByteOrder(this, "MSB"); /* irrelevant */ - rc = UADSetNumberFormat(this, "SIGNED"); - break; - case AUDIO_S16LSB: - success = 1; - bitsPerSample = 16; - rc = UADSetSampleRate(this, spec->freq << 16, &outRate); - rc = UADSetByteOrder(this, "LSB"); - rc = UADSetNumberFormat(this, "SIGNED"); - break; - case AUDIO_S16MSB: - success = 1; - bitsPerSample = 16; - rc = UADSetSampleRate(this, spec->freq << 16, &outRate); - rc = UADSetByteOrder(this, "MSB"); - rc = UADSetNumberFormat(this, "SIGNED"); - break; - case AUDIO_U16LSB: - success = 1; - bitsPerSample = 16; - rc = UADSetSampleRate(this, spec->freq << 16, &outRate); - rc = UADSetByteOrder(this, "LSB"); - rc = UADSetNumberFormat(this, "UNSIGNED"); - break; - case AUDIO_U16MSB: - success = 1; - bitsPerSample = 16; - rc = UADSetSampleRate(this, spec->freq << 16, &outRate); - rc = UADSetByteOrder(this, "MSB"); - rc = UADSetNumberFormat(this, "UNSIGNED"); - break; - default: - break; - } - if (!success) { - test_format = SDL_NextAudioFormat(); - } - } while (!success && test_format); - - if (success == 0) { - SDL_SetError("Couldn't find any hardware audio formats"); - return -1; - } - - spec->format = test_format; - - for (frag_spec = 0; (0x01 << frag_spec) < spec->size; ++frag_spec); - if ((0x01 << frag_spec) != spec->size) { - SDL_SetError("Fragment size must be a power of two"); - return -1; - } - if (frag_spec > 2048) - frag_spec = 2048; - - this->hidden->bytesPerSample = (bitsPerSample / 8) * spec->channels; - samplesPerSec = this->hidden->bytesPerSample * outRate; - - this->hidden->playbuf._length = 0; - this->hidden->playbuf._maximum = spec->size; - this->hidden->playbuf._buffer = (unsigned char *) SDL_malloc(spec->size); - this->hidden->fillbuf._length = 0; - this->hidden->fillbuf._maximum = spec->size; - this->hidden->fillbuf._buffer = (unsigned char *) SDL_malloc(spec->size); - - rc = UADSetBitsPerSample(this, bitsPerSample); - rc = UADSetDMABufferSize(this, frag_spec, &outBufSize); - rc = UADSetChannels(this, spec->channels); /* functions reduces to mono or stereo */ - - lgain = 100; /*maximum left input gain */ - rgain = 100; /*maimum right input gain */ - rc = UADEnableOutput(this, "LINE_OUT", &lgain, &rgain); - rc = UADInitialize(this); - rc = UADStart(this); - rc = UADSetVolume(this, 100); - rc = UADSetBalance(this, 0); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static UMSAudioDevice_ReturnCode -UADGetBitsPerSample(_THIS, long *bits) -{ - return UMSAudioDevice_get_bits_per_sample(this->hidden->umsdev, - this->hidden->ev, bits); -} - -static UMSAudioDevice_ReturnCode -UADSetBitsPerSample(_THIS, long bits) -{ - return UMSAudioDevice_set_bits_per_sample(this->hidden->umsdev, - this->hidden->ev, bits); -} - -static UMSAudioDevice_ReturnCode -UADSetSampleRate(_THIS, long rate, long *set_rate) -{ - /* from the mac code: sample rate = spec->freq << 16; */ - return UMSAudioDevice_set_sample_rate(this->hidden->umsdev, - this->hidden->ev, rate, set_rate); -} - -static UMSAudioDevice_ReturnCode -UADSetByteOrder(_THIS, string byte_order) -{ - return UMSAudioDevice_set_byte_order(this->hidden->umsdev, - this->hidden->ev, byte_order); -} - -static UMSAudioDevice_ReturnCode -UADSetAudioFormatType(_THIS, string fmt) -{ - /* possible PCM, A_LAW or MU_LAW */ - return UMSAudioDevice_set_audio_format_type(this->hidden->umsdev, - this->hidden->ev, fmt); -} - -static UMSAudioDevice_ReturnCode -UADSetNumberFormat(_THIS, string fmt) -{ - /* possible SIGNED, UNSIGNED, or TWOS_COMPLEMENT */ - return UMSAudioDevice_set_number_format(this->hidden->umsdev, - this->hidden->ev, fmt); -} - -static UMSAudioDevice_ReturnCode -UADInitialize(_THIS) -{ - return UMSAudioDevice_initialize(this->hidden->umsdev, this->hidden->ev); -} - -static UMSAudioDevice_ReturnCode -UADStart(_THIS) -{ - return UMSAudioDevice_start(this->hidden->umsdev, this->hidden->ev); -} - -static UMSAudioDevice_ReturnCode -UADSetTimeFormat(_THIS, UMSAudioTypes_TimeFormat fmt) -{ - /* - * Switches the time format to the new format, immediately. - * possible UMSAudioTypes_Msecs, UMSAudioTypes_Bytes or UMSAudioTypes_Samples - */ - return UMSAudioDevice_set_time_format(this->hidden->umsdev, - this->hidden->ev, fmt); -} - -static UMSAudioDevice_ReturnCode -UADWriteBuffSize(_THIS, long *buff_size) -{ - /* - * returns write buffer size in the current time format - */ - return UMSAudioDevice_write_buff_size(this->hidden->umsdev, - this->hidden->ev, buff_size); -} - -static UMSAudioDevice_ReturnCode -UADWriteBuffRemain(_THIS, long *buff_size) -{ - /* - * returns amount of available space in the write buffer - * in the current time format - */ - return UMSAudioDevice_write_buff_remain(this->hidden->umsdev, - this->hidden->ev, buff_size); -} - -static UMSAudioDevice_ReturnCode -UADWriteBuffUsed(_THIS, long *buff_size) -{ - /* - * returns amount of filled space in the write buffer - * in the current time format - */ - return UMSAudioDevice_write_buff_used(this->hidden->umsdev, - this->hidden->ev, buff_size); -} - -static UMSAudioDevice_ReturnCode -UADSetDMABufferSize(_THIS, long bytes, long *bytes_ret) -{ - /* - * Request a new DMA buffer size, maximum requested size 2048. - * Takes effect with next initialize() call. - * Devices may or may not support DMA. - */ - return UMSAudioDevice_set_DMA_buffer_size(this->hidden->umsdev, - this->hidden->ev, - bytes, bytes_ret); -} - -static UMSAudioDevice_ReturnCode -UADSetVolume(_THIS, long volume) -{ - /* - * Set the volume. - * Takes effect immediately. - */ - return UMSAudioDevice_set_volume(this->hidden->umsdev, - this->hidden->ev, volume); -} - -static UMSAudioDevice_ReturnCode -UADSetBalance(_THIS, long balance) -{ - /* - * Set the balance. - * Takes effect immediately. - */ - return UMSAudioDevice_set_balance(this->hidden->umsdev, - this->hidden->ev, balance); -} - -static UMSAudioDevice_ReturnCode -UADSetChannels(_THIS, long channels) -{ - /* - * Set mono or stereo. - * Takes effect with next initialize() call. - */ - if (channels != 1) - channels = 2; - return UMSAudioDevice_set_number_of_channels(this->hidden->umsdev, - this->hidden->ev, channels); -} - -static UMSAudioDevice_ReturnCode -UADOpen(_THIS, string device, string mode, long flags) -{ - return UMSAudioDevice_open(this->hidden->umsdev, - this->hidden->ev, device, mode, flags); -} - -static UMSAudioDevice_ReturnCode -UADWrite(_THIS, UMSAudioTypes_Buffer * buff, - long samples, long *samples_written) -{ - return UMSAudioDevice_write(this->hidden->umsdev, - this->hidden->ev, - buff, samples, samples_written); -} - -static UMSAudioDevice_ReturnCode -UADPlayRemainingData(_THIS, boolean block) -{ - return UMSAudioDevice_play_remaining_data(this->hidden->umsdev, - this->hidden->ev, block); -} - -static UMSAudioDevice_ReturnCode -UADStop(_THIS) -{ - return UMSAudioDevice_stop(this->hidden->umsdev, this->hidden->ev); -} - -static UMSAudioDevice_ReturnCode -UADClose(_THIS) -{ - return UMSAudioDevice_close(this->hidden->umsdev, this->hidden->ev); -} - -static UMSAudioDevice_ReturnCode -UADEnableOutput(_THIS, string output, long *left_gain, long *right_gain) -{ - return UMSAudioDevice_enable_output(this->hidden->umsdev, - this->hidden->ev, - output, left_gain, right_gain); -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/ums/SDL_umsaudio.h b/src/audio/ums/SDL_umsaudio.h deleted file mode 100644 index 3c452225d..000000000 --- a/src/audio/ums/SDL_umsaudio.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - 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_config.h" - -#ifndef _SDL_UMSaudio_h -#define _SDL_UMSaudio_h - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* Pointer to the (open) UMS audio device */ - Environment *ev; - UMSAudioDevice umsdev; - - /* Raw mixing buffer */ - UMSAudioTypes_Buffer playbuf; - UMSAudioTypes_Buffer fillbuf; - - long bytesPerSample; -}; - -#endif /* _SDL_UMSaudio_h */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/winmm/SDL_winmm.c b/src/audio/winmm/SDL_winmm.c index de73f7118..019f7dff2 100644 --- a/src/audio/winmm/SDL_winmm.c +++ b/src/audio/winmm/SDL_winmm.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_AUDIO_DRIVER_WINMM + /* Allow access to a raw mixing buffer */ #include "../../core/windows/SDL_windows.h" @@ -406,4 +408,6 @@ AudioBootStrap WINMM_bootstrap = { "winmm", "Windows Waveform Audio", WINMM_Init, 0 }; +#endif /* SDL_AUDIO_DRIVER_WINMM */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/xaudio2/SDL_xaudio2.c b/src/audio/xaudio2/SDL_xaudio2.c index 5287586e8..a1230e4d7 100644 --- a/src/audio/xaudio2/SDL_xaudio2.c +++ b/src/audio/xaudio2/SDL_xaudio2.c @@ -19,14 +19,15 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" + +#if SDL_AUDIO_DRIVER_XAUDIO2 + #include "../../core/windows/SDL_windows.h" #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_assert.h" -#if SDL_AUDIO_DRIVER_XAUDIO2 - #include /* XAudio2 exists as of the March 2008 DirectX SDK */ #if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) # warning Your DirectX SDK is too old. Disabling XAudio2 support. diff --git a/src/core/android/SDL_android.cpp b/src/core/android/SDL_android.cpp index 0f689ed75..a905c8dae 100644 --- a/src/core/android/SDL_android.cpp +++ b/src/core/android/SDL_android.cpp @@ -21,6 +21,8 @@ #include "SDL_config.h" #include "SDL_stdinc.h" +#ifdef __ANDROID__ + #include "SDL_android.h" extern "C" { @@ -605,4 +607,6 @@ extern "C" int Android_JNI_FileClose(SDL_RWops* ctx) return Android_JNI_FileClose(ctx, true); } +#endif /* __ANDROID__ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c index e00a399d8..a7c4425bb 100644 --- a/src/core/windows/SDL_windows.c +++ b/src/core/windows/SDL_windows.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#ifdef __WIN32__ + #include "SDL_error.h" #include "SDL_windows.h" @@ -59,4 +61,6 @@ WIN_CoUninitialize(void) CoUninitialize(); } +#endif /* __WIN32__ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c index 2d6185355..13bcbf86e 100644 --- a/src/events/SDL_gesture.c +++ b/src/events/SDL_gesture.c @@ -103,7 +103,7 @@ int SDL_RecordGesture(SDL_TouchID touchId) { return (touchId < 0); } -unsigned long SDL_HashDollar(SDL_FloatPoint* points) { +static unsigned long SDL_HashDollar(SDL_FloatPoint* points) { unsigned long hash = 5381; int i; for(i = 0;i < DOLLARNPOINTS; i++) { @@ -242,7 +242,7 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) { } -float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) { +static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) { // SDL_FloatPoint p[DOLLARNPOINTS]; float dist = 0; SDL_FloatPoint p; @@ -257,7 +257,7 @@ float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang) { } -float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) { +static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) { //------------BEGIN DOLLAR BLACKBOX----------------// //-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-// //-"http://depts.washington.edu/aimgroup/proj/dollar/"-// @@ -294,7 +294,7 @@ float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ) { } //DollarPath contains raw points, plus (possibly) the calculated length -int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) { +static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) { int i; float interval; float dist; @@ -387,7 +387,7 @@ int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) { return numPoints; } -float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) { +static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) { SDL_FloatPoint points[DOLLARNPOINTS]; int i; @@ -431,20 +431,7 @@ int SDL_GestureAddTouch(SDL_Touch* touch) { return 0; } -int SDL_GestureRemoveTouch(SDL_TouchID id) { - int i; - for (i = 0; i < SDL_numGestureTouches; i++) { - if (SDL_gestureTouch[i].id == id) { - SDL_numGestureTouches--; - SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i])); - return 1; - } - } - return -1; -} - - -SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { +static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { int i; for(i = 0;i < SDL_numGestureTouches; i++) { //printf("%i ?= %i\n",SDL_gestureTouch[i].id,id); @@ -453,7 +440,7 @@ SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { return NULL; } -int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { +static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { SDL_Event event; event.mgesture.type = SDL_MULTIGESTURE; event.mgesture.touchId = touch->id; @@ -465,7 +452,7 @@ int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { return SDL_PushEvent(&event) > 0; } -int SDL_SendGestureDollar(SDL_GestureTouch* touch, +static int SDL_SendGestureDollar(SDL_GestureTouch* touch, SDL_GestureID gestureId,float error) { SDL_Event event; event.dgesture.type = SDL_DOLLARGESTURE; @@ -483,7 +470,7 @@ int SDL_SendGestureDollar(SDL_GestureTouch* touch, } -int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) { +static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId) { SDL_Event event; event.dgesture.type = SDL_DOLLARRECORD; event.dgesture.touchId = touch->id; diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 7d990dd94..6424de9db 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -854,23 +854,6 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode) return keyboard->keymap[scancode]; } -SDL_Keycode SDL_GetKeycodeFromName(const char *name) -{ - int i; - - if (!name || !*name) { - return SDL_SCANCODE_UNKNOWN; - } - - for (i = 0; i < SDL_arraysize(SDL_scancode_names); ++i) { - if (SDL_strcasecmp(name, SDL_scancode_names[i]) == 0) { - return (SDL_Scancode)i; - } - } - return SDL_SCANCODE_UNKNOWN; -} - - SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key) { diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index 9227ff3d0..c0c005c80 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -59,7 +59,7 @@ SDL_GetTouchIndex(int index) return SDL_touchPads[index]; } -int +static int SDL_GetFingerIndexId(SDL_Touch* touch,SDL_FingerID fingerid) { int i; @@ -190,6 +190,7 @@ SDL_GetNumTouch(void) { return SDL_num_touch; } + SDL_Window * SDL_GetTouchFocusWindow(SDL_TouchID id) { diff --git a/src/libm/e_atan2.c b/src/libm/e_atan2.c index f6974bd12..3f1ee5771 100644 --- a/src/libm/e_atan2.c +++ b/src/libm/e_atan2.c @@ -36,7 +36,7 @@ * to produce the hexadecimal values shown. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" static const double diff --git a/src/libm/e_log.c b/src/libm/e_log.c index 47e8ea452..da64138cd 100644 --- a/src/libm/e_log.c +++ b/src/libm/e_log.c @@ -66,7 +66,7 @@ static const char rcsid[] = * to produce the hexadecimal values shown. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" #ifdef __STDC__ diff --git a/src/libm/e_pow.c b/src/libm/e_pow.c index f90652c65..9145c4b57 100644 --- a/src/libm/e_pow.c +++ b/src/libm/e_pow.c @@ -59,7 +59,7 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; * to produce the hexadecimal values shown. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(scalbn) diff --git a/src/libm/e_rem_pio2.c b/src/libm/e_rem_pio2.c index 3578a0fad..a8ffe3142 100644 --- a/src/libm/e_rem_pio2.c +++ b/src/libm/e_rem_pio2.c @@ -21,7 +21,7 @@ static const char rcsid[] = * use __kernel_rem_pio2() */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(fabs) diff --git a/src/libm/e_sqrt.c b/src/libm/e_sqrt.c index 3c4b25ea5..b8b8bec6f 100644 --- a/src/libm/e_sqrt.c +++ b/src/libm/e_sqrt.c @@ -85,7 +85,7 @@ static const char rcsid[] = *--------------- */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" #ifdef __STDC__ diff --git a/src/libm/k_cos.c b/src/libm/k_cos.c index ab2637eb7..64c50e3fb 100644 --- a/src/libm/k_cos.c +++ b/src/libm/k_cos.c @@ -50,7 +50,7 @@ static const char rcsid[] = * thus, reducing the rounding error in the subtraction. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" #ifdef __STDC__ diff --git a/src/libm/k_rem_pio2.c b/src/libm/k_rem_pio2.c index 42db4a898..f881d35d6 100644 --- a/src/libm/k_rem_pio2.c +++ b/src/libm/k_rem_pio2.c @@ -131,7 +131,7 @@ static const char rcsid[] = * to produce the hexadecimal values shown. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(scalbn) diff --git a/src/libm/k_sin.c b/src/libm/k_sin.c index 250ee6eca..60881575a 100644 --- a/src/libm/k_sin.c +++ b/src/libm/k_sin.c @@ -43,7 +43,7 @@ static const char rcsid[] = * sin(x) = x + (S1*x + (x *(r-y/2)+y)) */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" #ifdef __STDC__ diff --git a/src/libm/math.h b/src/libm/math_libm.h similarity index 91% rename from src/libm/math.h rename to src/libm/math_libm.h index 260b3fed2..6c1f8e9d7 100644 --- a/src/libm/math.h +++ b/src/libm/math_libm.h @@ -28,6 +28,7 @@ #else #define atan SDL_atan #endif +double atan(double x); #ifndef HAVE_ATAN2 #define __ieee754_atan2 SDL_atan2 @@ -38,24 +39,28 @@ #else #define copysign SDL_copysign #endif +double copysign(double x, double y); #ifdef HAVE_COS #define cos SDL_uclibc_cos #else #define cos SDL_cos #endif +double cos(double x); #ifdef HAVE_FABS #define fabs SDL_uclibc_fabs #else #define fabs SDL_fabs #endif +double fabs(double x); #ifdef HAVE_FLOOR #define floor SDL_uclibc_floor #else #define floor SDL_floor #endif +double floor(double x); #ifndef HAVE_LOG #define __ieee754_log SDL_log @@ -70,12 +75,14 @@ #else #define scalbn SDL_scalbn #endif +double scalbn(double x, int n); #ifdef HAVE_SIN #define sin SDL_uclibc_sin #else #define sin SDL_sin #endif +double sin(double x); #ifndef HAVE_SQRT #define __ieee754_sqrt SDL_sqrt diff --git a/src/libm/s_atan.c b/src/libm/s_atan.c index 08cfb08e8..f664f0eb3 100644 --- a/src/libm/s_atan.c +++ b/src/libm/s_atan.c @@ -29,7 +29,7 @@ * to produce the hexadecimal values shown. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" static const double atanhi[] = { diff --git a/src/libm/s_copysign.c b/src/libm/s_copysign.c index 65e719007..afd43e9a7 100644 --- a/src/libm/s_copysign.c +++ b/src/libm/s_copysign.c @@ -21,7 +21,7 @@ static const char rcsid[] = * with the sign bit of y. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(copysign) diff --git a/src/libm/s_cos.c b/src/libm/s_cos.c index 9a568fca2..66b156c9f 100644 --- a/src/libm/s_cos.c +++ b/src/libm/s_cos.c @@ -46,7 +46,7 @@ static const char rcsid[] = * TRIG(x) returns trig(x) nearly rounded */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(cos) diff --git a/src/libm/s_fabs.c b/src/libm/s_fabs.c index dba666cbc..5cf0c3977 100644 --- a/src/libm/s_fabs.c +++ b/src/libm/s_fabs.c @@ -19,7 +19,7 @@ static const char rcsid[] = * fabs(x) returns the absolute value of x. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(fabs) diff --git a/src/libm/s_floor.c b/src/libm/s_floor.c index d6b8f177e..b553d3038 100644 --- a/src/libm/s_floor.c +++ b/src/libm/s_floor.c @@ -24,7 +24,7 @@ static const char rcsid[] = * Inexact flag raised if x not equal to floor(x). */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" #ifdef __STDC__ diff --git a/src/libm/s_scalbn.c b/src/libm/s_scalbn.c index e90631da6..74b979445 100644 --- a/src/libm/s_scalbn.c +++ b/src/libm/s_scalbn.c @@ -22,7 +22,7 @@ static const char rcsid[] = * exponentiation or a multiplication. */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(copysign) diff --git a/src/libm/s_sin.c b/src/libm/s_sin.c index 1b22f8813..771176619 100644 --- a/src/libm/s_sin.c +++ b/src/libm/s_sin.c @@ -46,7 +46,7 @@ static const char rcsid[] = * TRIG(x) returns trig(x) nearly rounded */ -#include "math.h" +#include "math_libm.h" #include "math_private.h" libm_hidden_proto(sin) diff --git a/src/main/android/SDL_android_main.cpp b/src/main/android/SDL_android_main.cpp index 4058e6b9c..89e41ab7d 100644 --- a/src/main/android/SDL_android_main.cpp +++ b/src/main/android/SDL_android_main.cpp @@ -1,4 +1,8 @@ +#include "SDL_config.h" + +#ifdef __ANDROID__ + /* Include the SDL main definition header */ #include "SDL_main.h" @@ -33,4 +37,6 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass c exit(status); } +#endif /* __ANDROID__ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/main/beos/SDL_BeApp.cc b/src/main/beos/SDL_BeApp.cc index 07632f39d..33a7330be 100644 --- a/src/main/beos/SDL_BeApp.cc +++ b/src/main/beos/SDL_BeApp.cc @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#ifdef __BEOS__ + /* Handle the BeApp specific portions of the application */ #include @@ -116,8 +118,6 @@ SDL_QuitBeApp(void) } } - -/* vi: set ts=4 sw=4 expandtab: */ #ifdef __cplusplus } #endif @@ -131,3 +131,7 @@ void SDL_BApp::ClearID(SDL_BWin *bwin) { --i; } } + +#endif /* __BEOS__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/main/windows/SDL_windows_main.c b/src/main/windows/SDL_windows_main.c index ef50d5d2c..4d60e2d4e 100644 --- a/src/main/windows/SDL_windows_main.c +++ b/src/main/windows/SDL_windows_main.c @@ -3,6 +3,9 @@ The WinMain function -- calls your program's main() function */ +#include "SDL_config.h" + +#ifdef __WIN32__ #include #include @@ -202,4 +205,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int sw) return 0; } +#endif /* __WIN32__ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/power/beos/SDL_syspower.c b/src/power/beos/SDL_syspower.c index 454d48fa1..eb49628b5 100644 --- a/src/power/beos/SDL_syspower.c +++ b/src/power/beos/SDL_syspower.c @@ -21,7 +21,7 @@ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#ifdef SDL_POWER_BEOS +#if SDL_POWER_BEOS #include #include diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index 9852b789e..2e409488c 100644 --- a/src/power/linux/SDL_syspower.c +++ b/src/power/linux/SDL_syspower.c @@ -21,7 +21,7 @@ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#ifdef SDL_POWER_LINUX +#if SDL_POWER_LINUX #include #include diff --git a/src/power/macosx/SDL_syspower.c b/src/power/macosx/SDL_syspower.c index 0434a16e6..b76b5c650 100644 --- a/src/power/macosx/SDL_syspower.c +++ b/src/power/macosx/SDL_syspower.c @@ -21,7 +21,7 @@ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#ifdef SDL_POWER_MACOSX +#if SDL_POWER_MACOSX #include #include diff --git a/src/power/nds/SDL_syspower.c b/src/power/nds/SDL_syspower.c index 485a28817..e0a92f235 100644 --- a/src/power/nds/SDL_syspower.c +++ b/src/power/nds/SDL_syspower.c @@ -21,7 +21,7 @@ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#ifdef SDL_POWER_NINTENDODS +#if SDL_POWER_NINTENDODS #include "SDL_power.h" diff --git a/src/thread/irix/SDL_systhread_c.h b/src/power/uikit/SDL_syspower.h similarity index 83% rename from src/thread/irix/SDL_systhread_c.h rename to src/power/uikit/SDL_syspower.h index 0e698918c..2bec9e171 100644 --- a/src/thread/irix/SDL_systhread_c.h +++ b/src/power/uikit/SDL_syspower.h @@ -20,8 +20,13 @@ */ #include "SDL_config.h" -#include +#if SDL_POWER_UIKIT -typedef pid_t SYS_ThreadHandle; +#include "SDL_power.h" + +void SDL_UIKit_UpdateBatteryMonitoring(void); +SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent); + +#endif /* SDL_POWER_UIKIT */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m index 3f6f33d38..2766ef5dd 100644 --- a/src/power/uikit/SDL_syspower.m +++ b/src/power/uikit/SDL_syspower.m @@ -21,13 +21,14 @@ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#ifdef SDL_POWER_UIKIT +#if SDL_POWER_UIKIT #import #include "SDL_power.h" #include "SDL_timer.h" #include "SDL_assert.h" +#include "SDL_syspower.h" // turn off the battery monitor if it's been more than X ms since last check. static const int BATTERY_MONITORING_TIMEOUT = 3000; diff --git a/src/power/windows/SDL_syspower.c b/src/power/windows/SDL_syspower.c index 4e3f6f468..0d75a2bcc 100644 --- a/src/power/windows/SDL_syspower.c +++ b/src/power/windows/SDL_syspower.c @@ -21,7 +21,7 @@ #include "SDL_config.h" #ifndef SDL_POWER_DISABLED -#ifdef SDL_POWER_WINDOWS +#if SDL_POWER_WINDOWS #include "../../core/windows/SDL_windows.h" diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index c6de6a853..251ae3cce 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -745,7 +745,7 @@ SDL_UnlockTextureYUV(SDL_Texture * texture) SDL_UnlockTexture(native); } -void +static void SDL_UnlockTextureNative(SDL_Texture * texture) { SDL_Texture *native = texture->native; diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index b356fc66a..844acee35 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -581,7 +581,6 @@ static int GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count) { - GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; int i; GLshort *vertices; @@ -603,7 +602,6 @@ static int GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, int count) { - GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; int i; GLshort *vertices; @@ -632,7 +630,6 @@ static int GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count) { - GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; int i; GLES_SetDrawingState(renderer); diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index d4773a0a8..fc3a9d31f 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -877,7 +877,6 @@ GLES2_SetDrawingState(SDL_Renderer * renderer) static int GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count) { - GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLfloat *vertices; int idx; @@ -910,7 +909,6 @@ GLES2_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int coun static int GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count) { - GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLfloat *vertices; int idx; @@ -943,7 +941,6 @@ GLES2_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count static int GLES2_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count) { - GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata; GLfloat vertices[8]; int idx; diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 30c22727b..ce63f1dee 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -23,6 +23,7 @@ #if !SDL_RENDER_DISABLED #include "../SDL_sysrender.h" +#include "SDL_render_sw_c.h" #include "SDL_draw.h" #include "SDL_blendfillrect.h" diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index e3942713a..69a1c8c80 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -31,7 +31,7 @@ #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4) #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF) -int UTF8_TrailingBytes(unsigned char c) +static int UTF8_TrailingBytes(unsigned char c) { if (c >= 0xC0 && c <= 0xDF) return 1; diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index a1144c176..2f1aeb975 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -26,6 +26,7 @@ #include "SDL_thread.h" #include "SDL_thread_c.h" #include "SDL_systhread.h" +#include "../SDL_error_c.h" #define ARRAY_CHUNKSIZE 32 /* The array of threads currently active in the application diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index 8474cfb0c..08ebd7bc8 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -32,8 +32,6 @@ #include "epoc/SDL_systhread_c.h" #elif SDL_THREAD_PTHREAD #include "pthread/SDL_systhread_c.h" -#elif SDL_THREAD_SPROC -#include "irix/SDL_systhread_c.h" #elif SDL_THREAD_WINDOWS #include "windows/SDL_systhread_c.h" #elif SDL_THREAD_NDS @@ -59,4 +57,5 @@ struct SDL_Thread extern void SDL_RunThread(void *data); #endif /* _SDL_thread_c_h */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/beos/SDL_syssem.c b/src/thread/beos/SDL_syssem.c index 9f966851a..afaccaf1a 100644 --- a/src/thread/beos/SDL_syssem.c +++ b/src/thread/beos/SDL_syssem.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#ifdef SDL_THREAD_BEOS + /* Semaphores in the BeOS environment */ #include @@ -148,4 +150,6 @@ SDL_SemPost(SDL_sem * sem) return 0; } +#endif /* SDL_THREAD_BEOS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/beos/SDL_systhread.c b/src/thread/beos/SDL_systhread.c index cf2f577b7..ff255ff76 100644 --- a/src/thread/beos/SDL_systhread.c +++ b/src/thread/beos/SDL_systhread.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#ifdef SDL_THREAD_BEOS + /* BeOS thread management routines for SDL */ #include @@ -120,4 +122,6 @@ SDL_SYS_WaitThread(SDL_Thread * thread) wait_for_thread(thread->handle, &the_status); } +#endif /* SDL_THREAD_BEOS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/irix/SDL_syssem.c b/src/thread/irix/SDL_syssem.c deleted file mode 100644 index 273b6b17f..000000000 --- a/src/thread/irix/SDL_syssem.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - 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_config.h" - -#include "SDL_thread.h" -#include "SDL_timer.h" - - -#include -#include -#include -#include -#include -#include - -#include "SDL_error.h" -#include "SDL_thread.h" - - -struct SDL_semaphore -{ - int id; -}; - -/* Not defined by many operating systems, use configure to detect */ -/* -#if !defined(HAVE_SEMUN) -union semun { - int val; - struct semid_ds *buf; - ushort *array; -}; -#endif -*/ - -static struct sembuf op_trywait[2] = { - {0, -1, (IPC_NOWAIT | SEM_UNDO)} /* Decrement semaphore, no block */ -}; - -static struct sembuf op_wait[2] = { - {0, -1, SEM_UNDO} /* Decrement semaphore */ -}; - -static struct sembuf op_post[1] = { - {0, 1, (IPC_NOWAIT | SEM_UNDO)} /* Increment semaphore */ -}; - -/* Create a blockable semaphore */ -SDL_sem * -SDL_CreateSemaphore(Uint32 initial_value) -{ - extern int _creating_thread_lock; /* SDL_threads.c */ - SDL_sem *sem; - union semun init; - - sem = (SDL_sem *) SDL_malloc(sizeof(*sem)); - if (sem == NULL) { - SDL_OutOfMemory(); - return (NULL); - } - sem->id = semget(IPC_PRIVATE, 1, (0600 | IPC_CREAT)); - if (sem->id < 0) { - SDL_SetError("Couldn't create semaphore"); - SDL_free(sem); - return (NULL); - } - init.val = initial_value; /* Initialize semaphore */ - semctl(sem->id, 0, SETVAL, init); - return (sem); -} - -void -SDL_DestroySemaphore(SDL_sem * sem) -{ - if (sem) { -#ifdef __IRIX__ - semctl(sem->id, 0, IPC_RMID); -#else - union semun dummy; - dummy.val = 0; - semctl(sem->id, 0, IPC_RMID, dummy); -#endif - SDL_free(sem); - } -} - -int -SDL_SemTryWait(SDL_sem * sem) -{ - int retval; - - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - retval = 0; - tryagain: - if (semop(sem->id, op_trywait, 1) < 0) { - if (errno == EINTR) { - goto tryagain; - } - retval = SDL_MUTEX_TIMEDOUT; - } - return retval; -} - -int -SDL_SemWait(SDL_sem * sem) -{ - int retval; - - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - retval = 0; - tryagain: - if (semop(sem->id, op_wait, 1) < 0) { - if (errno == EINTR) { - goto tryagain; - } - SDL_SetError("Semaphore operation error"); - retval = -1; - } - return retval; -} - -int -SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) -{ - int retval; - - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - /* Try the easy cases first */ - if (timeout == 0) { - return SDL_SemTryWait(sem); - } - if (timeout == SDL_MUTEX_MAXWAIT) { - return SDL_SemWait(sem); - } - - /* Ack! We have to busy wait... */ - timeout += SDL_GetTicks(); - do { - retval = SDL_SemTryWait(sem); - if (retval == 0) { - break; - } - SDL_Delay(1); - } while (SDL_GetTicks() < timeout); - - return retval; -} - -Uint32 -SDL_SemValue(SDL_sem * sem) -{ - int semval; - Uint32 value; - - value = 0; - if (sem) { - tryagain: -#ifdef __IRIX__ - semval = semctl(sem->id, 0, GETVAL); -#else - { - union semun arg; - arg.val = 0; - semval = semctl(sem->id, 0, GETVAL, arg); - } -#endif - if (semval < 0) { - if (errno == EINTR) { - goto tryagain; - } - } else { - value = (Uint32) semval; - } - } - return value; -} - -int -SDL_SemPost(SDL_sem * sem) -{ - int retval; - - if (!sem) { - SDL_SetError("Passed a NULL semaphore"); - return -1; - } - - retval = 0; - tryagain: - if (semop(sem->id, op_post, 1) < 0) { - if (errno == EINTR) { - goto tryagain; - } - SDL_SetError("Semaphore operation error"); - retval = -1; - } - return retval; -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/irix/SDL_systhread.c b/src/thread/irix/SDL_systhread.c deleted file mode 100644 index d2ed080d0..000000000 --- a/src/thread/irix/SDL_systhread.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - 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_config.h" - -/* IRIX thread management routines for SDL */ - -#include -#include -#include -#include -#include - -#include "SDL_thread.h" -#include "../SDL_systhread.h" - - -static int sig_list[] = { - SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGALRM, SIGTERM, SIGCLD, SIGWINCH, - SIGVTALRM, SIGPROF, 0 -}; - - -int -SDL_SYS_CreateThread(SDL_Thread * thread, void *args) -{ - /* Create the thread and go! */ - if (sproc(SDL_RunThread, PR_SALL, args) < 0) { - SDL_SetError("Not enough resources to create thread"); - return (-1); - } - return (0); -} - -void -SDL_SYS_SetupThread(const char *name) -{ - int i; - sigset_t mask; - - /* Mask asynchronous signals for this thread */ - sigemptyset(&mask); - for (i = 0; sig_list[i]; ++i) { - sigaddset(&mask, sig_list[i]); - } - sigprocmask(SIG_BLOCK, &mask, NULL); -} - -SDL_threadID -SDL_ThreadID(void) -{ - return ((SDL_threadID) getpid()); -} - -void -SDL_WaitThread(SDL_Thread * thread, int *status) -{ - errno = 0; - while (errno != ECHILD) { - waitpid(thread->handle, NULL, 0); - } -} - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/nds/SDL_systhread.c b/src/thread/nds/SDL_systhread.c index 3bdebcee1..0355db870 100644 --- a/src/thread/nds/SDL_systhread.c +++ b/src/thread/nds/SDL_systhread.c @@ -61,10 +61,4 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) return (0); } -void -SDL_SYS_KillThread(SDL_Thread * thread) -{ - return; -} - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/windows/SDL_sysmutex.c b/src/thread/windows/SDL_sysmutex.c index 184cd27dd..ab35a9614 100644 --- a/src/thread/windows/SDL_sysmutex.c +++ b/src/thread/windows/SDL_sysmutex.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_THREAD_WINDOWS + /* Mutex functions using the Win32 API */ #include "../../core/windows/SDL_windows.h" @@ -90,4 +92,6 @@ SDL_mutexV(SDL_mutex * mutex) return (0); } +#endif /* SDL_THREAD_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c index c5589f0c9..b1543dab9 100644 --- a/src/thread/windows/SDL_syssem.c +++ b/src/thread/windows/SDL_syssem.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_THREAD_WINDOWS + /* Semaphore functions using the Win32 API */ #include "../../core/windows/SDL_windows.h" @@ -169,4 +171,6 @@ SDL_SemPost(SDL_sem * sem) return 0; } +#endif /* SDL_THREAD_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index 3c133e09c..47bc0d20e 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/src/thread/windows/SDL_systhread.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_THREAD_WINDOWS + /* Win32 thread management routines for SDL */ #include "SDL_thread.h" @@ -216,4 +218,6 @@ SDL_SYS_WaitThread(SDL_Thread * thread) CloseHandle(thread->handle); } +#endif /* SDL_THREAD_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/thread/windows/win_ce_semaphore.c b/src/thread/windows/win_ce_semaphore.c index 62072f562..f243682b7 100644 --- a/src/thread/windows/win_ce_semaphore.c +++ b/src/thread/windows/win_ce_semaphore.c @@ -26,7 +26,11 @@ 6. The wait function emulates WaitForSingleObject only. An emulation of WaitForMultipleObjects is much harder to implement outside the kernel, and it is not clear how to handle a mixture of WCE semaphores and normal - events and mutexes. */ + events and mutexes. +*/ +#include "SDL_config.h" + +#if SDL_THREAD_WINDOWS #include "../../core/windows/SDL_windows.h" @@ -224,4 +228,6 @@ CleanUp(SYNCHHANDLE hSynch, DWORD Flags) return hSynch; } +#endif /* SDL_THREAD_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_rect.c b/src/video/SDL_rect.c index 1772166b1..fba69fc2d 100644 --- a/src/video/SDL_rect.c +++ b/src/video/SDL_rect.c @@ -21,6 +21,7 @@ #include "SDL_config.h" #include "SDL_rect.h" +#include "SDL_rect_c.h" SDL_bool diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c index 01fad7099..3e0c030f8 100644 --- a/src/video/SDL_shape.c +++ b/src/video/SDL_shape.c @@ -115,7 +115,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm SDL_UnlockSurface(shape); } -SDL_ShapeTree* +static SDL_ShapeTree* RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rect dimensions) { int x = 0,y = 0; Uint8* pixel = NULL; @@ -249,7 +249,7 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh return result; } -SDL_bool +static SDL_bool SDL_WindowHasAShape(SDL_Window *window) { if (window == NULL || !SDL_IsShapedWindow(window)) return SDL_FALSE; diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index abed6a824..bb26ff094 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -576,7 +576,7 @@ SDL_GetNumVideoDisplays(void) return _this->num_displays; } -int +static int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display) { int displayIndex; @@ -655,12 +655,6 @@ SDL_AddDisplayMode(SDL_VideoDisplay * display, const SDL_DisplayMode * mode) return SDL_TRUE; } -SDL_VideoDisplay * -SDL_GetFirstDisplay(void) -{ - return &_this->displays[0]; -} - static int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display) { @@ -847,7 +841,7 @@ SDL_GetClosestDisplayMode(int displayIndex, return SDL_GetClosestDisplayModeForDisplay(display, mode, closest); } -int +static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode) { SDL_DisplayMode display_mode; diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c index 6145cd0c0..ec20b9b8c 100644 --- a/src/video/android/SDL_androidevents.c +++ b/src/video/android/SDL_androidevents.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_ANDROID + #include "SDL_androidevents.h" void @@ -28,4 +30,6 @@ Android_PumpEvents(_THIS) /* No polling necessary */ } +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index f8d47be85..abde8fcd7 100644 --- a/src/video/android/SDL_androidgl.c +++ b/src/video/android/SDL_androidgl.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_ANDROID + /* Android SDL video driver implementation */ #include "SDL_video.h" @@ -112,4 +114,6 @@ Android_GL_DeleteContext(_THIS, SDL_GLContext context) __android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_DeleteContext\n"); } +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/android/SDL_androidkeyboard.c b/src/video/android/SDL_androidkeyboard.c index 70e7e7b2f..df80fdf10 100644 --- a/src/video/android/SDL_androidkeyboard.c +++ b/src/video/android/SDL_androidkeyboard.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_ANDROID + #include #include "../../events/SDL_events_c.h" @@ -176,4 +178,6 @@ Android_OnKeyUp(int keycode) return SDL_SendKeyboardKey(SDL_RELEASED, TranslateKeycode(keycode)); } +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index 5ca966697..cf81143dd 100644 --- a/src/video/android/SDL_androidtouch.c +++ b/src/video/android/SDL_androidtouch.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_ANDROID + #include #include "SDL_events.h" @@ -85,4 +87,6 @@ void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int actio } } +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c index 00c262708..d4d46a8ba 100644 --- a/src/video/android/SDL_androidvideo.c +++ b/src/video/android/SDL_androidvideo.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_ANDROID + /* Android SDL video driver implementation */ @@ -166,4 +168,6 @@ Android_SetScreenResolution(int width, int height, Uint32 format) } } +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index e0abadd4e..68107e2c2 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/src/video/android/SDL_androidwindow.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_ANDROID + #include "../SDL_sysvideo.h" #include "SDL_androidvideo.h" @@ -62,4 +64,6 @@ Android_DestroyWindow(_THIS, SDL_Window * window) } } +#endif /* SDL_VIDEO_DRIVER_ANDROID */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/bwindow/SDL_bclipboard.cc b/src/video/bwindow/SDL_bclipboard.cc index 028dcac99..41ebfb453 100644 --- a/src/video/bwindow/SDL_bclipboard.cc +++ b/src/video/bwindow/SDL_bclipboard.cc @@ -18,10 +18,11 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" +#if SDL_VIDEO_DRIVER_BWINDOW /* BWindow based framebuffer implementation */ -#include "SDL_config.h" #include #include @@ -91,3 +92,4 @@ SDL_bool BE_HasClipboardText(_THIS) { } /* Extern C */ #endif +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bevents.cc b/src/video/bwindow/SDL_bevents.cc index e5ad003ec..bc5c6eb67 100644 --- a/src/video/bwindow/SDL_bevents.cc +++ b/src/video/bwindow/SDL_bevents.cc @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_BWINDOW #include "SDL_bevents.h" @@ -32,3 +35,5 @@ void BE_PumpEvents(_THIS) { #ifdef __cplusplus } #endif + +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bframebuffer.cc b/src/video/bwindow/SDL_bframebuffer.cc index 7dbd06717..f24a136d4 100644 --- a/src/video/bwindow/SDL_bframebuffer.cc +++ b/src/video/bwindow/SDL_bframebuffer.cc @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_BWINDOW #include "SDL_bframebuffer.h" @@ -248,3 +251,5 @@ int32 BE_UpdateOnce(SDL_Window *window) { #ifdef __cplusplus } #endif + +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bkeyboard.cc b/src/video/bwindow/SDL_bkeyboard.cc index 03ba7cac2..13dbd0929 100644 --- a/src/video/bwindow/SDL_bkeyboard.cc +++ b/src/video/bwindow/SDL_bkeyboard.cc @@ -19,6 +19,9 @@ Sam Lantinga slouken@libsdl.org */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_BWINDOW #include #include @@ -182,3 +185,5 @@ void BE_SetKeyState(int32 bkey, int8 state) { #ifdef __cplusplus } #endif + +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bmodes.cc b/src/video/bwindow/SDL_bmodes.cc index 0651cf937..a68522be8 100644 --- a/src/video/bwindow/SDL_bmodes.cc +++ b/src/video/bwindow/SDL_bmodes.cc @@ -18,8 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" - +#if SDL_VIDEO_DRIVER_BWINDOW #include #include @@ -327,3 +328,5 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ #ifdef __cplusplus } #endif + +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bopengl.cc b/src/video/bwindow/SDL_bopengl.cc index f4cd9c08e..d2f4e790c 100644 --- a/src/video/bwindow/SDL_bopengl.cc +++ b/src/video/bwindow/SDL_bopengl.cc @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_BWINDOW #include "SDL_bopengl.h" @@ -209,11 +212,8 @@ void BE_GL_RebootContexts(_THIS) { - - - - - #ifdef __cplusplus } #endif + +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bvideo.cc b/src/video/bwindow/SDL_bvideo.cc index 0037c04d5..0ff99aff6 100644 --- a/src/video/bwindow/SDL_bvideo.cc +++ b/src/video/bwindow/SDL_bvideo.cc @@ -18,8 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" - +#if SDL_VIDEO_DRIVER_BWINDOW #ifdef __cplusplus @@ -168,3 +169,5 @@ void BE_VideoQuit(_THIS) #ifdef __cplusplus } #endif + +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/bwindow/SDL_bwindow.cc b/src/video/bwindow/SDL_bwindow.cc index 2c550d593..1c97211e7 100644 --- a/src/video/bwindow/SDL_bwindow.cc +++ b/src/video/bwindow/SDL_bwindow.cc @@ -19,6 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_BWINDOW #include "../SDL_sysvideo.h" #include "SDL_BWin.h" @@ -210,3 +212,4 @@ SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, } #endif +#endif /* SDL_VIDEO_DRIVER_BWINDOW */ diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index e575f2ca1..2b1b231e0 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL_cocoavideo.h" #include "../../events/SDL_clipboardevents_c.h" @@ -124,4 +126,6 @@ [pool release]; } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index b5e4e0273..321ea76ad 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -19,6 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_COCOA #include "SDL_timer.h" #include "SDL_cocoavideo.h" @@ -220,4 +222,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende [pool release]; } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index c82b7059e..c2da570db 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL_cocoavideo.h" #include "../../events/SDL_keyboard_c.h" @@ -28,7 +30,7 @@ #include //#define DEBUG_IME NSLog -#define DEBUG_IME (void) +#define DEBUG_IME(...) #ifndef NX_DEVICERCTLKEYMASK #define NX_DEVICELCTLKEYMASK 0x00000001 @@ -733,4 +735,6 @@ - (NSArray *) validAttributesForMarkedText { } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 5babd40d1..cbed0bae9 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL_cocoavideo.h" /* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */ @@ -113,7 +115,6 @@ - (void) setFrame:(NSRect)frame; GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) { SDL_DisplayModeData *data; - CFNumberRef number; long width, height, bpp, refreshRate; data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); @@ -146,6 +147,7 @@ - (void) setFrame:(NSRect)frame; #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 if (!IS_SNOW_LEOPARD_OR_LATER(_this)) { + CFNumberRef number; CFDictionaryRef vidmode = (CFDictionaryRef) moderef; number = CFDictionaryGetValue(vidmode, kCGDisplayWidth); CFNumberGetValue(number, kCFNumberLongType, &width); @@ -448,4 +450,6 @@ - (void) setFrame:(NSRect)frame; ShowMenuBar(); } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 488bef6b7..024639c71 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL_events.h" #include "SDL_cocoavideo.h" @@ -147,21 +149,6 @@ SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor()); } -static int -ConvertMouseButtonToSDL(int button) -{ - switch (button) - { - case 0: - return(SDL_BUTTON_LEFT); /* 1 */ - case 1: - return(SDL_BUTTON_RIGHT); /* 3 */ - case 2: - return(SDL_BUTTON_MIDDLE); /* 2 */ - } - return button+1; -} - void Cocoa_HandleMouseEvent(_THIS, NSEvent *event) { @@ -202,4 +189,6 @@ { } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 6dbf8e122..378ab3c9a 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -20,11 +20,11 @@ */ #include "SDL_config.h" -#include "SDL_cocoavideo.h" - /* NSOpenGL implementation of SDL OpenGL support */ #if SDL_VIDEO_OPENGL_CGL +#include "SDL_cocoavideo.h" + #include #include #include diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 19d432d5f..542a82899 100644 --- a/src/video/cocoa/SDL_cocoashape.m +++ b/src/video/cocoa/SDL_cocoashape.m @@ -19,6 +19,10 @@ 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL_cocoavideo.h" #include "SDL_shape.h" #include "SDL_cocoashape.h" @@ -89,6 +93,8 @@ closure.window = shaper->window; SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure); [closure.path addClip]; + + return 0; } int @@ -97,3 +103,7 @@ assert(data != NULL); return 0; } + +#endif /* SDL_VIDEO_DRIVER_COCOA */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index 02d9eefb5..886b2bebc 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL.h" #include "SDL_endian.h" #include "SDL_cocoavideo.h" @@ -259,4 +261,6 @@ return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn); } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vim: set ts=4 sw=4 expandtab: */ diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index f21addc88..f8956e087 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_COCOA + #include "SDL_syswm.h" #include "SDL_timer.h" /* For SDL_GetTicks() */ #include "../SDL_sysvideo.h" @@ -277,8 +279,6 @@ - (void)otherMouseUp:(NSEvent *)theEvent - (void)mouseEntered:(NSEvent *)theEvent { - SDL_Mouse *mouse = SDL_GetMouse(); - SDL_SetMouseFocus(_data->window); SDL_SetCursor(NULL); @@ -991,4 +991,6 @@ - (void)rightMouseDown:(NSEvent *)theEvent } } +#endif /* SDL_VIDEO_DRIVER_COCOA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/directfb/SDL_DirectFB_WM.c b/src/video/directfb/SDL_DirectFB_WM.c index 56f807612..c079f6381 100644 --- a/src/video/directfb/SDL_DirectFB_WM.c +++ b/src/video/directfb/SDL_DirectFB_WM.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_window.h" @@ -407,3 +410,4 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt) return 0; } +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/src/video/directfb/SDL_DirectFB_dyn.c b/src/video/directfb/SDL_DirectFB_dyn.c index 90075893d..840586b58 100644 --- a/src/video/directfb/SDL_DirectFB_dyn.c +++ b/src/video/directfb/SDL_DirectFB_dyn.c @@ -18,9 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_DIRECTFB + #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_dyn.h" @@ -112,3 +113,5 @@ SDL_DirectFB_UnLoadLibrary(void) { } #endif + +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 72bd7452e..1a935144b 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/src/video/directfb/SDL_DirectFB_events.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB /* Handle the event stream, converting DirectFB input events into SDL events */ @@ -743,3 +746,4 @@ DirectFB_QuitKeyboard(_THIS) } +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/src/video/directfb/SDL_DirectFB_modes.c b/src/video/directfb/SDL_DirectFB_modes.c index 33573a224..e56e413f6 100644 --- a/src/video/directfb/SDL_DirectFB_modes.c +++ b/src/video/directfb/SDL_DirectFB_modes.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_modes.h" @@ -406,4 +409,6 @@ DirectFB_QuitModes(_THIS) } } +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/directfb/SDL_DirectFB_mouse.c b/src/video/directfb/SDL_DirectFB_mouse.c index 980efd725..e83f43ae6 100644 --- a/src/video/directfb/SDL_DirectFB_mouse.c +++ b/src/video/directfb/SDL_DirectFB_mouse.c @@ -18,8 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB + #include "SDL_assert.h" #include "SDL_DirectFB_video.h" @@ -387,4 +389,6 @@ DirectFB_QuitMouse(_THIS) #endif +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/directfb/SDL_DirectFB_opengl.c b/src/video/directfb/SDL_DirectFB_opengl.c index 4385c8d9e..7c5737c90 100644 --- a/src/video/directfb/SDL_DirectFB_opengl.c +++ b/src/video/directfb/SDL_DirectFB_opengl.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" @@ -352,4 +355,6 @@ DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window) #endif +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c index 39ca67a28..a2ca4be41 100644 --- a/src/video/directfb/SDL_DirectFB_render.c +++ b/src/video/directfb/SDL_DirectFB_render.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB //#include "SDL_DirectFB_video.h" #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_modes.h" @@ -1255,4 +1258,6 @@ DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, } #endif +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c index dbc71368e..5f8f2d163 100644 --- a/src/video/directfb/SDL_DirectFB_shape.c +++ b/src/video/directfb/SDL_DirectFB_shape.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_assert.h" #include "SDL_DirectFB_video.h" @@ -128,3 +131,4 @@ DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowSh return -1; } +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index ba7eb9693..83835df2d 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" @@ -416,3 +419,5 @@ void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo* ri) ri->texture_formats[j++] = pixelformat_tab[i].sdl; ri->num_texture_formats = j; } + +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/src/video/directfb/SDL_DirectFB_window.c b/src/video/directfb/SDL_DirectFB_window.c index 274451876..094116a36 100644 --- a/src/video/directfb/SDL_DirectFB_window.c +++ b/src/video/directfb/SDL_DirectFB_window.c @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_modes.h" @@ -520,3 +523,5 @@ DirectFB_AdjustWindowSurface(SDL_Window * window) error: return; } + +#endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/src/video/dummy/SDL_nullevents.c b/src/video/dummy/SDL_nullevents.c index c97cbd278..f348f842a 100644 --- a/src/video/dummy/SDL_nullevents.c +++ b/src/video/dummy/SDL_nullevents.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_DUMMY + /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ @@ -34,4 +36,6 @@ DUMMY_PumpEvents(_THIS) /* do nothing. */ } +#endif /* SDL_VIDEO_DRIVER_DUMMY */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/dummy/SDL_nullframebuffer.c b/src/video/dummy/SDL_nullframebuffer.c index 44f933681..f9cca9a1d 100644 --- a/src/video/dummy/SDL_nullframebuffer.c +++ b/src/video/dummy/SDL_nullframebuffer.c @@ -20,7 +20,10 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_DUMMY + #include "../SDL_sysvideo.h" +#include "SDL_nullframebuffer_c.h" #define DUMMY_SURFACE "_SDL_DummySurface" @@ -86,4 +89,6 @@ void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window * window) } } +#endif /* SDL_VIDEO_DRIVER_DUMMY */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c index 4e561ec61..c5c21233e 100644 --- a/src/video/dummy/SDL_nullvideo.c +++ b/src/video/dummy/SDL_nullvideo.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_DUMMY + /* Dummy SDL video driver implementation; this is just enough to make an * SDL-based application THINK it's got a working video driver, for * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, @@ -139,4 +141,6 @@ DUMMY_VideoQuit(_THIS) { } +#endif /* SDL_VIDEO_DRIVER_DUMMY */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/nds/SDL_ndsevents.c b/src/video/nds/SDL_ndsevents.c index cd7df0f99..558eda048 100644 --- a/src/video/nds/SDL_ndsevents.c +++ b/src/video/nds/SDL_ndsevents.c @@ -20,8 +20,7 @@ */ #include "SDL_config.h" -/* Being a null driver, there's no event stream. We just define stubs for - most of the API. */ +#if SDL_VIDEO_DRIVER_NDS #include #include @@ -50,4 +49,6 @@ NDS_PumpEvents(_THIS) } } +#endif /* SDL_VIDEO_DRIVER_NDS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/nds/SDL_ndsvideo.c b/src/video/nds/SDL_ndsvideo.c index d94192b22..98d3d25e8 100644 --- a/src/video/nds/SDL_ndsvideo.c +++ b/src/video/nds/SDL_ndsvideo.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_NDS + /* SDL Nintendo DS video driver implementation */ #include @@ -394,4 +396,6 @@ double SDLCALL SDL_pow(double x, double y) return 0; } +#endif /* SDL_VIDEO_DRIVER_NDS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/nds/SDL_ndswindow.c b/src/video/nds/SDL_ndswindow.c index 16589cf8a..f374a1c08 100644 --- a/src/video/nds/SDL_ndswindow.c +++ b/src/video/nds/SDL_ndswindow.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_NDS + #include "SDL_ndsvideo.h" @@ -30,4 +32,6 @@ int NDS_CreateWindow(_THIS, SDL_Window * window) return 0; } +#endif /* SDL_VIDEO_DRIVER_NDS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/pandora/SDL_pandora.c b/src/video/pandora/SDL_pandora.c index f0a5ec888..880a221f9 100644 --- a/src/video/pandora/SDL_pandora.c +++ b/src/video/pandora/SDL_pandora.c @@ -18,9 +18,11 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_PANDORA /* SDL internals */ -#include "SDL_config.h" #include "../SDL_sysvideo.h" #include "SDL_version.h" #include "SDL_syswm.h" @@ -863,4 +865,6 @@ PND_gl_deletecontext(_THIS, SDL_GLContext context) return; } +#endif /* SDL_VIDEO_DRIVER_PANDORA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/pandora/SDL_pandora_events.c b/src/video/pandora/SDL_pandora_events.c index c71366564..c6b22b18e 100644 --- a/src/video/pandora/SDL_pandora_events.c +++ b/src/video/pandora/SDL_pandora_events.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_PANDORA + /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ @@ -31,4 +33,6 @@ PND_PumpEvents(_THIS) /* Not implemented. */ } +#endif /* SDL_VIDEO_DRIVER_PANDORA */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index b62e37f90..9a3580051 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT #import "../SDL_sysvideo.h" #import "SDL_assert.h" @@ -159,4 +162,6 @@ - (void) applicationDidBecomeActive:(UIApplication*)application @end +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 0edffd825..fb91ba233 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_UIKIT + #include "../../events/SDL_events_c.h" #include "SDL_uikitvideo.h" @@ -51,4 +53,6 @@ So what we do is that in the UIApplicationDelegate class (SDLUIApplicationDelega } } +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index 085460653..d8ed4e4d0 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT #include "SDL_uikitopengles.h" #include "SDL_uikitopenglview.h" @@ -27,6 +30,7 @@ #include "SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" +#include "../../power/uikit/SDL_syspower.h" #include "SDL_loadso.h" #include @@ -73,8 +77,6 @@ int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) return 0; } -extern void SDL_UIKit_UpdateBatteryMonitoring(void); - void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) { #ifdef SDL_POWER_UIKIT @@ -101,7 +103,6 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) { SDL_uikitopenglview *view; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - UIScreen *uiscreen = (UIScreen *) SDL_GetDisplayForWindow(window)->driverdata; UIWindow *uiwindow = data->uiwindow; /* construct our view, passing in SDL's OpenGL configuration data */ @@ -150,4 +151,6 @@ void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context) [view release]; } +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m index 7f03d36b4..ffb298520 100644 --- a/src/video/uikit/SDL_uikitopenglview.m +++ b/src/video/uikit/SDL_uikitopenglview.m @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT #import #import @@ -192,4 +195,6 @@ - (void)dealloc @end +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 6a5cf5cd0..ba154e875 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -18,10 +18,11 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" -#import +#if SDL_VIDEO_DRIVER_UIKIT -#include "SDL_config.h" +#import #include "SDL_video.h" #include "SDL_mouse.h" @@ -143,7 +144,6 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) return; } - const NSArray *modes = [uiscreen availableModes]; for (UIScreenMode *uimode in [uiscreen availableModes]) { CGSize size = [uimode size]; mode.format = SDL_PIXELFORMAT_ABGR8888; @@ -274,4 +274,6 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) } } +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index ad5588ede..e2e69d296 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -18,6 +18,9 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT #import "SDL_uikitview.h" @@ -28,6 +31,7 @@ #if SDL_IPHONE_KEYBOARD #import "keyinfotable.h" #import "SDL_uikitappdelegate.h" +#import "SDL_uikitkeyboard.h" #import "SDL_uikitwindow.h" #endif @@ -311,7 +315,7 @@ - (BOOL)textFieldShouldReturn:(UITextField*)_textField /* iPhone keyboard addition functions */ #if SDL_IPHONE_KEYBOARD -SDL_uikitview * getWindowView(SDL_Window * window) +static SDL_uikitview * getWindowView(SDL_Window * window) { if (window == NULL) { SDL_SetError("Window does not exist"); @@ -405,4 +409,6 @@ int SDL_iPhoneKeyboardToggle(SDL_Window * window) #endif /* SDL_IPHONE_KEYBOARD */ +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 3d436fef3..497ef929b 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,25 +1,27 @@ /* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga - - 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. - */ + Simple DirectMedia Layer + Copyright (C) 1997-2011 Sam Lantinga + + 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_config.h" +#if SDL_VIDEO_DRIVER_UIKIT + #include "SDL_video.h" #include "SDL_assert.h" #include "SDL_hints.h" @@ -150,4 +152,6 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h); } +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + @end diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index 8a0a5b1ad..515f6c9d1 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_UIKIT + #include "SDL_syswm.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -88,11 +90,11 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo [UIApplication sharedApplication].statusBarHidden = NO; } - const UIDeviceOrientation o = [[UIDevice currentDevice] orientation]; - const BOOL landscape = (o == UIDeviceOrientationLandscapeLeft) || - (o == UIDeviceOrientationLandscapeRight); - const BOOL rotate = ( ((window->w > window->h) && (!landscape)) || - ((window->w < window->h) && (landscape)) ); + //const UIDeviceOrientation o = [[UIDevice currentDevice] orientation]; + //const BOOL landscape = (o == UIDeviceOrientationLandscapeLeft) || + // (o == UIDeviceOrientationLandscapeRight); + //const BOOL rotate = ( ((window->w > window->h) && (!landscape)) || + // ((window->w < window->h) && (landscape)) ); // The View Controller will handle rotating the view when the // device orientation changes. This will trigger resize events, if @@ -215,4 +217,6 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo } } +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsclipboard.c b/src/video/windows/SDL_windowsclipboard.c index 12d02281f..1310a18e1 100644 --- a/src/video/windows/SDL_windowsclipboard.c +++ b/src/video/windows/SDL_windowsclipboard.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" #include "../../events/SDL_clipboardevents_c.h" @@ -163,4 +165,6 @@ WIN_CheckClipboardUpdate(struct SDL_VideoData * data) } } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index cf382e0d0..62bb92e43 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -18,9 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_windowsvideo.h" #include "SDL_windowsshape.h" #include "SDL_syswm.h" @@ -694,4 +695,6 @@ SDL_UnregisterApp() } } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsframebuffer.c b/src/video/windows/SDL_windowsframebuffer.c index 3e4c271a3..13948006d 100644 --- a/src/video/windows/SDL_windowsframebuffer.c +++ b/src/video/windows/SDL_windowsframebuffer.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_windowsvideo.h" #ifndef _WIN32_WCE @@ -121,4 +123,6 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window * window) } } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index ca03e529b..a824505f4 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #ifdef _WIN32_WCE #define SDL_DISABLE_WINDOWS_IME #endif @@ -1539,4 +1541,6 @@ void IME_Present(SDL_VideoData *videodata) #endif /* SDL_DISABLE_WINDOWS_IME */ +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c index 4f7a418b9..71092ac93 100644 --- a/src/video/windows/SDL_windowsmodes.c +++ b/src/video/windows/SDL_windowsmodes.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_windowsvideo.h" /* Windows CE compatibility */ @@ -316,4 +318,6 @@ WIN_QuitModes(_THIS) /* All fullscreen windows should have restored modes by now */ } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index 0b6b4d738..0a0011fa9 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/src/video/windows/SDL_windowsmouse.c @@ -18,9 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_assert.h" #include "SDL_windowsvideo.h" @@ -162,4 +163,6 @@ WIN_QuitMouse(_THIS) { } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c index f9ebf91d2..a69f30864 100644 --- a/src/video/windows/SDL_windowsopengl.c +++ b/src/video/windows/SDL_windowsopengl.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_windowsvideo.h" /* WGL implementation of SDL OpenGL support */ @@ -605,4 +607,6 @@ WIN_GL_DeleteContext(_THIS, SDL_GLContext context) #endif /* SDL_VIDEO_OPENGL_WGL */ +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index 909c5d35f..e915ae067 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -18,8 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_WINDOWS -#include #include "SDL_assert.h" #include "SDL_windowsshape.h" #include "SDL_windowsvideo.h" @@ -101,3 +103,5 @@ Win32_ResizeWindowShape(SDL_Window *window) { return 0; } + +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index a1495493b..c90e91955 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "SDL_main.h" #include "SDL_video.h" #include "SDL_mouse.h" @@ -186,4 +188,6 @@ WIN_VideoQuit(_THIS) WIN_QuitMouse(_this); } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vim: set ts=4 sw=4 expandtab: */ diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index b441d9675..3caac8010 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -20,6 +20,8 @@ */ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_WINDOWS + #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../../events/SDL_keyboard_c.h" @@ -746,4 +748,6 @@ SDL_HelperWindowDestroy(void) } } +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index 2e6d0130f..0cb186b57 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/src/video/x11/SDL_x11opengl.c @@ -19,6 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_X11 + #include "SDL_x11video.h" #include "SDL_assert.h" @@ -610,4 +613,6 @@ X11_GL_DeleteContext(_THIS, SDL_GLContext context) #endif /* SDL_VIDEO_OPENGL_GLX */ +#endif /* SDL_VIDEO_DRIVER_X11 */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c index 3e4d42185..0e545d257 100644 --- a/src/video/x11/SDL_x11opengles.c +++ b/src/video/x11/SDL_x11opengles.c @@ -20,7 +20,7 @@ */ #include "SDL_config.h" -#if SDL_VIDEO_OPENGL_ES +#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES #include "SDL_x11video.h" #include "SDL_x11opengles.h" @@ -360,6 +360,6 @@ X11_GLES_DeleteContext(_THIS, SDL_GLContext context) } -#endif /* SDL_VIDEO_OPENGL_ES */ +#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/x11/imKStoUCS.c b/src/video/x11/imKStoUCS.c index c17a1b304..5dd6b1ddd 100644 --- a/src/video/x11/imKStoUCS.c +++ b/src/video/x11/imKStoUCS.c @@ -22,6 +22,9 @@ be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the XFree86 Project. */ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_X11 /* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.4 2003/04/29 11:29:18 pascal Exp $ */ @@ -343,3 +346,5 @@ X11_KeySymToUcs4(KeySym keysym) else return 0; } + +#endif /* SDL_VIDEO_DRIVER_X11 */