}
if (args.fullscreen) {
- setTimeout(function() {
+ // In some browser / OS combinations (E.g. Chrome on Windows), the
+ // window initially opens slighly too big. The width and heigh options
+ // seem to control the area inside the browser window, so what with
+ // scroll-bars, etc. the actual window is bigger than the screen.
+ // Therefore, we need to fix things up after the window is open.
+ var hackcount = 100;
+ var get_size_exactly_right = function() {
windowobj.moveTo(0, 0);
- windowobj.resizeTo(screen.availWidth, screen.availHeight)
- }, 0);
+ windowobj.resizeTo(screen.availWidth, screen.availHeight);
+
+ // Unfortunately, it seems that in Chrome on Ubuntu, if you call
+ // something like windowobj.resizeTo(1280, 1024) too soon (up to
+ // about 50ms) after the window is open, then it actually behaves
+ // as if you called windowobj.resizeTo(0, 0). Therefore, we need to
+ // check that the resize actually worked, and if not, repeatedly try
+ // again after a short delay until it works (but with a limit of
+ // hackcount repeats.
+ if (hackcount > 0 && (windowobj.innerHeight < 10 || windowobj.innerWidth < 10)) {
+ hackcount -= 1;
+ setTimeout(get_size_exactly_right, 10);
+ }
+ }
+ setTimeout(get_size_exactly_right, 0);
}
windowobj.focus();