@novnc/novnc 1.5.0-g9f727b7 → 1.5.0-gbb797dc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/rfb.js +41 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ profits such as:
|
|
|
68
68
|
* Supported VNC encodings: raw, copyrect, rre, hextile, tight, tightPNG,
|
|
69
69
|
ZRLE, JPEG, Zlib
|
|
70
70
|
* Supports scaling, clipping and resizing the desktop
|
|
71
|
+
* Supports back & forward mouse buttons
|
|
71
72
|
* Local cursor rendering
|
|
72
73
|
* Clipboard copy/paste with full Unicode support
|
|
73
74
|
* Translations
|
package/lib/rfb.js
CHANGED
|
@@ -171,6 +171,8 @@ var RFB = exports["default"] = /*#__PURE__*/function (_EventTargetMixin) {
|
|
|
171
171
|
_this._supportsSetDesktopSize = false;
|
|
172
172
|
_this._screenID = 0;
|
|
173
173
|
_this._screenFlags = 0;
|
|
174
|
+
_this._pendingRemoteResize = false;
|
|
175
|
+
_this._lastResize = 0;
|
|
174
176
|
_this._qemuExtKeyEventSupported = false;
|
|
175
177
|
_this._extendedPointerEventSupported = false;
|
|
176
178
|
_this._clipboardText = null;
|
|
@@ -808,15 +810,10 @@ var RFB = exports["default"] = /*#__PURE__*/function (_EventTargetMixin) {
|
|
|
808
810
|
_this2._updateScale();
|
|
809
811
|
_this2._saveExpectedClientSize();
|
|
810
812
|
});
|
|
811
|
-
if (this._resizeSession) {
|
|
812
|
-
// Request changing the resolution of the remote display to
|
|
813
|
-
// the size of the local browser viewport.
|
|
814
813
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
this._resizeTimeout = setTimeout(this._requestRemoteResize.bind(this), 500);
|
|
819
|
-
}
|
|
814
|
+
// Request changing the resolution of the remote display to
|
|
815
|
+
// the size of the local browser viewport.
|
|
816
|
+
this._requestRemoteResize();
|
|
820
817
|
}
|
|
821
818
|
|
|
822
819
|
// Update state of clipping in Display object, and make sure the
|
|
@@ -867,12 +864,36 @@ var RFB = exports["default"] = /*#__PURE__*/function (_EventTargetMixin) {
|
|
|
867
864
|
}, {
|
|
868
865
|
key: "_requestRemoteResize",
|
|
869
866
|
value: function _requestRemoteResize() {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
867
|
+
if (!this._resizeSession) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if (this._viewOnly) {
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
if (!this._supportsSetDesktopSize) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// Rate limit to one pending resize at a time
|
|
878
|
+
if (this._pendingRemoteResize) {
|
|
873
879
|
return;
|
|
874
880
|
}
|
|
881
|
+
|
|
882
|
+
// And no more than once every 100ms
|
|
883
|
+
if (Date.now() - this._lastResize < 100) {
|
|
884
|
+
clearTimeout(this._resizeTimeout);
|
|
885
|
+
this._resizeTimeout = setTimeout(this._requestRemoteResize.bind(this), 100 - (Date.now() - this._lastResize));
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
this._resizeTimeout = null;
|
|
875
889
|
var size = this._screenSize();
|
|
890
|
+
|
|
891
|
+
// Do we actually change anything?
|
|
892
|
+
if (size.w === this._fbWidth && size.h === this._fbHeight) {
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
this._pendingRemoteResize = true;
|
|
896
|
+
this._lastResize = Date.now();
|
|
876
897
|
RFB.messages.setDesktopSize(this._sock, Math.floor(size.w), Math.floor(size.h), this._screenID, this._screenFlags);
|
|
877
898
|
Log.Debug('Requested new desktop size: ' + size.w + 'x' + size.h);
|
|
878
899
|
}
|
|
@@ -2912,6 +2933,10 @@ var RFB = exports["default"] = /*#__PURE__*/function (_EventTargetMixin) {
|
|
|
2912
2933
|
* 2 - another client requested the resize
|
|
2913
2934
|
*/
|
|
2914
2935
|
|
|
2936
|
+
if (this._FBU.x === 1) {
|
|
2937
|
+
this._pendingRemoteResize = false;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2915
2940
|
// We need to handle errors when we requested the resize.
|
|
2916
2941
|
if (this._FBU.x === 1 && this._FBU.y !== 0) {
|
|
2917
2942
|
var msg = "";
|
|
@@ -2942,6 +2967,11 @@ var RFB = exports["default"] = /*#__PURE__*/function (_EventTargetMixin) {
|
|
|
2942
2967
|
if (firstUpdate) {
|
|
2943
2968
|
this._requestRemoteResize();
|
|
2944
2969
|
}
|
|
2970
|
+
if (this._FBU.x === 1 && this._FBU.y === 0) {
|
|
2971
|
+
// We might have resized again whilst waiting for the
|
|
2972
|
+
// previous request, so check if we are in sync
|
|
2973
|
+
this._requestRemoteResize();
|
|
2974
|
+
}
|
|
2945
2975
|
return true;
|
|
2946
2976
|
}
|
|
2947
2977
|
}, {
|