Comparing version 2.1.1 to 2.2.0
@@ -207,3 +207,39 @@ // http://www.x.org/releases/X11R7.6/doc/randrproto/randrproto.txt | ||
}, | ||
ext.GetOutputInfo = function(output, ts, cb) | ||
{ | ||
X.seq_num ++; | ||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 9, 3, output, ts ]); | ||
X.replies[X.seq_num] = [ | ||
function(buf, opt) { | ||
var i; | ||
var pos = 0; | ||
var res = buf.unpack('LLLLCCSSSSS'); | ||
var info = { | ||
timestamp : res[0], | ||
crtc : res[1], | ||
mm_width : res[2], | ||
mm_height : res[3], | ||
connection : res[4], | ||
subpixelOrder : res[5], | ||
preferredModes: res[8] | ||
}; | ||
pos += 28; | ||
var format = Array(res[6] + 1).join('L'); | ||
info.crtcs = buf.unpack(format, pos); | ||
pos += res[6] << 2; | ||
format = Array(res[7] + 1).join('L'); | ||
info.modes = buf.unpack(format, pos); | ||
pos += res[7] << 2; | ||
format = Array(res[9] + 1).join('L'); | ||
info.clones = buf.unpack(format, pos); | ||
pos += res[9] << 2; | ||
info.name = buf.slice(pos, pos + res_modes[10]).toString('binary'); | ||
return info; | ||
}, | ||
cb | ||
]; | ||
X.pack_stream.flush(); | ||
}, | ||
ext.GetCrtcInfo = function(crtc, configTs, cb) { | ||
@@ -210,0 +246,0 @@ X.seq_num ++; |
@@ -15,3 +15,3 @@ { | ||
"homepage": "https://github.com/sidorares/node-x11", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"maintainers": [ | ||
@@ -18,0 +18,0 @@ { |
@@ -11,25 +11,22 @@ var x11 = require('../lib'); | ||
var client = x11.createClient(function(err, dpy) { | ||
if (!err) { | ||
display = dpy; | ||
X = display.client; | ||
} | ||
should.not.exist(err); | ||
display = dpy; | ||
X = display.client; | ||
root = display.screen[0].root; | ||
var eventMask = x11.eventMask.SubstructureNotify; | ||
X.ChangeWindowAttributes(root, { eventMask: eventMask }); | ||
done(); | ||
}); | ||
done(err); | ||
}); | ||
client.on('error', function(err) { | ||
done(err); | ||
}); | ||
client.on('error', done); | ||
}); | ||
afterEach(function(done) { | ||
X.on('end', done); | ||
X.terminate(); | ||
X.on('end', done); | ||
X = null; | ||
display = null; | ||
}); | ||
it('should exist as client member', function(done) { | ||
it('should exist as client member', function() { | ||
should.exist(X.KillKlient); | ||
assert.equal(typeof X.KillKlient, 'function'); | ||
done(); | ||
}); | ||
@@ -39,14 +36,15 @@ | ||
x11.createClient(function(err, dpy) { | ||
if (!err) { | ||
var otherclient = dpy.client; | ||
var wnd = otherclient.AllocID(); | ||
otherclient.CreateWindow(wnd, dpy.screen[0].root, 0, 0, 1, 1); | ||
otherclient.on('end', done); | ||
X.KillKlient(wnd); | ||
} else { | ||
done(err); | ||
} | ||
should.not.exist(err); | ||
var otherclient = dpy.client; | ||
var wnd = otherclient.AllocID(); | ||
X.once('event', function(ev) { | ||
ev.name.should.equal('CreateNotify'); | ||
ev.wid.should.equal(wnd); | ||
X.KillKlient(wnd); | ||
}); | ||
otherclient.CreateWindow(wnd, dpy.screen[0].root, 0, 0, 1, 1); | ||
otherclient.on('end', done); | ||
}); | ||
}); | ||
}); |
var x11 = require('../lib'); | ||
var async = require('async'); | ||
var should = require('should'); | ||
@@ -38,2 +39,22 @@ var assert = require('assert'); | ||
it('GetScreenResources && GetOutputInfo', function(done) { | ||
var self = this; | ||
this.randr.GetScreenResources(this.root, function(err, resources) { | ||
should.not.exist(err); | ||
should.exist(resources); | ||
async.each( | ||
resources.outputs, | ||
function(output, cb) { | ||
self.randr.GetOutputInfo(output, 0, function(err, info) { | ||
should.not.exist(err); | ||
should.exist(info); | ||
cb(); | ||
}); | ||
}, | ||
done | ||
); | ||
}); | ||
}); | ||
after(function(done) { | ||
@@ -40,0 +61,0 @@ this.X.terminate(); |
1630358
17621