diff --git a/direct/src/p3d/packp3d.py b/direct/src/p3d/packp3d.py index 57bb271b25..faf9d556be 100755 --- a/direct/src/p3d/packp3d.py +++ b/direct/src/p3d/packp3d.py @@ -37,11 +37,9 @@ Options: all be combined in the first file. If the private key is encrypted, the password will be required to decrypt it. - -A - Sets the auto-start flag in the application, so that the user - will not need to click the green play button before it starts, - when embedded in a web page. This can also be set on the HTML - page. + -c config=value + Sets the indicated config flag in the application. This option + may be repeated as necessary. -r package Names an additional package that this application requires at @@ -78,14 +76,14 @@ class ArgumentError(StandardError): pass def makePackedApp(args): - opts, args = getopt.getopt(args, 'd:m:S:Ar:s:Dh') + opts, args = getopt.getopt(args, 'd:m:S:c:r:s:Dh') packager = Packager.Packager() root = Filename('.') main = None signParams = [] - autoStart = False + configFlags = [] requires = [] allowPythonDev = False @@ -96,8 +94,8 @@ def makePackedApp(args): main = value elif option == '-S': signParams.append(value) - elif option == '-A': - autoStart = True + elif option == '-c': + configFlags.append(value.split('=', 1)) elif option == '-r': requires.append(value) elif option == '-s': @@ -155,8 +153,8 @@ def makePackedApp(args): name, version, host = tokens packager.do_require(name, version = version, host = host) - if autoStart: - packager.do_config(auto_start = True) + if configFlags: + packager.do_config(**dict(configFlags)) packager.do_dir(root) packager.do_mainModule(mainModule) diff --git a/direct/src/plugin/Sources.pp b/direct/src/plugin/Sources.pp index 445637b4dd..d9f01479bd 100644 --- a/direct/src/plugin/Sources.pp +++ b/direct/src/plugin/Sources.pp @@ -163,6 +163,7 @@ // If you have to link with a static Python library, define it here. #define EXTRA_LIBS $[EXTRA_P3DPYTHON_LIBS] + #define OSX_SYS_FRAMEWORKS Carbon #define WIN_SYS_LIBS user32.lib #end bin_target diff --git a/direct/src/plugin/p3dPythonMain.cxx b/direct/src/plugin/p3dPythonMain.cxx index 3324111982..fd26a17dc0 100644 --- a/direct/src/plugin/p3dPythonMain.cxx +++ b/direct/src/plugin/p3dPythonMain.cxx @@ -18,6 +18,11 @@ #include #include // strrchr using namespace std; + +#ifdef __APPLE__ +#include +extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); } +#endif //////////////////////////////////////////////////////////////////// // Function: main @@ -80,6 +85,16 @@ main(int argc, char *argv[]) { } } +#ifdef __APPLE__ + // In case the application is going to run a wx app, allow it to + // have access to the desktop. + ProcessSerialNumber psn; + + GetCurrentProcess(&psn); + CPSEnableForegroundOperation(&psn); + SetFrontProcess(&psn); +#endif + if (!run_p3dpython(program_name, archive_file, input_handle, output_handle, NULL, interactive_console)) { cerr << "Failure on startup.\n"; diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index 744397f991..fbc949d978 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -975,6 +975,7 @@ class Freezer: # It's actually a package. In this case, we really write # the file moduleName/__init__.py. filename += '/__init__' + moduleDirs[moduleName] = True # Ensure we don't have an implicit filename from above. multifile.removeSubfile(filename + '.py')