Xorg: make gl view client abstract

This commit is contained in:
zt515 2017-11-29 00:59:49 +08:00
parent c97df73aa3
commit 0fda37d443
8 changed files with 169 additions and 108 deletions

View File

@ -40,6 +40,7 @@ import android.os.Build;
import java.util.Arrays;
@SuppressWarnings("JniMissingFunction")
class AccelerometerReader implements SensorEventListener
{
@ -48,7 +49,7 @@ class AccelerometerReader implements SensorEventListener
public static final GyroscopeListener gyro = new GyroscopeListener();
public static final OrientationListener orientation = new OrientationListener();
public AccelerometerReader(Activity context)
public AccelerometerReader(Context context)
{
_manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
}
@ -79,11 +80,11 @@ class AccelerometerReader implements SensorEventListener
_manager.registerListener(gyro, _manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_GAME);
}
if( (Globals.AppUsesOrientationSensor) && _manager != null &&
_manager.getDefaultSensor(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR) != null )
_manager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR) != null )
{
Log.i("SDL", "libSDL: starting orientation sensor");
_manager.registerListener(orientation, _manager.getDefaultSensor(
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR),
Sensor.TYPE_GAME_ROTATION_VECTOR),
SensorManager.SENSOR_DELAY_GAME);
}
}
@ -304,8 +305,7 @@ class AccelerometerReader implements SensorEventListener
if ( manager == null && manager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) == null )
return;
manager.registerListener(gyro, manager.getDefaultSensor(
Globals.AppUsesOrientationSensor ? Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ?
Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_ROTATION_VECTOR : Sensor.TYPE_GYROSCOPE),
Globals.AppUsesOrientationSensor ? Sensor.TYPE_GAME_ROTATION_VECTOR : Sensor.TYPE_GYROSCOPE),
SensorManager.SENSOR_DELAY_GAME);
}
public void unregisterListener(Activity context,SensorEventListener l)

View File

@ -151,6 +151,7 @@ import android.app.KeyguardManager;
* </pre>
*
*/
@SuppressWarnings("ALL")
public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Callback {
/**
* The renderer only renders

View File

@ -69,10 +69,11 @@ import java.util.LinkedList;
import java.util.TreeSet;
import java.util.concurrent.Semaphore;
import io.neoterm.xorg.NeoGLViewClient;
import io.neoterm.xorg.R;
public class MainActivity extends Activity {
public class MainActivity extends Activity implements NeoGLViewClient {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -300,7 +301,7 @@ public class MainActivity extends Activity {
_videoLayout = new FrameLayout(this);
SetLayerType.get().setLayerType(_videoLayout);
setContentView(_videoLayout);
mGLView = new DemoGLSurfaceView(this);
mGLView = new NeoGLView(this);
SetLayerType.get().setLayerType(mGLView);
// Add TV screen borders, if needed
if (isRunningOnOUYA() && Globals.TvBorders) {
@ -480,8 +481,18 @@ public class MainActivity extends Activity {
{0, R.xml.qwerty_alt_shift, R.xml.c64, R.xml.amiga_alt_shift, R.xml.atari800}
};
@Override
public Context getContext() {
return this;
}
@Override
public boolean isKeyboardWithoutTextInputShown() {
return keyboardWithoutTextInputShown;
}
public void showScreenKeyboardWithoutTextInputField(final int keyboard) {
if (!keyboardWithoutTextInputShown) {
if (!isKeyboardWithoutTextInputShown()) {
keyboardWithoutTextInputShown = true;
runOnUiThread(new Runnable() {
public void run() {
@ -897,6 +908,11 @@ public class MainActivity extends Activity {
//Log.d("SDL", "updateScreenOrientation(): screen orientation: " + rotation + " inverted " + AccelerometerReader.gyro.invertedOrientation);
}
@Override
public void initScreenOrientation() {
setScreenOrientation();
}
public void setText(final String t) {
class Callback implements Runnable {
MainActivity Parent;
@ -991,6 +1007,11 @@ public class MainActivity extends Activity {
return (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) || Globals.OuyaEmulation;
}
@Override
public NeoGLView getGLView() {
return mGLView;
}
public boolean isCurrentOrientationHorizontal() {
if (Globals.AutoDetectOrientation) {
// Less reliable way to detect orientation, but works with multiwindow
@ -1038,7 +1059,7 @@ public class MainActivity extends Activity {
return _videoLayout;
}
DemoGLSurfaceView mGLView = null;
NeoGLView mGLView = null;
private static AudioThread mAudioThread = null;
private TextView _tv = null;

View File

@ -0,0 +1,13 @@
package io.neoterm;
import io.neoterm.xorg.NeoGLViewClient;
/**
* @author kiva
*/
public class NeoGLView extends DemoGLSurfaceView {
public NeoGLView(NeoGLViewClient client) {
super(client);
}
}

View File

@ -77,6 +77,7 @@ import android.content.pm.PackageManager;
import android.os.Build;
import android.content.Intent;
import io.neoterm.xorg.NeoGLViewClient;
import io.neoterm.xorg.R;
@ -537,7 +538,7 @@ public class Settings
Globals.ScreenFollowsMouse ? 1 : 0 );
}
static void Apply(MainActivity p)
static void Apply(NeoGLViewClient p)
{
setEnvVars(p);
nativeSetVideoDepth(Globals.VideoDepthBpp, Globals.NeedGles2 ? 1 : 0, Globals.NeedGles3 ? 1 : 0);
@ -577,7 +578,7 @@ public class Settings
Globals.TouchscreenKeyboardTransparency,
Globals.FloatingScreenJoystick ? 1 : 0,
Globals.AppTouchscreenKeyboardKeysAmount );
SetupTouchscreenKeyboardGraphics(p);
SetupTouchscreenKeyboardGraphics(p.getContext());
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
if( Globals.TouchscreenKeyboardSize == Globals.TOUCHSCREEN_KEYBOARD_CUSTOM )
@ -604,7 +605,7 @@ public class Settings
Globals.TouchscreenCalibration[2], Globals.TouchscreenCalibration[3]);
}
static void setEnvVars(MainActivity p)
static void setEnvVars(NeoGLViewClient p)
{
String lang = new String(Locale.getDefault().getLanguage());
if( Locale.getDefault().getCountry().length() > 0 )
@ -613,11 +614,11 @@ public class Settings
nativeSetEnv( "LANG", lang );
nativeSetEnv( "LANGUAGE", lang );
// TODO: get current user name and set envvar USER, the API is not availalbe on Android 1.6 so I don't bother with this
nativeSetEnv( "APPDIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "SECURE_STORAGE_DIR", p.getFilesDir().getAbsolutePath() );
nativeSetEnv( "APPDIR", p.getContext().getFilesDir().getAbsolutePath() );
nativeSetEnv( "SECURE_STORAGE_DIR", p.getContext().getFilesDir().getAbsolutePath() );
nativeSetEnv( "DATADIR", Globals.DataDir );
nativeSetEnv( "UNSECURE_STORAGE_DIR", Globals.DataDir );
SdcardAppPath.get().setEnv(p);
SdcardAppPath.get().setEnv(p.getContext());
nativeSetEnv( "HOME", Globals.DataDir );
nativeSetEnv( "SDCARD", Environment.getExternalStorageDirectory().getAbsolutePath() );
nativeSetEnv( "SDCARD_DOWNLOADS", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() );
@ -626,11 +627,11 @@ public class Settings
nativeSetEnv( "SDCARD_DCIM", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() );
nativeSetEnv( "SDCARD_MUSIC", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath() );
nativeSetEnv( "ANDROID_VERSION", String.valueOf(Build.VERSION.SDK_INT) );
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getPackageName() );
nativeSetEnv( "ANDROID_PACKAGE_PATH", p.getPackageCodePath() );
nativeSetEnv( "ANDROID_MY_OWN_APP_FILE", p.getPackageResourcePath() ); // This may be different from p.getPackageCodePath() on multi-user systems, but should still be the same .apk file
nativeSetEnv( "ANDROID_PACKAGE_NAME", p.getContext().getPackageName() );
nativeSetEnv( "ANDROID_PACKAGE_PATH", p.getContext().getPackageCodePath() );
nativeSetEnv( "ANDROID_MY_OWN_APP_FILE", p.getContext().getPackageResourcePath() ); // This may be different from p.getPackageCodePath() on multi-user systems, but should still be the same .apk file
try {
nativeSetEnv( "ANDROID_APP_NAME", p.getString(p.getApplicationInfo().labelRes) );
nativeSetEnv( "ANDROID_APP_NAME", p.getContext().getString(p.getContext().getApplicationInfo().labelRes) );
} catch (Exception eeeeee) {}
Log.d("SDL", "libSDL: Is running on OUYA: " + p.isRunningOnOUYA());
if( p.isRunningOnOUYA() )
@ -639,11 +640,12 @@ public class Settings
nativeSetEnv( "TV", "1" );
nativeSetEnv( "ANDROID_TV", "1" );
}
if (p.getIntent().getCategories() != null && p.getIntent().getCategories().contains("com.google.intent.category.CARDBOARD")) {
nativeSetEnv( "CARDBOARD", "1" );
nativeSetEnv( "VR", "1" );
nativeSetEnv( "CARDBOARD_VR", "1" );
}
// TODO: Implement this
// if (p.getIntent().getCategories() != null && p.getIntent().getCategories().contains("com.google.intent.category.CARDBOARD")) {
// nativeSetEnv( "CARDBOARD", "1" );
// nativeSetEnv( "VR", "1" );
// nativeSetEnv( "CARDBOARD_VR", "1" );
// }
// if (p.getIntent().getStringExtra(RestartMainActivity.SDL_RESTART_PARAMS) != null)
// nativeSetEnv( RestartMainActivity.SDL_RESTART_PARAMS, p.getIntent().getStringExtra(RestartMainActivity.SDL_RESTART_PARAMS) );
try {
@ -665,7 +667,7 @@ public class Settings
} catch (Exception eeeee) {}
}
static byte [] loadRaw(Activity p, int res)
static byte [] loadRaw(Context p, int res)
{
byte [] buf = new byte[65536 * 2];
byte [] a = new byte[1048576 * 5]; // We need 5Mb buffer for Keen theme, and this Java code is inefficient
@ -690,7 +692,7 @@ public class Settings
return b;
}
static void SetupTouchscreenKeyboardGraphics(Activity p)
static void SetupTouchscreenKeyboardGraphics(Context p)
{
if( Globals.UseTouchscreenKeyboard )
{
@ -726,10 +728,7 @@ public class Settings
{
public static SdcardAppPath get()
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
return Kitkat.Holder.sInstance;
else
return Froyo.Holder.sInstance;
return Kitkat.Holder.sInstance;
}
public String path(final Context p)
{

View File

@ -23,51 +23,31 @@ freely, subject to the following restrictions:
package io.neoterm;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11;
import javax.microedition.khronos.opengles.GL11Ext;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGL11;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import java.io.File;
import java.util.concurrent.locks.ReentrantLock;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import android.os.Bundle;
import android.os.Build;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.util.Log;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.AssetManager;
import android.app.Activity;
import android.view.MotionEvent;
import android.view.KeyEvent;
import android.view.InputDevice;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.app.PendingIntent;
import android.app.AlarmManager;
import android.content.Intent;
import android.view.View;
import android.view.Display;
import android.net.Uri;
import android.Manifest;
import android.content.pm.PackageManager;
import android.hardware.input.InputManager;
import io.neoterm.xorg.NeoGLViewClient;
class Mouse
{
@ -630,10 +610,10 @@ abstract class DifferentTouchInput
@SuppressWarnings("JniMissingFunction")
class DemoRenderer extends GLSurfaceView_SDL.Renderer
{
public DemoRenderer(MainActivity _context)
public DemoRenderer(NeoGLViewClient client)
{
context = _context;
Clipboard.get().setListener(context, new Runnable()
mClient = client;
Clipboard.get().setListener(mClient.getContext(), new Runnable()
{
public void run()
{
@ -671,12 +651,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
int mLastPendingResize = 0;
public void onWindowResize(final int w, final int h)
{
if (context.isRunningOnOUYA())
if (mClient.isRunningOnOUYA())
return; // TV screen is never resized, and this event will mess up TV borders
Log.d("SDL", "libSDL: DemoRenderer.onWindowResize(): " + w + "x" + h);
mLastPendingResize ++;
final int resizeThreadIndex = mLastPendingResize;
context.mGLView.postDelayed(new Runnable()
mClient.getGLView().postDelayed(new Runnable()
{
public void run()
{
@ -685,14 +665,14 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
return; // Avoid running this function multiple times in a row
int ww = w - w % 2;
int hh = h - h % 2;
View topView = context.getWindow().peekDecorView();
View topView = mClient.getWindow().peekDecorView();
if (topView != null && Globals.ImmersiveMode)
{
ww = topView.getWidth() - topView.getWidth() % 2;
hh = topView.getHeight() - topView.getHeight() % 2;
}
Display display = context.getWindowManager().getDefaultDisplay();
Display display = mClient.getWindowManager().getDefaultDisplay();
if (mWidth != 0 && mHeight != 0 && (mWidth != ww || mHeight != hh))
{
@ -703,7 +683,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
{
Log.i("SDL", "Multiwindow detected - enabling screen orientation autodetection");
Globals.AutoDetectOrientation = true;
context.setScreenOrientation();
mClient.initScreenOrientation();
DemoRenderer.super.ResetVideoSurface();
DemoRenderer.super.onWindowResize(ww, hh);
}
@ -748,16 +728,11 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
mGlContextLost = false;
if( Globals.CompatibilityHacksStaticInit )
MainActivity.LoadApplicationLibrary(context);
while( !MainActivity.ApplicationLibraryLoaded )
try { Thread.sleep(200); } catch (InterruptedException eeee) {}
Settings.Apply(context);
Settings.Apply(mClient);
Settings.nativeSetEnv( "DISPLAY_RESOLUTION_WIDTH", String.valueOf(Math.max(mWidth, mHeight)) );
Settings.nativeSetEnv( "DISPLAY_RESOLUTION_HEIGHT", String.valueOf(Math.min(mWidth, mHeight)) ); // In Kitkat with immersive mode, getWindowManager().getDefaultDisplay().getMetrics() return inaccurate height
accelerometer = new AccelerometerReader(context);
accelerometer = new AccelerometerReader(mClient.getContext());
if( Globals.MoveMouseWithGyroscope )
startAccelerometerGyroscope(1);
// Tweak video thread priority, if user selected big audio buffer
@ -765,12 +740,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
String commandline = Globals.CommandLine;
if( context.getIntent() != null && context.getIntent().getScheme() != null &&
context.getIntent().getScheme().compareTo(android.content.ContentResolver.SCHEME_FILE) == 0 &&
context.getIntent().getData() != null && context.getIntent().getData().getPath() != null )
{
commandline += " " + context.getIntent().getData().getPath();
}
// if( mClient.getIntent() != null && mClient.getIntent().getScheme() != null &&
// mClient.getIntent().getScheme().compareTo(android.content.ContentResolver.SCHEME_FILE) == 0 &&
// mClient.getIntent().getData() != null && mClient.getIntent().getData().getPath() != null )
// {
// commandline += " " + mClient.getIntent().getData().getPath();
// }
nativeInit( Globals.DataDir,
commandline,
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
@ -794,7 +769,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
if(mGlContextLost) {
mGlContextLost = false;
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
Settings.SetupTouchscreenKeyboardGraphics(mClient.getContext()); // Reload on-screen buttons graphics
super.SwapBuffers();
}
@ -806,7 +781,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
this.notify();
}
}
if( context.isScreenKeyboardShown() && !context.keyboardWithoutTextInputShown )
if( mClient.isScreenKeyboardShown() && !mClient.isKeyboardWithoutTextInputShown() )
{
try {
Thread.sleep(50); // Give some time to the keyboard input thread
@ -819,7 +794,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
if( mOrientationFrameHackyCounter > 100 )
{
mOrientationFrameHackyCounter = 0;
context.updateScreenOrientation();
mClient.updateScreenOrientation();
}
return 1;
@ -827,54 +802,54 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public void showScreenKeyboardWithoutTextInputField() // Called from native code
{
context.showScreenKeyboardWithoutTextInputField(Globals.TextInputKeyboard);
mClient.showScreenKeyboardWithoutTextInputField(Globals.TextInputKeyboard);
}
public void showInternalScreenKeyboard(int keyboard) // Called from native code
{
context.showScreenKeyboardWithoutTextInputField(keyboard);
mClient.showScreenKeyboardWithoutTextInputField(keyboard);
}
public void showScreenKeyboard(final String oldText, int unused) // Called from native code
{
class Callback implements Runnable
{
public MainActivity parent;
public NeoGLViewClient client;
public String oldText;
public void run()
{
parent.showScreenKeyboard(oldText);
client.showScreenKeyboard(oldText);
}
}
Callback cb = new Callback();
cb.parent = context;
cb.client = mClient;
cb.oldText = oldText;
context.runOnUiThread(cb);
mClient.runOnUiThread(cb);
}
public void hideScreenKeyboard() // Called from native code
{
class Callback implements Runnable
{
public MainActivity parent;
public NeoGLViewClient client;
public void run()
{
parent.hideScreenKeyboard();
client.hideScreenKeyboard();
}
}
Callback cb = new Callback();
cb.parent = context;
context.runOnUiThread(cb);
cb.client = mClient;
mClient.runOnUiThread(cb);
}
public int isScreenKeyboardShown() // Called from native code
{
return context.isScreenKeyboardShown() ? 1 : 0;
return mClient.isScreenKeyboardShown() ? 1 : 0;
}
public void setScreenKeyboardHintMessage(String s) // Called from native code
{
context.setScreenKeyboardHintMessage(s);
mClient.setScreenKeyboardHintMessage(s);
}
public void startAccelerometerGyroscope(int started) // Called from native code
@ -888,12 +863,12 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public String getClipboardText() // Called from native code
{
return Clipboard.get().get(context);
return Clipboard.get().get(mClient.getContext());
}
public void setClipboardText(final String s) // Called from native code
{
Clipboard.get().set(context, s);
Clipboard.get().set(mClient.getContext(), s);
}
public void exitApp()
@ -938,7 +913,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
{
i.setClassName(pkgName, activity);
}
context.startActivity(i);
mClient.getContext().startActivity(i);
} catch (Exception e) {
Log.i("SDL", "libSDL: cannot start external app: " + e.toString());
}
@ -946,7 +921,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public void setSystemMousePointerVisible(int visible)
{
context.setSystemMousePointerVisible(visible);
mClient.setSystemMousePointerVisible(visible);
}
public void restartMyself(String restartParams)
@ -977,7 +952,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
public static native void nativeTextInputFinished();
public static native void nativeClipboardChanged();
private MainActivity context = null;
private NeoGLViewClient mClient = null;
public AccelerometerReader accelerometer = null;
private GL10 mGl = null;
@ -999,13 +974,13 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
@SuppressWarnings("JniMissingFunction")
class DemoGLSurfaceView extends GLSurfaceView_SDL {
public DemoGLSurfaceView(MainActivity context) {
super(context);
mParent = context;
public DemoGLSurfaceView(NeoGLViewClient client) {
super(client.getContext());
mClient = client;
setEGLConfigChooser(Globals.VideoDepthBpp, Globals.NeedDepthBuffer, Globals.NeedStencilBuffer, Globals.NeedGles2, Globals.NeedGles3);
mRenderer = new DemoRenderer(context);
mRenderer = new DemoRenderer(client);
setRenderer(mRenderer);
DifferentTouchInput.registerInputManagerCallbacks(context);
DifferentTouchInput.registerInputManagerCallbacks(client.getContext());
}
@Override
@ -1019,7 +994,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
nativeMouseButtonsPressed(2, 1);
return true;
}
else if( mParent.keyboardWithoutTextInputShown )
else if( mClient.isKeyboardWithoutTextInputShown() )
{
return true;
}
@ -1042,9 +1017,9 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
nativeMouseButtonsPressed(2, 0);
return true;
}
else if( mParent.keyboardWithoutTextInputShown )
else if( mClient.isKeyboardWithoutTextInputShown() )
{
mParent.showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
mClient.showScreenKeyboardWithoutTextInputField(0); // Hide keyboard
return true;
}
}
@ -1053,7 +1028,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
return super.onKeyUp(keyCode, event);
//if( keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU )
// DimSystemStatusBar.get().dim(mParent._videoLayout);
// DimSystemStatusBar.get().dim(mClient._videoLayout);
return true;
}
@ -1076,11 +1051,8 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
@Override
public boolean onTouchEvent(final MotionEvent event)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
{
if (getX() != 0)
event.offsetLocation(-getX(), -getY());
}
if (getX() != 0)
event.offsetLocation(-getX(), -getY());
DifferentTouchInput.touchInput.process(event);
if( DemoRenderer.mRatelimitTouchEvents )
{
@ -1156,7 +1128,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
};
DemoRenderer mRenderer;
MainActivity mParent;
NeoGLViewClient mClient;
public static native void nativeMotionEvent( int x, int y, int action, int pointerId, int pressure, int radius );
public static native int nativeKey( int keyCode, int down, int unicode, int gamepadId );

View File

@ -0,0 +1,43 @@
package io.neoterm.xorg;
import android.content.Context;
import android.view.Window;
import android.view.WindowManager;
import io.neoterm.NeoGLView;
/**
* @author kiva
*/
public interface NeoGLViewClient {
Context getContext();
boolean isKeyboardWithoutTextInputShown();
void showScreenKeyboardWithoutTextInputField(int flags);
void setScreenKeyboardHintMessage(String hideMessage);
boolean isScreenKeyboardShown();
void showScreenKeyboard(String message);
void hideScreenKeyboard();
void runOnUiThread(Runnable runnable);
void updateScreenOrientation();
void initScreenOrientation();
boolean isRunningOnOUYA();
NeoGLView getGLView();
Window getWindow();
WindowManager getWindowManager();
void setSystemMousePointerVisible(int visible);
}

View File

@ -0,0 +1,12 @@
package io.neoterm.frontend.xorg
import io.neoterm.NeoGLView
import io.neoterm.xorg.NeoGLViewClient
/**
* @author kiva
*/
class XSessionData {
var glView: NeoGLView? = null
var client: NeoGLViewClient? = null
}