mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 20:39:03 +00:00
Merge pull request #73 from sidorares/fix_configure_request
events: fix ConfigureRequest parsing
This commit is contained in:
commit
0fc0a6a411
2 changed files with 64 additions and 7 deletions
16
lib/xcore.js
16
lib/xcore.js
|
|
@ -344,15 +344,17 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw, headerBuf)
|
|||
event.borderWidth = values[6];
|
||||
event.overrideRedirect = values[7];
|
||||
} else if (type == 23) {
|
||||
var values = raw.unpack('LLLssSSS');
|
||||
event.name = 'ConfigureRequest'
|
||||
var values = raw.unpack('LLssSSSS');
|
||||
event.name = 'ConfigureRequest';
|
||||
event.stackMode = code;
|
||||
event.parent = extra;
|
||||
event.wid = values[0];
|
||||
event.x = values[1]
|
||||
event.y = values[2]
|
||||
event.width = values[3]
|
||||
event.height = values[4]
|
||||
event.borderWidth = values[5];
|
||||
event.sibling = values[1];
|
||||
event.x = values[2]
|
||||
event.y = values[3]
|
||||
event.width = values[4]
|
||||
event.height = values[5]
|
||||
event.borderWidth = values[6];
|
||||
//
|
||||
// The value-mask indicates which components were specified in
|
||||
// the request. The value-mask and the corresponding values are reported as given
|
||||
|
|
|
|||
55
test/configure-request.js
Normal file
55
test/configure-request.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
var x11 = require('../lib');
|
||||
var should = require('should');
|
||||
|
||||
describe('ConfigureRequest', function() {
|
||||
before(function(done) {
|
||||
var self = this;
|
||||
var client = x11.createClient(function(err, dpy) {
|
||||
should.not.exist(err);
|
||||
self.X = dpy.client;
|
||||
self.root = dpy.screen[0].root;
|
||||
self.wid = self.X.AllocID();
|
||||
self.wid_helper = self.X.AllocID();
|
||||
/* self.X acts like a WM */
|
||||
self.X.ChangeWindowAttributes(self.root, { eventMask: x11.eventMask.SubstructureRedirect });
|
||||
self.X.CreateWindow(self.wid, self.root, 0, 0, 1, 1); // 1x1 pixel window
|
||||
self.X.QueryTree(self.root, function(err, list) {
|
||||
should.not.exist(err);
|
||||
list.children.indexOf(self.wid).should.not.equal(-1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
client.on('error', function (err) {
|
||||
console.error('Error : ', err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be emitted to the WM if this.wid is configured by a client', function(done) {
|
||||
var self = this;
|
||||
var client = x11.createClient(function(err, dpy) {
|
||||
should.not.exist(err);
|
||||
self.X.once('event', function(ev) {
|
||||
console.log(ev);
|
||||
ev.name.should.equal('ConfigureRequest');
|
||||
ev.x.should.equal(0);
|
||||
ev.y.should.equal(20);
|
||||
ev.width.should.equal(200);
|
||||
ev.height.should.equal(300);
|
||||
ev.wid.should.equal(self.wid);
|
||||
done();
|
||||
});
|
||||
|
||||
var X = dpy.client;
|
||||
X.MoveResizeWindow(self.wid, 0, 20, 200, 300);
|
||||
});
|
||||
|
||||
client.on('error', done);
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
this.X.DestroyWindow(this.wid);
|
||||
this.X.on('end', done);
|
||||
this.X.terminate();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue