disable audio for alt-tab

This commit is contained in:
cxgeorge 2001-08-21 00:31:49 +00:00
parent d478348a71
commit 704456e91d
2 changed files with 22 additions and 0 deletions

View File

@ -623,6 +623,20 @@ class ShowBase:
self.notify.info("Taking screenshot: " + imageName)
takeSnapshot(self.win, imageName)
def DisableAudio(self):
if self.wantSfx:
self.sfxManager.setActive(0)
if self.wantMusic:
self.musicManager.setActive(0)
self.notify.debug("Disabling audio")
def EnableAudio(self):
if self.wantSfx:
self.sfxManager.setActive(1)
if self.wantMusic:
self.musicManager.setActive(1)
self.notify.debug("Enabling audio")
def run(self):
self.taskMgr.run()

View File

@ -28,6 +28,8 @@
#include <keyboardButton.h>
#include <mouseButton.h>
#include <throw_event.h>
#ifdef DO_PSTATS
#include <pStatTimer.h>
#endif
@ -673,6 +675,8 @@ void wdxGraphicsWindow::deactivate_window(void) {
if((wndpl.showCmd!=SW_MINIMIZE)&&(wndpl.showCmd!=SW_SHOWMINIMIZED)) {
ShowWindow(_mwindow, SW_MINIMIZE);
}
throw_event("PandaPaused"); // right now this is used to signal python event handler to disable audio
}
// if(!bResponsive_minimized_fullscreen_window) {
@ -722,6 +726,10 @@ void wdxGraphicsWindow::reactivate_window(void) {
// SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOOWNERZORDER);
GdiFlush();
}
if(_props._fullscreen) {
throw_event("PandaRestarted"); // right now this is used to signal python event handler to re-enable audio
}
}
////////////////////////////////////////////////////////////////////