mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
ignored keyup hashmap.
This commit is contained in:
parent
d87c78ba50
commit
9ba33292ea
@ -65,7 +65,6 @@
|
|||||||
|
|
||||||
private keyboard = GuacamoleKeyboard()
|
private keyboard = GuacamoleKeyboard()
|
||||||
private focused = false
|
private focused = false
|
||||||
private ctrlKey = 0
|
|
||||||
|
|
||||||
@Prop()
|
@Prop()
|
||||||
private readonly sessions!: Record<string, Session>
|
private readonly sessions!: Record<string, Session>
|
||||||
@ -118,25 +117,26 @@
|
|||||||
this._overlay.width = width * CANVAS_SCALE
|
this._overlay.width = width * CANVAS_SCALE
|
||||||
this._overlay.height = height * CANVAS_SCALE
|
this._overlay.height = height * CANVAS_SCALE
|
||||||
|
|
||||||
|
let ctrlKey = 0
|
||||||
|
let noKeyUp = {} as Record<number, boolean>
|
||||||
|
|
||||||
// Initialize Guacamole Keyboard
|
// Initialize Guacamole Keyboard
|
||||||
this.keyboard.onkeydown = (key: number) => {
|
this.keyboard.onkeydown = (key: number) => {
|
||||||
if (!this.focused) {
|
if (!this.focused || !this.isControling) {
|
||||||
return true
|
noKeyUp[key] = true
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isControling) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ctrl+v is aborted
|
// ctrl+v is aborted
|
||||||
if (this.ctrlKey != 0 && key == KeyTable.XK_v) {
|
if (ctrlKey != 0 && key == KeyTable.XK_v) {
|
||||||
this.keyboard.release(this.ctrlKey)
|
this.keyboard.release(ctrlKey)
|
||||||
|
noKeyUp[key] = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// save information if it is ctrl key event
|
// save information if it is ctrl key event
|
||||||
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
||||||
if (isCtrlKey) this.ctrlKey = key
|
if (isCtrlKey) ctrlKey = key
|
||||||
|
|
||||||
this.webrtc.send('keydown', {
|
this.webrtc.send('keydown', {
|
||||||
key: keySymsRemap(key),
|
key: keySymsRemap(key),
|
||||||
@ -144,16 +144,13 @@
|
|||||||
return isCtrlKey
|
return isCtrlKey
|
||||||
}
|
}
|
||||||
this.keyboard.onkeyup = (key: number) => {
|
this.keyboard.onkeyup = (key: number) => {
|
||||||
if (!this.focused) {
|
if (key in noKeyUp) {
|
||||||
return
|
delete noKeyUp[key]
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.isControling) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
const isCtrlKey = key == KeyTable.XK_Control_L || key == KeyTable.XK_Control_R
|
||||||
if (isCtrlKey) this.ctrlKey = 0
|
if (isCtrlKey) ctrlKey = 0
|
||||||
|
|
||||||
this.webrtc.send('keyup', {
|
this.webrtc.send('keyup', {
|
||||||
key: keySymsRemap(key),
|
key: keySymsRemap(key),
|
||||||
|
Loading…
Reference in New Issue
Block a user