mirror of
https://github.com/danbulant/node-x11
synced 2026-05-27 05:52:02 +00:00
QueryExtension request
This commit is contained in:
parent
a911771bfc
commit
0ca8b090be
2 changed files with 41 additions and 2 deletions
|
|
@ -229,7 +229,6 @@ module.exports = {
|
||||||
format += 'S';
|
format += 'S';
|
||||||
args.push(points[i]);
|
args.push(points[i]);
|
||||||
}
|
}
|
||||||
console.error([format, args]);
|
|
||||||
return [format, args];
|
return [format, args];
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -245,7 +244,6 @@ module.exports = {
|
||||||
format += 'S';
|
format += 'S';
|
||||||
args.push(points[i]);
|
args.push(points[i]);
|
||||||
}
|
}
|
||||||
console.error([format, args]);
|
|
||||||
return [format, args];
|
return [format, args];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -285,6 +283,24 @@ module.exports = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
QueryExtension: [
|
||||||
|
function(name) {
|
||||||
|
var padded = xutil.padded_string(name);
|
||||||
|
return ['CxSSxxa', [98, 2+padded.length/4, name.length, padded] ];
|
||||||
|
},
|
||||||
|
|
||||||
|
function(buf) {
|
||||||
|
var res = buf.unpack('CCCC');
|
||||||
|
var ext = {};
|
||||||
|
ext.present = res[0];
|
||||||
|
ext.majorOpcode = res[1];
|
||||||
|
ext.firstEvent = res[2];
|
||||||
|
ext.firstError = res[3];
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
ListExtensions: [
|
ListExtensions: [
|
||||||
[ 'CxS', [99, 1] ],
|
[ 'CxS', [99, 1] ],
|
||||||
|
|
||||||
|
|
@ -297,6 +313,12 @@ module.exports = {
|
||||||
var len = buf[off++];
|
var len = buf[off++];
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
break;
|
break;
|
||||||
|
if (off + len > buf.length)
|
||||||
|
{
|
||||||
|
len = buf.length - off;
|
||||||
|
if (len <= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
res.push(buf.unpackString(len, off));
|
res.push(buf.unpackString(len, off));
|
||||||
off += len;
|
off += len;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17
test/query_ext.js
Normal file
17
test/query_ext.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
var x11 = require('../lib/x11');
|
||||||
|
var X = x11.createClient();
|
||||||
|
var numExt = 0;
|
||||||
|
X.on('connect', function(display) {
|
||||||
|
X.ListExtensions(function(list) {
|
||||||
|
console.log(list);
|
||||||
|
list.forEach(function(ext) {
|
||||||
|
numExt++;
|
||||||
|
X.QueryExtension(ext, function(e) {
|
||||||
|
e.name = ext;
|
||||||
|
console.log(e);
|
||||||
|
if (--numExt == 0)
|
||||||
|
X.terminate();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue