overlay use control instead of event emitter.

This commit is contained in:
Miroslav Šedivý 2022-07-21 19:37:34 +02:00
parent cf97610067
commit f3850e022c
2 changed files with 8 additions and 6 deletions

View File

@ -22,6 +22,7 @@
<neko-overlay
v-show="!private_mode_enabled && connected"
:style="{ pointerEvents: state.control.locked ? 'none' : 'auto' }"
:control="control"
:sessions="state.sessions"
:hostId="state.control.host_id"
:webrtc="connection.webrtc"
@ -32,12 +33,9 @@
:cursorDraw="cursorDrawFunction"
:implicitControl="state.settings.implicit_hosting && session.profile.can_host"
:inactiveCursors="state.settings.inactive_cursors && session.profile.sends_inactive_cursor"
@implicitControlRequest="control.request()"
@implicitControlRelease="control.release()"
@updateKeyboardModifiers="updateKeyboardModifiers($event)"
@uploadDrop="uploadDrop($event)"
@onAction="control.emit('overlay.' + $event.action, $event.target)"
@clipboard="control.paste($event)"
/>
</div>
</div>

View File

@ -49,6 +49,7 @@
import GuacamoleKeyboard from './utils/guacamole-keyboard'
import { KeyTable, keySymsRemap } from './utils/keyboard-remapping'
import { getFilesFromDataTansfer } from './utils/file-upload'
import { NekoControl } from './internal/control'
import { NekoWebRTC } from './internal/webrtc'
import { Session, Scroll } from './types/state'
import { CursorPosition, CursorImage } from './types/webrtc'
@ -72,6 +73,9 @@
private keyboard = GuacamoleKeyboard()
private focused = false
@Prop()
private readonly control!: NekoControl
@Prop()
private readonly sessions!: Record<string, Session>
@ -231,7 +235,7 @@
}
onInput(e: InputEvent) {
this.$emit('clipboard', this._textarea.value)
this.control.paste(this._textarea.value)
this._textarea.value = ''
}
@ -560,7 +564,7 @@
implicitControlRequest(e: MouseEvent) {
if (this.implicitControl && e.type === 'mousedown' && this.reqMouseDown == null) {
this.reqMouseDown = e
this.$emit('implicitControlRequest')
this.control.request()
}
if (this.implicitControl && e.type === 'mouseup' && this.reqMouseUp == null) {
@ -571,7 +575,7 @@
// unused
implicitControlRelease() {
if (this.implicitControl) {
this.$emit('implicitControlRelease')
this.control.release()
}
}
}