升级到XULRunner 33后,为什么我无法将Cmd-Tab转换为Mac OS X 10.9上的应用程序窗口?

mak*_*dad 6 macos xulrunner

我有一个独立的XULRunner应用程序,以前运行的是XULRunner 1.9.2(旧的,我知道).我刚升级到XULRunner 33.

以前,当我在本地开发(的MacBook Pro与Mac OS X 10.9.5),我会经常Cmd+ Tab我的IDE和我的应用程序之间.

升级后,我不能再这样做了.我的桌面上仍然有一个窗口(如中所定义main.xul),但它不再出现在我的Cmd+ Tab列表中.我必须在桌面上"找到"它.

关闭窗口会退出应用程序等,而且我得到一个应用程序窗口的事实意味着我main.xul是正确的...但我不知道为什么会这样.

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://my-app-name/skin/css/main.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://my-app-name/locale/main.dtd">
<window id="main" title="&window-title;" width="750" height="530" persist="width,height,screenX,screenY,sizemode" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script><!-- MY APPLICATION CODE HERE --></script>

  <keyset>
    <key modifiers="accel" key="W" oncommand="window.close()"/>
    <key modifiers="accel" key="Q" id="quit"/>
  </keyset>

  <toolbox>
    <menubar>
      <menu id="menu_file" label="File" hidden="true">
        <menupopup>
          <menuitem id="menu_FileQuitItem" key="quit" label="Quit" oncommand="goQuitApplication();"/>
        </menupopup>
      </menu>
    </menubar>
  </toolbox>
</window>
Run Code Online (Sandbox Code Playgroud)

我已经阅读了XULRunner教程中的Windows和菜单:

XULRunner 1.9.2上的相同代码运行正常,我可以"激活"窗口.使用新的XULRunner,窗口标题在Mac OS X中显示为灰色,无法选择.

有什么想法尝试的想法?

我不知道它是否有用,但是当我选择窗口时,我也习惯在OS X中获得一个菜单栏.即使现在,如果我点击窗口的标题栏,OS X显示的菜单栏也不会显示我的应用程序菜单.

Ale*_*ara 2

我不知道更改了什么,也不知道他们何时更改,但这种行为在 MDN 上有所记录。

摘自XULRunner 入门

在 Mac 上,在一切完好无损地运行 XULRunner 应用程序之前,必须使用--install-appxulrunner 命令行标志安装它。安装应用程序会创建一个 OS X 应用程序包:

该页面继续介绍了如何执行此操作的一些步骤,但我始终无法让它们与现代 XULRunner 版本一起使用。

我能够让现代 XULRunner 版本完全运行的唯一方法是手动创建应用程序包。

在此示例中,我将使用MDN 文档中引用的“hello world”示例。

步骤1:

创建以下目录结构。

hello.app/
    Contents/
        MacOS/
        Resources/
Run Code Online (Sandbox Code Playgroud)

第2步:

下载您想要的 XULRunner 运行时版本(我使用的是 33),然后解压XUL.framework.

步骤3:

将里面的所有文件复制XUL.framework/Versions/Current/hello.app/Contents/MacOS/.

也复制dependentlibs.listhello.app/Contents/Resources/

步骤4:

下载示例文件,并将以下文件和目录复制到hello.app/Contents/Resources/.

  • chrome/
  • defaults/
  • application.ini
  • chrome.manifest

第5步:

由于另一个问题xulrunner二进制文件不会自动找到application.ini它应该找到的东西。为了解决这个问题,我们需要一个存根加载器,就像我之前写的那样。

#!/bin/sh

runpath="`dirname "$0"`"
contentsdir="`cd "$runpath"/.. > /dev/null && pwd`"
exec "$runpath/xulrunner" --app "$contentsdir/Resources/application.ini"
Run Code Online (Sandbox Code Playgroud)

创建一个名为helloat的新文件hello.app/Contents/MacOS/hello,将上面的代码放入其中,并赋予其可执行权限(chmod +x hello)。

第6步:

现在我们需要一个Info.plist文件。这是我根据部署 XULRunner示例创建的一个。请注意,CFBundleExecutable必须与上面的存根加载程序文件名匹配。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>hello</string>
    <key>CFBundleGetInfoString</key>
    <string>1.0</string>
    <key>CFBundleIconFile</key>
    <string>app_icon.icns</string>
    <key>CFBundleIdentifier</key>
    <string>net.yourcompany.yourapplication</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>applicationName</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

将此文件保存在hello.app/Info.plist.

第7步:

创建一个名为PkgInfoat的新文件hello.app/PkgInfo,并将此文本放入其中。

APPL????
Run Code Online (Sandbox Code Playgroud)

步骤8:

您现在应该能够使用菜单和文档图标以及Cmd+Tab功能来运行应用程序。您可以通过 Finder 或命令行打开它。

$ ./hello.app/Contents/MacOS/hello
Run Code Online (Sandbox Code Playgroud)