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 += ' +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