xulRunner 1.9, Mac OS X and the fullScreen issue
Scritto da Marco Balestra Tue, 26 Aug 2008 08:07:00 GMT
Mi scuso per l’uso dell’inglese, ma la natura di questo post è abbastanza tecnica da richiederlo.
A note for Italian speaking people: have my apologies for using English on an Italian site, but this is a technical post, and it's better to use English for it.
Having xulRunner 1.9 fullScreen on Mac (Kiosk mode) is actually an issue, by the way I found a solution…
On all platforms the command fullScreen=true has no effect; this was already true with xulRunner 1.8.*, and there is a well-known work-around:
setTimeout("window.fullScreen=true;",10)
By deferring the command, it works. On Mac OS X this has no immediate effect, you have to open the window a second time.
Moreover, if you have the typical developer preference to reload XUL, it won’t have effect at all.
In any case on Mac OS X, even with such limitation, the titlebar will stay…
Using xulRunner 1.8 it was possible to hide also the titlebar with an openDialog, but this is no longer true in xulRunner 1.9
How-to
The fullscreen window
It’s necessary to open the fullscreen window directly in fullscreen, using another window object as a launcher, because it seems to be impossible to swith a already opened window to fullscreen.
The window to be opened placing/sizing needs be determined at open time only, otherwise it will conflict with window atributes.
This window will be very simple, it won’t report any of sizing attributes:sizemode, width, height, screenX and screenY must be omitted.
Obviously we’ll also omit them from the persist window attribute, if any.
Note: don’t forget to include the hidechrome="true" attribute.
<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://main/locale/main.dtd" > <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="myFullScreenWindow" hidechrome="true" onload="myOnloadCode()" >
The opener code
In the opener window we’ll issue a command like:
var uri = 'chrome://main/content/fullscreen.xul'; var winName = 'fullscreenWindow', var winFeatures = 'chrome,dependent,top=0,left=0,width=800,height=600'; winFeatures += ",titlebar=no,fullscreen=yes"; window.open(uri,winName,winFeatures );
Note: It’s also possible to use window.openDialog() instead of window.open().
That’s all.