How to show a window in the fastest way possible?
I have 3 main windows in my Xulrunner app that will be accessed very frequently. The application is running on a very slow system, so before the window shows up, I see a fully black box, and then the window appears, filling that black area.
As I'm in an embedded system, and the "minimize" animation is not shown, I did the window's minimize instead of closing, but it's still not showing up as fast as I wanted.
Is there a way to let a window lo开发者_运维百科ad in a buffer so that it appears more quickly? Or, how can I display this window in the fastest way possible?
--update
By the way, the windows have nothing heavy. One is a popup window with a "Loading" label, and I it still takes much time (about a second) to show up:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Style -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="loadingWindow" hidechrome="true"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox pack="center" align="center">
<label id="textLabel">Loading...</label>
</vbox>
</window>
I open it with:
openDialog("chrome://myapp/content/loading.xul", 'Loading', 'chrome, popup, centerscreen');
can you do native code?
createHiddenWindow()
alternatively, you could toy with creating a tiny, transparent window with the chrome hidden
It's not complete but for starters:
<?xml version="1.0"?>
<!--<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>-->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="1px" height="1px" hidechrome="true" style="max-width:1px; max-height:1px; opacity:0">
<description>blar</description>
</window>
can't you simply swap out all elements from the main window and replace them with the elements of the window you want to show? or, probably better yet, doing something similar with a deck?
I'm not sure that this is what you want, but it's possible to temporarily hide a window so that when you want it you can simply show it again. See nsMsgComposeService::ShowCachedComposeWindow for the general idea.
精彩评论