Added the automatic resize functionality for vnc_auto.html.

This commit is contained in:
samhed 2013-09-11 10:49:25 +02:00
parent 359f88a764
commit 0ac6c31ccf
2 changed files with 26 additions and 4 deletions

View File

@ -71,7 +71,18 @@
"input.js", "display.js", "jsunzip.js", "rfb.js"]);
var rfb;
var resizeTimeout;
function UIresize() {
// Control-bar height: 36px +
// border height: 5px = 41px to be deducted from the height
rfb.setDesktopSize(window.innerWidth, window.innerHeight - 41);
}
function FBUComplete(rfb, fbu) {
UIresize();
rfb.set_onFBUComplete(function() { });
}
function passwordRequired(rfb) {
var msg;
msg = '<form onsubmit="return setPassword();"';
@ -113,6 +124,16 @@
}
}
window.onresize = function () {
// When the window has been resized, wait until the size remains
// the same for 0.5 seconds before sending the request for changing
// the resolution of the session
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function(){
UIresize();
}, 500);
};
window.onscriptsload = function () {
var host, port, password, path, token;
@ -161,7 +182,8 @@
'shared': WebUtil.getQueryVar('shared', true),
'view_only': WebUtil.getQueryVar('view_only', false),
'updateState': updateState,
'onPasswordRequired': passwordRequired});
'onPasswordRequired': passwordRequired,
'onFBUComplete': FBUComplete});
rfb.connect(host, port, password, path);
};
</script>