私はこのファイルをグーグルコードで次の関数で見つけました:
function SetAlwaysOnTop() {
var chkTop = document.getElementById("itmAlwaysOnTop");
var xulWin = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow);
if(chkTop.getAttribute("checked") == "true") {
xulWin.zLevel = xulWin.raisedZ;
} else {
xulWin.zLevel = xulWin.normalZ;
}
}
私が必要とする部分は次のとおりです。
var xulWin = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow);
xulWin.zLevel = xulWin.raisedZ;
しかし、Ciがどこで定義されているのかわかりません。それが何であるかについて何か考えはありますか?または、ウィンドウを常に一番上に設定する方法に関する他のアイデアはありますか?(「Windows専用」のソリューションは私には合いません)。
- アップデート
私はnsIWindowMediatorについて読んでいます。これには、ウィンドウのZオーダーを処理するためのいくつかのメソッドがあります。しかし、メソッドはjavascriptではなくc++から使用する必要があると言っています。つまり、コードはXPCOMコンポーネントから使用する必要があります(ウィンドウを開くにはXPCOMコンポーネントとして使用する必要があります)?すでにそれを使用した人は確認できますか?
とにかくまだ読んでいます。
- アップデート
nsIWindowMediator(XPCOMコンポーネントを使用)を試しましたが、Zレベルを設定しても何も起こりません。
それでも、窓を上に置く方法を探してください。
--'alwaysraised'で試行します:
test.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
onload="open('top.xul','GreenfoxChannelWindow','chrome, alwaysraised');"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="MAIN WINDOW"/>
</window>
top.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="ON TOP"/>
</window>
動作しませんでした。
--'zlevel'で試行:
test.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
onload="open('top.xul','GreenfoxChannelWindow','chrome');"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="MAIN WINDOW"/>
</window>
top.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300" zlevel="6"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="ON TOP"/>
</window>
動作しませんでした。常に上げられた設定、またはtest.xulに高いまたは低いzlevelを追加するNither(top.xul zlevel = "6"を使用)