Add resize as a capability

Makes the API more transparent than piggybacking on completion
of the first framebuffer update.
This commit is contained in:
Pierre Ossman
2017-10-13 14:40:25 +02:00
parent cd523e8f28
commit 832be2625b
5 changed files with 46 additions and 23 deletions
+9 -3
View File
@@ -49,7 +49,7 @@ export default function RFB(defaults) {
this._rfb_tightvnc = false;
this._rfb_xvp_ver = 0;
this._capabilities = { power: false };
this._capabilities = { power: false, resize: false };
this._encHandlers = {};
this._encStats = {};
@@ -638,6 +638,11 @@ RFB.prototype = {
}
},
_setCapability: function (cap, val) {
this._capabilities[cap] = val;
this._onCapabilities(this, this._capabilities);
},
_handle_message: function () {
if (this._sock.rQlen() === 0) {
Log.Warn("handle_message called on an empty receive queue");
@@ -1277,8 +1282,7 @@ RFB.prototype = {
case 1: // XVP_INIT
this._rfb_xvp_ver = xvp_ver;
Log.Info("XVP extensions enabled (version " + this._rfb_xvp_ver + ")");
this._capabilities.power = true;
this._onCapabilities(this, this._capabilities)
this._setCapability("power", true);
break;
default:
this._fail("Unexpected server message",
@@ -2398,6 +2402,8 @@ RFB.encodingHandlers = {
if (this._sock.rQwait("ExtendedDesktopSize", this._FBU.bytes)) { return false; }
this._supportsSetDesktopSize = true;
this._setCapability("resize", true);
var number_of_screens = this._sock.rQpeek8();
this._FBU.bytes = 4 + (number_of_screens * 16);