From 39cde7fc487e68857971fb38487d746e5d174017 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 20 Jul 2014 12:11:50 +0200 Subject: [PATCH] Hide "immersive mode" on pre-kitkat Android. --- UI/GameSettingsScreen.cpp | 8 +++++++- Windows/main.cpp | 4 ++++ headless/Headless.cpp | 1 + ios/main.mm | 2 ++ native | 2 +- unittest/UnitTest.cpp | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 10d10a60e8..ea2a9ec19f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -126,8 +126,12 @@ void GameSettingsScreen::CreateViews() { graphicsSettings->Add(new CheckBox(&g_Config.bSmallDisplay, gs->T("Small Display"))); if (pixel_xres < pixel_yres * 1.3) // Smaller than 4:3 graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch"))); + #ifdef ANDROID - graphicsSettings->Add(new CheckBox(&g_Config.bImmersiveMode, gs->T("Immersive Mode")))->OnClick.Handle(this, &GameSettingsScreen::OnImmersiveModeChange); + // Hide Immersive Mode on pre-kitkat Android + if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19) { + graphicsSettings->Add(new CheckBox(&g_Config.bImmersiveMode, gs->T("Immersive Mode")))->OnClick.Handle(this, &GameSettingsScreen::OnImmersiveModeChange); + } #endif graphicsSettings->Add(new ItemHeader(gs->T("Performance"))); @@ -441,6 +445,8 @@ UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) { UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) { System_SendMessage("immersive", ""); + if (g_Config.iAndroidHwScale != 0) + System_SendMessage("recreate", ""); return UI::EVENT_DONE; } diff --git a/Windows/main.cpp b/Windows/main.cpp index 6f1e88d001..a680573945 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -169,6 +169,10 @@ std::string System_GetProperty(SystemProperty prop) { } } +int System_GetPropertyInt(SystemProperty prop) { + return -1; +} + void System_SendMessage(const char *command, const char *parameter) { if (!strcmp(command, "finish")) { PostMessage(MainWindow::GetHWND(), WM_CLOSE, 0, 0); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index c6960af01b..cb520ab27f 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -73,6 +73,7 @@ void NativeRender() { } void NativeResized() { } std::string System_GetProperty(SystemProperty prop) { return ""; } +int System_GetPropertyInt(SystemProperty prop) { return -1; } void System_SendMessage(const char *command, const char *parameter) {} bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue) { return false; } diff --git a/ios/main.mm b/ios/main.mm index 6e5dea13d4..a4f3f46def 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -22,6 +22,8 @@ std::string System_GetProperty(SystemProperty prop) { } } +int System_GetPropertyInt(SystemProperty prop) { return -1; } + void System_SendMessage(const char *command, const char *parameter) { if (!strcmp(command, "finish")) { exit(0); diff --git a/native b/native index ed04a0bf28..1bc2fef02c 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit ed04a0bf28dbe89f894bb33b0700f72c9ec17b72 +Subproject commit 1bc2fef02c07e86e9d60855af21001a72d1587e6 diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index a9e9a4341a..767a11d869 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -48,6 +48,7 @@ #define RET(a) if (!(a)) { return false; } std::string System_GetProperty(SystemProperty prop) { return ""; } +int System_GetPropertyInt(SystemProperty prop) { return -1; } #define M_PI_2 1.57079632679489661923