diff --git a/direct/src/directscripts/RunPanda3D.js b/direct/src/directscripts/RunPanda3D.js
index 943bc31914..4b3d6f23a1 100644
--- a/direct/src/directscripts/RunPanda3D.js
+++ b/direct/src/directscripts/RunPanda3D.js
@@ -14,9 +14,10 @@ var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : f
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
-function P3D_Generateobj(objAttrs, params, embedAttrs)
+function P3D_Generateobj(objAttrs, params, embedAttrs, imageAttrs)
{
var str = '';
+
if (isIE && isWin && !isOpera)
{
str += ' ';
}
- str += '';
}
else
{
- str += '';
+ str += '> ';
}
+ if (imageAttrs["src"]) {
+ str += '';
+ }
+ str += '';
document.write(str);
}
-function P3D_RunContent(){
+function P3D_RunContent() {
var ret =
P3D_GetArgs
(arguments, "clsid:924b4927-d3ba-41ea-9f7e-8a89194ab3ac",
"application/x-panda3d");
- P3D_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
+ P3D_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs, ret.imageAttrs);
}
function P3D_GetArgs(args, classid, mimeType){
@@ -57,6 +66,7 @@ function P3D_GetArgs(args, classid, mimeType){
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
+ ret.imageAttrs = new Object();
for (var i = 0; i < args.length; i = i + 2){
var currArg = args[i].toLowerCase();
@@ -64,7 +74,7 @@ function P3D_GetArgs(args, classid, mimeType){
switch (currArg){
case "src":
case "data":
- ret.embedAttrs['src'] = args[i+1];
+ ret.embedAttrs['data'] = args[i+1];
ret.params['data'] = args[i+1];
break;
@@ -72,9 +82,19 @@ function P3D_GetArgs(args, classid, mimeType){
ret.objAttrs['codebase'] = args[i+1];
break;
- case "id":
+ case "noplugin_img":
+ ret.imageAttrs["src"] = args[i+1];
+ break;
+
+ case "splash_img":
+ ret.imageAttrs["src"] = ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
+
case "width":
case "height":
+ ret.imageAttrs[args[i]] = ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
+ break;
+
+ case "id":
case "align":
case "vspace":
case "hspace":
diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py
index 63e136e7e0..1f02acffbf 100644
--- a/direct/src/p3d/Packager.py
+++ b/direct/src/p3d/Packager.py
@@ -2694,11 +2694,22 @@ class Packager:
# includes specifications in the plist file to avoid
# creating a dock icon and stuff.
+ resources = []
+
# Find p3dpython.plist in the direct source tree.
import direct
plist = Filename(direct.__path__[0], 'plugin/p3dpython.plist')
+
+## # Find panda3d.icns in the models tree.
+## filename = Filename('plugin_images/panda3d.icns')
+## found = filename.resolveFilename(getModelPath().getValue())
+## if not found:
+## found = filename.resolveFilename("models")
+## if found:
+## resources.append(filename)
+
self.do_makeBundle('P3DPython.app', plist, executable = 'p3dpython',
- dependencyDir = '')
+ resources = resources, dependencyDir = '')
else:
# Anywhere else, we just ship the executable file p3dcert.exe.
diff --git a/direct/src/showbase/Sources.pp b/direct/src/showbase/Sources.pp
index a19ee99b5a..574e023c21 100644
--- a/direct/src/showbase/Sources.pp
+++ b/direct/src/showbase/Sources.pp
@@ -16,7 +16,8 @@
User32.lib
#define SOURCES \
- showBase.cxx showBase.h
+ showBase.cxx showBase.h \
+ $[if $[IS_OSX],showBase_assist.mm]
#define IGATESCAN all
#end lib_target
diff --git a/direct/src/showbase/WxGlobal.py b/direct/src/showbase/WxGlobal.py
index 4ab31c4df6..17a4a4efa1 100755
--- a/direct/src/showbase/WxGlobal.py
+++ b/direct/src/showbase/WxGlobal.py
@@ -8,8 +8,10 @@ def wxLoop(self):
return Task.cont
def spawnWxLoop():
- if hasattr(base, 'wxApp') and base.wxApp:
- base.wxApp.Exit()
- base.wxApp = wx.App(False)
+ if not getattr(base, 'wxApp', None):
+ # Create a new base.wxApp, but only if it's not already
+ # created.
+ base.wxApp = wx.App(False)
+
# Spawn this task
taskMgr.add(wxLoop, "wxLoop")
diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx
index 4ea6a510bc..c2051023da 100644
--- a/direct/src/showbase/showBase.cxx
+++ b/direct/src/showbase/showBase.cxx
@@ -11,6 +11,15 @@
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
+
+#ifdef __APPLE__
+// We have to include this before we include any Panda libraries,
+// because one of the things we pick up in Panda defines a macro for
+// TCP_NODELAY and friends, causing heartaches for the header files
+// picked up here.
+#include
+extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
+#endif
#include "showBase.h"
@@ -59,8 +68,17 @@ get_config_showbase() {
// At the moment, this is a no-op except on Mac.
void
init_app_for_gui() {
- // Actually, this may not be necessary after all. Let's assume the
- // user will always be running from a bundle or from pythonw.
+#ifdef IS_OSX
+ // Rudely bring the application to the foreground. This is
+ // particularly important when running wx via the plugin, since the
+ // plugin app is seen as separate from the browser app, even though
+ // the user sees them as the same thing. We need to bring the
+ // plugin app to the foreground to make its wx windows visible.
+ activate_osx_application();
+#endif
+
+ // We don't appear need to do the following, however, if we launch
+ // the plugin correctly from its own bundle.
/*
static bool initted_for_gui = false;
if (!initted_for_gui) {
diff --git a/direct/src/showbase/showBase.h b/direct/src/showbase/showBase.h
index 68c2667682..8b9c24f40a 100644
--- a/direct/src/showbase/showBase.h
+++ b/direct/src/showbase/showBase.h
@@ -51,6 +51,10 @@ EXPCL_DIRECT bool query_fullscreen_testresult(int xsize, int ysize);
EXPCL_DIRECT void store_accessibility_shortcut_keys();
EXPCL_DIRECT void allow_accessibility_shortcut_keys(bool allowKeys);
+#ifdef IS_OSX
+void activate_osx_application();
+#endif
+
END_PUBLISH
diff --git a/direct/src/showbase/showBase_assist.mm b/direct/src/showbase/showBase_assist.mm
new file mode 100644
index 0000000000..2eb8c0c3bc
--- /dev/null
+++ b/direct/src/showbase/showBase_assist.mm
@@ -0,0 +1,19 @@
+#ifndef CPPPARSER
+#include "showBase.h"
+
+#ifdef IS_OSX
+
+#include
+
+////////////////////////////////////////////////////////////////////
+// Function: activate_osx_application
+// Description: Activates the current application for Mac OSX.
+////////////////////////////////////////////////////////////////////
+void
+activate_osx_application() {
+ cerr << "activate_osx_application\n";
+ [ [NSApplication sharedApplication] activateIgnoringOtherApps: YES ];
+}
+
+#endif // IS_OSX
+#endif // CPPPARSER