View | Details | Raw Unified | Return to bug 4642
Collapse All | Expand All

(-)webaccess/noVNC/include/rfb.js (-1 / +70 lines)
Lines 63-69 Link Here
63
        //['JPEG_quality_hi',   -23 ],
63
        //['JPEG_quality_hi',   -23 ],
64
        //['compress_lo',      -255 ],
64
        //['compress_lo',      -255 ],
65
        ['compress_hi',        -247 ],
65
        ['compress_hi',        -247 ],
66
        ['last_rect',          -224 ]
66
        ['last_rect',          -224 ],
67
        ['ext_desktop_size',   -308 ]
67
        ],
68
        ],
68
69
69
    encHandlers    = {},
70
    encHandlers    = {},
Lines 120-125 Link Here
120
121
121
    test_mode        = false,
122
    test_mode        = false,
122
123
124
    supportsSetDesktopSize = false,
125
    screen_id              = 0,
126
    screen_flags           = 0,
127
123
    def_con_timeout  = Websock_native ? 2 : 5,
128
    def_con_timeout  = Websock_native ? 2 : 5,
124
129
125
    /* Mouse state */
130
    /* Mouse state */
Lines 1589-1594 Link Here
1589
    return true;
1594
    return true;
1590
};
1595
};
1591
1596
1597
encHandlers.ext_desktop_size = function () {
1598
    //Util.Debug(">> ext_desktop_size");    
1599
    if (ws.rQwait("ext_desktop_size", 4)) { return false; }
1600
1601
    var number_of_screens = ws.rQshift8();
1602
1603
    ws.rQshift8();  // padding
1604
    ws.rQshift16(); // padding
1605
    
1606
    for (var i=0; i<number_of_screens; i += 1) {
1607
	screen_id = ws.rQshift32();    // id
1608
	ws.rQshift16();                // x-position
1609
	ws.rQshift16();                // y-position
1610
	ws.rQshift16();                // width
1611
	ws.rQshift16();                // height
1612
	screen_flags = ws.rQshift32(); // flags
1613
    }
1614
1615
    if (FBU.x == 0) {
1616
        fb_width = FBU.width;
1617
        fb_height = FBU.height;
1618
        conf.onFBResize(that, fb_width, fb_height);
1619
        display.resize(fb_width, fb_height);
1620
        timing.fbu_rt_start = (new Date()).getTime();
1621
        // Send a new non-incremental request
1622
        ws.send(fbUpdateRequests());
1623
1624
        if (FBU.y == 0) {
1625
            supportsSetDesktopSize = true;
1626
        }
1627
    }
1628
1629
    FBU.bytes = 0;
1630
    FBU.rects -= 1;
1631
1632
    //Util.Debug("<< ext_desktop_size");
1633
    return true;
1634
};
1635
1592
encHandlers.DesktopSize = function set_desktopsize() {
1636
encHandlers.DesktopSize = function set_desktopsize() {
1593
    Util.Debug(">> set_desktopsize");
1637
    Util.Debug(">> set_desktopsize");
1594
    fb_width = FBU.width;
1638
    fb_width = FBU.width;
Lines 1851-1856 Link Here
1851
    //Util.Debug("<< clipboardPasteFrom");
1895
    //Util.Debug("<< clipboardPasteFrom");
1852
};
1896
};
1853
1897
1898
that.setDesktopSize = function(width, height) {
1899
    if (rfb_state !== "normal") { return; }
1900
    
1901
    if (supportsSetDesktopSize) {
1902
	
1903
        var arr = [251];    // msg-type
1904
        arr.push8(0);       // padding
1905
        arr.push16(width);  // width
1906
        arr.push16(height); // height
1907
1908
        arr.push8(1);       // number-of-screens
1909
        arr.push8(0);       // padding
1910
1911
        // screen array
1912
        arr.push32(screen_id);    // id
1913
        arr.push16(0);            // x-position
1914
        arr.push16(0);            // y-position
1915
        arr.push16(width);        // width
1916
        arr.push16(height);       // height
1917
        arr.push32(screen_flags); // flags 
1918
1919
        ws.send(arr);
1920
    }
1921
};
1922
1854
// Override internal functions for testing
1923
// Override internal functions for testing
1855
that.testMode = function(override_send, data_mode) {
1924
that.testMode = function(override_send, data_mode) {
1856
    test_mode = true;
1925
    test_mode = true;
(-)webaccess/noVNC/include/ui.js (+22 lines)
Lines 10-17 Link Here
10
/*jslint white: false, browser: true */
10
/*jslint white: false, browser: true */
11
/*global window, $D, Util, WebUtil, RFB, Display */
11
/*global window, $D, Util, WebUtil, RFB, Display */
12
12
13
var resizeTimeout;
14
13
// Load supporting scripts
15
// Load supporting scripts
14
window.onscriptsload = function () { UI.load(); };
16
window.onscriptsload = function () { UI.load(); };
17
window.onresize = function () { UI.onresize(); };
18
15
Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
19
Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
16
                   "input.js", "display.js", "jsunzip.js", "rfb.js"]);
20
                   "input.js", "display.js", "jsunzip.js", "rfb.js"]);
17
21
Lines 29-34 Link Here
29
    WebUtil.initSettings(UI.start, callback);
33
    WebUtil.initSettings(UI.start, callback);
30
},
34
},
31
35
36
// When the window has been resized, wait until the size remains
37
// the same for 0.5 seconds before sending the request for changing 
38
// the resolution of the session
39
onresize: function (callback) {
40
    clearTimeout(resizeTimeout);
41
    resizeTimeout = setTimeout(function(){
42
	// Control-bar height: 44px +
43
	// Status-bar height: 24px + 
44
	// border height: 5px = 73px to be deducted from the height
45
	UI.rfb.setDesktopSize(window.innerWidth, window.innerHeight - 73);
46
    }, 500);
47
},
48
32
// Render default UI and initialize settings menu
49
// Render default UI and initialize settings menu
33
start: function(callback) {
50
start: function(callback) {
34
    var html = '', i, sheet, sheets, llevels, port;
51
    var html = '', i, sheet, sheets, llevels, port;
Lines 447-452 Link Here
447
            klass = "noVNC_status_error";
464
            klass = "noVNC_status_error";
448
            break;
465
            break;
449
        case 'normal':
466
        case 'normal':
467
            // When reconnecting to an existing session, 
468
            // make sure the resolution is updated to the window size
469
            if (oldstate === 'ServerInitialisation') {
470
        	onresize();
471
            }
450
            klass = "noVNC_status_normal";
472
            klass = "noVNC_status_normal";
451
            break;
473
            break;
452
        case 'disconnected':
474
        case 'disconnected':

Return to bug 4642