Bugzilla – Attachment 478 Details for
Bug 4642
Resize support for the HTML5 Client
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Implements the resize support functionality
resizesupport.patch (text/plain), 4.58 KB, created by
Samuel Mannehed
on 2013-06-20 15:12:06 CEST
(
hide
)
Description:
Implements the resize support functionality
Filename:
MIME Type:
Creator:
Samuel Mannehed
Created:
2013-06-20 15:12:06 CEST
Size:
4.58 KB
patch
obsolete
>Index: webaccess/noVNC/include/rfb.js >=================================================================== >--- webaccess/noVNC/include/rfb.js (revision 27526) >+++ webaccess/noVNC/include/rfb.js (working copy) >@@ -63,7 +63,8 @@ > //['JPEG_quality_hi', -23 ], > //['compress_lo', -255 ], > ['compress_hi', -247 ], >- ['last_rect', -224 ] >+ ['last_rect', -224 ], >+ ['ext_desktop_size', -308 ] > ], > > encHandlers = {}, >@@ -120,6 +121,10 @@ > > test_mode = false, > >+ supportsSetDesktopSize = false, >+ screen_id = 0, >+ screen_flags = 0, >+ > def_con_timeout = Websock_native ? 2 : 5, > > /* Mouse state */ >@@ -1589,6 +1594,45 @@ > return true; > }; > >+encHandlers.ext_desktop_size = function () { >+ //Util.Debug(">> ext_desktop_size"); >+ if (ws.rQwait("ext_desktop_size", 4)) { return false; } >+ >+ var number_of_screens = ws.rQshift8(); >+ >+ ws.rQshift8(); // padding >+ ws.rQshift16(); // padding >+ >+ for (var i=0; i<number_of_screens; i += 1) { >+ screen_id = ws.rQshift32(); // id >+ ws.rQshift16(); // x-position >+ ws.rQshift16(); // y-position >+ ws.rQshift16(); // width >+ ws.rQshift16(); // height >+ screen_flags = ws.rQshift32(); // flags >+ } >+ >+ if (FBU.x == 0) { >+ 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()); >+ >+ if (FBU.y == 0) { >+ supportsSetDesktopSize = true; >+ } >+ } >+ >+ FBU.bytes = 0; >+ FBU.rects -= 1; >+ >+ //Util.Debug("<< ext_desktop_size"); >+ return true; >+}; >+ > encHandlers.DesktopSize = function set_desktopsize() { > Util.Debug(">> set_desktopsize"); > fb_width = FBU.width; >@@ -1851,6 +1895,31 @@ > //Util.Debug("<< clipboardPasteFrom"); > }; > >+that.setDesktopSize = function(width, height) { >+ if (rfb_state !== "normal") { return; } >+ >+ if (supportsSetDesktopSize) { >+ >+ var arr = [251]; // msg-type >+ arr.push8(0); // padding >+ arr.push16(width); // width >+ arr.push16(height); // height >+ >+ arr.push8(1); // number-of-screens >+ arr.push8(0); // padding >+ >+ // screen array >+ arr.push32(screen_id); // id >+ arr.push16(0); // x-position >+ arr.push16(0); // y-position >+ arr.push16(width); // width >+ arr.push16(height); // height >+ arr.push32(screen_flags); // flags >+ >+ ws.send(arr); >+ } >+}; >+ > // Override internal functions for testing > that.testMode = function(override_send, data_mode) { > test_mode = true; >Index: webaccess/noVNC/include/ui.js >=================================================================== >--- webaccess/noVNC/include/ui.js (revision 27526) >+++ webaccess/noVNC/include/ui.js (working copy) >@@ -10,8 +10,12 @@ > /*jslint white: false, browser: true */ > /*global window, $D, Util, WebUtil, RFB, Display */ > >+var resizeTimeout; >+ > // Load supporting scripts > window.onscriptsload = function () { UI.load(); }; >+window.onresize = function () { UI.onresize(); }; >+ > Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js", > "input.js", "display.js", "jsunzip.js", "rfb.js"]); > >@@ -29,6 +33,19 @@ > WebUtil.initSettings(UI.start, callback); > }, > >+// 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 >+onresize: function (callback) { >+ clearTimeout(resizeTimeout); >+ resizeTimeout = setTimeout(function(){ >+ // Control-bar height: 44px + >+ // Status-bar height: 24px + >+ // border height: 5px = 73px to be deducted from the height >+ UI.rfb.setDesktopSize(window.innerWidth, window.innerHeight - 73); >+ }, 500); >+}, >+ > // Render default UI and initialize settings menu > start: function(callback) { > var html = '', i, sheet, sheets, llevels, port; >@@ -447,6 +464,11 @@ > klass = "noVNC_status_error"; > break; > case 'normal': >+ // When reconnecting to an existing session, >+ // make sure the resolution is updated to the window size >+ if (oldstate === 'ServerInitialisation') { >+ onresize(); >+ } > klass = "noVNC_status_normal"; > break; > case 'disconnected':
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 4642
: 478 |
479