mirror of
https://github.com/danbulant/node-x11
synced 2026-05-27 05:52:02 +00:00
initial big-reqests support
This commit is contained in:
parent
51a9febab2
commit
53c5df562b
2 changed files with 30 additions and 2 deletions
|
|
@ -330,10 +330,10 @@ module.exports = {
|
||||||
// format: 0 - Bitmap, 1 - XYPixmap, 2 - ZPixmap
|
// format: 0 - Bitmap, 1 - XYPixmap, 2 - ZPixmap
|
||||||
function(format, drawable, gc, width, height, dstX, dstY, leftPad, depth, data) {
|
function(format, drawable, gc, width, height, dstX, dstY, leftPad, depth, data) {
|
||||||
var padded = xutil.padded_length(data.length);
|
var padded = xutil.padded_length(data.length);
|
||||||
var reqLen = 6 + padded/4; // (length + 3) >> 2 ???
|
var reqLen = 7 + padded/4; // (length + 3) >> 2 ???
|
||||||
var padLength = padded - data.length;
|
var padLength = padded - data.length;
|
||||||
var pad = new Buffer(padLength); // TODO: new pack format 'X' - skip amount of bytes supplied in numerical argument
|
var pad = new Buffer(padLength); // TODO: new pack format 'X' - skip amount of bytes supplied in numerical argument
|
||||||
return [ 'CCSLLSSssCCxxaa', [72, format, reqLen, drawable, gc, width, height, dstX, dstY, leftPad, depth, data, pad]];
|
return [ 'CCSLLLSSssCCxxaa', [72, format, 0, reqLen, drawable, gc, width, height, dstX, dstY, leftPad, depth, data, pad]];
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
28
lib/x11/ext/big-requests.js
Normal file
28
lib/x11/ext/big-requests.js
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
// http://www.x.org/releases/X11R7.6/doc/bigreqsproto/bigreq.html
|
||||||
|
|
||||||
|
// TODO: move to templates
|
||||||
|
exports.requireExt = function(display, callback)
|
||||||
|
{
|
||||||
|
var X = display.client;
|
||||||
|
X.QueryExtension('BIG_REQUESTS', function(ext) {
|
||||||
|
|
||||||
|
if (!ext.present)
|
||||||
|
callback(new Error('extension not available'));
|
||||||
|
|
||||||
|
ext.Enable = function( callback )
|
||||||
|
{
|
||||||
|
X.seq_num++;
|
||||||
|
X.pack_stream.pack('CCSL', [ext.majorOpcode, 0, 1]);
|
||||||
|
X.replies[X.seq_num] = [
|
||||||
|
function(buf, opt) {
|
||||||
|
// max packet size in reply
|
||||||
|
console.log([buf, opt]);
|
||||||
|
},
|
||||||
|
callback
|
||||||
|
];
|
||||||
|
X.pack_stream.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(ext);
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue