Pause rendering when minimized, when appropriate (hopefully? This is sort of hard to test.).

This commit is contained in:
The Dax 2014-06-29 18:06:47 -04:00 committed by Henrik Rydgard
parent 1fbd94d589
commit 8a78f5e814
4 changed files with 20 additions and 0 deletions

View File

@ -419,6 +419,7 @@ enum SkipDrawReasonFlags {
SKIPDRAW_SKIPFRAME = 1,
SKIPDRAW_NON_DISPLAYED_FB = 2, // Skip drawing to FBO:s that have not been displayed.
SKIPDRAW_BAD_FB_TEXTURE = 4,
SKIPDRAW_WINDOW_MINIMIZED = 8, // Don't draw when the host window is minimized.
};
bool vertTypeIsSkinningEnabled(u32 vertType);

View File

@ -224,6 +224,12 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
if (PSP_IsInited()) {
currentMIPS->UpdateCore(g_Config.bJit ? CPU_JIT : CPU_INTERPRETER);
}
} else if (!strcmp(message, "window minimized")) {
if (!strcmp(value, "true")) {
gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED;
} else {
gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED;
}
}
}

View File

@ -37,6 +37,7 @@
#include "Core/HLE/sceUtility.h"
#include "Common/CPUDetect.h"
#include "Common/FileUtil.h"
#include "GPU/GPUState.h"
#include "ui_atlas.h"
@ -197,6 +198,12 @@ void UIDialogScreenWithBackground::sendMessage(const char *message, const char *
auto langScreen = new NewLanguageScreen(de->T("Language"));
langScreen->OnChoice.Handle(this, &UIDialogScreenWithBackground::OnLanguageChange);
screenManager()->push(langScreen);
} else if (!strcmp(message, "window minimized")) {
if (!strcmp(value, "true")) {
gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED;
} else {
gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED;
}
}
}

View File

@ -1093,11 +1093,17 @@ namespace MainWindow
case SIZE_MAXIMIZED:
case SIZE_RESTORED:
Core_NotifyWindowHidden(false);
if (!g_Config.bPauseWhenMinimized) {
NativeMessageReceived("window minimized", "false");
}
SavePosition();
ResizeDisplay();
break;
case SIZE_MINIMIZED:
Core_NotifyWindowHidden(g_Config.bPauseWhenMinimized);
if (!g_Config.bPauseWhenMinimized) {
NativeMessageReceived("window minimized", "true");
}
break;
default:
break;