mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
add responsive-fullscreen-minimized-window
This commit is contained in:
parent
26c811a68e
commit
6f664baacf
@ -38,6 +38,8 @@ bool gl_show_fps_meter = config_wgldisplay.GetBool("show-fps-meter", false);
|
|||||||
float gl_fps_meter_update_interval = max(0.5,config_wgldisplay.GetFloat("fps-meter-update-interval", 1.7));
|
float gl_fps_meter_update_interval = max(0.5,config_wgldisplay.GetFloat("fps-meter-update-interval", 1.7));
|
||||||
int gl_forced_pixfmt=config_wgldisplay.GetInt("gl-force-pixfmt", 0);
|
int gl_forced_pixfmt=config_wgldisplay.GetInt("gl-force-pixfmt", 0);
|
||||||
|
|
||||||
|
bool bResponsive_minimized_fullscreen_window = config_wgldisplay.GetBool("responsive-minimized-fullscreen-window",false);
|
||||||
|
|
||||||
extern void AtExitFn(void);
|
extern void AtExitFn(void);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -30,6 +30,7 @@ extern bool gl_show_fps_meter;
|
|||||||
extern float gl_fps_meter_update_interval;
|
extern float gl_fps_meter_update_interval;
|
||||||
extern bool gl_sync_video;
|
extern bool gl_sync_video;
|
||||||
extern int gl_forced_pixfmt;
|
extern int gl_forced_pixfmt;
|
||||||
|
extern bool bResponsive_minimized_fullscreen_window;
|
||||||
|
|
||||||
extern EXPCL_PANDAGL void init_libwgldisplay();
|
extern EXPCL_PANDAGL void init_libwgldisplay();
|
||||||
|
|
||||||
|
@ -279,6 +279,8 @@ void wglGraphicsWindow::config(void) {
|
|||||||
|
|
||||||
_exiting_window = false;
|
_exiting_window = false;
|
||||||
_return_control_to_app = false;
|
_return_control_to_app = false;
|
||||||
|
|
||||||
|
_active_minimized_fullscreen = false;
|
||||||
_PandaPausedTimer = NULL;
|
_PandaPausedTimer = NULL;
|
||||||
_mouse_input_enabled = false;
|
_mouse_input_enabled = false;
|
||||||
_mouse_motion_enabled = false;
|
_mouse_motion_enabled = false;
|
||||||
@ -693,6 +695,17 @@ int wglGraphicsWindow::choose_visual(void) {
|
|||||||
for(pfnum=1;pfnum<=MaxPixFmtNum;pfnum++) {
|
for(pfnum=1;pfnum<=MaxPixFmtNum;pfnum++) {
|
||||||
DescribePixelFormat(_hdc, pfnum, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
DescribePixelFormat(_hdc, pfnum, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||||
|
|
||||||
|
// official, nvidia sanctioned way. should be equiv to my algorithm
|
||||||
|
if ( (pfd.dwFlags & PFD_GENERIC_FORMAT ) != 0 ) {
|
||||||
|
drvtype = Software;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ( pfd.dwFlags & PFD_GENERIC_ACCELERATED )
|
||||||
|
drvtype = MCD;
|
||||||
|
else
|
||||||
|
drvtype = ICD;
|
||||||
|
|
||||||
|
#if MY_OLD_ALGORITHM
|
||||||
if((pfd.dwFlags & PFD_GENERIC_ACCELERATED) && (pfd.dwFlags & PFD_GENERIC_FORMAT))
|
if((pfd.dwFlags & PFD_GENERIC_ACCELERATED) && (pfd.dwFlags & PFD_GENERIC_FORMAT))
|
||||||
drvtype=MCD;
|
drvtype=MCD;
|
||||||
else if(!(pfd.dwFlags & PFD_GENERIC_ACCELERATED) && !(pfd.dwFlags & PFD_GENERIC_FORMAT))
|
else if(!(pfd.dwFlags & PFD_GENERIC_ACCELERATED) && !(pfd.dwFlags & PFD_GENERIC_FORMAT))
|
||||||
@ -701,6 +714,7 @@ int wglGraphicsWindow::choose_visual(void) {
|
|||||||
drvtype=Software;
|
drvtype=Software;
|
||||||
continue; // skipping all SW fmts
|
continue; // skipping all SW fmts
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(wgldisplay_cat.is_debug())
|
if(wgldisplay_cat.is_debug())
|
||||||
wgldisplay_cat->debug() << "----------------" << endl;
|
wgldisplay_cat->debug() << "----------------" << endl;
|
||||||
@ -1198,18 +1212,28 @@ LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam
|
|||||||
void wglGraphicsWindow::deactivate_window(void) {
|
void wglGraphicsWindow::deactivate_window(void) {
|
||||||
// current policy is to suspend minimized or deactivated fullscreen windows, but leave
|
// current policy is to suspend minimized or deactivated fullscreen windows, but leave
|
||||||
// regular windows running normally
|
// regular windows running normally
|
||||||
|
|
||||||
|
if((!_props._fullscreen) || _exiting_window || _window_inactive || _active_minimized_fullscreen) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if(wgldisplay_cat.is_spam())
|
if(wgldisplay_cat.is_spam())
|
||||||
wgldisplay_cat.spam() << "deactivate_window called" << endl;
|
wgldisplay_cat.spam() << "deactivate_window called, but ignored in current mode" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((!_props._fullscreen) || _exiting_window || _window_inactive)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bResponsive_minimized_fullscreen_window) {
|
||||||
if(wgldisplay_cat.is_spam())
|
if(wgldisplay_cat.is_spam())
|
||||||
wgldisplay_cat.spam() << "WGL window deactivated, releasing gl context and waiting...\n";
|
wgldisplay_cat.spam() << "WGL window deactivated, releasing gl context and waiting...\n";
|
||||||
|
|
||||||
_window_inactive = true;
|
_window_inactive = true;
|
||||||
unmake_current();
|
unmake_current();
|
||||||
|
} else {
|
||||||
|
_active_minimized_fullscreen = true;
|
||||||
|
assert(_props._fullscreen);
|
||||||
|
|
||||||
|
if(wgldisplay_cat.is_spam())
|
||||||
|
wgldisplay_cat.spam() << "WGL window minimized from fullscreen mode, remaining active...\n";
|
||||||
|
}
|
||||||
|
|
||||||
// make sure window is minimized
|
// make sure window is minimized
|
||||||
|
|
||||||
@ -1220,6 +1244,7 @@ void wglGraphicsWindow::deactivate_window(void) {
|
|||||||
wgldisplay_cat.error() << "GetWindowPlacement failed!\n";
|
wgldisplay_cat.error() << "GetWindowPlacement failed!\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -1227,11 +1252,13 @@ void wglGraphicsWindow::deactivate_window(void) {
|
|||||||
// revert to default display mode
|
// revert to default display mode
|
||||||
ChangeDisplaySettings(NULL,0x0);
|
ChangeDisplaySettings(NULL,0x0);
|
||||||
|
|
||||||
|
if(!bResponsive_minimized_fullscreen_window) {
|
||||||
_PandaPausedTimer = SetTimer(_mwindow,PAUSED_TIMER_ID,1500,NULL);
|
_PandaPausedTimer = SetTimer(_mwindow,PAUSED_TIMER_ID,1500,NULL);
|
||||||
if(_PandaPausedTimer!=PAUSED_TIMER_ID) {
|
if(_PandaPausedTimer!=PAUSED_TIMER_ID) {
|
||||||
wgldisplay_cat.error() << "Error in SetTimer!\n";
|
wgldisplay_cat.error() << "Error in SetTimer!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wglGraphicsWindow::reactivate_window(void) {
|
void wglGraphicsWindow::reactivate_window(void) {
|
||||||
if(_window_inactive ) {
|
if(_window_inactive ) {
|
||||||
@ -1252,6 +1279,18 @@ void wglGraphicsWindow::reactivate_window(void) {
|
|||||||
|
|
||||||
GdiFlush();
|
GdiFlush();
|
||||||
make_current();
|
make_current();
|
||||||
|
} else if(_active_minimized_fullscreen) {
|
||||||
|
if(wgldisplay_cat.is_spam())
|
||||||
|
wgldisplay_cat.spam() << "redisplaying minimized fullscrn active WGL window...\n";
|
||||||
|
|
||||||
|
// move window to top of zorder,
|
||||||
|
SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOOWNERZORDER);
|
||||||
|
|
||||||
|
ChangeDisplaySettings(_pCurrent_display_settings,CDS_FULLSCREEN);
|
||||||
|
|
||||||
|
GdiFlush();
|
||||||
|
make_current();
|
||||||
|
_active_minimized_fullscreen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1308,7 +1347,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
wgldisplay_cat.spam() << "WM_EXITSIZEMOVE received" << endl;
|
wgldisplay_cat.spam() << "WM_EXITSIZEMOVE received" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(_window_inactive)
|
|
||||||
reactivate_window();
|
reactivate_window();
|
||||||
handle_reshape();
|
handle_reshape();
|
||||||
break;
|
break;
|
||||||
@ -1332,7 +1370,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if((wparam==SIZE_MAXIMIZED) || (wparam==SIZE_RESTORED)) { // old comment -- added SIZE_RESTORED to handle 3dfx case (what does this mean?)
|
if((wparam==SIZE_MAXIMIZED) || (wparam==SIZE_RESTORED)) { // old comment -- added SIZE_RESTORED to handle 3dfx case (what does this mean?)
|
||||||
if(_window_inactive)
|
|
||||||
reactivate_window();
|
reactivate_window();
|
||||||
|
|
||||||
// if((_props._xsize != width) || (_props._ysize != height))
|
// if((_props._xsize != width) || (_props._ysize != height))
|
||||||
|
@ -119,6 +119,7 @@ private:
|
|||||||
DEVMODE *_pCurrent_display_settings;
|
DEVMODE *_pCurrent_display_settings;
|
||||||
|
|
||||||
bool _window_inactive;
|
bool _window_inactive;
|
||||||
|
bool _active_minimized_fullscreen;
|
||||||
bool _return_control_to_app;
|
bool _return_control_to_app;
|
||||||
bool _exiting_window;
|
bool _exiting_window;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user