Add resize as a capability
Makes the API more transparent than piggybacking on completion of the first framebuffer update.
This commit is contained in:
+9
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user