|
@@ -20,7 +20,7 @@ var that = {}, // Public API methods
|
|
|
init_vars, updateState, fail, handle_message,
|
|
|
init_msg, normal_msg, framebufferUpdate, print_stats,
|
|
|
|
|
|
- pixelFormat, clientEncodings, fbUpdateRequest,
|
|
|
+ pixelFormat, clientEncodings, fbUpdateRequest, fbUpdateRequests,
|
|
|
keyEvent, pointerEvent, clientCutText,
|
|
|
|
|
|
extract_data_uri, scan_tight_imgQ,
|
|
@@ -531,10 +531,10 @@ function genDES(password, challenge) {
|
|
|
|
|
|
function flushClient() {
|
|
|
if (mouse_arr.length > 0) {
|
|
|
- //send(mouse_arr.concat(fbUpdateRequest(1)));
|
|
|
+ //send(mouse_arr.concat(fbUpdateRequests()));
|
|
|
ws.send(mouse_arr);
|
|
|
setTimeout(function() {
|
|
|
- ws.send(fbUpdateRequest(1));
|
|
|
+ ws.send(fbUpdateRequests());
|
|
|
}, 50);
|
|
|
|
|
|
mouse_arr = [];
|
|
@@ -552,7 +552,7 @@ checkEvents = function() {
|
|
|
now = new Date().getTime();
|
|
|
if (now > last_req_time + conf.fbu_req_rate) {
|
|
|
last_req_time = now;
|
|
|
- ws.send(fbUpdateRequest(1));
|
|
|
+ ws.send(fbUpdateRequests());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -562,7 +562,7 @@ checkEvents = function() {
|
|
|
keyPress = function(keysym, down) {
|
|
|
var arr;
|
|
|
arr = keyEvent(keysym, down);
|
|
|
- arr = arr.concat(fbUpdateRequest(1));
|
|
|
+ arr = arr.concat(fbUpdateRequests());
|
|
|
ws.send(arr);
|
|
|
};
|
|
|
|
|
@@ -792,7 +792,7 @@ init_msg = function() {
|
|
|
|
|
|
response = pixelFormat();
|
|
|
response = response.concat(clientEncodings());
|
|
|
- response = response.concat(fbUpdateRequest(0));
|
|
|
+ response = response.concat(fbUpdateRequests());
|
|
|
timing.fbu_rt_start = (new Date()).getTime();
|
|
|
ws.send(response);
|
|
|
|
|
@@ -1312,7 +1312,7 @@ encHandlers.DesktopSize = function set_desktopsize() {
|
|
|
display.viewportChange(0, 0, fb_width, fb_height);
|
|
|
timing.fbu_rt_start = (new Date()).getTime();
|
|
|
// Send a new non-incremental request
|
|
|
- ws.send(fbUpdateRequest(0));
|
|
|
+ ws.send(fbUpdateRequests());
|
|
|
|
|
|
FBU.bytes = 0;
|
|
|
FBU.rects -= 1;
|
|
@@ -1414,10 +1414,10 @@ clientEncodings = function() {
|
|
|
|
|
|
fbUpdateRequest = function(incremental, x, y, xw, yw) {
|
|
|
//Util.Debug(">> fbUpdateRequest");
|
|
|
- if (!x) { x = 0; }
|
|
|
- if (!y) { y = 0; }
|
|
|
- if (!xw) { xw = fb_width; }
|
|
|
- if (!yw) { yw = fb_height; }
|
|
|
+ if (typeof(x) !== "undefined") { x = 0; }
|
|
|
+ if (typeof(y) !== "undefined") { y = 0; }
|
|
|
+ if (typeof(xw) !== "undefined") { xw = fb_width; }
|
|
|
+ if (typeof(yw) !== "undefined") { yw = fb_height; }
|
|
|
var arr;
|
|
|
arr = [3]; // msg-type
|
|
|
arr.push8(incremental);
|
|
@@ -1429,6 +1429,26 @@ fbUpdateRequest = function(incremental, x, y, xw, yw) {
|
|
|
return arr;
|
|
|
};
|
|
|
|
|
|
+// Based on clean/dirty areas, generate requests to send
|
|
|
+fbUpdateRequests = function() {
|
|
|
+ var cleanDirty = display.getCleanDirtyReset(),
|
|
|
+ arr = [], i, cb, db;
|
|
|
+
|
|
|
+ cb = cleanDirty.cleanBox;
|
|
|
+ if (cb.w > 0 && cb.h > 0) {
|
|
|
+ // Request incremental for clean box
|
|
|
+ arr = arr.concat(fbUpdateRequest(1, cb.x, cb.y, cb.w, cb.h));
|
|
|
+ }
|
|
|
+ for (i = 0; i < cleanDirty.dirtyBoxes.length; i++) {
|
|
|
+ db = cleanDirty.dirtyBoxes[i];
|
|
|
+ // Force all (non-incremental for dirty box
|
|
|
+ arr = arr.concat(fbUpdateRequest(0, db.x, db.y, db.w, db.h));
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
keyEvent = function(keysym, down) {
|
|
|
//Util.Debug(">> keyEvent, keysym: " + keysym + ", down: " + down);
|
|
|
var arr;
|
|
@@ -1513,7 +1533,7 @@ that.sendCtrlAltDel = function() {
|
|
|
arr = arr.concat(keyEvent(0xFFFF, 0)); // Delete
|
|
|
arr = arr.concat(keyEvent(0xFFE9, 0)); // Alt
|
|
|
arr = arr.concat(keyEvent(0xFFE3, 0)); // Control
|
|
|
- arr = arr.concat(fbUpdateRequest(1));
|
|
|
+ arr = arr.concat(fbUpdateRequests());
|
|
|
ws.send(arr);
|
|
|
};
|
|
|
|
|
@@ -1530,7 +1550,7 @@ that.sendKey = function(code, down) {
|
|
|
arr = arr.concat(keyEvent(code, 1));
|
|
|
arr = arr.concat(keyEvent(code, 0));
|
|
|
}
|
|
|
- arr = arr.concat(fbUpdateRequest(1));
|
|
|
+ arr = arr.concat(fbUpdateRequests());
|
|
|
ws.send(arr);
|
|
|
};
|
|
|
|