From 87f57dd710604cf8b5c835292a0ac16bd36499c9 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 13 Nov 2009 01:22:05 +0000 Subject: [PATCH] fix onwindowattach/detach --- direct/src/p3d/AppRunner.py | 1 + direct/src/plugin/p3dInstance.cxx | 5 +++++ direct/src/plugin/p3dOsxSplashWindow.cxx | 11 +++++++---- direct/src/plugin/p3dSplashWindow.I | 11 +++++++++++ direct/src/plugin/p3dSplashWindow.h | 1 + 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/direct/src/p3d/AppRunner.py b/direct/src/p3d/AppRunner.py index a18bc3e0df..ee3d4bb662 100644 --- a/direct/src/p3d/AppRunner.py +++ b/direct/src/p3d/AppRunner.py @@ -729,6 +729,7 @@ class AppRunner(DirectObject): if windowType == 'embedded': wp.setParentWindow(parent) base.win.requestProperties(wp) + self.windowProperties = wp return # If we haven't got a window already, start 'er up. Apply the diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 891150ea12..8f85444615 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -2740,6 +2740,11 @@ void P3DInstance:: paint_window() { #ifdef __APPLE__ 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; } diff --git a/direct/src/plugin/p3dOsxSplashWindow.cxx b/direct/src/plugin/p3dOsxSplashWindow.cxx index faea0b8c24..0a4ebb2b9e 100644 --- a/direct/src/plugin/p3dOsxSplashWindow.cxx +++ b/direct/src/plugin/p3dOsxSplashWindow.cxx @@ -127,11 +127,14 @@ void P3DOsxSplashWindow:: set_visible(bool 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(); } //////////////////////////////////////////////////////////////////// diff --git a/direct/src/plugin/p3dSplashWindow.I b/direct/src/plugin/p3dSplashWindow.I index 0859faa8e4..a26403cbf3 100755 --- a/direct/src/plugin/p3dSplashWindow.I +++ b/direct/src/plugin/p3dSplashWindow.I @@ -33,6 +33,17 @@ get_wparams() const { 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 // Access: Public diff --git a/direct/src/plugin/p3dSplashWindow.h b/direct/src/plugin/p3dSplashWindow.h index 0f804b7be1..6d66d14a05 100755 --- a/direct/src/plugin/p3dSplashWindow.h +++ b/direct/src/plugin/p3dSplashWindow.h @@ -42,6 +42,7 @@ public: inline const P3DWindowParams &get_wparams() const; virtual void set_visible(bool visible); + inline bool get_visible() const; enum ImagePlacement { IP_background,