From 4b3f0d6ddb928019d9f73f7d47381d823a254797 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Fri, 16 Jan 2015 23:03:14 +0100 Subject: [PATCH 1/5] Fixed two warnings about initialized but unused local variables in tests. --- test/testautomation_video.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/testautomation_video.c b/test/testautomation_video.c index f90ff5c2a..cfc4a238e 100644 --- a/test/testautomation_video.c +++ b/test/testautomation_video.c @@ -541,7 +541,6 @@ video_getWindowBrightnessNegative(void *arg) { const char *invalidWindowError = "Invalid window"; char *lastError; - const char* title = "video_getWindowBrightnessNegative Test Window"; float result; /* Call against invalid window */ @@ -728,7 +727,6 @@ video_getWindowGammaRamp(void *arg) int video_getWindowGammaRampNegative(void *arg) { - const char* title = "video_getWindowGammaRampNegative Test Window"; Uint16 red[256]; Uint16 green[256]; Uint16 blue[256]; From 2b53ffc77c603ab2c3640b2657212d4ac2925600 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Fri, 16 Jan 2015 23:07:10 +0100 Subject: [PATCH 2/5] Fixed wrong documentation in joystick implementation source. --- src/joystick/haiku/SDL_haikujoystick.cc | 3 +-- src/joystick/iphoneos/SDL_sysjoystick.m | 3 +-- src/joystick/psp/SDL_sysjoystick.c | 5 +---- src/joystick/windows/SDL_mmjoystick.c | 3 +-- src/joystick/windows/SDL_windowsjoystick.c | 3 +-- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/joystick/haiku/SDL_haikujoystick.cc b/src/joystick/haiku/SDL_haikujoystick.cc index 0caea17f6..22c046aad 100644 --- a/src/joystick/haiku/SDL_haikujoystick.cc +++ b/src/joystick/haiku/SDL_haikujoystick.cc @@ -53,8 +53,7 @@ extern "C" static int SDL_SYS_numjoysticks = 0; /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available - * joysticks. Joystick 0 should be the system default joystick. + * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ int SDL_SYS_JoystickInit(void) diff --git a/src/joystick/iphoneos/SDL_sysjoystick.m b/src/joystick/iphoneos/SDL_sysjoystick.m index a4027599e..d67cd0c7a 100644 --- a/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/src/joystick/iphoneos/SDL_sysjoystick.m @@ -37,8 +37,7 @@ const char *accelerometerName = "iOS accelerometer"; static CMMotionManager *motionManager = nil; /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available - * joysticks. Joystick 0 should be the system default joystick. + * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ int diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c index 9a2362e1d..f848d1cee 100644 --- a/src/joystick/psp/SDL_sysjoystick.c +++ b/src/joystick/psp/SDL_sysjoystick.c @@ -97,16 +97,13 @@ int JoystickUpdate(void *data) /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available - * joysticks. Joystick 0 should be the system default joystick. + * Joystick 0 should be the system default joystick. * It should return number of joysticks, or -1 on an unrecoverable fatal error. */ int SDL_SYS_JoystickInit(void) { int i; -/* SDL_numjoysticks = 1; */ - /* Setup input */ sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); diff --git a/src/joystick/windows/SDL_mmjoystick.c b/src/joystick/windows/SDL_mmjoystick.c index 0f3b6decc..0ae344246 100644 --- a/src/joystick/windows/SDL_mmjoystick.c +++ b/src/joystick/windows/SDL_mmjoystick.c @@ -143,8 +143,7 @@ GetJoystickName(int index, const char *szRegKey) static int SDL_SYS_numjoysticks = 0; /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available - * joysticks. Joystick 0 should be the system default joystick. + * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ int diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c index d649edc15..0b2f370b5 100644 --- a/src/joystick/windows/SDL_windowsjoystick.c +++ b/src/joystick/windows/SDL_windowsjoystick.c @@ -278,8 +278,7 @@ void SDL_SYS_AddJoystickDevice(JoyStick_DeviceData *device) } /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available - * joysticks. Joystick 0 should be the system default joystick. + * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. */ int From c4275f95ce925ff279fc09b1394342d6c6fd42b1 Mon Sep 17 00:00:00 2001 From: "Felix H. Dahlke" Date: Sat, 17 Jan 2015 04:36:15 +0100 Subject: [PATCH 3/5] Fixed bug 2807 - Not using CoreAudio on OS X when built via CMake --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8296d71f..fff35a53e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1050,6 +1050,7 @@ elseif(APPLE) endif() if(SDL_AUDIO) + set(SDL_AUDIO_DRIVER_COREAUDIO 1) set(MACOSX_COREAUDIO 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) From f15d13d6ef8b6225c3c574c7d8ae6a6f0921b609 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 18 Jan 2015 02:50:14 -0500 Subject: [PATCH 4/5] CMake: Removed unused variable (thanks, Felix!). "MACOSX_COREAUDIO" is actually an internal #define set up elsewhere, and this CMake var is never exported past the CMake script anyhow. Partially fixes Bugzilla #2807. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fff35a53e..6baff8a0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1051,7 +1051,6 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) - set(MACOSX_COREAUDIO 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) From a26a4e9ee2be42dfdba455d7c0136b90f888dd0b Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Fri, 23 Jan 2015 20:29:08 +0100 Subject: [PATCH 5/5] Fixed bug 2816 - [patch] Android: Expose screen refresh rate Jonas Kulla Display::getRefreshRate() is available on all API levels. --- android-project/src/org/libsdl/app/SDLActivity.java | 4 ++-- src/core/android/SDL_android.c | 4 ++-- src/video/android/SDL_androidvideo.c | 7 +++++-- src/video/android/SDL_androidvideo.h | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java index f65a01050..a864aa07a 100644 --- a/android-project/src/org/libsdl/app/SDLActivity.java +++ b/android-project/src/org/libsdl/app/SDLActivity.java @@ -392,7 +392,7 @@ public class SDLActivity extends Activity { public static native void nativeQuit(); public static native void nativePause(); public static native void nativeResume(); - public static native void onNativeResize(int x, int y, int format); + public static native void onNativeResize(int x, int y, int format, float rate); public static native int onNativePadDown(int device_id, int keycode); public static native int onNativePadUp(int device_id, int keycode); public static native void onNativeJoy(int device_id, int axis, @@ -1041,7 +1041,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, mWidth = width; mHeight = height; - SDLActivity.onNativeResize(width, height, sdlFormat); + SDLActivity.onNativeResize(width, height, sdlFormat, mDisplay.getRefreshRate()); Log.v("SDL", "Window size:" + width + "x"+height); // Set mIsSurfaceReady to 'true' *before* making a call to handleResume diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index e09b06d4e..a9089548b 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -143,9 +143,9 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) /* Resize */ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( JNIEnv* env, jclass jcls, - jint width, jint height, jint format) + jint width, jint height, jint format, jfloat rate) { - Android_SetScreenResolution(width, height, format); + Android_SetScreenResolution(width, height, format, rate); } /* Paddown */ diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c index 05c07537d..ed3d3b323 100644 --- a/src/video/android/SDL_androidvideo.c +++ b/src/video/android/SDL_androidvideo.c @@ -64,6 +64,8 @@ extern int Android_GLES_LoadLibrary(_THIS, const char *path); int Android_ScreenWidth = 0; int Android_ScreenHeight = 0; Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN; +int Android_ScreenRate = 0; + SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL; /* Currently only one window */ @@ -166,7 +168,7 @@ Android_VideoInit(_THIS) mode.format = Android_ScreenFormat; mode.w = Android_ScreenWidth; mode.h = Android_ScreenHeight; - mode.refresh_rate = 0; + mode.refresh_rate = Android_ScreenRate; mode.driverdata = NULL; if (SDL_AddBasicVideoDisplay(&mode) < 0) { return -1; @@ -189,11 +191,12 @@ Android_VideoQuit(_THIS) /* This function gets called before VideoInit() */ void -Android_SetScreenResolution(int width, int height, Uint32 format) +Android_SetScreenResolution(int width, int height, Uint32 format, float rate) { Android_ScreenWidth = width; Android_ScreenHeight = height; Android_ScreenFormat = format; + Android_ScreenRate = rate; if (Android_Window) { SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height); diff --git a/src/video/android/SDL_androidvideo.h b/src/video/android/SDL_androidvideo.h index ccd5d7a16..a403c81b5 100644 --- a/src/video/android/SDL_androidvideo.h +++ b/src/video/android/SDL_androidvideo.h @@ -28,7 +28,7 @@ #include "../SDL_sysvideo.h" /* Called by the JNI layer when the screen changes size or format */ -extern void Android_SetScreenResolution(int width, int height, Uint32 format); +extern void Android_SetScreenResolution(int width, int height, Uint32 format, float rate); /* Private display data */