diff --git a/panda/src/wdxdisplay/config_wdxdisplay.cxx b/panda/src/wdxdisplay/config_wdxdisplay.cxx index 6f9dbb5ee1..ecd1557ecc 100644 --- a/panda/src/wdxdisplay/config_wdxdisplay.cxx +++ b/panda/src/wdxdisplay/config_wdxdisplay.cxx @@ -29,6 +29,8 @@ ConfigureFn(config_wdxdisplay) { init_libwdxdisplay(); } +bool bResponsive_minimized_fullscreen_window = config_wdxdisplay.GetBool("responsive-minimized-fullscreen-window",false); + extern void AtExitFn(void); //////////////////////////////////////////////////////////////////// diff --git a/panda/src/wdxdisplay/config_wdxdisplay.h b/panda/src/wdxdisplay/config_wdxdisplay.h index c663525183..ae3e0e058b 100644 --- a/panda/src/wdxdisplay/config_wdxdisplay.h +++ b/panda/src/wdxdisplay/config_wdxdisplay.h @@ -25,6 +25,7 @@ NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX); +extern bool bResponsive_minimized_fullscreen_window; extern Filename get_icon_filename(); extern EXPCL_PANDADX void init_libwdxdisplay(); diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index f076f55eb5..2436cef5d5 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -601,8 +601,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { // windowed apps currently run regardless of if its window is in the foreground // so we cannot rely on window messages to reawaken app - - if((wparam==_PandaPausedTimer) && _window_inactive) { + if((wparam==_PandaPausedTimer) && (_window_inactive||_active_minimized_fullscreen)) { assert(_dxgsg!=NULL); _dxgsg->CheckCooperativeLevel(DO_REACTIVATE_WINDOW); @@ -649,12 +648,25 @@ void wdxGraphicsWindow::deactivate_window(void) { // current policy is to suspend minimized or deactivated fullscreen windows, but leave // regular windows running normally - if(_window_inactive || _exiting_window) + if(_window_inactive || _exiting_window || _active_minimized_fullscreen) { + #ifdef _DEBUG + if(wdxdisplay_cat.is_spam()) + wdxdisplay_cat.spam() << "deactivate_window called, but ignored in current mode\n"; + #endif return; + } - if(wdxdisplay_cat.is_spam()) - wdxdisplay_cat.spam() << "WDX window deactivated, waiting...\n"; - _window_inactive = true; + if(bResponsive_minimized_fullscreen_window) { + if(wdxdisplay_cat.is_spam()) + wdxdisplay_cat.spam() << "WDX fullscreen window switching to active minimized mode...\n"; + _active_minimized_fullscreen = true; + } else { + + if(wdxdisplay_cat.is_spam()) + wdxdisplay_cat.spam() << "WDX window deactivated, waiting...\n"; + + _window_inactive = true; + } if(_props._fullscreen) { // make sure window is minimized @@ -671,37 +683,53 @@ void wdxGraphicsWindow::deactivate_window(void) { } } - _PandaPausedTimer = SetTimer(_mwindow,PAUSED_TIMER_ID,500,NULL); - if(_PandaPausedTimer!=PAUSED_TIMER_ID) { - wdxdisplay_cat.error() << "Error in SetTimer!\n"; - } +// if(!bResponsive_minimized_fullscreen_window) { + // need this even in responsive-mode to trigger the dxgsg check of cooplvl, i think? + _PandaPausedTimer = SetTimer(_mwindow,PAUSED_TIMER_ID,500,NULL); + if(_PandaPausedTimer!=PAUSED_TIMER_ID) { + wdxdisplay_cat.error() << "Error in SetTimer!\n"; + } +// } } void wdxGraphicsWindow::reactivate_window(void) { - if(!_window_inactive) - return; + if(_window_inactive) { + + // first see if dx cooperative level is OK for reactivation + // if(!_dxgsg->CheckCooperativeLevel()) + // return; + + if(wdxdisplay_cat.is_spam()) + wdxdisplay_cat.spam() << "WDX window re-activated...\n"; + + _window_inactive = false; + + if(_PandaPausedTimer!=NULL) { + KillTimer(_mwindow,_PandaPausedTimer); + _PandaPausedTimer = NULL; + } + + // move window to top of zorder + // if(_props._fullscreen) + // SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOOWNERZORDER); + GdiFlush(); - // first see if dx cooperative level is OK for reactivation -// if(!_dxgsg->CheckCooperativeLevel()) -// return; + } else if(_active_minimized_fullscreen) { + if(wdxdisplay_cat.is_spam()) + wdxdisplay_cat.spam() << "WDX window unminimized from active-minimized state...\n"; + + if(_PandaPausedTimer!=NULL) { + KillTimer(_mwindow,_PandaPausedTimer); + _PandaPausedTimer = NULL; + } - if(wdxdisplay_cat.is_spam()) - wdxdisplay_cat.spam() << "WDX window re-activated...\n"; - - _window_inactive = false; - - if(_PandaPausedTimer!=NULL) { - KillTimer(_mwindow,_PandaPausedTimer); - _PandaPausedTimer = NULL; + _active_minimized_fullscreen = false; + + // move window to top of zorder + // if(_props._fullscreen) + // SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOOWNERZORDER); + GdiFlush(); } - - // move window to top of zorder -// if(_props._fullscreen) -// SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOOWNERZORDER); - - GdiFlush(); - - } //////////////////////////////////////////////////////////////////// @@ -741,6 +769,7 @@ void wdxGraphicsWindow::config(void) { _exiting_window = false; _window_inactive = false; _return_control_to_app = false; + _active_minimized_fullscreen = false; _hOldForegroundWindow=GetForegroundWindow(); diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.h b/panda/src/wdxdisplay/wdxGraphicsWindow.h index 18655325a4..0d3c9afafa 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.h +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.h @@ -108,6 +108,7 @@ private: bool _ignore_key_repeat; bool _exiting_window; bool _window_inactive; + bool _active_minimized_fullscreen; bool _return_control_to_app; public: