mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
Trying to fix tests
This commit is contained in:
parent
48f132b3fe
commit
d46d43a22e
3 changed files with 30 additions and 16 deletions
|
|
@ -188,7 +188,7 @@ var valueMask = {
|
|||
},
|
||||
stackMode : {
|
||||
mask: 0x000040,
|
||||
format: 'Cxx'
|
||||
format: 'Cxxx'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -285,6 +285,7 @@ var templates = {
|
|||
format += vals[0];
|
||||
args.push(vals[1]);
|
||||
args = args.concat(vals[2]);
|
||||
// console.log('CreateWindow', format, args);
|
||||
return [format, args];
|
||||
}
|
||||
|
||||
|
|
@ -292,13 +293,14 @@ var templates = {
|
|||
|
||||
ChangeWindowAttributes:[
|
||||
function(wid, values) {
|
||||
var format = 'CxSLL';
|
||||
var format = 'CxSLSxx';
|
||||
var packetLength = 3 + (values ? Object.keys(values).length : 0);
|
||||
var vals = packValueMask('CreateWindow', values);
|
||||
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];
|
||||
}
|
||||
],
|
||||
|
|
@ -360,12 +362,13 @@ var templates = {
|
|||
*/
|
||||
function(win, options) {
|
||||
var vals = packValueMask('ConfigureWindow', options);
|
||||
var format = 'CxSLL' + vals[0];
|
||||
var params = [12, Object.keys(options).length + 3, win, vals[1]];
|
||||
var format = 'CxSLSxx' + vals[0];
|
||||
var args = [12, Object.keys(options).length + 3, win, vals[1]];
|
||||
|
||||
params = params.concat(vals[2]);
|
||||
args = args.concat(vals[2]);
|
||||
|
||||
return [format, params];
|
||||
// console.log('ConfigureWindow', format, args);
|
||||
return [format, args];
|
||||
}
|
||||
],
|
||||
|
||||
|
|
@ -476,7 +479,7 @@ var templates = {
|
|||
},
|
||||
|
||||
function(buf, format) {
|
||||
var res = buf.unpack('LLL');
|
||||
var res = buf.unpack('LLL');
|
||||
var prop = {};
|
||||
prop.type = res[0];
|
||||
prop.bytesAfter = res[1];
|
||||
|
|
@ -744,6 +747,7 @@ var templates = {
|
|||
// 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];
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@
|
|||
var x11 = require('..');
|
||||
// TODO: move to templates
|
||||
|
||||
exports.requireExt = function(display, callback)
|
||||
exports.requireExt = function(display, callback)
|
||||
{
|
||||
var X = display.client;
|
||||
X.QueryExtension('Composite', function(err, ext) {
|
||||
X.QueryExtension('Composite', function(err, ext) {
|
||||
|
||||
if (!ext.present)
|
||||
return callback(new Error('extension not available'));
|
||||
|
||||
ext.Redirect = {
|
||||
ext.Redirect = {
|
||||
Automatic: 0,
|
||||
Manual: 1
|
||||
};
|
||||
|
|
@ -33,7 +33,7 @@ exports.requireExt = function(display, callback)
|
|||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 0, 3, clientMaj, clientMin]);
|
||||
X.replies[X.seq_num] = [
|
||||
function(buf, opt) {
|
||||
var res = buf.unpack('LL');
|
||||
var res = buf.unpack('LL');
|
||||
return res;
|
||||
},
|
||||
callback
|
||||
|
|
@ -82,7 +82,7 @@ exports.requireExt = function(display, callback)
|
|||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 6, 3, window, pixmap]);
|
||||
X.pack_stream.flush();
|
||||
}
|
||||
|
||||
|
||||
ext.GetOverlayWindow = function(window, callback)
|
||||
{
|
||||
X.seq_num++;
|
||||
|
|
@ -96,19 +96,22 @@ exports.requireExt = function(display, callback)
|
|||
];
|
||||
X.pack_stream.flush();
|
||||
}
|
||||
|
||||
|
||||
ext.ReleaseOverlayWindow = function(window)
|
||||
{
|
||||
X.seq_num++;
|
||||
X.pack_stream.pack('CCSL', [ext.majorOpcode, 8, 2, window]);
|
||||
X.pack_stream.flush();
|
||||
}
|
||||
|
||||
|
||||
// currently version 0.4 TODO: bump up with coordinate translations
|
||||
ext.QueryVersion(0, 4, function(err, vers) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
|
||||
ext.major = vers[0];
|
||||
ext.minor = vers[1];
|
||||
callback(ext);
|
||||
callback(null, ext);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ 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);
|
||||
|
|
@ -65,6 +71,7 @@ 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();
|
||||
|
|
@ -75,7 +82,7 @@ describe('ConfigureWindow', function() {
|
|||
after(function(done) {
|
||||
this.X.DestroyWindow(this.wid);
|
||||
this.X.DestroyWindow(this.wid_helper);
|
||||
this.X.terminate();
|
||||
this.X.on('end', done);
|
||||
this.X.terminate();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue