From 0698944752d3e676a1a0161213b7ec9c9a902cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 6 Oct 2019 00:20:49 +0200 Subject: [PATCH] Fixes --- android/jni/AndroidVulkanContext.cpp | 4 ++-- android/jni/app-android.cpp | 2 ++ android/src/org/ppsspp/ppsspp/NativeActivity.java | 12 +++++------- ext/native/ui/screen.cpp | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/android/jni/AndroidVulkanContext.cpp b/android/jni/AndroidVulkanContext.cpp index b514f13d6..71c63077b 100644 --- a/android/jni/AndroidVulkanContext.cpp +++ b/android/jni/AndroidVulkanContext.cpp @@ -211,7 +211,7 @@ void AndroidVulkanContext::SwapBuffers() { } void AndroidVulkanContext::Resize() { - ILOG("AndroidVulkanContext::Resize begin (%d, %d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + ILOG("AndroidVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); g_Vulkan->DestroyObjects(); @@ -220,7 +220,7 @@ void AndroidVulkanContext::Resize() { g_Vulkan->ReinitSurface(); g_Vulkan->InitObjects(); draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); - ILOG("AndroidVulkanContext::Resize end (%d, %d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + ILOG("AndroidVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); } void AndroidVulkanContext::SwapInterval(int interval) { diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 1834e2b1a..2dfd00185 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -629,6 +629,7 @@ static void recalculateDpi() { pixel_in_dps_x = (float)pixel_xres / dp_xres; pixel_in_dps_y = (float)pixel_yres / dp_yres; + ILOG("RecalcDPI: display_xres=%d display_yres=%d", display_xres, display_yres); ILOG("RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f", g_dpi, g_dpi_scale_x, g_dpi_scale_y); ILOG("RecalcDPI: dp_xscale=%f dp_yscale=%f", dp_xscale, dp_yscale); ILOG("RecalcDPI: dp_xres=%d dp_yres=%d", dp_xres, dp_yres); @@ -904,6 +905,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JN display_hz = refreshRate; recalculateDpi(); + NativeResized(); } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_computeDesiredBackbufferDimensions() { diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 1dc3e7ba6..312955e29 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -53,8 +53,6 @@ import java.lang.reflect.Field; import java.util.List; import java.util.Locale; -import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - public abstract class NativeActivity extends Activity implements SurfaceHolder.Callback { // Remember to loadLibrary your JNI .so in a static {} block @@ -414,14 +412,13 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C flags |= View.SYSTEM_UI_FLAG_LOW_PROFILE; } if (useImmersive()) { - flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | SYSTEM_UI_FLAG_HIDE_NAVIGATION; + flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; } if (getWindow().getDecorView() != null) { getWindow().getDecorView().setSystemUiVisibility(flags); } else { - Log.e(TAG, "updateSystemUiVisibility: decor view not yet created, ignoring"); + Log.e(TAG, "updateSystemUiVisibility: decor view not yet created, ignoring for now"); } - updateDisplayMeasurements(); } @@ -606,6 +603,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C Log.w(TAG, "Surface changed. Resolution: " + width + "x" + height + " Format: " + format); // The window size might have changed (immersive mode, native fullscreen on some devices) NativeApp.backbufferResize(width, height, format); + updateDisplayMeasurements(); mSurface = holder.getSurface(); if (!javaGL) { // If we got a surface, this starts the thread. If not, it doesn't. @@ -678,7 +676,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C // whether it's because of our or system actions. // We will try to force it to follow our preference but will not stupidly // act as if it's visible if it's not. - navigationHidden = ((visibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0); + navigationHidden = ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0); // TODO: Check here if it's the state we want. Log.i(TAG, "SystemUiVisibilityChange! visibility=" + visibility + " navigationHidden: " + navigationHidden); updateDisplayMeasurements(); @@ -812,7 +810,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C updateSystemUiVisibility(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - densityDpi = (float) newConfig.densityDpi; + densityDpi = (float)newConfig.densityDpi; } } diff --git a/ext/native/ui/screen.cpp b/ext/native/ui/screen.cpp index 8d86f10a6..3bdfb5cb9 100644 --- a/ext/native/ui/screen.cpp +++ b/ext/native/ui/screen.cpp @@ -125,6 +125,7 @@ void ScreenManager::deviceRestored() { } void ScreenManager::resized() { + ILOG("ScreenManager::resized(dp: %dx%d)", dp_xres, dp_yres); std::lock_guard guard(inputLock_); // Have to notify the whole stack, otherwise there will be problems when going back // to non-top screens.