feat: sync clipboard on window focus. (#662)

This commit is contained in:
Miroslav Šedivý
2026-07-31 14:27:48 +02:00
committed by GitHub
parent 97b0513e89
commit 3bb1959a55
+7
View File
@@ -532,9 +532,11 @@
this.$client.sendData('keyup', { key: this.keyMap(key) }) this.$client.sendData('keyup', { key: this.keyMap(key) })
} }
this.keyboard.listenTo(this._overlay) this.keyboard.listenTo(this._overlay)
window.addEventListener('focus', this._onWindowFocus)
} }
beforeDestroy() { beforeDestroy() {
window.removeEventListener('focus', this._onWindowFocus)
this.observer.disconnect() this.observer.disconnect()
this.$accessor.video.setPlayable(false) this.$accessor.video.setPlayable(false)
/* Guacamole Keyboard does not provide destroy functions */ /* Guacamole Keyboard does not provide destroy functions */
@@ -845,6 +847,11 @@
this.sendMousePos(e) this.sendMousePos(e)
} }
// stable reference for add/removeEventListener
private _onWindowFocus = () => {
if (this.hosting) this.syncClipboard()
}
onMouseEnter(e: MouseEvent) { onMouseEnter(e: MouseEvent) {
if (this.hosting) { if (this.hosting) {
this.$accessor.remote.syncKeyboardModifierState({ this.$accessor.remote.syncKeyboardModifierState({