fix clipboard write to client from secondary screen
This commit is contained in:
parent
d51c5e37b7
commit
82e0100a97
55
core/rfb.js
55
core/rfb.js
|
@ -1738,6 +1738,11 @@ export default class RFB extends EventTargetMixin {
|
||||||
this._mouseLastScreenIndex = event.data.mouseLastScreenIndex;
|
this._mouseLastScreenIndex = event.data.mouseLastScreenIndex;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'receivedClipboard':
|
||||||
|
if (event.data.mouseLastScreenIndex === this._display.screenIndex) {
|
||||||
|
this._write_binary_clipboard(...event.data.args);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'disconnect':
|
case 'disconnect':
|
||||||
this.disconnect();
|
this.disconnect();
|
||||||
break;
|
break;
|
||||||
|
@ -3216,33 +3221,41 @@ export default class RFB extends EventTargetMixin {
|
||||||
if (this.clipboardBinary) {
|
if (this.clipboardBinary) {
|
||||||
this._clipHash = 0;
|
this._clipHash = 0;
|
||||||
|
|
||||||
navigator.clipboard.write([new ClipboardItem(clipItemData)]).then(
|
if (this._mouseLastScreenIndex === 0) {
|
||||||
() => {
|
this._write_binary_clipboard(clipItemData, textdata)
|
||||||
if (textdata) {
|
} else {
|
||||||
this._clipHash = hashUInt8Array(textdata);
|
this._proxyRFBMessage('receivedClipboard', [ clipItemData, textdata ]);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
Log.Error("Error writing to client clipboard: " + err);
|
|
||||||
// Lets try writeText
|
|
||||||
if (textdata.length > 0) {
|
|
||||||
navigator.clipboard.writeText(textdata).then(
|
|
||||||
() => {
|
|
||||||
this._clipHash = hashUInt8Array(textdata);
|
|
||||||
},
|
|
||||||
(err) => {
|
|
||||||
Log.Error("Error writing text to client clipboard: " + err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_write_binary_clipboard(clipItemData, textdata) {
|
||||||
|
navigator.clipboard.write([new ClipboardItem(clipItemData)]).then(
|
||||||
|
() => {
|
||||||
|
if (textdata) {
|
||||||
|
this._clipHash = hashUInt8Array(textdata);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
Log.Error("Error writing to client clipboard: " + err);
|
||||||
|
// Lets try writeText
|
||||||
|
if (textdata.length > 0) {
|
||||||
|
navigator.clipboard.writeText(textdata).then(
|
||||||
|
() => {
|
||||||
|
this._clipHash = hashUInt8Array(textdata);
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
Log.Error("Error writing text to client clipboard: " + err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_handle_server_stats_msg() {
|
_handle_server_stats_msg() {
|
||||||
this._sock.rQskipBytes(3); // Padding
|
this._sock.rQskipBytes(3); // Padding
|
||||||
const length = this._sock.rQshift32();
|
const length = this._sock.rQshift32();
|
||||||
|
|
Loading…
Reference in New Issue