mirror of
https://github.com/danbulant/node-x11
synced 2026-06-10 10:11:03 +00:00
src: fix CreateNotify parsing and add new test
- The first 4 fields in an event 'CCSL' are already unpacked in expectReplyHeader. No need to get the L field again: it is already in the 'extra' variable.
This commit is contained in:
parent
bd991fa6e3
commit
3b18e43fe6
2 changed files with 21 additions and 1 deletions
|
|
@ -301,7 +301,7 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw, headerBuf)
|
|||
event.height = values[3];
|
||||
event.count = values[4]; // TODO: ???
|
||||
} else if (type == 16) { // CreateNotify
|
||||
var values = raw.unpack('LLssSSSc');
|
||||
var values = raw.unpack('LssSSSc');
|
||||
event.name = 'CreateNotify'
|
||||
event.parent = extra;
|
||||
event.wid = values[0];
|
||||
|
|
|
|||
|
|
@ -57,4 +57,24 @@ describe('CreateWindow request', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should emit CreateNotify event when', function(done) {
|
||||
var wid = X.AllocID();
|
||||
var root = display.screen[0].root;
|
||||
X.ChangeWindowAttributes(root, { eventMask: x11.eventMask.SubstructureNotify });
|
||||
X.on('event', function(ev) {
|
||||
ev.name.should.equal('CreateNotify');
|
||||
ev.parent.should.equal(root);
|
||||
ev.wid.should.equal(wid);
|
||||
ev.x.should.equal(0);
|
||||
ev.y.should.equal(0);
|
||||
ev.width.should.equal(1);
|
||||
ev.height.should.equal(1);
|
||||
ev.borderWidth.should.equal(0);
|
||||
ev.overrideRedirect.should.equal(false);
|
||||
done();
|
||||
});
|
||||
|
||||
X.CreateWindow(wid, root, 0, 0, 1, 1); // 1x1 pixel window
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue