diff options
author | Sam Lantinga <slouken@libsdl.org> | 2011-10-31 05:56:58 -0400 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2011-10-31 05:56:58 -0400 |
commit | 07b4a2ffe6a33667d09fbe4693d4c977b2f3d100 (patch) | |
tree | 0c97c27488f1b550ada2af5270b321833378a7ac /src | |
parent | e19a2fbe61685250e0db0d972253250cc85c4809 (diff) |
Lots of fixes importing SDL source wholesale into a new iOS project
--HG--
rename : src/libm/math.h => src/libm/math_libm.h
Diffstat (limited to 'src')
133 files changed, 492 insertions, 1095 deletions
diff --git a/src/SDL_error_c.h b/src/SDL_error_c.h index 1e63b705..f346faa0 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 523be6e2..eb754ec4 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 <sys/types.h> @@ -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 425e51da..f74985ca 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 0abe283e..25d7bd40 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 867125f9..310cb53b 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 <SoundPlayer.h> @@ -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 7da1687e..8d1b0895 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 4e2a48d6..cd5556c9 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 283ef22d..4e68a395 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 f61b4aac..5c4a7692 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 <stdio.h> /* 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 4cc8e291..e824e956 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 <sys/types.h> @@ -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 ebe2eb07..3ba9ba77 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 0322e232..a31faad3 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 <signal.h> @@ -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 abfe2591..034e1726 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 <nds.h> @@ -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 2036c0c2..821fa771 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 <errno.h> @@ -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 6b2333e0..b3e0b4e5 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 590b089e..2cf4b8b5 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 <errno.h> #include <unistd.h> #include <fcntl.h> @@ -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 1ae9c7c4..2768cf30 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 <slouken@libsdl.org> @@ -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 <fcntl.h> @@ -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 999ad01e..00000000 --- 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 <slouken@libsdl.org> - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_config.h" - -/* Allow access to a raw mixing buffer */ - -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/mman.h> - -#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 3c452225..00000000 --- a/src/audio/ums/SDL_umsaudio.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org> - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_config.h" - -#ifndef _SDL_UMSaudio_h -#define _SDL_UMSaudio_h - -#include <UMS/UMSAudioDevice.h> - -#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 de73f711..019f7dff 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 5287586e..a1230e4d 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 <dxsdkver.h> /* 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 0f689ed7..a905c8da 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 e00a399d..a7c4425b 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 2d618535..13bcbf86 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 7d990dd9..6424de9d 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 9227ff3d..c0c005c8 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 f6974bd1..3f1ee577 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 47e8ea45..da64138c 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 f90652c6..9145c4b5 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 3578a0fa..a8ffe314 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 3c4b25ea..b8b8bec6 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 ab2637eb..64c50e3f 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 42db4a89..f881d35d 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 250ee6ec..60881575 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 index 260b3fed..6c1f8e9d 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 08cfb08e..f664f0eb 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 65e71900..afd43e9a 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 9a568fca..66b156c9 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 dba666cb..5cf0c397 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 d6b8f177..b553d303 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 e90631da..74b97944 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 1b22f881..77117661 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 4058e6b9..89e41ab7 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 07632f39..33a7330b 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 <AppKit.h> @@ -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 ef50d5d2..4d60e2d4 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 <stdio.h> #include <stdlib.h> @@ -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 454d48fa..eb49628b 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 <stdio.h> #include <stdlib.h> diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index 9852b789..2e409488 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 <stdio.h> #include <unistd.h> diff --git a/src/power/macosx/SDL_syspower.c b/src/power/macosx/SDL_syspower.c index 0434a16e..b76b5c65 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 <Carbon/Carbon.h> #include <IOKit/ps/IOPowerSources.h> diff --git a/src/power/nds/SDL_syspower.c b/src/power/nds/SDL_syspower.c index 485a2881..e0a92f23 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 index 0e698918..2bec9e17 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 <sys/types.h> +#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 3f6f33d3..2766ef5d 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 <UIKit/UIKit.h> #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 4e3f6f46..0d75a2bc 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 c6de6a85..251ae3cc 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 b356fc66..844acee3 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 d4773a0a..fc3a9d31 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 30c22727..ce63f1de 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 e3942713..69a1c8c8 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 a1144c17..2f1aeb97 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 8474cfb0..08ebd7bc 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 9f966851..afaccaf1 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 <be/kernel/OS.h> @@ -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 cf2f577b..ff255ff7 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 <stdio.h> @@ -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 273b6b17..00000000 --- a/src/thread/irix/SDL_syssem.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org> - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_config.h" - -#include "SDL_thread.h" -#include "SDL_timer.h" - - -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <errno.h> - -#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 d2ed080d..00000000 --- a/src/thread/irix/SDL_systhread.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org> - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "SDL_config.h" - -/* IRIX thread management routines for SDL */ - -#include <errno.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/prctl.h> - -#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 3bdebcee..0355db87 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 184cd27d..ab35a961 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 c5589f0c..b1543dab 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 3c133e09..47bc0d20 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 62072f56..f243682b 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 1772166b..fba69fc2 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 01fad709..3e0c030f 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 abed6a82..bb26ff09 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 6145cd0c..ec20b9b8 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 f8d47be8..abde8fcd 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 70e7e7b2..df80fdf1 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 <android/log.h> #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 5ca96669..cf81143d 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 <android/log.h> #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 00c26270..d4d46a8b 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 e0abadd4..68107e2c 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 028dcac9..41ebfb45 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 <unistd.h> #include <TypeConstants.h> @@ -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 e5ad003e..bc5c6eb6 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 7dbd0671..f24a136d 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 03ba7cac..13dbd092 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 <SupportDefs.h> #include <support/UTF8.h> @@ -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 0651cf93..a68522be 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 <AppKit.h> #include <InterfaceKit.h> @@ -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 f4cd9c08..d2f4e790 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 0037c04d..0ff99aff 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 2c550d59..1c97211e 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 e575f2ca..2b1b231e 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 @@ Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) [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 b5e4e027..321ea76a 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 @@ Cocoa_PumpEvents(_THIS) [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 c82b7059..c2da570d 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 <Carbon/Carbon.h> //#define DEBUG_IME NSLog -#define DEBUG_IME (void) +#define DEBUG_IME(...) #ifndef NX_DEVICERCTLKEYMASK #define NX_DEVICELCTLKEYMASK 0x00000001 @@ -733,4 +735,6 @@ Cocoa_QuitKeyboard(_THIS) { } +#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 5babd40d..cbed0bae 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 @@ static SDL_bool 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 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode) #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 @@ Cocoa_QuitModes(_THIS) 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 488bef6b..024639c7 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 @@ Cocoa_InitMouse(_THIS) 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 @@ Cocoa_QuitMouse(_THIS) { } +#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 6dbf8e12..378ab3c9 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 <OpenGL/CGLTypes.h> #include <OpenGL/OpenGL.h> #include <OpenGL/CGLRenderers.h> diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 19d432d5..542a8289 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 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape closure.window = shaper->window; SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure); [closure.path addClip]; + + return 0; } int @@ -97,3 +103,7 @@ Cocoa_ResizeWindowShape(SDL_Window *window) { 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 02d9eefb..886b2beb 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 @@ SDL_PromptAssertion_cocoa(const SDL_assert_data *data) 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 f21addc8..f8956e08 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 @@ static __inline__ void ConvertNSRect(NSRect *r) - (void)mouseEntered:(NSEvent *)theEvent { - SDL_Mouse *mouse = SDL_GetMouse(); - SDL_SetMouseFocus(_data->window); SDL_SetCursor(NULL); @@ -991,4 +991,6 @@ Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) } } +#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 56f80761..c079f638 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 90075893..840586b5 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 72bd7452..1a935144 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 33573a22..e56e413f 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 980efd72..e83f43ae 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 4385c8d9..7c5737c9 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 39ca67a2..a2ca4be4 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 dbc71368..5f8f2d16 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 @@ error: 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 ba7eb969..83835df2 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 27445187..094116a3 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 c97cbd27..f348f842 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 44f93368..f9cca9a1 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 4e561ec6..c5c21233 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 cd7df0f9..558eda04 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 <stdio.h> #include <stdlib.h> @@ -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 d94192b2..98d3d25e 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 <stdio.h> @@ -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 16589cf8..f374a1c0 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 f0a5ec88..880a221f 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 c7136656..c6b22b18 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 b62e37f9..9a358005 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 @@ static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, @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 0edffd82..fb91ba23 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 @@ UIKit_PumpEvents(_THIS) } } +#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 08546065..d8ed4e4d 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 <dlfcn.h> @@ -73,8 +77,6 @@ UIKit_GL_LoadLibrary(_THIS, const char *path) 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 7f03d36b..ffb29852 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 <QuartzCore/QuartzCore.h> #import <OpenGLES/EAGLDrawable.h> @@ -192,4 +195,6 @@ @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 6a5cf5cd..ba154e87 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 <UIKit/UIKit.h> +#if SDL_VIDEO_DRIVER_UIKIT -#include "SDL_config.h" +#import <UIKit/UIKit.h> #include "SDL_video.h" #include "SDL_mouse.h" @@ -143,7 +144,6 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) 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 @@ UIKit_VideoQuit(_THIS) } } +#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 ad5588ed..e2e69d29 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 @@ /* 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 3d436fef..497ef929 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 <slouken@libsdl.org> - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - */ + Simple DirectMedia Layer + Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org> + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ #include "SDL_config.h" +#if SDL_VIDEO_DRIVER_UIKIT + #include "SDL_video.h" #include "SDL_assert.h" #include "SDL_hints.h" @@ -150,4 +152,6 @@ 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 8a0a5b1a..515f6c9d 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 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) } } +#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 12d02281..1310a18e 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 cf382e0d..62bb92e4 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 3e4c271a..13948006 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 ca03e529..a824505f 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 4f7a418b..71092ac9 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 0b6b4d73..0a0011fa 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 f9ebf91d..a69f3086 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 909c5d35..e915ae06 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 <stdio.h> #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 a1495493..c90e9195 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 b441d967..3caac801 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 2e6d0130..0cb186b5 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 3e4d4218..0e545d25 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 c17a1b30..5dd6b1dd 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 */ |