From 1cea58d9e475a968a0c311b7342e9a6ae13fb13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 18 Feb 2021 23:14:47 +0100 Subject: [PATCH] set keyboard layout on control. --- src/component/main.vue | 16 ++++++++++++++++ src/component/types/state.ts | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/src/component/main.vue b/src/component/main.vue index c6665025..6eb6fa50 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -117,6 +117,10 @@ sensitivity: 1, }, clipboard: null, + keyboard: { + layout: '', + variant: '', + }, host_id: null, implicit_hosting: false, }, @@ -280,6 +284,10 @@ Vue.set(this.state.control.scroll, 'sensitivity', value) } + public setKeyboard(layout: string, variant: string = '') { + Vue.set(this.state.control, 'keyboard', { layout, variant }) + } + public setScreenSize(width: number, height: number, rate: number) { //this.api.room.screenConfigurationChange({ screenConfiguration: { width, height, rate } }) this.websocket.send('screen/set', { width, height, rate }) @@ -496,6 +504,14 @@ document.removeEventListener('click', this.unmute) } + @Watch('controlling') + @Watch('state.control.keyboard') + updateKeyboard() { + if (this.controlling && this.state.control.keyboard.layout) { + this.websocket.send('keyboard/map', this.state.control.keyboard) + } + } + @Watch('state.screen.size') onResize() { const { width, height } = this.state.screen.size diff --git a/src/component/types/state.ts b/src/component/types/state.ts index 391cc7d8..bb2fbe93 100644 --- a/src/component/types/state.ts +++ b/src/component/types/state.ts @@ -50,6 +50,7 @@ export interface Video { export interface Control { scroll: Scroll clipboard: Clipboard | null + keyboard: Keyboard host_id: string | null implicit_hosting: boolean } @@ -63,6 +64,11 @@ export interface Clipboard { text: string } +export interface Keyboard { + layout: string + variant: string +} + ///////////////////////////// // Screen /////////////////////////////