mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-18 12:43:44 -04:00
disable audio for alt-tab
This commit is contained in:
parent
d478348a71
commit
704456e91d
@ -623,6 +623,20 @@ class ShowBase:
|
|||||||
self.notify.info("Taking screenshot: " + imageName)
|
self.notify.info("Taking screenshot: " + imageName)
|
||||||
takeSnapshot(self.win, 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):
|
def run(self):
|
||||||
self.taskMgr.run()
|
self.taskMgr.run()
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include <keyboardButton.h>
|
#include <keyboardButton.h>
|
||||||
#include <mouseButton.h>
|
#include <mouseButton.h>
|
||||||
|
|
||||||
|
#include <throw_event.h>
|
||||||
|
|
||||||
#ifdef DO_PSTATS
|
#ifdef DO_PSTATS
|
||||||
#include <pStatTimer.h>
|
#include <pStatTimer.h>
|
||||||
#endif
|
#endif
|
||||||
@ -673,6 +675,8 @@ void wdxGraphicsWindow::deactivate_window(void) {
|
|||||||
if((wndpl.showCmd!=SW_MINIMIZE)&&(wndpl.showCmd!=SW_SHOWMINIMIZED)) {
|
if((wndpl.showCmd!=SW_MINIMIZE)&&(wndpl.showCmd!=SW_SHOWMINIMIZED)) {
|
||||||
ShowWindow(_mwindow, SW_MINIMIZE);
|
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) {
|
// 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);
|
// SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOOWNERZORDER);
|
||||||
GdiFlush();
|
GdiFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_props._fullscreen) {
|
||||||
|
throw_event("PandaRestarted"); // right now this is used to signal python event handler to re-enable audio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user