Browse Source

fix onwindowattach/detach

David Rose 16 years ago
parent
commit
87f57dd710

+ 1 - 0
direct/src/p3d/AppRunner.py

@@ -729,6 +729,7 @@ class AppRunner(DirectObject):
             if windowType == 'embedded':
             if windowType == 'embedded':
                 wp.setParentWindow(parent)
                 wp.setParentWindow(parent)
             base.win.requestProperties(wp)
             base.win.requestProperties(wp)
+            self.windowProperties = wp
             return
             return
 
 
         # If we haven't got a window already, start 'er up.  Apply the
         # If we haven't got a window already, start 'er up.  Apply the

+ 5 - 0
direct/src/plugin/p3dInstance.cxx

@@ -2740,6 +2740,11 @@ void P3DInstance::
 paint_window() {
 paint_window() {
 #ifdef __APPLE__
 #ifdef __APPLE__
   if (_swbuffer == NULL || !_instance_window_opened) {
   if (_swbuffer == NULL || !_instance_window_opened) {
+    // We don't have a Panda3D window yet.
+    return;
+  }
+  if (_splash_window != NULL && _splash_window->get_visible()) {
+    // If the splash window is up, don't draw the Panda3D window.
     return;
     return;
   }
   }
 
 

+ 7 - 4
direct/src/plugin/p3dOsxSplashWindow.cxx

@@ -127,11 +127,14 @@ void P3DOsxSplashWindow::
 set_visible(bool visible) {
 set_visible(bool visible) {
   P3DSplashWindow::set_visible(visible);
   P3DSplashWindow::set_visible(visible);
 
 
-  if (_visible) {
-    ShowWindow(_toplevel_window);
-  } else {
-    HideWindow(_toplevel_window);
+  if (_toplevel_window != NULL) {
+    if (_visible) {
+      ShowWindow(_toplevel_window);
+    } else {
+      HideWindow(_toplevel_window);
+    }
   }
   }
+  refresh();
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 11 - 0
direct/src/plugin/p3dSplashWindow.I

@@ -33,6 +33,17 @@ get_wparams() const {
   return _wparams;
   return _wparams;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: P3DSplashWindow::get_visible
+//       Access: Public
+//  Description: Returns the current setting of the "visible" flag.
+//               If false, the splash window is hidden.
+////////////////////////////////////////////////////////////////////
+inline bool P3DSplashWindow::
+get_visible() const {
+  return _visible;
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: P3DSplashWindow::ImageData::Constructor
 //     Function: P3DSplashWindow::ImageData::Constructor
 //       Access: Public
 //       Access: Public

+ 1 - 0
direct/src/plugin/p3dSplashWindow.h

@@ -42,6 +42,7 @@ public:
   inline const P3DWindowParams &get_wparams() const;
   inline const P3DWindowParams &get_wparams() const;
 
 
   virtual void set_visible(bool visible);
   virtual void set_visible(bool visible);
+  inline bool get_visible() const;
 
 
   enum ImagePlacement {
   enum ImagePlacement {
     IP_background,
     IP_background,