mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
more mac app focus issues
This commit is contained in:
parent
8795e86f45
commit
2eeed7bbd6
@ -14,9 +14,10 @@ var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : f
|
|||||||
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
|
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
|
||||||
|
|
||||||
|
|
||||||
function P3D_Generateobj(objAttrs, params, embedAttrs)
|
function P3D_Generateobj(objAttrs, params, embedAttrs, imageAttrs)
|
||||||
{
|
{
|
||||||
var str = '';
|
var str = '';
|
||||||
|
|
||||||
if (isIE && isWin && !isOpera)
|
if (isIE && isWin && !isOpera)
|
||||||
{
|
{
|
||||||
str += '<object ';
|
str += '<object ';
|
||||||
@ -29,27 +30,35 @@ function P3D_Generateobj(objAttrs, params, embedAttrs)
|
|||||||
{
|
{
|
||||||
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
|
str += '<param name="' + i + '" value="' + params[i] + '" /> ';
|
||||||
}
|
}
|
||||||
str += '</object>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str += '<embed ';
|
str += '<object ';
|
||||||
for (var i in embedAttrs)
|
for (var i in embedAttrs)
|
||||||
{
|
{
|
||||||
str += i + '="' + embedAttrs[i] + '" ';
|
str += i + '="' + embedAttrs[i] + '" ';
|
||||||
}
|
}
|
||||||
str += '> </embed>';
|
str += '> ';
|
||||||
}
|
}
|
||||||
|
if (imageAttrs["src"]) {
|
||||||
|
str += '<img ';
|
||||||
|
for (var i in imageAttrs)
|
||||||
|
{
|
||||||
|
str += i + '="' + imageAttrs[i] + '" ';
|
||||||
|
}
|
||||||
|
str += '>';
|
||||||
|
}
|
||||||
|
str += '</object>';
|
||||||
|
|
||||||
document.write(str);
|
document.write(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function P3D_RunContent(){
|
function P3D_RunContent() {
|
||||||
var ret =
|
var ret =
|
||||||
P3D_GetArgs
|
P3D_GetArgs
|
||||||
(arguments, "clsid:924b4927-d3ba-41ea-9f7e-8a89194ab3ac",
|
(arguments, "clsid:924b4927-d3ba-41ea-9f7e-8a89194ab3ac",
|
||||||
"application/x-panda3d");
|
"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){
|
function P3D_GetArgs(args, classid, mimeType){
|
||||||
@ -57,6 +66,7 @@ function P3D_GetArgs(args, classid, mimeType){
|
|||||||
ret.embedAttrs = new Object();
|
ret.embedAttrs = new Object();
|
||||||
ret.params = new Object();
|
ret.params = new Object();
|
||||||
ret.objAttrs = new Object();
|
ret.objAttrs = new Object();
|
||||||
|
ret.imageAttrs = new Object();
|
||||||
|
|
||||||
for (var i = 0; i < args.length; i = i + 2){
|
for (var i = 0; i < args.length; i = i + 2){
|
||||||
var currArg = args[i].toLowerCase();
|
var currArg = args[i].toLowerCase();
|
||||||
@ -64,7 +74,7 @@ function P3D_GetArgs(args, classid, mimeType){
|
|||||||
switch (currArg){
|
switch (currArg){
|
||||||
case "src":
|
case "src":
|
||||||
case "data":
|
case "data":
|
||||||
ret.embedAttrs['src'] = args[i+1];
|
ret.embedAttrs['data'] = args[i+1];
|
||||||
ret.params['data'] = args[i+1];
|
ret.params['data'] = args[i+1];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -72,9 +82,19 @@ function P3D_GetArgs(args, classid, mimeType){
|
|||||||
ret.objAttrs['codebase'] = args[i+1];
|
ret.objAttrs['codebase'] = args[i+1];
|
||||||
break;
|
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 "width":
|
||||||
case "height":
|
case "height":
|
||||||
|
ret.imageAttrs[args[i]] = ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "id":
|
||||||
case "align":
|
case "align":
|
||||||
case "vspace":
|
case "vspace":
|
||||||
case "hspace":
|
case "hspace":
|
||||||
|
@ -2694,11 +2694,22 @@ class Packager:
|
|||||||
# includes specifications in the plist file to avoid
|
# includes specifications in the plist file to avoid
|
||||||
# creating a dock icon and stuff.
|
# creating a dock icon and stuff.
|
||||||
|
|
||||||
|
resources = []
|
||||||
|
|
||||||
# Find p3dpython.plist in the direct source tree.
|
# Find p3dpython.plist in the direct source tree.
|
||||||
import direct
|
import direct
|
||||||
plist = Filename(direct.__path__[0], 'plugin/p3dpython.plist')
|
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',
|
self.do_makeBundle('P3DPython.app', plist, executable = 'p3dpython',
|
||||||
dependencyDir = '')
|
resources = resources, dependencyDir = '')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Anywhere else, we just ship the executable file p3dcert.exe.
|
# Anywhere else, we just ship the executable file p3dcert.exe.
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
User32.lib
|
User32.lib
|
||||||
|
|
||||||
#define SOURCES \
|
#define SOURCES \
|
||||||
showBase.cxx showBase.h
|
showBase.cxx showBase.h \
|
||||||
|
$[if $[IS_OSX],showBase_assist.mm]
|
||||||
|
|
||||||
#define IGATESCAN all
|
#define IGATESCAN all
|
||||||
#end lib_target
|
#end lib_target
|
||||||
|
@ -8,8 +8,10 @@ def wxLoop(self):
|
|||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
def spawnWxLoop():
|
def spawnWxLoop():
|
||||||
if hasattr(base, 'wxApp') and base.wxApp:
|
if not getattr(base, 'wxApp', None):
|
||||||
base.wxApp.Exit()
|
# Create a new base.wxApp, but only if it's not already
|
||||||
base.wxApp = wx.App(False)
|
# created.
|
||||||
|
base.wxApp = wx.App(False)
|
||||||
|
|
||||||
# Spawn this task
|
# Spawn this task
|
||||||
taskMgr.add(wxLoop, "wxLoop")
|
taskMgr.add(wxLoop, "wxLoop")
|
||||||
|
@ -11,6 +11,15 @@
|
|||||||
// with this source code in a file named "LICENSE."
|
// 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 <Carbon/Carbon.h>
|
||||||
|
extern "C" { void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "showBase.h"
|
#include "showBase.h"
|
||||||
|
|
||||||
@ -59,8 +68,17 @@ get_config_showbase() {
|
|||||||
// At the moment, this is a no-op except on Mac.
|
// At the moment, this is a no-op except on Mac.
|
||||||
void
|
void
|
||||||
init_app_for_gui() {
|
init_app_for_gui() {
|
||||||
// Actually, this may not be necessary after all. Let's assume the
|
#ifdef IS_OSX
|
||||||
// user will always be running from a bundle or from pythonw.
|
// 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;
|
static bool initted_for_gui = false;
|
||||||
if (!initted_for_gui) {
|
if (!initted_for_gui) {
|
||||||
|
@ -51,6 +51,10 @@ EXPCL_DIRECT bool query_fullscreen_testresult(int xsize, int ysize);
|
|||||||
EXPCL_DIRECT void store_accessibility_shortcut_keys();
|
EXPCL_DIRECT void store_accessibility_shortcut_keys();
|
||||||
EXPCL_DIRECT void allow_accessibility_shortcut_keys(bool allowKeys);
|
EXPCL_DIRECT void allow_accessibility_shortcut_keys(bool allowKeys);
|
||||||
|
|
||||||
|
#ifdef IS_OSX
|
||||||
|
void activate_osx_application();
|
||||||
|
#endif
|
||||||
|
|
||||||
END_PUBLISH
|
END_PUBLISH
|
||||||
|
|
||||||
|
|
||||||
|
19
direct/src/showbase/showBase_assist.mm
Normal file
19
direct/src/showbase/showBase_assist.mm
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef CPPPARSER
|
||||||
|
#include "showBase.h"
|
||||||
|
|
||||||
|
#ifdef IS_OSX
|
||||||
|
|
||||||
|
#include <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// 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
|
Loading…
x
Reference in New Issue
Block a user