Change clippingDisplay() to a property

It fits much better as a property given that it only tells what the
current state of things are.
This commit is contained in:
Pierre Ossman
2017-10-20 13:03:50 +02:00
parent 15a6269510
commit a80aa41628
6 changed files with 15 additions and 36 deletions
+5 -5
View File
@@ -106,6 +106,11 @@ Display.prototype = {
return this._fb_height;
},
get isClipped() {
var vp = this._viewportLoc;
return this._fb_width > vp.w || this._fb_height > vp.h;
},
logo: null,
// ===== EVENT HANDLERS =====
@@ -512,11 +517,6 @@ Display.prototype = {
this._target.style.cursor = "none";
},
clippingDisplay: function () {
var vp = this._viewportLoc;
return this._fb_width > vp.w || this._fb_height > vp.h;
},
autoscale: function (containerWidth, containerHeight, downscaleOnly) {
var vp = this._viewportLoc;
var targetAspectRatio = containerWidth / containerHeight;
+2 -5
View File
@@ -268,6 +268,8 @@ RFB.prototype = {
get viewport() { return this._display.viewport; },
set viewport(viewport) { this._display.viewport = viewport; },
get isClipped() { return this._display.isClipped; },
// ===== EVENT HANDLERS =====
onupdatestate: function () {}, // onupdatestate(rfb, state, oldstate): connection state change
@@ -380,11 +382,6 @@ RFB.prototype = {
this._display.viewportChangeSize(width, height);
},
clippingDisplay: function () {
if (this._rfb_connection_state !== 'connected') { return false; }
return this._display.clippingDisplay();
},
// Requests a change of remote desktop size. This message is an extension
// and may only be sent if we have received an ExtendedDesktopSize message
requestDesktopSize: function (width, height) {