mirror of
https://github.com/danbulant/node-x11
synced 2026-05-21 13:29:13 +00:00
fixed PR
This commit is contained in:
parent
0c95b39c28
commit
4feba92047
2 changed files with 8 additions and 28 deletions
|
|
@ -270,11 +270,9 @@ var templates = {
|
|||
if (values === undefined)
|
||||
values = {}
|
||||
|
||||
var packetLength = 8 + (values ? Object.keys(values).length : 0);
|
||||
var format = 'CCSLLssSSSSLL';
|
||||
|
||||
// TODO: slice from function arguments?
|
||||
var args = [1, depth, packetLength, id, parentId, x, y, width, height, borderWidth, _class, visual];
|
||||
|
||||
// TODO: the code is a little bit mess
|
||||
// additional values need to be packed in the following way:
|
||||
|
|
@ -282,10 +280,11 @@ var templates = {
|
|||
// values list (bytes #32 .. #32+4*num_values) in order of corresponding bits TODO: it's actually not 4*num. Some values are 4b ytes, some - 1 byte
|
||||
|
||||
var vals = packValueMask('CreateWindow', values);
|
||||
var packetLength = 8 + (values ? vals[2].length : 0);
|
||||
var args = [1, depth, packetLength, id, parentId, x, y, width, height, borderWidth, _class, visual];
|
||||
format += vals[0];
|
||||
args.push(vals[1]);
|
||||
args = args.concat(vals[2]);
|
||||
// console.log('CreateWindow', format, args);
|
||||
return [format, args];
|
||||
}
|
||||
|
||||
|
|
@ -294,13 +293,12 @@ var templates = {
|
|||
ChangeWindowAttributes:[
|
||||
function(wid, values) {
|
||||
var format = 'CxSLSxx';
|
||||
var packetLength = 3 + (values ? Object.keys(values).length : 0);
|
||||
var vals = packValueMask('CreateWindow', values);
|
||||
var packetLength = 3 + (values ? vals[2].length : 0);
|
||||
var args = [2, packetLength, wid, vals[1]];
|
||||
var valArr = vals[2];
|
||||
format += vals[0];
|
||||
args = args.concat(valArr);
|
||||
// console.log('ChangeWindowAttributes', format, args);
|
||||
return [format, args];
|
||||
}
|
||||
],
|
||||
|
|
@ -363,11 +361,8 @@ var templates = {
|
|||
function(win, options) {
|
||||
var vals = packValueMask('ConfigureWindow', options);
|
||||
var format = 'CxSLSxx' + vals[0];
|
||||
var args = [12, Object.keys(options).length + 3, win, vals[1]];
|
||||
|
||||
var args = [12, vals[2].length + 3, win, vals[1]];
|
||||
args = args.concat(vals[2]);
|
||||
|
||||
// console.log('ConfigureWindow', format, args);
|
||||
return [format, args];
|
||||
}
|
||||
],
|
||||
|
|
@ -741,19 +736,12 @@ var templates = {
|
|||
CreateGC: [
|
||||
function(cid, drawable, values) {
|
||||
var format = 'CxSLLL';
|
||||
var packetLength = 4 + (values ? Object.keys(values).length : 0);
|
||||
var args = [55, packetLength, cid, drawable];
|
||||
var vals = packValueMask('CreateGC', values);
|
||||
var packetLength = 4 + (values ? vals[2].length : 0);
|
||||
var args = [55, packetLength, cid, drawable];
|
||||
format += vals[0]
|
||||
args.push(vals[1]); // values bitmask
|
||||
args = args.concat(vals[2])
|
||||
// var valArr = vals[2];
|
||||
// for (var v in valArr)
|
||||
// {
|
||||
// format += 'L'; // TODO: we know format string length in advance and += inefficient for string
|
||||
// args.push(valArr[v]);
|
||||
// }
|
||||
console.log('CreateGC', format, args);
|
||||
return [format, args];
|
||||
}
|
||||
],
|
||||
|
|
@ -761,9 +749,9 @@ var templates = {
|
|||
ChangeGC: [
|
||||
function(cid, values) {
|
||||
var format = 'CxSLL';
|
||||
var packetLength = 3 + (values ? Object.keys(values).length : 0);
|
||||
var args = [56, packetLength, cid];
|
||||
var vals = packValueMask('CreateGC', values);
|
||||
var packetLength = 3 + (values ? vals[2].length : 0);
|
||||
var args = [56, packetLength, cid];
|
||||
args.push(vals[0]); // values bitmask
|
||||
var valArr = vals[1];
|
||||
for (var v in valArr)
|
||||
|
|
@ -852,7 +840,6 @@ var templates = {
|
|||
// 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]];
|
||||
// return [ 'CCSLLLSSssCCxxaa', [72, format, 0, 1+reqLen, drawable, gc, width, height, dstX, dstY, leftPad, depth, data, pad]];
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,6 @@ describe('ConfigureWindow', function() {
|
|||
self.wid_helper = self.X.AllocID();
|
||||
self.X.CreateWindow(self.wid, dpy.screen[0].root, 0, 0, 1, 1); // 1x1 pixel window
|
||||
self.X.CreateWindow(self.wid_helper, dpy.screen[0].root, 0, 0, 1, 1); // 1x1 pixel window
|
||||
|
||||
|
||||
// self.X.ConfigureWindow(self.wid, { stackMode: 1 });
|
||||
// self.X.ConfigureWindow(self.wid_helper, { stackMode: 1 });
|
||||
|
||||
|
||||
self.X.QueryTree(dpy.screen[0].root, function(err, list) {
|
||||
should.not.exist(err);
|
||||
list.children.indexOf(self.wid).should.not.equal(-1);
|
||||
|
|
@ -71,7 +65,6 @@ describe('ConfigureWindow', function() {
|
|||
it('should RaiseWindow correctly', function(done) {
|
||||
var self = this;
|
||||
this.X.once('event', function(ev) {
|
||||
console.log(ev);
|
||||
ev.type.should.equal(22); /* ConfigureNotify */
|
||||
ev.aboveSibling.should.equal(self.wid_helper);
|
||||
done();
|
||||
|
|
|
|||
Loading…
Reference in a new issue