initial big-reqests support

This commit is contained in:
Andrey Sidorov 2011-09-09 10:04:19 +10:00
parent 51a9febab2
commit 53c5df562b
2 changed files with 30 additions and 2 deletions

View file

@ -330,10 +330,10 @@ module.exports = {
// format: 0 - Bitmap, 1 - XYPixmap, 2 - ZPixmap
function(format, drawable, gc, width, height, dstX, dstY, leftPad, depth, data) {
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 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]];
}
],

View 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);
});
}