mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-31 04:50:48 +00:00
- skip rendering when application is not active
Use vid_activeinbackground CVAR to override this behavior
This commit is contained in:
parent
311259b0f5
commit
2be84dc636
11 changed files with 25 additions and 45 deletions
|
@ -28,13 +28,6 @@
|
||||||
|
|
||||||
// HEADER FILES ------------------------------------------------------------
|
// HEADER FILES ------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <direct.h>
|
|
||||||
#define mkdir(a,b) _mkdir (a)
|
|
||||||
#else
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_FPU_CONTROL
|
#ifdef HAVE_FPU_CONTROL
|
||||||
#include <fpu_control.h>
|
#include <fpu_control.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,6 +230,7 @@ FStartupInfo DoomStartupInfo;
|
||||||
FString lastIWAD;
|
FString lastIWAD;
|
||||||
int restart = 0;
|
int restart = 0;
|
||||||
bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction
|
bool batchrun; // just run the startup and collect all error messages in a logfile, then quit without any interaction
|
||||||
|
bool AppActive = true;
|
||||||
|
|
||||||
cycle_t FrameCycles;
|
cycle_t FrameCycles;
|
||||||
|
|
||||||
|
@ -645,6 +639,8 @@ CVAR (Flag, compat_multiexit, compatflags2, COMPATF2_MULTIEXIT);
|
||||||
CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT);
|
CVAR (Flag, compat_teleport, compatflags2, COMPATF2_TELEPORT);
|
||||||
CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW);
|
CVAR (Flag, compat_pushwindow, compatflags2, COMPATF2_PUSHWINDOW);
|
||||||
|
|
||||||
|
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// D_Display
|
// D_Display
|
||||||
|
@ -660,6 +656,11 @@ void D_Display ()
|
||||||
if (nodrawers || screen == NULL)
|
if (nodrawers || screen == NULL)
|
||||||
return; // for comparative timing / profiling
|
return; // for comparative timing / profiling
|
||||||
|
|
||||||
|
if (!AppActive && (screen->IsFullscreen() || !vid_activeinbackground))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cycle_t cycles;
|
cycle_t cycles;
|
||||||
|
|
||||||
cycles.Reset();
|
cycles.Reset();
|
||||||
|
|
|
@ -148,12 +148,6 @@ void OpenGLFrameBuffer::InitializeState()
|
||||||
|
|
||||||
void OpenGLFrameBuffer::Update()
|
void OpenGLFrameBuffer::Update()
|
||||||
{
|
{
|
||||||
if (!CanUpdate())
|
|
||||||
{
|
|
||||||
GLRenderer->Flush();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawRateStuff();
|
DrawRateStuff();
|
||||||
GLRenderer->Flush();
|
GLRenderer->Flush();
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ protected:
|
||||||
|
|
||||||
void InitializeState();
|
void InitializeState();
|
||||||
|
|
||||||
bool CanUpdate();
|
|
||||||
void SwapBuffers();
|
void SwapBuffers();
|
||||||
|
|
||||||
void SetGammaTable(uint16_t* table);
|
void SetGammaTable(uint16_t* table);
|
||||||
|
|
|
@ -296,18 +296,24 @@ ApplicationController* appCtrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern bool AppActive;
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(NSNotification*)aNotification
|
- (void)applicationDidBecomeActive:(NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
ZD_UNUSED(aNotification);
|
ZD_UNUSED(aNotification);
|
||||||
|
|
||||||
S_SetSoundPaused(1);
|
S_SetSoundPaused(1);
|
||||||
|
|
||||||
|
AppActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(NSNotification*)aNotification
|
- (void)applicationWillResignActive:(NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
ZD_UNUSED(aNotification);
|
ZD_UNUSED(aNotification);
|
||||||
|
|
||||||
S_SetSoundPaused((!!i_soundinbackground) || 0);
|
S_SetSoundPaused(i_soundinbackground);
|
||||||
|
|
||||||
|
AppActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -701,11 +701,6 @@ void SystemFrameBuffer::InitializeState()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemFrameBuffer::CanUpdate()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemFrameBuffer::SwapBuffers()
|
void SystemFrameBuffer::SwapBuffers()
|
||||||
{
|
{
|
||||||
[[NSOpenGLContext currentContext] flushBuffer];
|
[[NSOpenGLContext currentContext] flushBuffer];
|
||||||
|
|
|
@ -33,7 +33,6 @@ public:
|
||||||
virtual int GetTrueHeight() { return GetClientHeight(); }
|
virtual int GetTrueHeight() { return GetClientHeight(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool CanUpdate();
|
|
||||||
void SetGammaTable(uint16_t *tbl);
|
void SetGammaTable(uint16_t *tbl);
|
||||||
void ResetGammaTable();
|
void ResetGammaTable();
|
||||||
void InitializeState();
|
void InitializeState();
|
||||||
|
|
|
@ -305,9 +305,16 @@ void MessagePump (const SDL_Event &sev)
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
switch (sev.window.event)
|
switch (sev.window.event)
|
||||||
{
|
{
|
||||||
|
extern bool AppActive;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
|
S_SetSoundPaused(1);
|
||||||
|
AppActive = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
S_SetSoundPaused((!!i_soundinbackground) || sev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED);
|
S_SetSoundPaused(i_soundinbackground);
|
||||||
|
AppActive = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -394,11 +394,6 @@ void SystemFrameBuffer::InitializeState()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemFrameBuffer::CanUpdate ()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
|
void SystemFrameBuffer::SetGammaTable(uint16_t *tbl)
|
||||||
{
|
{
|
||||||
if (m_supportsGamma)
|
if (m_supportsGamma)
|
||||||
|
|
|
@ -30,7 +30,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool CanUpdate();
|
|
||||||
void ResetGammaTable();
|
void ResetGammaTable();
|
||||||
void SetGammaTable(uint16_t * tbl);
|
void SetGammaTable(uint16_t * tbl);
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ LPDIRECTINPUT8 g_pdi;
|
||||||
LPDIRECTINPUT g_pdi3;
|
LPDIRECTINPUT g_pdi3;
|
||||||
|
|
||||||
|
|
||||||
BOOL AppActive = TRUE;
|
extern bool AppActive;
|
||||||
int SessionState = 0;
|
int SessionState = 0;
|
||||||
int BlockMouseMove;
|
int BlockMouseMove;
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_ACTIVATEAPP:
|
case WM_ACTIVATEAPP:
|
||||||
AppActive = wParam;
|
AppActive = wParam == TRUE;
|
||||||
if (wParam)
|
if (wParam)
|
||||||
{
|
{
|
||||||
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
|
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
|
|
||||||
extern HWND Window;
|
extern HWND Window;
|
||||||
extern BOOL AppActive;
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||||
|
@ -71,8 +70,6 @@ PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
||||||
|
@ -1118,18 +1115,6 @@ void SystemFrameBuffer::InitializeState()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool SystemFrameBuffer::CanUpdate()
|
|
||||||
{
|
|
||||||
if (!AppActive && (IsFullscreen() || !vid_activeinbackground)) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void SystemFrameBuffer::ResetGammaTable()
|
void SystemFrameBuffer::ResetGammaTable()
|
||||||
{
|
{
|
||||||
if (m_supportsGamma)
|
if (m_supportsGamma)
|
||||||
|
|
Loading…
Reference in a new issue