fixed some errors in the logic from my last commit, also some minor indentation fixes

This commit is contained in:
Samuel Mannehed 2013-06-25 13:10:39 +02:00
parent 0bb4537529
commit b0871c124e
2 changed files with 29 additions and 24 deletions

View File

@ -1,6 +1,7 @@
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* Licensed under MPL 2.0 (see LICENSE.txt) * Licensed under MPL 2.0 (see LICENSE.txt)
* *
* See README.md for usage and integration instructions. * See README.md for usage and integration instructions.
@ -1594,34 +1595,37 @@ encHandlers.ext_desktop_size = function () {
//Util.Debug(">> ext_desktop_size"); //Util.Debug(">> ext_desktop_size");
if (ws.rQwait("ext_desktop_size", 4)) { return false; } if (ws.rQwait("ext_desktop_size", 4)) { return false; }
supportsSetDesktopSize = true;
var number_of_screens = ws.rQshift8(); var number_of_screens = ws.rQshift8();
ws.rQshift8(); // padding ws.rQshift8(); // padding
ws.rQshift16(); // padding ws.rQshift16(); // padding
for (var i=0; i<number_of_screens; i += 1) { for (var i=0; i<number_of_screens; i += 1) {
screen_id = ws.rQshift32(); // id // Save the id and flags of the first screen
ws.rQshift16(); // x-position if (i == 0) {
ws.rQshift16(); // y-position screen_id = ws.rQshift32(); // id
ws.rQshift16(); // width ws.rQshift16(); // x-position
ws.rQshift16(); // height ws.rQshift16(); // y-position
screen_flags = ws.rQshift32(); // flags ws.rQshift16(); // width
} ws.rQshift16(); // height
screen_flags = ws.rQshift32(); // flags
if (FBU.x == 0) { } else {
fb_width = FBU.width; ws.rQshiftBytes(16);
fb_height = FBU.height;
conf.onFBResize(that, fb_width, fb_height);
display.resize(fb_width, fb_height);
timing.fbu_rt_start = (new Date()).getTime();
// Send a new non-incremental request
ws.send(fbUpdateRequests());
if (FBU.y == 0) {
supportsSetDesktopSize = true;
} }
} }
if (FBU.x == 0 && FBU.y != 0) { return false; }
fb_width = FBU.width;
fb_height = FBU.height;
conf.onFBResize(that, fb_width, fb_height);
display.resize(fb_width, fb_height);
timing.fbu_rt_start = (new Date()).getTime();
// Send a new non-incremental request
ws.send(fbUpdateRequests());
FBU.bytes = 0; FBU.bytes = 0;
FBU.rects -= 1; FBU.rects -= 1;

View File

@ -1,6 +1,7 @@
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* Licensed under MPL 2.0 (see LICENSE.txt) * Licensed under MPL 2.0 (see LICENSE.txt)
* *
* See README.md for usage and integration instructions. * See README.md for usage and integration instructions.
@ -39,10 +40,10 @@ load: function (callback) {
onresize: function (callback) { onresize: function (callback) {
clearTimeout(resizeTimeout); clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function(){ resizeTimeout = setTimeout(function(){
// Control-bar height: 44px + // Control-bar height: 44px +
// Status-bar height: 24px + // Status-bar height: 24px +
// border height: 5px = 73px to be deducted from the height // border height: 5px = 73px to be deducted from the height
UI.rfb.setDesktopSize(window.innerWidth, window.innerHeight - 73); UI.rfb.setDesktopSize(window.innerWidth, window.innerHeight - 73);
}, 500); }, 500);
}, },
@ -465,7 +466,7 @@ updateState: function(rfb, state, oldstate, msg) {
// When reconnecting to an existing session, // When reconnecting to an existing session,
// make sure the resolution is updated to the window size // make sure the resolution is updated to the window size
if (oldstate === 'ServerInitialisation') { if (oldstate === 'ServerInitialisation') {
onresize(); onresize();
} }
klass = "noVNC_status_normal"; klass = "noVNC_status_normal";
break; break;