Browse Source

add active fullscrn minimized mode

cxgeorge 24 years ago
parent
commit
69579cc4df

+ 2 - 0
panda/src/wdxdisplay/config_wdxdisplay.cxx

@@ -29,6 +29,8 @@ ConfigureFn(config_wdxdisplay) {
   init_libwdxdisplay();
   init_libwdxdisplay();
 }
 }
 
 
+bool bResponsive_minimized_fullscreen_window = config_wdxdisplay.GetBool("responsive-minimized-fullscreen-window",false);
+
 extern void AtExitFn(void);
 extern void AtExitFn(void);
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/wdxdisplay/config_wdxdisplay.h

@@ -25,6 +25,7 @@
 
 
 NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
 NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
 
 
+extern bool bResponsive_minimized_fullscreen_window;
 extern Filename get_icon_filename();
 extern Filename get_icon_filename();
 
 
 extern EXPCL_PANDADX void init_libwdxdisplay();
 extern EXPCL_PANDADX void init_libwdxdisplay();

+ 61 - 32
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
             //    windowed apps currently run regardless of if its window is in the foreground
             //    so we cannot rely on window messages to reawaken app
             //    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);
                 assert(_dxgsg!=NULL);
                 _dxgsg->CheckCooperativeLevel(DO_REACTIVATE_WINDOW);
                 _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
     // current policy is to suspend minimized or deactivated fullscreen windows, but leave
     // regular windows running normally
     // 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;
      return;
+   }
+
+   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(wdxdisplay_cat.is_spam())
+           wdxdisplay_cat.spam() << "WDX window deactivated, waiting...\n";
+
+       _window_inactive = true;
+   }
 
 
    if(_props._fullscreen) {
    if(_props._fullscreen) {
        // make sure window is minimized
        // 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) {
 void wdxGraphicsWindow::reactivate_window(void) {
-    if(!_window_inactive)
-        return;
-
-    // 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(_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();
+
+    } 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(_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;
     _exiting_window = false;
     _window_inactive = false;
     _window_inactive = false;
     _return_control_to_app = false;
     _return_control_to_app = false;
+    _active_minimized_fullscreen = false;
 
 
     _hOldForegroundWindow=GetForegroundWindow();
     _hOldForegroundWindow=GetForegroundWindow();
 
 

+ 1 - 0
panda/src/wdxdisplay/wdxGraphicsWindow.h

@@ -108,6 +108,7 @@ private:
   bool              _ignore_key_repeat;
   bool              _ignore_key_repeat;
   bool              _exiting_window;
   bool              _exiting_window;
   bool              _window_inactive;
   bool              _window_inactive;
+  bool              _active_minimized_fullscreen;
   bool              _return_control_to_app;
   bool              _return_control_to_app;
 
 
 public:
 public: