diff --git a/RemoteDesktop/README.md b/RemoteDesktop/README.md
index a5ffe16..dbb57ff 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.11 - Support 16 bits per pixel
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability
diff --git a/RemoteDesktop/build/debug/README.md b/RemoteDesktop/build/debug/README.md
index a5ffe16..dbb57ff 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.11 - Support 16 bits per pixel
* v0.1.10 - Allow to sync clipboard between local and remote machine, CTRL+SHIF+V to paste text from local to remote machine
* v0.1.9 - improve stability
* v0.1.7-8 - remove package dependencies, use web assembly for jpeg decoding, improve rendering performance and connection stability
diff --git a/RemoteDesktop/build/debug/decoder_asm.js b/RemoteDesktop/build/debug/decoder_asm.js
index be57af6..468314f 100644
--- a/RemoteDesktop/build/debug/decoder_asm.js
+++ b/RemoteDesktop/build/debug/decoder_asm.js
@@ -11,19 +11,20 @@
return api = {
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
- updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']),
- decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number'])
+ updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
+ decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
};
};
wasm_update = function(msg) {
- var datain, dataout, flag, h, p, po, size, tmp, w, x, y;
+ var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
datain = new Uint8Array(msg);
x = datain[1] | (datain[2] << 8);
y = datain[3] | (datain[4] << 8);
w = datain[5] | (datain[6] << 8);
h = datain[7] | (datain[8] << 8);
- flag = datain[9];
+ flag = datain[9] & 0x01;
+ bbp = datain[9] & 0xFE;
msg = {};
msg.pixels = void 0;
msg.x = x;
@@ -31,13 +32,10 @@
msg.w = w;
msg.h = h;
size = w * h * 4;
- tmp = new Uint8Array(size);
- if (flag === 0) {
- tmp.set(datain.subarray(10), 0);
- msg.pixels = tmp.buffer;
- postMessage(msg, [msg.pixels]);
+ if (size === 0) {
return;
}
+ tmp = new Uint8Array(size);
p = api.createBuffer(datain.length);
Module.HEAP8.set(datain, p);
po = api.decodeBuffer(p, datain.length, size);
@@ -45,12 +43,14 @@
tmp.set(dataout, 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
- api.destroyBuffer(po);
- return api.destroyBuffer(p);
+ api.destroyBuffer(p);
+ if (flag !== 0x0 || bbp !== 32) {
+ return api.destroyBuffer(po);
+ }
};
onmessage = function(e) {
- if (e.data.depth) {
+ if (e.data.width) {
return resolution = e.data;
} else {
return wasm_update(e.data);
diff --git a/RemoteDesktop/build/debug/main.js b/RemoteDesktop/build/debug/main.js
index 70aa84d..32543f1 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("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,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=class extends this.OS.application.BaseApplication{constructor(e){super("RemoteDesktop",e)}main(){return this.canvas=this.find("screen"),this.container=this.find("container"),this.client=new s({element:this.canvas}),this.bindKey("CTRL-SHIFT-V",e=>this.pasteText()),this.client.onerror=e=>(this.error(e),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("resize",e=>this.setScale()),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(){var e,t,n,s;if(this.client&&this.client.resolution)return s=$(this.container).width(),e=$(this.container).height(),(t=s/this.client.resolution.w)>(n=e/this.client.resolution.h)?this.client.setScale(n):this.client.setScale(t)}menu(){return[{text:"__(Connection)",nodes:[{text:"__(New Connection)",dataid:this.name+"-new"},{text:"__(Disconnect)",dataid:this.name+"-close"}],onchildselect:e=>this.actionConnection()}]}actionConnection(e){return this.client&&this.client.disconnect(!1),this.showConnectionDialog()}showConnectionDialog(){return this.openDialog(new e,{title:__("Connection")}).then(e=>(this.client.ws=e.wvnc,this.client.connect(e.server,e)))}cleanup(){if(this.client)return this.client.disconnect(!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.depth=n,this.canvas.width=e,this.canvas.height=t,this.resolution={w:e,h:t,depth:this.depth},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)}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.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,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+1))[0]=50,t&&t.quality&&(n[0]=t.quality),n.set((new TextEncoder).encode(e),1),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")}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,32),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]),this.socket.send(this.buildCommand(4,1));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 \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.client=new s({element:this.canvas}),this.bindKey("CTRL-SHIFT-V",e=>this.pasteText()),this.client.onerror=e=>(this.error(e),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("resize",e=>this.setScale()),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(){var e,t,n,s;if(this.client&&this.client.resolution)return s=$(this.container).width(),e=$(this.container).height(),(t=s/this.client.resolution.w)>(n=e/this.client.resolution.h)?this.client.setScale(n):this.client.setScale(t)}menu(){return[{text:"__(Connection)",nodes:[{text:"__(New Connection)",dataid:this.name+"-new"},{text:"__(Disconnect)",dataid:this.name+"-close"}],onchildselect:e=>this.actionConnection()}]}actionConnection(e){return this.client&&this.client.disconnect(!1),this.showConnectionDialog()}showConnectionDialog(){return this.openDialog(new e,{title:__("Connection")}).then(e=>(this.client.ws=e.wvnc,this.client.connect(e.server,e)))}cleanup(){if(this.client)return this.client.disconnect(!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)}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.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,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")}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]),this.socket.send(this.buildCommand(4,1));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 5281648..c303358 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.10-b",
+ "version":"0.1.11-b",
"dependencies": [],
"category":"Internet",
"icon": "icon.png",
diff --git a/RemoteDesktop/build/debug/wvnc_asm.wasm b/RemoteDesktop/build/debug/wvnc_asm.wasm
index b07a94e..c043223 100644
Binary files a/RemoteDesktop/build/debug/wvnc_asm.wasm and b/RemoteDesktop/build/debug/wvnc_asm.wasm differ
diff --git a/RemoteDesktop/build/release/RemoteDesktop.zip b/RemoteDesktop/build/release/RemoteDesktop.zip
index 8227134..b28f366 100644
Binary files a/RemoteDesktop/build/release/RemoteDesktop.zip and b/RemoteDesktop/build/release/RemoteDesktop.zip differ
diff --git a/RemoteDesktop/coffees/WVNC.coffee b/RemoteDesktop/coffees/WVNC.coffee
index 00a312b..014c2b1 100644
--- a/RemoteDesktop/coffees/WVNC.coffee
+++ b/RemoteDesktop/coffees/WVNC.coffee
@@ -138,13 +138,11 @@ class WVNC
initCanvas: (w, h , d) ->
me = @
- @depth = d
@canvas.width = w
@canvas.height = h
@resolution =
w: w,
h: h,
- depth: @depth
@decoder.postMessage @resolution
#me.canvas.style.cursor = "none"
@setScale @scale
@@ -193,13 +191,15 @@ class WVNC
initConnection: (vncserver, params) ->
#vncserver = "192.168.1.20:5901"
- data = new Uint8Array vncserver.length + 1
- data[0] = 50 # jpeg quality
+ data = new Uint8Array vncserver.length + 2
+ data[0] = 16 # bbp
+ data[1] = 50 # jpeg quality
if params
- data[0] = params.quality if params.quality
+ data[0] = params.bbp if params.bbp
+ data[1] = params.quality if params.quality
## rate in milisecond
- data.set (new TextEncoder()).encode(vncserver), 1
+ data.set (new TextEncoder()).encode(vncserver), 2
@socket.send(@buildCommand 0x01, data)
resetModifierKeys: () ->
@@ -308,8 +308,7 @@ class WVNC
when 0x83
w = data[1] | (data[2]<<8)
h = data[3] | (data[4]<<8)
- depth = 32
- @initCanvas w, h, depth
+ @initCanvas w, h
# status command for ack
@socket.send(@buildCommand 0x04, 1)
@enableEvent = true
diff --git a/RemoteDesktop/coffees/main.coffee b/RemoteDesktop/coffees/main.coffee
index 8526dfa..f9e3dd9 100644
--- a/RemoteDesktop/coffees/main.coffee
+++ b/RemoteDesktop/coffees/main.coffee
@@ -5,12 +5,17 @@ class ConnectionDialog extends this.OS.GUI.BasicDialog
main: () ->
super.main()
+ @find("bbp").data = [
+ { text: "16 bits", value: 16, selected: true },
+ { text: "32 bits", value: 32 }
+ ]
@find("jq").value = 40
@find("bt-ok").onbtclick = (e) =>
return unless @handle
data =
wvnc: (@find "txtWVNC").value
server: (@find "txtServer").value
+ bbp: (@find "bbp").selectedItem.data.value,
quality:(@find "jq").value
@handle data
@quit()
@@ -19,7 +24,7 @@ class ConnectionDialog extends this.OS.GUI.BasicDialog
@quit()
ConnectionDialog.scheme = """
-
+
@@ -28,6 +33,9 @@ ConnectionDialog.scheme = """
+
+
+
diff --git a/RemoteDesktop/javascript/decoder_asm.js b/RemoteDesktop/javascript/decoder_asm.js
index be57af6..468314f 100644
--- a/RemoteDesktop/javascript/decoder_asm.js
+++ b/RemoteDesktop/javascript/decoder_asm.js
@@ -11,19 +11,20 @@
return api = {
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
- updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']),
- decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number'])
+ updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
+ decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
};
};
wasm_update = function(msg) {
- var datain, dataout, flag, h, p, po, size, tmp, w, x, y;
+ var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
datain = new Uint8Array(msg);
x = datain[1] | (datain[2] << 8);
y = datain[3] | (datain[4] << 8);
w = datain[5] | (datain[6] << 8);
h = datain[7] | (datain[8] << 8);
- flag = datain[9];
+ flag = datain[9] & 0x01;
+ bbp = datain[9] & 0xFE;
msg = {};
msg.pixels = void 0;
msg.x = x;
@@ -31,13 +32,10 @@
msg.w = w;
msg.h = h;
size = w * h * 4;
- tmp = new Uint8Array(size);
- if (flag === 0) {
- tmp.set(datain.subarray(10), 0);
- msg.pixels = tmp.buffer;
- postMessage(msg, [msg.pixels]);
+ if (size === 0) {
return;
}
+ tmp = new Uint8Array(size);
p = api.createBuffer(datain.length);
Module.HEAP8.set(datain, p);
po = api.decodeBuffer(p, datain.length, size);
@@ -45,12 +43,14 @@
tmp.set(dataout, 0);
msg.pixels = tmp.buffer;
postMessage(msg, [msg.pixels]);
- api.destroyBuffer(po);
- return api.destroyBuffer(p);
+ api.destroyBuffer(p);
+ if (flag !== 0x0 || bbp !== 32) {
+ return api.destroyBuffer(po);
+ }
};
onmessage = function(e) {
- if (e.data.depth) {
+ if (e.data.width) {
return resolution = e.data;
} else {
return wasm_update(e.data);
diff --git a/RemoteDesktop/javascript/wvnc_asm.wasm b/RemoteDesktop/javascript/wvnc_asm.wasm
index b07a94e..c043223 100755
Binary files a/RemoteDesktop/javascript/wvnc_asm.wasm and b/RemoteDesktop/javascript/wvnc_asm.wasm differ
diff --git a/RemoteDesktop/package.json b/RemoteDesktop/package.json
index 5281648..c303358 100644
--- a/RemoteDesktop/package.json
+++ b/RemoteDesktop/package.json
@@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
- "version":"0.1.10-b",
+ "version":"0.1.11-b",
"dependencies": [],
"category":"Internet",
"icon": "icon.png",
diff --git a/packages.json b/packages.json
index d552959..d092f95 100644
--- a/packages.json
+++ b/packages.json
@@ -365,7 +365,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md",
"category": "Internet",
"author": "Dany LE",
- "version": "0.1.10-b",
+ "version": "0.1.11-b",
"dependencies": [],"category":"Internet","icon":"icon.png","mimes":["none"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip"
},