From 000037dbf69c2c1580f3c9bb8a9771bf18bc7ae8 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 24 Dec 2017 18:01:45 -0500 Subject: [PATCH] - implemented 'i_soundinbackground' to continue playing sounds and music while in the background. - OpenGL rendering continues now even when losing focus while in windowed mode. --- src/posix/cocoa/i_main.mm | 3 ++- src/posix/sdl/i_input.cpp | 3 ++- src/win32/i_input.cpp | 3 ++- src/win32/win32gliface.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/posix/cocoa/i_main.mm b/src/posix/cocoa/i_main.mm index fd3e9a737..5d30341b4 100644 --- a/src/posix/cocoa/i_main.mm +++ b/src/posix/cocoa/i_main.mm @@ -60,6 +60,7 @@ // --------------------------------------------------------------------------- +CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) EXTERN_CVAR(Int, vid_defwidth ) EXTERN_CVAR(Int, vid_defheight) EXTERN_CVAR(Bool, vid_vsync ) @@ -323,7 +324,7 @@ ApplicationController* appCtrl; { ZD_UNUSED(aNotification); - S_SetSoundPaused(0); + S_SetSoundPaused((!!i_soundinbackground) || 0); } diff --git a/src/posix/sdl/i_input.cpp b/src/posix/sdl/i_input.cpp index ecf93ed5d..338b343d5 100644 --- a/src/posix/sdl/i_input.cpp +++ b/src/posix/sdl/i_input.cpp @@ -62,6 +62,7 @@ extern int paused; CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) EXTERN_CVAR (Bool, fullscreen) @@ -312,7 +313,7 @@ void MessagePump (const SDL_Event &sev) { case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_FOCUS_LOST: - S_SetSoundPaused(sev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED); + S_SetSoundPaused((!!i_soundinbackground) || sev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED); break; } break; diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 9b05775fe..928943820 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -165,6 +165,7 @@ BOOL AppActive = TRUE; int SessionState = 0; int BlockMouseMove; +CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR(Bool, norawinput, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) @@ -567,7 +568,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS); } - S_SetSoundPaused (wParam); + S_SetSoundPaused ((!!i_soundinbackground) || wParam); break; case WM_WTSSESSION_CHANGE: diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 77963a43b..d5df5d8df 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -1130,7 +1130,7 @@ void Win32GLFrameBuffer::InitializeState() bool Win32GLFrameBuffer::CanUpdate() { - if (!AppActive) return false; + if (!AppActive && IsFullscreen()) return false; return true; }