mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2025-08-28 14:52:45 +02:00
improve UI handling
This commit is contained in:
@@ -175,12 +175,16 @@ class WVNC
|
||||
|
||||
@socket.onmessage = (e) ->
|
||||
me.consume e
|
||||
@socket.onerror = (e) =>
|
||||
me.onerror("Websocket error")
|
||||
|
||||
@socket.onclose = () ->
|
||||
me.socket = null
|
||||
me.canvas.style.cursor = "auto"
|
||||
me.canvas.getContext('2d').clearRect 0,0, me.resolution.w, me.resolution.h if me.canvas and me.resolution
|
||||
clearTimeout(me.pingto) if me.pingto
|
||||
me.pingto = undefined
|
||||
me.ondisconnect()
|
||||
console.log "socket closed"
|
||||
|
||||
disconnect: (close_worker) ->
|
||||
@@ -279,6 +283,9 @@ class WVNC
|
||||
|
||||
onresize: () ->
|
||||
console.log "resize"
|
||||
|
||||
ondisconnect: () ->
|
||||
console.log "disconnect"
|
||||
|
||||
consume: (e) ->
|
||||
data = new Uint8Array e.data
|
||||
|
@@ -98,8 +98,10 @@ class RemoteDesktop extends this.OS.application.BaseApplication
|
||||
}
|
||||
@bindKey "CTRL-SHIFT-V", (e) =>
|
||||
@pasteText()
|
||||
@client.onerror = (m) =>
|
||||
@error m
|
||||
#@client.onerror = (m) =>
|
||||
# @error m.toString()
|
||||
# @showConnectionDialog()
|
||||
@client.ondisconnect = () =>
|
||||
@showConnectionDialog()
|
||||
@client.onresize = ()=>
|
||||
@setScale()
|
||||
@@ -160,16 +162,13 @@ class RemoteDesktop extends this.OS.application.BaseApplication
|
||||
{ text: "__(New Connection)", dataid: "#{@name}-new", },
|
||||
{ text: "__(Disconnect)", dataid: "#{@name}-close" }
|
||||
],
|
||||
onchildselect: (e) => @actionConnection()
|
||||
onchildselect: (e) =>
|
||||
@client.disconnect(false) if @client
|
||||
}
|
||||
]
|
||||
|
||||
actionConnection: (e) ->
|
||||
@client.disconnect(false) if @client
|
||||
@showConnectionDialog()
|
||||
|
||||
showConnectionDialog: () ->
|
||||
|
||||
return unless @client
|
||||
@openDialog new ConnectionDialog, { title: __("Connection")}
|
||||
.then (d) =>
|
||||
@client.ws = d.wvnc
|
||||
@@ -177,5 +176,6 @@ class RemoteDesktop extends this.OS.application.BaseApplication
|
||||
|
||||
cleanup: () ->
|
||||
@client.disconnect(true) if @client
|
||||
@client = undefined
|
||||
|
||||
this.OS.register "RemoteDesktop", RemoteDesktop
|
Reference in New Issue
Block a user