diff --git a/lib/x11/auth.js b/lib/x11/auth.js index d12a54b..b9b22c1 100644 --- a/lib/x11/auth.js +++ b/lib/x11/auth.js @@ -27,26 +27,21 @@ function parseXauth( buf ) }; cookie.type = buf.unpack('n')[0]; offset += 2; - console.log(cookie.type); // TODO: rewrite following using loop (16bits length + string data) var addressLen = buf.unpack('n', offset)[0]; offset += 2; - console.log(addressLen); cookie.address = buf.unpackString(addressLen, offset); offset += addressLen; var displayNumLen = buf.unpack('n', offset)[0]; - console.log(displayNumLen); offset += 2; cookie.display = buf.unpackString(displayNumLen, offset); offset += displayNumLen; var authNameLen = buf.unpack('n', offset)[0]; offset += 2; - console.log(authNameLen); cookie.authName = buf.unpackString(authNameLen, offset); offset += authNameLen; var authDataLen = buf.unpack('n', offset)[0]; offset += 2; - console.log(authDataLen); cookie.authData = buf.unpackString(authDataLen, offset); offset += authDataLen; auth.push(cookie); diff --git a/lib/x11/xcore.js b/lib/x11/xcore.js index 878b09c..3ab66ee 100644 --- a/lib/x11/xcore.js +++ b/lib/x11/xcore.js @@ -19,7 +19,7 @@ var xerrors = require('./xerrors'); var coreRequests = require('./corereqs'); var stdatoms = require('./stdatoms'); -function XClient(stream) +function XClient(stream, displayNum, screenNum) { EventEmitter.call(this); this.stream = stream; @@ -27,6 +27,10 @@ function XClient(stream) this.core_requests = {}; this.ext_requests = {}; + this.displayNum = displayNum; + this.screenNum = screenNum; + this.authHost = os.hostname(); + pack_stream = new PackStream(); // data received from stream is dispached to @@ -329,10 +333,7 @@ module.exports.createClient = function(initCb, display) if (defaultTransportName == 'unix' && host == '127.0.0.1') stream = net.createConnection('/tmp/.X11-unix/X' + displayNum); - var client = new XClient(stream); - client.displayNum = displayNum; - client.screenNum = screenNum; - client.authHost = os.hostname(); + var client = new XClient(stream, displayNum, screenNum); if (initCb) { client.on('connect', function(display) {