From 0062fc28aac2a849cdf70baec7edbec727b75d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 30 Apr 2022 19:34:12 +0200 Subject: [PATCH] overlay focus only when hosting. --- client/src/components/video.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/src/components/video.vue b/client/src/components/video.vue index 164bc39e..2143648e 100644 --- a/client/src/components/video.vue +++ b/client/src/components/video.vue @@ -451,7 +451,7 @@ /* Initialize Guacamole Keyboard */ this.keyboard.onkeydown = (key: number) => { - if (!this.focused || !this.hosting || this.locked) { + if (!this.hosting || this.locked) { return true } @@ -459,7 +459,7 @@ return false } this.keyboard.onkeyup = (key: number) => { - if (!this.focused || !this.hosting || this.locked) { + if (!this.hosting || this.locked) { return } @@ -700,7 +700,6 @@ this.syncClipboard() } - this._overlay.focus() this.focused = true } @@ -724,5 +723,15 @@ this._container.style.maxWidth = `${(this.horizontal / this.vertical) * offsetHeight}px` this._aspect.style.paddingBottom = `${(this.vertical / this.horizontal) * 100}%` } + + @Watch('focused') + @Watch('hosting') + @Watch('locked') + onFocus() { + // in order to capture key events, overlay must be focused + if (this.focused && this.hosting && !this.locked) { + this._overlay.focus() + } + } }