Browse Source

fix minimized window error

David Rose 24 years ago
parent
commit
4c1e4ad1e2

+ 20 - 16
panda/src/display/graphicsEngine.cxx

@@ -111,15 +111,17 @@ cull_and_draw_together() {
   Windows::iterator wi;
   for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
     GraphicsWindow *win = (*wi);
-    win->begin_frame();
-    win->clear();
-
-    int num_display_regions = win->get_num_display_regions();
-    for (int i = 0; i < num_display_regions; i++) {
-      DisplayRegion *dr = win->get_display_region(i);
-      cull_and_draw_together(win, dr);
+    if (win->get_window_active()) {
+      win->begin_frame();
+      win->clear();
+      
+      int num_display_regions = win->get_num_display_regions();
+      for (int i = 0; i < num_display_regions; i++) {
+        DisplayRegion *dr = win->get_display_region(i);
+        cull_and_draw_together(win, dr);
+      }
+      win->end_frame();
     }
-    win->end_frame();
     win->process_events();
   }
 }
@@ -160,15 +162,17 @@ cull_bin_draw() {
   Windows::iterator wi;
   for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
     GraphicsWindow *win = (*wi);
-    win->begin_frame();
-    win->clear();
-
-    int num_display_regions = win->get_num_display_regions();
-    for (int i = 0; i < num_display_regions; i++) {
-      DisplayRegion *dr = win->get_display_region(i);
-      cull_bin_draw(win, dr);
+    if (win->get_window_active()) {
+      win->begin_frame();
+      win->clear();
+      
+      int num_display_regions = win->get_num_display_regions();
+      for (int i = 0; i < num_display_regions; i++) {
+        DisplayRegion *dr = win->get_display_region(i);
+        cull_bin_draw(win, dr);
+      }
+      win->end_frame();
     }
-    win->end_frame();
     win->process_events();
   }
 }

+ 13 - 0
panda/src/display/graphicsWindow.I

@@ -417,6 +417,19 @@ get_button_event(int device) {
   return _input_devices[device].get_button_event();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::get_window_active
+//       Access: Public
+//  Description: Returns true if the window is currently active and
+//               ready to be rendered into, or false otherwise.  This
+//               state is normally updated only by the GSG, or by the
+//               window itself.
+////////////////////////////////////////////////////////////////////
+INLINE bool GraphicsWindow::
+get_window_active() const {
+  return _window_active;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsWindow::win_display_regions_changed
 //       Access: Public

+ 92 - 61
panda/src/display/graphicsWindow.cxx

@@ -148,6 +148,7 @@ GraphicsWindow(GraphicsPipe *pipe) : Configurable() {
   _idle_callback = NULL;
   _frame_number = 0;
   _is_synced = false;
+  _window_active = true;
   _display_regions_stale = false;
 }
 
@@ -168,6 +169,7 @@ GraphicsWindow(GraphicsPipe *pipe,
   _draw_callback = NULL;
   _idle_callback = NULL;
   _is_synced = false;
+  _window_active = true;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -327,15 +329,6 @@ is_channel_defined(int index) const {
   return (_channels[index] != (GraphicsChannel *)NULL);
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsWindow::flag_redisplay
-//       Access: Public, Virtual
-//  Description:
-////////////////////////////////////////////////////////////////////
-void GraphicsWindow::
-flag_redisplay() {
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsWindow::declare_channel
 //       Access: Protected
@@ -391,6 +384,80 @@ do_determine_display_regions() {
   _display_regions_stale = false;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::resized
+//       Access: Public, Virtual
+//  Description: Called whenever the window gets the resize event.
+////////////////////////////////////////////////////////////////////
+void GraphicsWindow::
+resized(const unsigned int x, const unsigned int y) {
+  Channels::iterator ci;
+  for (ci = _channels.begin(); ci != _channels.end(); ++ci) {
+    GraphicsChannel *chan = (*ci);
+    chan->window_resized(x, y);
+  }
+  _props._xsize = x;
+  _props._ysize = y;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::make_scratch_display_region
+//       Access: Public
+//  Description: Allocates and returns a temporary DisplayRegion that
+//               may be used to render offscreen into.  This
+//               DisplayRegion is not associated with any layer.
+//
+//               To allocate a normal DisplayRegion for rendering, use
+//               the interface provded in GraphicsLayer.
+////////////////////////////////////////////////////////////////////
+PT(DisplayRegion) GraphicsWindow::
+make_scratch_display_region(int xsize, int ysize) const {
+  if (xsize > _props._xsize) {
+    display_cat.error()
+      << "GraphicsWindow::make_scratch_display_region() - x size is larger "
+      << "than window x size" << endl;
+    xsize = _props._xsize;
+  }
+  if (ysize > _props._ysize) {
+    display_cat.error()
+      << "GraphicsWindow::make_scratch_display_region() - y size is larger "
+      << "than window y size" << endl;
+    ysize = _props._ysize;
+  }
+
+  return new DisplayRegion(xsize, ysize);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::make_current
+//       Access: Public, Virtual
+//  Description: Makes the window's graphics context the currently
+//               active context that will be next rendered into by the
+//               GSG, if this makes sense for the particular type of
+//               GraphicsWindow.
+////////////////////////////////////////////////////////////////////
+void GraphicsWindow::
+make_current(void) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::unmake_current
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void GraphicsWindow::
+unmake_current(void) {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::flag_redisplay
+//       Access: Public, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+void GraphicsWindow::
+flag_redisplay() {
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsWindow::register_draw_function
 //       Access: Public, Virtual
@@ -450,71 +517,39 @@ end_frame() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: GraphicsWindow::resized
+//     Function: GraphicsWindow::process_events
 //       Access: Public, Virtual
-//  Description: Called whenever the window gets the resize event.
+//  Description: Do whatever processing is necessary to ensure that
+//               the window responds to user events.
 ////////////////////////////////////////////////////////////////////
 void GraphicsWindow::
-resized(const unsigned int x, const unsigned int y) {
-  Channels::iterator ci;
-  for (ci = _channels.begin(); ci != _channels.end(); ++ci) {
-    GraphicsChannel *chan = (*ci);
-    chan->window_resized(x, y);
-  }
-  _props._xsize = x;
-  _props._ysize = y;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsWindow::make_scratch_display_region
-//       Access: Public
-//  Description: Allocates and returns a temporary DisplayRegion that
-//               may be used to render offscreen into.  This
-//               DisplayRegion is not associated with any layer.
-//
-//               To allocate a normal DisplayRegion for rendering, use
-//               the interface provded in GraphicsLayer.
-////////////////////////////////////////////////////////////////////
-PT(DisplayRegion) GraphicsWindow::
-make_scratch_display_region(int xsize, int ysize) const {
-  if (xsize > _props._xsize) {
-    display_cat.error()
-      << "GraphicsWindow::make_scratch_display_region() - x size is larger "
-      << "than window x size" << endl;
-    xsize = _props._xsize;
-  }
-  if (ysize > _props._ysize) {
-    display_cat.error()
-      << "GraphicsWindow::make_scratch_display_region() - y size is larger "
-      << "than window y size" << endl;
-    ysize = _props._ysize;
-  }
-
-  return new DisplayRegion(xsize, ysize);
+process_events() {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: GraphicsWindow::make_current
+//     Function: GraphicsWindow::deactivate_window
 //       Access: Public, Virtual
-//  Description: Makes the window's graphics context the currently
-//               active context that will be next rendered into by the
-//               GSG, if this makes sense for the particular type of
-//               GraphicsWindow.
+//  Description: Indicates the window should stop rendering
+//               temporarily, and does whatever else is associated
+//               with that.  This is normally called only by the
+//               GraphicsWindow itself, or by the GSG.
 ////////////////////////////////////////////////////////////////////
 void GraphicsWindow::
-make_current(void) {
+deactivate_window() {
+  _window_active = false;
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: GraphicsWindow::unmake_current
+//     Function: GraphicsWindow::reactivate_window
 //       Access: Public, Virtual
-//  Description:
+//  Description: Restores the normal window rendering behavior after a
+//               previous call to deactivate_window().
 ////////////////////////////////////////////////////////////////////
 void GraphicsWindow::
-unmake_current(void) {
+reactivate_window() {
+  _window_active = true;
 }
 
-
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsWindow::make_gsg
 //       Access: Protected
@@ -659,7 +694,3 @@ get_depth_bitwidth(void) {
     display_cat.warning() << "get_depth_bitwidth() unimplemented by " << get_type() << endl; 
     return -1;
 }
-
-void GraphicsWindow::deactivate_window(void) { return; }
-void GraphicsWindow::reactivate_window(void) { return; }
-

+ 7 - 4
panda/src/display/graphicsWindow.h

@@ -180,8 +180,6 @@ PUBLISHED:
   INLINE bool has_pointer(int device) const;
   INLINE bool has_keyboard(int device) const;
 
-  virtual void process_events(void) { return; };   // process window events
-
 public:
   INLINE const MouseData &get_mouse_data(int device) const;
   INLINE bool has_button_event(int device) const;
@@ -197,8 +195,12 @@ public:
   virtual void begin_frame();
   void clear();
   virtual void end_frame();
-  virtual void deactivate_window(void);
-  virtual void reactivate_window(void);
+
+  virtual void process_events();
+
+  INLINE bool get_window_active() const;
+  virtual void deactivate_window();
+  virtual void reactivate_window();
 
   INLINE void win_display_regions_changed();
 
@@ -228,6 +230,7 @@ protected:
   int _frame_number;
 
   bool _is_synced;
+  bool _window_active;
 
 protected:
 

+ 10 - 58
panda/src/wdxdisplay/wdxGraphicsWindow.cxx

@@ -618,7 +618,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
             //    think of to make this work is to have the timer periodically check for restored
             //    coop level
 
-            //    if(_props._fullscreen && _window_inactive) {
+            //    if(_props._fullscreen && !_window_active) {
             //          if(_dxgsg!=NULL)
             //              _dxgsg->CheckCooperativeLevel(DO_REACTIVATE_WINDOW);
             //           else reactivate_window();
@@ -736,7 +736,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||_active_minimized_fullscreen)) {
+            if((wparam==_PandaPausedTimer) && (!_window_active||_active_minimized_fullscreen)) {
                 assert(_dxgsg!=NULL);
                 _dxgsg->CheckCooperativeLevel(DO_REACTIVATE_WINDOW);
 
@@ -901,7 +901,7 @@ 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 || _active_minimized_fullscreen) {
+   if(!_window_active || _exiting_window || _active_minimized_fullscreen) {
        #ifdef _DEBUG
           if(wdxdisplay_cat.is_spam())
             wdxdisplay_cat.spam()  << "deactivate_window called, but ignored in current mode\n";
@@ -918,7 +918,7 @@ void wdxGraphicsWindow::deactivate_window(void) {
        if(wdxdisplay_cat.is_spam())
            wdxdisplay_cat.spam() << "WDX window deactivated, waiting...\n";
 
-       _window_inactive = true;
+       _window_active = false;
    }
 
    if(_props._fullscreen) {
@@ -949,7 +949,7 @@ void wdxGraphicsWindow::deactivate_window(void) {
 }
 
 void wdxGraphicsWindow::reactivate_window(void) {
-    if(_window_inactive) {
+    if(!_window_active) {
     
         // first see if dx cooperative level is OK for reactivation
     //    if(!_dxgsg->CheckCooperativeLevel())
@@ -958,7 +958,7 @@ void wdxGraphicsWindow::reactivate_window(void) {
         if(wdxdisplay_cat.is_spam())
             wdxdisplay_cat.spam() << "WDX window re-activated...\n";
     
-        _window_inactive = false;
+        _window_active = true;
     
         if(_PandaPausedTimer!=NULL) {
             KillTimer(_dxgsg->scrn.hWnd,_PandaPausedTimer);
@@ -1263,7 +1263,7 @@ void wdxGraphicsWindow::config_window(wdxGraphicsWindowGroup *pParentGroup) {
     _hdc = NULL;
     _gsg = _dxgsg = NULL;
     _exiting_window = false;
-    _window_inactive = false;
+    _window_active = true;
     _return_control_to_app = false;
     _active_minimized_fullscreen = false;
 
@@ -2545,21 +2545,6 @@ handle_keyrelease(ButtonHandle key) {
     }
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: wdxGraphicsWindow::supports_update
-//       Access: Public, Virtual
-//  Description: Returns true if this particular kind of
-//               GraphicsWindow supports use of the update() function
-//               to update the graphics one frame at a time, so that
-//               the window does not need to be the program's main
-//               loop.  Returns false if the only way to update the
-//               window is to call main_loop().
-////////////////////////////////////////////////////////////////////
-bool wdxGraphicsWindow::
-supports_update() const {
-    return true;
-}
-
 void INLINE process_1_event(void) {
   MSG msg;
 
@@ -2576,11 +2561,11 @@ void INLINE process_1_event(void) {
 }
 
 void INLINE wdxGraphicsWindow::process_events(void) {
-  if(_window_inactive) {
+  if(!_window_active) {
       // Get 1 msg at a time until no more are left and we block and sleep,
-      // or message changes _return_control_to_app or _window_inactive status
+      // or message changes _return_control_to_app or _window_active status
 
-      while(_window_inactive && (!_return_control_to_app)) {
+      while(!_window_active && (!_return_control_to_app)) {
           process_1_event();
       }
       _return_control_to_app = false;
@@ -2595,39 +2580,6 @@ void INLINE wdxGraphicsWindow::process_events(void) {
   }
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: update
-//       Access:
-//  Description:
-////////////////////////////////////////////////////////////////////
-void wdxGraphicsWindow::update(void) {
-#ifdef DO_PSTATS
-  _show_code_pcollector.stop();
-
-  if(!_window_inactive) {
-      PStatClient::main_tick();
-  }
-#endif
-
-  process_events();
-
-  if(_window_inactive) {
-      // note _window_inactive must be checked after process_events is called, to avoid draw_callback being called
-      if(_idle_callback)
-          call_idle_callback();
-      return;
-  }
-
-  call_draw_callback(true);
-
-  if(_idle_callback)
-    call_idle_callback();
-
-#ifdef DO_PSTATS
-  _show_code_pcollector.start();
-#endif
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: wdxGraphicsWindow::get_gsg_type
 //       Access: Public, Virtual

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

@@ -60,8 +60,6 @@ public:
   wdxGraphicsWindow(GraphicsPipe* pipe,const GraphicsWindow::Properties& props,wdxGraphicsWindowGroup *pParentGroup);
 
   virtual ~wdxGraphicsWindow(void);
-  virtual bool supports_update() const;
-  virtual void update(void);
   virtual void end_frame( void );
 
   virtual TypeHandle get_gsg_type() const;

+ 11 - 59
panda/src/wdxdisplay8/wdxGraphicsWindow8.cxx

@@ -596,7 +596,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
             //    think of to make this work is to have the timer periodically check for restored
             //    coop level
 
-            //    if(_props._fullscreen && _window_inactive) {
+            //    if(_props._fullscreen && !_window_active) {
             //          if(_dxgsg!=NULL)
             //              _dxgsg->CheckCooperativeLevel(DO_REACTIVATE_WINDOW);
             //           else reactivate_window();
@@ -682,7 +682,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||_active_minimized_fullscreen)) {
+            if((wparam==_PandaPausedTimer) && (!_window_active||_active_minimized_fullscreen)) {
                 assert(_dxgsg!=NULL);
                 _dxgsg->CheckCooperativeLevel(DO_REACTIVATE_WINDOW);
 
@@ -848,7 +848,7 @@ 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 || _active_minimized_fullscreen) {
+   if(!_window_active || _exiting_window || _active_minimized_fullscreen) {
        #ifdef _DEBUG
           if(wdxdisplay_cat.is_spam())
             wdxdisplay_cat.spam()  << "deactivate_window called, but ignored in current mode\n";
@@ -865,7 +865,7 @@ void wdxGraphicsWindow::deactivate_window(void) {
        if(wdxdisplay_cat.is_spam())
            wdxdisplay_cat.spam() << "WDX window deactivated, waiting...\n";
 
-       _window_inactive = true;
+       _window_active = false;
    }
 
    if(_props._fullscreen) {
@@ -897,7 +897,7 @@ void wdxGraphicsWindow::deactivate_window(void) {
 
 // currently this should only be called from CheckCoopLvl to return from Alt-tab
 void wdxGraphicsWindow::reactivate_window(void) {
-    if((_window_inactive)||(_active_minimized_fullscreen)) { 
+    if((!_window_active)||(_active_minimized_fullscreen)) { 
     
         // first see if dx cooperative level is OK for reactivation
     //    if(!_dxgsg->CheckCooperativeLevel())
@@ -908,8 +908,8 @@ void wdxGraphicsWindow::reactivate_window(void) {
             _PandaPausedTimer = NULL;
         }
 
-        if(_window_inactive) {
-            _window_inactive = false;
+        if(!_window_active) {
+            _window_active = true;
             if(wdxdisplay_cat.is_spam())
                 wdxdisplay_cat.spam() << "WDX window re-activated...\n";
         } else {
@@ -1268,7 +1268,7 @@ void wdxGraphicsWindow::config_window(wdxGraphicsWindowGroup *pParentGroup) {
     _hdc = NULL;
     _gsg = _dxgsg = NULL;
     _exiting_window = false;
-    _window_inactive = false;
+    _window_active = true;
     _return_control_to_app = false;
     _active_minimized_fullscreen = false;
 
@@ -2619,21 +2619,6 @@ handle_keyrelease(ButtonHandle key) {
     }
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: wdxGraphicsWindow::supports_update
-//       Access: Public, Virtual
-//  Description: Returns true if this particular kind of
-//               GraphicsWindow supports use of the update() function
-//               to update the graphics one frame at a time, so that
-//               the window does not need to be the program's main
-//               loop.  Returns false if the only way to update the
-//               window is to call main_loop().
-////////////////////////////////////////////////////////////////////
-bool wdxGraphicsWindow::
-supports_update() const {
-    return true;
-}
-
 void INLINE process_1_event(void) {
   MSG msg;
 
@@ -2650,11 +2635,11 @@ void INLINE process_1_event(void) {
 }
 
 void INLINE wdxGraphicsWindow::process_events(void) {
-  if(_window_inactive) {
+  if(!_window_active) {
       // Get 1 msg at a time until no more are left and we block and sleep,
-      // or message changes _return_control_to_app or _window_inactive status
+      // or message changes _return_control_to_app or _window_active status
 
-      while(_window_inactive && (!_return_control_to_app)) {
+      while(!_window_active && (!_return_control_to_app)) {
           process_1_event();
       }
       _return_control_to_app = false;
@@ -2669,39 +2654,6 @@ void INLINE wdxGraphicsWindow::process_events(void) {
   }
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: update
-//       Access:
-//  Description:
-////////////////////////////////////////////////////////////////////
-void wdxGraphicsWindow::update(void) {
-#ifdef DO_PSTATS
-  _show_code_pcollector.stop();
-
-  if(!_window_inactive) {
-      PStatClient::main_tick();
-  }
-#endif
-
-  process_events();
-
-  if(_window_inactive) {
-      // note _window_inactive must be checked after process_events is called, to avoid draw_callback being called
-      if(_idle_callback)
-          call_idle_callback();
-      return;
-  }
-
-  call_draw_callback(true);
-
-  if(_idle_callback)
-    call_idle_callback();
-
-#ifdef DO_PSTATS
-  _show_code_pcollector.start();
-#endif
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: wdxGraphicsWindow::get_gsg_type
 //       Access: Public, Virtual

+ 0 - 2
panda/src/wdxdisplay8/wdxGraphicsWindow8.h

@@ -63,8 +63,6 @@ public:
   wdxGraphicsWindow(GraphicsPipe* pipe,const GraphicsWindow::Properties& props,wdxGraphicsWindowGroup *pParentGroup);
 
   virtual ~wdxGraphicsWindow(void);
-  virtual bool supports_update() const;
-  virtual void update(void);
   virtual void end_frame( void );
 
   virtual TypeHandle get_gsg_type() const;

+ 11 - 59
panda/src/wgldisplay/wglGraphicsWindow.cxx

@@ -105,7 +105,7 @@ void wglGraphicsWindow::DestroyMe(bool bAtExitFnCalled) {
   if (!bAtExitFnCalled) {
       // to do gl releases, we need to have the context be current
       if ((_hdc!=NULL)&&(_context!=NULL)) {
-          // need to bypass make_current() since it checks _window_inactive which we need to ignore
+          // need to bypass make_current() since it checks _window_active which we need to ignore
           HGLRC current_context = wglGetCurrentContext();
           HDC current_dc = wglGetCurrentDC();
 
@@ -332,7 +332,7 @@ void wglGraphicsWindow::config() {
     _PandaPausedTimer = NULL;
     _context = NULL;
     _hdc = NULL;
-    _window_inactive = false;
+    _window_active = true;
     _pCurrent_display_settings = NULL;
     _mwindow = NULL;
     _gsg = NULL;
@@ -1298,11 +1298,11 @@ void INLINE process_1_event() {
 }
 
 void INLINE wglGraphicsWindow::process_events() {
-  if (_window_inactive) {
+  if (!_window_active) {
       // Get 1 msg at a time until no more are left and we block and sleep,
-      // or message changes _return_control_to_app or _window_inactive status
+      // or message changes _return_control_to_app or !_window_active status
 
-      while(_window_inactive && (!_return_control_to_app)) {
+      while(!_window_active && (!_return_control_to_app)) {
           process_1_event();
       }
       _return_control_to_app = false;
@@ -1317,61 +1317,13 @@ void INLINE wglGraphicsWindow::process_events() {
   }
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: wglGraphicsWindow::supports_update
-//       Access: Public, Virtual
-//  Description: Returns true if this particular kind of
-//               GraphicsWindow supports use of the update() function
-//               to update the graphics one frame at a time, so that
-//               the window does not need to be the program's main
-//               loop.  Returns false if the only way to update the
-//               window is to call main_loop().
-////////////////////////////////////////////////////////////////////
-bool wglGraphicsWindow::
-supports_update() const {
-  return true;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: update
-//       Access:
-//  Description:
-////////////////////////////////////////////////////////////////////
-void wglGraphicsWindow::update() {
-#ifdef DO_PSTATS
-  _show_code_pcollector.stop();
-
-  if (!_window_inactive) {
-      PStatClient::main_tick();
-  }
-#endif
-
-  process_events();
-
-  if (_window_inactive) {
-      // note _window_inactive must be checked after process_events is called, to avoid draw_callback being called
-      if (_idle_callback)
-          call_idle_callback();
-      return;
-  }
-
-  call_draw_callback(true);
-
-  if (_idle_callback)
-    call_idle_callback();
-
-#ifdef DO_PSTATS
-  _show_code_pcollector.start();
-#endif
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: make_current
 //       Access: Public
 //  Description:
 ////////////////////////////////////////////////////////////////////
 void wglGraphicsWindow::make_current() {
-  if ((_hdc==NULL)||(_context==NULL)||(_window_inactive)) {
+  if ((_hdc==NULL)||(_context==NULL)||(!_window_active)) {
       return;  // we're only allow unmake_current() to set this to NULL
   }
 
@@ -1474,7 +1426,7 @@ void wglGraphicsWindow::deactivate_window() {
     // current policy is to suspend minimized or deactivated fullscreen windows, but leave
     // regular windows running normally
 
-   if ((!_props._fullscreen) || _exiting_window || _window_inactive || _active_minimized_fullscreen) {
+   if ((!_props._fullscreen) || _exiting_window || !_window_active || _active_minimized_fullscreen) {
        #ifdef _DEBUG
           if (wgldisplay_cat.is_spam())
             wgldisplay_cat.spam()  << "deactivate_window called, but ignored in current mode"  << endl;
@@ -1488,7 +1440,7 @@ void wglGraphicsWindow::deactivate_window() {
        if (wgldisplay_cat.is_spam())
            wgldisplay_cat.spam() << "WGL window deactivated, releasing gl context and waiting...\n";
 
-      _window_inactive = true;
+      _window_active = false;
       unmake_current();
    } else {
        _active_minimized_fullscreen = true;
@@ -1528,11 +1480,11 @@ void wglGraphicsWindow::deactivate_window() {
 }
 
 void wglGraphicsWindow::reactivate_window() {
-    if (_window_inactive) {
+    if (!_window_active) {
         if (wgldisplay_cat.is_spam())
             wgldisplay_cat.spam() << "WGL window re-activated...\n";
 
-        _window_inactive = false;
+        _window_active = true;
 
         if (_PandaPausedTimer!=NULL) {
             KillTimer(_mwindow,_PandaPausedTimer);
@@ -1936,7 +1888,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
     break;
 
     case WM_TIMER:
-      if ((wparam==_PandaPausedTimer) && _window_inactive) {
+      if ((wparam==_PandaPausedTimer) && !_window_active) {
          //wgldisplay_cat.spam() << "returning control to app\n";
           _return_control_to_app = true;
          // throw_event("PandaPaused");

+ 0 - 3
panda/src/wgldisplay/wglGraphicsWindow.h

@@ -69,8 +69,6 @@ public:
              const GraphicsWindow::Properties& props);
   virtual ~wglGraphicsWindow();
 
-  virtual bool supports_update() const;
-  virtual void update();
   virtual void end_frame();
   virtual void swap();
   virtual int get_depth_bitwidth();
@@ -111,7 +109,6 @@ private:
   bool              _bIsLowVidMemCard;
   bool              _bLoadedCustomCursor;
 
-  bool              _window_inactive;
   bool              _active_minimized_fullscreen;
   bool              _return_control_to_app;
   bool              _exiting_window;