mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
Add option to control the iOS app switching mode
This commit is contained in:
parent
0b76d443e2
commit
305418813a
@ -231,6 +231,7 @@ enum class SystemNotification {
|
||||
ACTIVITY,
|
||||
UI_STATE_CHANGED,
|
||||
AUDIO_MODE_CHANGED,
|
||||
APP_SWITCH_MODE_CHANGED,
|
||||
};
|
||||
|
||||
// I guess it's not super great architecturally to centralize this, since it's not general - but same with a lot of
|
||||
|
@ -644,6 +644,10 @@ static const ConfigSetting graphicsSettings[] = {
|
||||
ConfigSetting("FullScreenMulti", &g_Config.bFullScreenMulti, false, CfgFlag::DEFAULT),
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(IOS)
|
||||
ConfigSetting("AppSwitchMode", &g_Config.iAppSwitchMode, (int)AppSwitchMode::DOUBLE_SWIPE_INDICATOR, CfgFlag::DEFAULT),
|
||||
#endif
|
||||
|
||||
ConfigSetting("BufferFiltering", &g_Config.iDisplayFilter, SCALE_LINEAR, CfgFlag::PER_GAME),
|
||||
ConfigSetting("DisplayOffsetX", &g_Config.fDisplayOffsetX, 0.5f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("DisplayOffsetY", &g_Config.fDisplayOffsetY, 0.5f, CfgFlag::PER_GAME),
|
||||
|
@ -210,6 +210,7 @@ public:
|
||||
|
||||
bool bTextureBackoffCache;
|
||||
bool bVertexDecoderJit;
|
||||
int iAppSwitchMode;
|
||||
bool bFullScreen;
|
||||
bool bFullScreenMulti;
|
||||
int iForceFullScreen = -1; // -1 = nope, 0 = force off, 1 = force on (not saved.)
|
||||
|
@ -126,6 +126,12 @@ enum class BackgroundAnimation {
|
||||
MOVING_BACKGROUND = 4,
|
||||
};
|
||||
|
||||
// iOS only
|
||||
enum class AppSwitchMode {
|
||||
SINGLE_SWIPE_NO_INDICATOR = 0,
|
||||
DOUBLE_SWIPE_INDICATOR = 1,
|
||||
};
|
||||
|
||||
// for Config.iShowStatusFlags
|
||||
enum class ShowStatusFlags {
|
||||
FPS_COUNTER = 1 << 1,
|
||||
|
@ -1048,6 +1048,17 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
|
||||
screenManager()->push(langScreen);
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
|
||||
static const char *indicator[] = {
|
||||
"Swipe once to switch app (indicator auto-hides)",
|
||||
"Swipe twice to switch app (indicator stays visible)"
|
||||
};
|
||||
PopupMultiChoice *switchMode = systemSettings->Add(new PopupMultiChoice(&g_Config.iAppSwitchMode, sy->T("App switching mode"), indicator, 0, ARRAY_SIZE(indicator), I18NCat::SYSTEM, screenManager()));
|
||||
switchMode->OnChoice.Add([](EventParams &e) {
|
||||
System_Notify(SystemNotification::APP_SWITCH_MODE_CHANGED);
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
|
||||
systemSettings->Add(new CheckBox(&g_Config.bUISound, sy->T("UI Sound")));
|
||||
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
|
||||
const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg";
|
||||
|
@ -134,8 +134,16 @@ id<PPSSPPViewController> sharedViewController;
|
||||
}
|
||||
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden {
|
||||
// Would love to hide it, but it prevents the double-swipe protection from working.
|
||||
return NO;
|
||||
if (g_Config.iAppSwitchMode == (int)AppSwitchMode::DOUBLE_SWIPE_INDICATOR) {
|
||||
return NO;
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appSwitchModeChanged
|
||||
{
|
||||
[self setNeedsUpdateOfHomeIndicatorAutoHidden];
|
||||
}
|
||||
|
||||
- (void)shareText:(NSString *)text {
|
||||
|
@ -15,6 +15,7 @@
|
||||
- (void)stopLocation;
|
||||
- (void)startVideo:(int)width height:(int)height;
|
||||
- (void)stopVideo;
|
||||
- (void)appSwitchModeChanged;
|
||||
|
||||
// Forwarded from the AppDelegate
|
||||
- (void)didBecomeActive;
|
||||
|
@ -481,8 +481,16 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye
|
||||
}
|
||||
|
||||
- (BOOL)prefersHomeIndicatorAutoHidden {
|
||||
// Would love to hide it, but it prevents the double-swipe protection from working.
|
||||
return NO;
|
||||
if (g_Config.iAppSwitchMode == (int)AppSwitchMode::DOUBLE_SWIPE_INDICATOR) {
|
||||
return NO;
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)appSwitchModeChanged
|
||||
{
|
||||
[self setNeedsUpdateOfHomeIndicatorAutoHidden];
|
||||
}
|
||||
|
||||
- (void)shareText:(NSString *)text {
|
||||
|
@ -387,6 +387,13 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
|
||||
void System_Notify(SystemNotification notification) {
|
||||
switch (notification) {
|
||||
case SystemNotification::APP_SWITCH_MODE_CHANGED:
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (sharedViewController) {
|
||||
[sharedViewController appSwitchModeChanged];
|
||||
}
|
||||
});
|
||||
break;
|
||||
case SystemNotification::UI_STATE_CHANGED:
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (sharedViewController) {
|
||||
|
Loading…
Reference in New Issue
Block a user