From a2a602f5b2ffb4a00f66ca4287c4e0eca63a52d3 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Sun, 8 Jan 2023 00:21:02 +0100 Subject: [PATCH] RemoteDesktop: v0.1.16 - Allow to enable/disable mouse capture in remote desktop, remove some unused toolbar buttons --- RemoteDesktop/README.md | 1 + RemoteDesktop/assets/main.css | 2 +- RemoteDesktop/assets/scheme.html | 7 +++---- RemoteDesktop/build/debug/README.md | 1 + RemoteDesktop/build/debug/main.css | 2 +- RemoteDesktop/build/debug/main.js | 2 +- RemoteDesktop/build/debug/package.json | 2 +- RemoteDesktop/build/debug/scheme.html | 7 +++---- RemoteDesktop/build/release/RemoteDesktop.zip | Bin 78160 -> 78238 bytes RemoteDesktop/coffees/WVNC.coffee | 5 +++++ RemoteDesktop/coffees/main.coffee | 13 +++++-------- RemoteDesktop/package.json | 2 +- packages.json | 2 +- 13 files changed, 24 insertions(+), 22 deletions(-) diff --git a/RemoteDesktop/README.md b/RemoteDesktop/README.md index f616122..d445657 100644 --- a/RemoteDesktop/README.md +++ b/RemoteDesktop/README.md @@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo ## Change logs +* v0.1.16 - Allow to enable/disable mouse capture in remote desktop, remove some unused toolbar buttons * v0.1.15 - Only send ACK command when finish rendering the received frame, this allows to vastly improve performance and bandwidth * v0.1.14 - Add toolbar for canvas size control * v0.1.13 - support AntOS v2.0.x diff --git a/RemoteDesktop/assets/main.css b/RemoteDesktop/assets/main.css index 4a806e6..5f6d1d6 100644 --- a/RemoteDesktop/assets/main.css +++ b/RemoteDesktop/assets/main.css @@ -1,7 +1,7 @@ afx-app-window[data-id="RemoteDesktop"] div[data-id="container"] { background-color: #272822; - overflow: hidden; + overflow: auto; } afx-app-window[data-id="RemoteDesktop"] canvas[data-id="screen"] { diff --git a/RemoteDesktop/assets/scheme.html b/RemoteDesktop/assets/scheme.html index d038277..f2c97ef 100644 --- a/RemoteDesktop/assets/scheme.html +++ b/RemoteDesktop/assets/scheme.html @@ -8,10 +8,9 @@
- - - - + + +
\ No newline at end of file diff --git a/RemoteDesktop/build/debug/README.md b/RemoteDesktop/build/debug/README.md index f616122..d445657 100644 --- a/RemoteDesktop/build/debug/README.md +++ b/RemoteDesktop/build/debug/README.md @@ -7,6 +7,7 @@ Further information on **wvnc**: [https://blog.lxsang.me/post/id/23](https://blo ## Change logs +* v0.1.16 - Allow to enable/disable mouse capture in remote desktop, remove some unused toolbar buttons * v0.1.15 - Only send ACK command when finish rendering the received frame, this allows to vastly improve performance and bandwidth * v0.1.14 - Add toolbar for canvas size control * v0.1.13 - support AntOS v2.0.x diff --git a/RemoteDesktop/build/debug/main.css b/RemoteDesktop/build/debug/main.css index 4a806e6..5f6d1d6 100644 --- a/RemoteDesktop/build/debug/main.css +++ b/RemoteDesktop/build/debug/main.css @@ -1,7 +1,7 @@ afx-app-window[data-id="RemoteDesktop"] div[data-id="container"] { background-color: #272822; - overflow: hidden; + overflow: auto; } afx-app-window[data-id="RemoteDesktop"] canvas[data-id="screen"] { diff --git a/RemoteDesktop/build/debug/main.js b/RemoteDesktop/build/debug/main.js index 41afa34..e8b2e74 100644 --- a/RemoteDesktop/build/debug/main.js +++ b/RemoteDesktop/build/debug/main.js @@ -1 +1 @@ -(function(){var e,t,n,s;(e=class e extends this.OS.GUI.BasicDialog{constructor(){super("ConnectionDialog",e.scheme)}main(){return super.main(),this.find("bbp").data=[{text:"16 bits",value:16,selected:!0},{text:"32 bits",value:32}],this.find("jq").value=40,this.find("bt-ok").onbtclick=e=>{var t;if(this.handle)return t={wvnc:this.find("txtWVNC").value,server:this.find("txtServer").value,bbp:this.find("bbp").selectedItem.data.value,quality:this.find("jq").value},this.handle(t),this.quit()},this.find("bt-cancel").onbtclick=e=>this.quit()}}).scheme='\n \n \n \n
\n \n \n
\n \n \n \n
\n \n \n
\n
\n
\n
\n',(t=class e extends this.OS.GUI.BasicDialog{constructor(){super("CredentialDialog",e.scheme)}main(){return this.find("bt-ok").onbtclick=()=>{var e;return this.handle?(e={username:this.find("txtUser").value,password:this.find("txtPass").value},this.handle(e),this.quit()):this.quit()},this.find("bt-cancel").onbtclick=()=>this.quit()}}).scheme='\n \n \n \n \n
\n \n \n
\n
\n
\n
',n=class extends this.OS.application.BaseApplication{constructor(e){super("RemoteDesktop",e)}main(){return this.canvas=this.find("screen"),this.container=this.find("container"),this.zoom=this.find("zoom"),this.btreset=this.find("btreset"),this.zoom.max=200,this.zoom.value=100,this.zoom.onvaluechange=e=>this.setScale(),this.find("scroll_down").onbtclick=e=>this.container.scrollTop+=20,this.find("scroll_up").onbtclick=e=>this.container.scrollTop-=20,this.find("scroll_left").onbtclick=e=>this.container.scrollLeft-=20,this.find("scroll_right").onbtclick=e=>this.container.scrollLeft+=20,this.btreset.onbtclick=e=>{var t,n,s,i;return i=$(this.container).width(),t=$(this.container).height(),n=i/this.client.resolution.w,s=t/this.client.resolution.h,this.zoom.value=n>s?100*s:100*n,this.setScale()},this.client=new s({element:this.canvas}),this.bindKey("CTRL-SHIFT-V",e=>this.pasteText()),this.client.ondisconnect=()=>this.showConnectionDialog(),this.client.onresize=()=>this.setScale(),this.client.onpassword=()=>new Promise((e,t)=>this.openDialog("PromptDialog",{title:__("VNC password"),label:__("VNC password"),value:"password",type:"password"}).then((function(t){return e(t)}))),this.client.oncopy=e=>this._api.setClipboard(e),this.client.oncredential=()=>new Promise((e,n)=>this.openDialog(new t,{title:__("User credential")}).then((function(t){return e(t.username,t.password)}))),this.on("focus",e=>$(this.canvas).focus()),this.client.init().then(()=>this.showConnectionDialog())}pasteText(){var e;if(this.client)return e=e=>{if(e&&""!==e)return this.client.sendTextAsClipboard(e)},this._api.getClipboard().then(t=>e(t)).catch(t=>(this.error(__("Unable to paste"),t),this.openDialog("TextDialog",{title:"Paste text"}).then(t=>e(t)).catch(e=>this.error(e.toString(),e))))}setScale(){if(console.log("scale changed"),this.client&&this.client.resolution)return this.client.setScale(this.zoom.value/100),this.container.scrollLeft=0,this.container.scrollTop=0}menu(){return[{text:"__(Connection)",nodes:[{text:"__(New Connection)",dataid:this.name+"-new"},{text:"__(Disconnect)",dataid:this.name+"-close"}],onchildselect:e=>{if(this.client)return this.client.disconnect(!1)}}]}showConnectionDialog(){if(this.client)return this.openDialog(new e,{title:__("Connection")}).then(e=>(this.client.ws=e.wvnc,this.client.connect(e.server,e)))}cleanup(){return this.client&&this.client.disconnect(!0),this.client=void 0}},this.OS.register("RemoteDesktop",n),s=class{constructor(e){var t,n;this.socket=void 0,this.ws=void 0,this.canvas=void 0,n="pkg://RemoteDesktop/decoder_asm.js".asFileHandle().getlink(),this.scale=1,e.ws&&(this.ws=e.ws),this.canvas=e.element,"string"==typeof this.canvas&&(this.canvas=document.getElementById(this.canvas)),this.decoder=new Worker(n),this.enableEvent=!1,this.pingto=!1,t=this,this.mouseMask=0,this.decoder.onmessage=function(e){return t.process(e.data)}}init(){var e;return e=this,new Promise((function(t,n){return e.canvas?($(e.canvas).attr("tabindex","1"),$(e.canvas).on("focus",()=>e.resetModifierKeys()),e.initInputEvent(),t()):n("Canvas is not set")}))}initInputEvent(){var e,t,n,s;if(n=this,this.canvas&&(t=function(e){var t;return t=n.canvas.getBoundingClientRect(),{x:Math.floor((e.clientX-t.left)/n.scale),y:Math.floor((e.clientY-t.top)/n.scale)}},s=function(e){var s;if(n.enableEvent)return s=t(e),n.sendPointEvent(s.x,s.y,n.mouseMask)},n.canvas))return n.canvas.oncontextmenu=function(e){return e.preventDefault(),!1},n.canvas.onmousemove=function(e){return s(e)},n.canvas.onmousedown=function(e){var t;return t=1<this.disconnect(!0),window.addEventListener("unload",e),window.addEventListener("beforeunload",e)}initCanvas(e,t,n){return this.canvas.width=e,this.canvas.height=t,this.resolution={w:e,h:t},this.decoder.postMessage(this.resolution),this.setScale(this.scale)}process(e){var t,n,s;if(this.socket)return n=new Uint8Array(e.pixels),(s=(t=this.canvas.getContext("2d",{alpha:!1})).createImageData(e.w,e.h)).data.set(n),t.putImageData(s,e.x,e.y),this.socket.send(this.buildCommand(4,1));this.socket.send(this.buildCommand(4,1))}setScale(e){if(this.scale=e,this.canvas)return this.canvas.style.transformOrigin="0 0",this.canvas.style.transform="scale("+e+")"}connect(e,t){var n;if(n=this,this.disconnect(!1),this.ws)return this.socket=new WebSocket(this.ws),this.socket.binaryType="arraybuffer",this.socket.onopen=function(){return console.log("socket opened"),n.initConnection(e,t)},this.socket.onmessage=function(e){return n.consume(e)},this.socket.onerror=e=>n.onerror("Websocket error"),this.socket.onclose=function(){return n.socket=null,n.canvas.style.cursor="auto",n.canvas&&n.resolution&&n.canvas.getContext("2d").clearRect(0,0,n.resolution.w,n.resolution.h),n.pingto&&clearTimeout(n.pingto),n.pingto=void 0,n.ondisconnect(),console.log("socket closed")}}disconnect(e){return this.socket&&this.socket.close(),this.socket=void 0,e&&this.decoder.terminate(),this.enableEvent=!1}initConnection(e,t){var n;return(n=new Uint8Array(e.length+2))[0]=16,n[1]=50,t&&(t.bbp&&(n[0]=t.bbp),t.quality&&(n[1]=t.quality)),n.set((new TextEncoder).encode(e),2),this.socket.send(this.buildCommand(1,n))}resetModifierKeys(){if(this.socket&&this.enableEvent)return this.sendKeyEvent(65511,0),this.sendKeyEvent(65512,0),this.sendKeyEvent(65505,0),this.sendKeyEvent(65507,0),this.sendKeyEvent(65513,0)}sendPointEvent(e,t,n){var s;if(this.socket&&this.enableEvent)return(s=new Uint8Array(5))[0]=255&e,s[1]=e>>8,s[2]=255&t,s[3]=t>>8,s[4]=n,this.socket.send(this.buildCommand(5,s))}sendKeyEvent(e,t){var n;if(this.socket&&this.enableEvent)return(n=new Uint8Array(3))[0]=255&e,n[1]=e>>8&255,n[2]=t,this.socket.send(this.buildCommand(6,n))}sendPing(){if(this.socket)return this.socket.send(this.buildCommand(8,"PING WVNC"))}buildCommand(e,t){var n,s;switch(s=void 0,typeof t){case"string":s=(new TextEncoder).encode(t);break;case"number":s=new Uint8Array([t]);break;default:s=t}return(n=new Uint8Array(s.length+3))[0]=e,n[2]=s.length>>8,n[1]=15&s.length,n.set(s,3),n.buffer}oncopy(e){return console.log("Get clipboard text: "+e)}onpassword(){return new Promise((function(e,t){return t("onpassword is not implemented")}))}sendTextAsClipboard(e){var t;if(this.socket)return this.socket.send(this.buildCommand(7,e)),t="v".charCodeAt(0),this.sendKeyEvent(65507,1),this.sendKeyEvent(t,1),this.sendKeyEvent(t,0),this.sendKeyEvent(65507,0)}oncredential(){return new Promise((function(e,t){return t("oncredential is not implemented")}))}onerror(e){return console.log("Error",e)}onresize(){return console.log("resize")}ondisconnect(){return console.log("disconnect")}consume(e){var t,n,s,i,a,o,r;switch(t=(n=new Uint8Array(e.data))[0],o=this,t){case 254:return n=n.subarray(1,n.length-1),s=new TextDecoder("utf-8"),this.onerror(s.decode(n));case 129:return console.log("Request for password"),this.enableEvent=!1,this.onpassword().then((function(e){return o.socket.send(o.buildCommand(2,e)),o.enableEvent=!0}));case 130:return console.log("Request for login"),this.enableEvent=!1,this.oncredential().then((function(e,t){var n;return(n=new Uint8Array(e.length+t.length+1)).set((new TextEncoder).encode(e),0),n.set(["\0"],e.length),n.set((new TextEncoder).encode(t),e.length+1),o.socket.send(o.buildCommand(3,n)),o.enableEvent=!0}));case 131:if(r=n[1]|n[2]<<8,a=n[3]|n[4]<<8,this.initCanvas(r,a),this.socket.send(this.buildCommand(4,1)),this.enableEvent=!0,this.onresize(),this.pingto)return;return i=()=>(this.sendPing(),this.pingto=setTimeout(i,5e3)),this.pingto=setTimeout(i,5e3);case 132:return this.decoder.postMessage(n.buffer,[n.buffer]);case 133:return n=n.subarray(1),s=new TextDecoder("utf-8"),this.oncopy(s.decode(n)),this.socket.send(this.buildCommand(4,1));default:return console.log(t)}}},window.WVNC=s}).call(this); \ No newline at end of file +(function(){var e,t,n,s;(e=class e extends this.OS.GUI.BasicDialog{constructor(){super("ConnectionDialog",e.scheme)}main(){return super.main(),this.find("bbp").data=[{text:"16 bits",value:16,selected:!0},{text:"32 bits",value:32}],this.find("jq").value=40,this.find("bt-ok").onbtclick=e=>{var t;if(this.handle)return t={wvnc:this.find("txtWVNC").value,server:this.find("txtServer").value,bbp:this.find("bbp").selectedItem.data.value,quality:this.find("jq").value},this.handle(t),this.quit()},this.find("bt-cancel").onbtclick=e=>this.quit()}}).scheme='\n \n \n \n
\n \n \n
\n \n \n
\n \n
\n \n \n
\n
\n
\n
\n',(t=class e extends this.OS.GUI.BasicDialog{constructor(){super("CredentialDialog",e.scheme)}main(){return this.find("bt-ok").onbtclick=()=>{var e;return this.handle?(e={username:this.find("txtUser").value,password:this.find("txtPass").value},this.handle(e),this.quit()):this.quit()},this.find("bt-cancel").onbtclick=()=>this.quit()}}).scheme='\n \n \n \n
\n \n
\n \n \n
\n
\n
\n
',n=class extends this.OS.application.BaseApplication{constructor(e){super("RemoteDesktop",e)}main(){return this.canvas=this.find("screen"),this.container=this.find("container"),this.zoom=this.find("zoom"),this.btreset=this.find("btreset"),this.zoom.max=200,this.zoom.value=100,this.zoom.onvaluechange=e=>this.setScale(),this.switch=this.find("capture_mouse"),this.switch.onswchange=e=>this.client.mouseCapture=this.switch.swon,this.btreset.onbtclick=e=>{var t,n,s,i;return i=$(this.container).width(),t=$(this.container).height(),n=i/this.client.resolution.w,s=t/this.client.resolution.h,this.zoom.value=n>s?100*s:100*n,this.setScale()},this.client=new s({element:this.canvas}),this.bindKey("CTRL-SHIFT-V",e=>this.pasteText()),this.client.ondisconnect=()=>this.showConnectionDialog(),this.client.onresize=()=>this.setScale(),this.client.onpassword=()=>new Promise((e,t)=>this.openDialog("PromptDialog",{title:__("VNC password"),label:__("VNC password"),value:"password",type:"password"}).then((function(t){return e(t)}))),this.client.oncopy=e=>this._api.setClipboard(e),this.client.oncredential=()=>new Promise((e,n)=>this.openDialog(new t,{title:__("User credential")}).then((function(t){return e(t.username,t.password)}))),this.on("focus",e=>$(this.canvas).focus()),this.client.init().then(()=>this.showConnectionDialog())}pasteText(){var e;if(this.client)return e=e=>{if(e&&""!==e)return this.client.sendTextAsClipboard(e)},this._api.getClipboard().then(t=>e(t)).catch(t=>(this.error(__("Unable to paste"),t),this.openDialog("TextDialog",{title:"Paste text"}).then(t=>e(t)).catch(e=>this.error(e.toString(),e))))}setScale(){if(console.log("scale changed"),this.client&&this.client.resolution)return this.client.setScale(this.zoom.value/100),this.container.scrollLeft=0,this.container.scrollTop=0}menu(){return[{text:"__(Connection)",nodes:[{text:"__(New Connection)",dataid:this.name+"-new"},{text:"__(Disconnect)",dataid:this.name+"-close"}],onchildselect:e=>{if(this.client)return this.client.disconnect(!1)}}]}showConnectionDialog(){if(this.client)return this.openDialog(new e,{title:__("Connection")}).then(e=>(this.client.ws=e.wvnc,this.client.connect(e.server,e)))}cleanup(){return this.client&&this.client.disconnect(!0),this.client=void 0}},this.OS.register("RemoteDesktop",n),s=class{constructor(e){var t,n;this.socket=void 0,this.ws=void 0,this.canvas=void 0,n="pkg://RemoteDesktop/decoder_asm.js".asFileHandle().getlink(),this.scale=1,e.ws&&(this.ws=e.ws),this.canvas=e.element,"string"==typeof this.canvas&&(this.canvas=document.getElementById(this.canvas)),this.decoder=new Worker(n),this.enableEvent=!1,this.mouseCapture=!0,this.pingto=!1,t=this,this.mouseMask=0,this.decoder.onmessage=function(e){return t.process(e.data)}}init(){var e;return e=this,new Promise((function(t,n){return e.canvas?($(e.canvas).attr("tabindex","1"),$(e.canvas).on("focus",()=>e.resetModifierKeys()),e.initInputEvent(),t()):n("Canvas is not set")}))}initInputEvent(){var e,t,n,s;if(n=this,this.canvas&&(t=function(e){var t;return t=n.canvas.getBoundingClientRect(),{x:Math.floor((e.clientX-t.left)/n.scale),y:Math.floor((e.clientY-t.top)/n.scale)}},s=function(e){var s;if(n.enableEvent)return s=t(e),n.sendPointEvent(s.x,s.y,n.mouseMask)},n.canvas))return n.canvas.oncontextmenu=function(e){return e.preventDefault(),!1},n.canvas.onmousemove=function(e){if(n.mouseCapture)return s(e)},n.canvas.onmousedown=function(e){var t;if(n.mouseCapture)return t=1<this.disconnect(!0),window.addEventListener("unload",e),window.addEventListener("beforeunload",e)}initCanvas(e,t,n){return this.canvas.width=e,this.canvas.height=t,this.resolution={w:e,h:t},this.decoder.postMessage(this.resolution),this.setScale(this.scale)}process(e){var t,n,s;if(this.socket)return n=new Uint8Array(e.pixels),(s=(t=this.canvas.getContext("2d",{alpha:!1})).createImageData(e.w,e.h)).data.set(n),t.putImageData(s,e.x,e.y),this.socket.send(this.buildCommand(4,1));this.socket.send(this.buildCommand(4,1))}setScale(e){if(this.scale=e,this.canvas)return this.canvas.style.transformOrigin="0 0",this.canvas.style.transform="scale("+e+")"}connect(e,t){var n;if(n=this,this.disconnect(!1),this.ws)return this.socket=new WebSocket(this.ws),this.socket.binaryType="arraybuffer",this.socket.onopen=function(){return console.log("socket opened"),n.initConnection(e,t)},this.socket.onmessage=function(e){return n.consume(e)},this.socket.onerror=e=>n.onerror("Websocket error"),this.socket.onclose=function(){return n.socket=null,n.canvas.style.cursor="auto",n.canvas&&n.resolution&&n.canvas.getContext("2d").clearRect(0,0,n.resolution.w,n.resolution.h),n.pingto&&clearTimeout(n.pingto),n.pingto=void 0,n.ondisconnect(),console.log("socket closed")}}disconnect(e){return this.socket&&this.socket.close(),this.socket=void 0,e&&this.decoder.terminate(),this.enableEvent=!1}initConnection(e,t){var n;return(n=new Uint8Array(e.length+2))[0]=16,n[1]=50,t&&(t.bbp&&(n[0]=t.bbp),t.quality&&(n[1]=t.quality)),n.set((new TextEncoder).encode(e),2),this.socket.send(this.buildCommand(1,n))}resetModifierKeys(){if(this.socket&&this.enableEvent)return this.sendKeyEvent(65511,0),this.sendKeyEvent(65512,0),this.sendKeyEvent(65505,0),this.sendKeyEvent(65507,0),this.sendKeyEvent(65513,0)}sendPointEvent(e,t,n){var s;if(this.socket&&this.enableEvent)return(s=new Uint8Array(5))[0]=255&e,s[1]=e>>8,s[2]=255&t,s[3]=t>>8,s[4]=n,this.socket.send(this.buildCommand(5,s))}sendKeyEvent(e,t){var n;if(this.socket&&this.enableEvent)return(n=new Uint8Array(3))[0]=255&e,n[1]=e>>8&255,n[2]=t,this.socket.send(this.buildCommand(6,n))}sendPing(){if(this.socket)return this.socket.send(this.buildCommand(8,"PING WVNC"))}buildCommand(e,t){var n,s;switch(s=void 0,typeof t){case"string":s=(new TextEncoder).encode(t);break;case"number":s=new Uint8Array([t]);break;default:s=t}return(n=new Uint8Array(s.length+3))[0]=e,n[2]=s.length>>8,n[1]=15&s.length,n.set(s,3),n.buffer}oncopy(e){return console.log("Get clipboard text: "+e)}onpassword(){return new Promise((function(e,t){return t("onpassword is not implemented")}))}sendTextAsClipboard(e){var t;if(this.socket)return this.socket.send(this.buildCommand(7,e)),t="v".charCodeAt(0),this.sendKeyEvent(65507,1),this.sendKeyEvent(t,1),this.sendKeyEvent(t,0),this.sendKeyEvent(65507,0)}oncredential(){return new Promise((function(e,t){return t("oncredential is not implemented")}))}onerror(e){return console.log("Error",e)}onresize(){return console.log("resize")}ondisconnect(){return console.log("disconnect")}consume(e){var t,n,s,i,a,o,r;switch(t=(n=new Uint8Array(e.data))[0],o=this,t){case 254:return n=n.subarray(1,n.length-1),s=new TextDecoder("utf-8"),this.onerror(s.decode(n));case 129:return console.log("Request for password"),this.enableEvent=!1,this.onpassword().then((function(e){return o.socket.send(o.buildCommand(2,e)),o.enableEvent=!0}));case 130:return console.log("Request for login"),this.enableEvent=!1,this.oncredential().then((function(e,t){var n;return(n=new Uint8Array(e.length+t.length+1)).set((new TextEncoder).encode(e),0),n.set(["\0"],e.length),n.set((new TextEncoder).encode(t),e.length+1),o.socket.send(o.buildCommand(3,n)),o.enableEvent=!0}));case 131:if(r=n[1]|n[2]<<8,a=n[3]|n[4]<<8,this.initCanvas(r,a),this.socket.send(this.buildCommand(4,1)),this.enableEvent=!0,this.onresize(),this.pingto)return;return i=()=>(this.sendPing(),this.pingto=setTimeout(i,5e3)),this.pingto=setTimeout(i,5e3);case 132:return this.decoder.postMessage(n.buffer,[n.buffer]);case 133:return n=n.subarray(1),s=new TextDecoder("utf-8"),this.oncopy(s.decode(n)),this.socket.send(this.buildCommand(4,1));default:return console.log(t)}}},window.WVNC=s}).call(this); \ No newline at end of file diff --git a/RemoteDesktop/build/debug/package.json b/RemoteDesktop/build/debug/package.json index d1c46be..bc2fab3 100644 --- a/RemoteDesktop/build/debug/package.json +++ b/RemoteDesktop/build/debug/package.json @@ -7,7 +7,7 @@ "author": "Dany LE", "email": "contact@iohub.dev" }, - "version":"0.1.15-b", + "version":"0.1.16-b", "dependencies": [], "category":"Internet", "icon": "icon.png", diff --git a/RemoteDesktop/build/debug/scheme.html b/RemoteDesktop/build/debug/scheme.html index d038277..f2c97ef 100644 --- a/RemoteDesktop/build/debug/scheme.html +++ b/RemoteDesktop/build/debug/scheme.html @@ -8,10 +8,9 @@
- - - - + + +
\ No newline at end of file diff --git a/RemoteDesktop/build/release/RemoteDesktop.zip b/RemoteDesktop/build/release/RemoteDesktop.zip index 770dbd88dab89263b831a895509fcac2169cc8c9..e4e35c6e88b796992c5360cc88046fafc49c6804 100644 GIT binary patch delta 5369 zcmZXY1yod9_rPa{9vTS|5tN|@7(lu^1cs83knV;dHyf)auZA|R52D4j$1 z(A^*J{nxkN_ul{Bwa#7Z?zm^~ea}62|9&lE=PqFrX{usjg8={lJ|F>AcTIAHgG@lN z>Op34%jJLo01OKNAiR?zEbXkFtzmYa&Q2vsVj3MhWZkC$(Zg^ad4(!j=JL8WFcy~M z3Pj%`VJhLZJt!|%_^l{3CBB?hY6scs=gV>G45@@VB>#kC&8AYNLH4eX3DE0i>GK&g ztXbd!EfE@!P^DOC@Q6}72)Q&MAqz85gwhDJvB=a0x;RTLrDsxyBams8mYUXzbvl`x zxG`vG(goW~9?uNsp>(ITjvxICwTHrDf7mQ!w0MKP>GSS=d1=T;N1TrmuGJQ0b>lYY zX0orcH-@O@mZaA*D-934pvVK-pCsVCwJm?%*Mf^}_9i|XCji`+f`qcteVprh_{ZVi ztDIX!cfGdv1htD(Lpx>;O8C{hhK$phFk5h3>s5C0%ek%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NC.coffee @@ -10,6 +10,7 @@ class WVNC @canvas = document.getElementById @canvas if typeof @canvas is 'string' @decoder = new Worker worker @enableEvent = false + @mouseCapture = true @pingto = false me = @ @mouseMask = 0 @@ -47,15 +48,18 @@ class WVNC return false me.canvas.onmousemove = (e) -> + return unless me.mouseCapture sendMouseLocation e me.canvas.onmousedown = (e) -> + return unless me.mouseCapture state = 1 << e.button me.mouseMask = me.mouseMask | state sendMouseLocation e #e.preventDefault() me.canvas.onmouseup = (e) -> + return unless me.mouseCapture state = 1 << e.button me.mouseMask = me.mouseMask & (~state) sendMouseLocation e @@ -109,6 +113,7 @@ class WVNC # mouse wheel event @canvas.addEventListener 'wheel', (e) -> return unless me.enableEvent + return unless me.mouseCapture #if (e.deltaY < 0) # up p = getMousePos e e.preventDefault() diff --git a/RemoteDesktop/coffees/main.coffee b/RemoteDesktop/coffees/main.coffee index 2c67497..1682182 100644 --- a/RemoteDesktop/coffees/main.coffee +++ b/RemoteDesktop/coffees/main.coffee @@ -34,6 +34,7 @@ ConnectionDialog.scheme = """

+
@@ -65,6 +66,7 @@ CredentialDialog.scheme = """ +
@@ -87,14 +89,9 @@ class RemoteDesktop extends this.OS.application.BaseApplication @zoom.max = 200 @zoom.value = 100 @zoom.onvaluechange = (e) => @setScale() - @find("scroll_down").onbtclick = (e) => - @container.scrollTop += 20 - @find("scroll_up").onbtclick = (e) => - @container.scrollTop -= 20 - @find("scroll_left").onbtclick = (e) => - @container.scrollLeft -= 20 - @find("scroll_right").onbtclick = (e) => - @container.scrollLeft += 20 + @switch = @find "capture_mouse" + @switch.onswchange = (e) => + @client.mouseCapture = @switch.swon @btreset.onbtclick = (e) => w = $(@container).width() h = $(@container).height() diff --git a/RemoteDesktop/package.json b/RemoteDesktop/package.json index d1c46be..bc2fab3 100644 --- a/RemoteDesktop/package.json +++ b/RemoteDesktop/package.json @@ -7,7 +7,7 @@ "author": "Dany LE", "email": "contact@iohub.dev" }, - "version":"0.1.15-b", + "version":"0.1.16-b", "dependencies": [], "category":"Internet", "icon": "icon.png", diff --git a/packages.json b/packages.json index d74ea52..c48ce06 100644 --- a/packages.json +++ b/packages.json @@ -365,7 +365,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/RemoteDesktop/README.md", "category": "Internet", "author": "Dany LE", - "version": "0.1.15-b", + "version": "0.1.16-b", "dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/RemoteDesktop/build/release/RemoteDesktop.zip" },