How to show a window in the fastest way possible?
Asked Answered
C

3

6

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 load 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');
Chatty answered 2/5, 2011 at 16:38 Comment(0)
W
3

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>
Workmanlike answered 3/5, 2011 at 4:12 Comment(2)
Yes, I can do native code (a xpcom), but how can I specify to this funciton the path of my xul file to load in the window? Also, I'll try the tiny, transparent window approach, thanks!Chatty
yeah, i really don't know, but i thought that might point you in the right direction.Workmanlike
U
1

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?

Unquote answered 3/5, 2011 at 6:10 Comment(4)
Actually not, they are small information windows (popup windows) that need to show up in front of any other opened window.Chatty
The complication in the approach of moving the window outside the screen is the focus, the window may become focused and the user will not know where the focus is. Maybe if I could also switch the window as focusable/non-focusable..Chatty
Actually, for one of my 3 windows, a popup window, it works, as it never takes focus. But for the other two windows I will need another approach.Chatty
I suppose you tried the following: window.onfocus = function() if (window.isHiddenOutsideScreen) window.blur(); // or mainWindow.focus(); or windowThatShouldBeFocused.focus();Unquote
N
0

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.

Natelson answered 12/5, 2011 at 19:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.