mirror of
https://github.com/danbulant/node-x11
synced 2026-05-24 12:35:39 +00:00
BigReq should work now
This commit is contained in:
parent
9b439d3d80
commit
d6bc4d5c32
3 changed files with 16 additions and 14 deletions
|
|
@ -108,6 +108,7 @@ module.exports = {
|
||||||
CreateWindow: [
|
CreateWindow: [
|
||||||
// create request packet - function OR format string
|
// create request packet - function OR format string
|
||||||
function(id, parentId, x, y, width, height, borderWidth, _class, visual, values) {
|
function(id, parentId, x, y, width, height, borderWidth, _class, visual, values) {
|
||||||
|
|
||||||
// TODO: ??? there is depth field in xproto, but xlib just sets it to zero
|
// TODO: ??? there is depth field in xproto, but xlib just sets it to zero
|
||||||
var depth = 0;
|
var depth = 0;
|
||||||
|
|
||||||
|
|
@ -156,7 +157,7 @@ module.exports = {
|
||||||
],
|
],
|
||||||
|
|
||||||
MapWindow: [
|
MapWindow: [
|
||||||
// 8 - opcode, 2 - length
|
// 8 - opcode, 2 - length, wid added as parameter
|
||||||
[ 'CxSL', [8, 2] ]
|
[ 'CxSL', [8, 2] ]
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -330,10 +331,13 @@ 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 = 7 + padded/4; // (length + 3) >> 2 ???
|
var reqLen = 6 + 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 [ 'CCSLLLSSssCCxxaa', [72, format, 0, reqLen, drawable, gc, width, height, dstX, dstY, leftPad, depth, data, pad]];
|
|
||||||
|
// TODO: move code to calculate reqLength and use BigReq if needed outside of corereq.js
|
||||||
|
// NOTE: big req is used here (first 'L' in format, 0 and +1 in params), won't work if not enabled
|
||||||
|
return [ 'CCSLLLSSssCCxxaa', [72, format, 0, 1+reqLen, drawable, gc, width, height, dstX, dstY, leftPad, depth, data, pad]];
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,25 +4,23 @@
|
||||||
exports.requireExt = function(display, callback)
|
exports.requireExt = function(display, callback)
|
||||||
{
|
{
|
||||||
var X = display.client;
|
var X = display.client;
|
||||||
X.QueryExtension('BIG_REQUESTS', function(ext) {
|
X.QueryExtension('BIG-REQUESTS', function(ext) {
|
||||||
|
|
||||||
if (!ext.present)
|
if (!ext.present)
|
||||||
callback(new Error('extension not available'));
|
callback(new Error('extension not available'));
|
||||||
|
|
||||||
ext.Enable = function( callback )
|
ext.Enable = function( cb )
|
||||||
{
|
{
|
||||||
X.seq_num++;
|
X.seq_num++;
|
||||||
X.pack_stream.pack('CCSL', [ext.majorOpcode, 0, 1]);
|
X.pack_stream.pack('CCS', [ext.majorOpcode, 0, 1]);
|
||||||
X.replies[X.seq_num] = [
|
X.replies[X.seq_num] = [
|
||||||
function(buf, opt) {
|
function(buf, opt) {
|
||||||
// max packet size in reply
|
return buf.unpack('L')[0];
|
||||||
console.log([buf, opt]);
|
|
||||||
},
|
},
|
||||||
callback
|
cb
|
||||||
];
|
];
|
||||||
X.pack_stream.flush();
|
X.pack_stream.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(ext);
|
callback(ext);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ for (var i=0; i < bitmap.length; ++i)
|
||||||
}
|
}
|
||||||
|
|
||||||
xclient.on('connect', function(display) {
|
xclient.on('connect', function(display) {
|
||||||
var X = this;
|
|
||||||
|
|
||||||
X.QueryExtension('BIG-REQUESTS', function(BigReq) {
|
var X = display.client;
|
||||||
console.log(BigReq);
|
X.require('big-requests', function(BigReq) {
|
||||||
|
|
||||||
BigReq.Enable(function(maxLen) { console.log( maxLen ); });
|
BigReq.Enable(function(maxLen) { console.log( maxLen ); });
|
||||||
|
|
||||||
var root = display.screen[0].root;
|
var root = display.screen[0].root;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue