SDL: more attempts to draw in the display cutout
This commit is contained in:
@@ -40,6 +40,7 @@ import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.app.KeyguardManager;
|
||||
import android.graphics.Rect;
|
||||
|
||||
/**
|
||||
* An implementation of SurfaceView that uses the dedicated surface for
|
||||
@@ -1218,6 +1219,13 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
|
||||
synchronized (this) {
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
if (Globals.DrawInDisplayCutout) {
|
||||
final Rect r = new Rect();
|
||||
MainActivity.instance._videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
//mWidth = r.width();
|
||||
//mHeight = r.height();
|
||||
//Log.v("SDL", "GLSurfaceView_SDL::onWindowResize(): adjusted to display cutout: " + mWidth + "x" + mHeight);
|
||||
}
|
||||
mSizeChanged = true;
|
||||
mRenderer.onWindowResize(w, h);
|
||||
notify();
|
||||
|
||||
@@ -91,6 +91,7 @@ class Globals
|
||||
public static boolean HorizontalOrientation = true;
|
||||
public static boolean AutoDetectOrientation = false;
|
||||
public static boolean ImmersiveMode = true;
|
||||
public static boolean DrawInDisplayCutout = true;
|
||||
public static boolean HideSystemMousePointer = false;
|
||||
public static boolean DownloadToSdcard = true;
|
||||
public static boolean PhoneHasArrowKeys = false;
|
||||
|
||||
@@ -324,6 +324,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||
p.getResources().getString(R.string.video_smooth),
|
||||
p.getResources().getString(R.string.video_immersive),
|
||||
p.getResources().getString(R.string.video_draw_cutout),
|
||||
p.getResources().getString(R.string.video_orientation_autodetect),
|
||||
p.getResources().getString(R.string.video_orientation_vertical),
|
||||
p.getResources().getString(R.string.video_bpp_24),
|
||||
@@ -333,6 +334,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.VideoLinearFilter,
|
||||
Globals.ImmersiveMode,
|
||||
Globals.DrawInDisplayCutout,
|
||||
Globals.AutoDetectOrientation,
|
||||
!Globals.HorizontalOrientation,
|
||||
Globals.VideoDepthBpp == 24,
|
||||
@@ -345,6 +347,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
p.getResources().getString(R.string.mouse_keepaspectratio),
|
||||
p.getResources().getString(R.string.video_smooth),
|
||||
p.getResources().getString(R.string.video_immersive),
|
||||
p.getResources().getString(R.string.video_draw_cutout),
|
||||
p.getResources().getString(R.string.video_orientation_autodetect),
|
||||
p.getResources().getString(R.string.video_orientation_vertical),
|
||||
p.getResources().getString(R.string.video_bpp_24),
|
||||
@@ -355,6 +358,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.VideoLinearFilter,
|
||||
Globals.ImmersiveMode,
|
||||
Globals.DrawInDisplayCutout,
|
||||
Globals.AutoDetectOrientation,
|
||||
!Globals.HorizontalOrientation,
|
||||
Globals.VideoDepthBpp == 24,
|
||||
@@ -390,14 +394,16 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
if( item == 2 )
|
||||
Globals.ImmersiveMode = isChecked;
|
||||
if( item == 3 )
|
||||
Globals.AutoDetectOrientation = isChecked;
|
||||
Globals.DrawInDisplayCutout = isChecked;
|
||||
if( item == 4 )
|
||||
Globals.HorizontalOrientation = !isChecked;
|
||||
Globals.AutoDetectOrientation = isChecked;
|
||||
if( item == 5 )
|
||||
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
||||
Globals.HorizontalOrientation = !isChecked;
|
||||
if( item == 6 )
|
||||
Globals.TvBorders = isChecked;
|
||||
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
||||
if( item == 7 )
|
||||
Globals.TvBorders = isChecked;
|
||||
if( item == 8 )
|
||||
Globals.MultiThreadedVideo = isChecked;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,6 +66,7 @@ import android.net.Uri;
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.graphics.Rect;
|
||||
|
||||
|
||||
class Mouse
|
||||
@@ -702,6 +703,14 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
hh = topView.getHeight() - topView.getHeight() % 2;
|
||||
}
|
||||
|
||||
if (Globals.DrawInDisplayCutout) {
|
||||
final Rect r = new Rect();
|
||||
context._videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
//ww = r.width();
|
||||
//hh = r.height();
|
||||
//Log.v("SDL", "DemoRenderer.onWindowResize(): adjusted to display cutout");
|
||||
}
|
||||
|
||||
Display display = context.getWindowManager().getDefaultDisplay();
|
||||
|
||||
if (mWidth != 0 && mHeight != 0 && (mWidth != ww || mHeight != hh))
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="video_orientation_autodetect">Auto-detect screen orientation</string>
|
||||
<string name="video_bpp_24">24 bpp screen color depth</string>
|
||||
<string name="video_immersive">Hide system navigation buttons / immersive mode</string>
|
||||
<string name="video_draw_cutout">Draw in display cutout area</string>
|
||||
<string name="tv_borders">TV borders</string>
|
||||
|
||||
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
||||
|
||||
Reference in New Issue
Block a user