Skip to content

Commit

Permalink
Reverted to SDL2 2.0.8 (May14)
Browse files Browse the repository at this point in the history
After some tests (especially on android) the latest SDLs are unstable.
  • Loading branch information
White Dragon committed Jul 13, 2018
1 parent 4037d78 commit 8724565
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 113 deletions.
2 changes: 1 addition & 1 deletion engine/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="1.4.4"
android:installLocation="preferExternal">

<!-- Android 4.4.2 / 8.0.0 -->
<!-- Android 4.4.2 -->
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />

<!-- OpenGL ES 2.0 -->
Expand Down
4 changes: 2 additions & 2 deletions engine/android/jni/openbor/include/sdl/SDL_revision.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define SDL_REVISION "hg-12019:25d299fc8443"
#define SDL_REVISION_NUMBER 12019
#define SDL_REVISION "hg-12001:84c2582329b0"
#define SDL_REVISION_NUMBER 12001
5 changes: 0 additions & 5 deletions engine/android/jni/openbor/include/sdl/SDL_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);

/**
\brief Return true if the application is running on a Chromebook
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);

/**
See the official Android developer guide for more information:
http://developer.android.com/guide/topics/data/data-storage.html
Expand Down
Binary file modified engine/android/jni/openbor/lib/armeabi-v7a/libSDL2.so
Binary file not shown.
94 changes: 17 additions & 77 deletions engine/android/src/org/libsdl/app/SDLActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public enum NativeState {
protected static SDLClipboardHandler mClipboardHandler;
protected static Hashtable<Integer, Object> mCursors;
protected static int mLastCursorID;
protected static SDLGenericMotionListener_API12 mMotionListener;

//White Dragon: added statics
protected static WakeLock wakeLock;
Expand All @@ -111,14 +110,6 @@ public enum NativeState {
// This is what SDL runs in. It invokes SDL_main(), eventually
protected static Thread mSDLThread;

protected static SDLGenericMotionListener_API12 getMotionListener() {
if (mMotionListener == null) {
mMotionListener = new SDLGenericMotionListener_API12();
}

return mMotionListener;
}

/**
* This method returns the name of the shared object with the application entry point
* It can be overridden by derived classes.
Expand Down Expand Up @@ -465,7 +456,6 @@ public void onWindowFocusChanged(boolean hasFocus) {
SDLActivity.mHasFocus = hasFocus;
if (hasFocus) {
mNextNativeState = NativeState.RESUMED;
SDLActivity.getMotionListener().reclaimRelativeMouseModeIfNeeded();
hideSystemUI(); //White Dragon: disable navigation bar
} else {
mNextNativeState = NativeState.PAUSED;
Expand Down Expand Up @@ -609,10 +599,7 @@ public static void handleNativeState() {
/* The native thread has finished */
public static void handleNativeExit() {
SDLActivity.mSDLThread = null;

// Make sure we currently have a singleton before we try to call it.
if (mSingleton != null)
mSingleton.finish();
mSingleton.finish();
}


Expand Down Expand Up @@ -662,16 +649,18 @@ public void handleMessage(Message msg) {
// This version of Android doesn't support the immersive fullscreen mode
break;
}
/* This needs more testing, per bug 4096 - Enabling fullscreen on Android causes the app to toggle fullscreen mode continuously in a loop
***
if (context instanceof Activity) {
Window window = ((Activity) context).getWindow();
if (window != null) {
if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) {
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
window.getDecorView().setSystemUiVisibility(flags);
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
Expand All @@ -683,6 +672,7 @@ public void handleMessage(Message msg) {
} else {
Log.e(TAG, "error handling message, getContext() returned no Activity");
}
***/
break;
case COMMAND_TEXTEDIT_HIDE:
if (mTextEdit != null) {
Expand Down Expand Up @@ -738,11 +728,11 @@ boolean sendCommand(int command, Object data) {
public static native void nativePause();
public static native void nativeResume();
public static native void onNativeDropFile(String filename);
public static native void onNativeResize(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, int format, float rate);
public static native void onNativeResize(int x, int y, int format, float rate);
public static native void onNativeKeyDown(int keycode);
public static native void onNativeKeyUp(int keycode);
public static native void onNativeKeyboardFocusLost();
public static native void onNativeMouse(int button, int action, float x, float y, boolean relative);
public static native void onNativeMouse(int button, int action, float x, float y);
public static native void onNativeTouch(int touchDevId, int pointerFingerId,
int action, float x,
float y, float p);
Expand Down Expand Up @@ -821,6 +811,7 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint)
}
}


/**
* This method is called by SDL using JNI.
*/
Expand All @@ -839,22 +830,6 @@ public static boolean isScreenKeyboardShown()

}

/**
* This method is called by SDL using JNI.
*/
public static boolean supportsRelativeMouse()
{
return SDLActivity.getMotionListener().supportsRelativeMouse();
}

/**
* This method is called by SDL using JNI.
*/
public static boolean setRelativeMouseEnabled(boolean enabled)
{
return SDLActivity.getMotionListener().setRelativeMouseEnabled(enabled);
}

/**
* This method is called by SDL using JNI.
*/
Expand All @@ -880,13 +855,6 @@ public static boolean isAndroidTV() {
return (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION);
}

/**
* This method is called by SDL using JNI.
*/
public static boolean isChromebook() {
return getContext().getPackageManager().hasSystemFeature("org.chromium.arc.device_management");
}

/**
* This method is called by SDL using JNI.
*/
Expand Down Expand Up @@ -921,12 +889,6 @@ public static boolean getManifestEnvironmentVariables() {
return false;
}

// This method is called by SDLControllerManager's API 26 Generic Motion Handler.
public static View getContentView()
{
return mSingleton.mLayout;
}

static class ShowTextInputTask implements Runnable {
/*
* This is used to regulate the pan&scan method to have some offset from
Expand Down Expand Up @@ -1458,9 +1420,9 @@ public SDLSurface(Context context) {
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);

if (Build.VERSION.SDK_INT >= 12) {
setOnGenericMotionListener(SDLActivity.getMotionListener());
setOnGenericMotionListener(new SDLGenericMotionListener_API12());
}

// Some arbitrary defaults to avoid a potential division by zero
mWidth = 1.0f;
mHeight = 1.0f;
Expand Down Expand Up @@ -1556,23 +1518,8 @@ public void surfaceChanged(SurfaceHolder holder,

mWidth = width;
mHeight = height;
int nDeviceWidth = width;
int nDeviceHeight = height;
try
{
if ( android.os.Build.VERSION.SDK_INT >= 17 )
{
android.util.DisplayMetrics realMetrics = new android.util.DisplayMetrics();
mDisplay.getRealMetrics( realMetrics );
nDeviceWidth = realMetrics.widthPixels;
nDeviceHeight = realMetrics.heightPixels;
}
}
catch ( java.lang.Throwable throwable ) {}

Log.v("SDL", "Window size: " + width + "x" + height);
Log.v("SDL", "Device size: " + nDeviceWidth + "x" + nDeviceHeight);
SDLActivity.onNativeResize(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate());
SDLActivity.onNativeResize(width, height, sdlFormat, mDisplay.getRefreshRate());
Log.v("SDL", "Window size: " + width + "x" + height);


boolean skip = false;
Expand Down Expand Up @@ -1775,14 +1722,7 @@ public boolean onTouch(View v, MotionEvent event) {
mouseButton = 1; // oh well.
}
}

// We need to check if we're in relative mouse mode and get the axis offset rather than the x/y values
// if we are. We'll leverage our existing mouse motion listener
SDLGenericMotionListener_API12 motionListener = SDLActivity.getMotionListener();
x = motionListener.getEventX(event);
y = motionListener.getEventY(event);

SDLActivity.onNativeMouse(mouseButton, action, x, y, motionListener.inRelativeMode());
SDLActivity.onNativeMouse(mouseButton, action, event.getX(0), event.getY(0));
} else {
switch(action) {
case MotionEvent.ACTION_MOVE:
Expand Down
31 changes: 3 additions & 28 deletions engine/android/src/org/libsdl/app/SDLControllerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,14 @@ public boolean onGenericMotion(View v, MotionEvent event) {
case MotionEvent.ACTION_SCROLL:
x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0);
y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0);
SDLActivity.onNativeMouse(0, action, x, y, false);
SDLActivity.onNativeMouse(0, action, x, y);
return true;

case MotionEvent.ACTION_HOVER_MOVE:
x = event.getX(0);
y = event.getY(0);

SDLActivity.onNativeMouse(0, action, x, y, false);
SDLActivity.onNativeMouse(0, action, x, y);
return true;

default:
Expand All @@ -556,30 +556,5 @@ public boolean onGenericMotion(View v, MotionEvent event) {
// Event was not managed
return false;
}

public boolean supportsRelativeMouse() {
return false;
}

public boolean inRelativeMode() {
return false;
}

public boolean setRelativeMouseEnabled(boolean enabled) {
return false;
}

public void reclaimRelativeMouseModeIfNeeded()
{

}

public float getEventX(MotionEvent event) {
return event.getX(0);
}

public float getEventY(MotionEvent event) {
return event.getY(0);
}

}

Binary file modified tools/win-sdk/win-sdk.7z.001
Binary file not shown.
Binary file modified tools/win-sdk/win-sdk.7z.002
Binary file not shown.

0 comments on commit 8724565

Please sign in to comment.