mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
randr: add GetOutputInfo request
This commit is contained in:
parent
8ed37aaa31
commit
e09c8b5429
2 changed files with 57 additions and 0 deletions
|
|
@ -204,7 +204,43 @@ exports.requireExt = function(display, callback)
|
|||
|
||||
X.pack_stream.flush();
|
||||
},
|
||||
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) {
|
||||
X.seq_num ++;
|
||||
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 20, 3, crtc, configTs ]);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
var x11 = require('../lib');
|
||||
var async = require('async');
|
||||
var should = require('should');
|
||||
var assert = require('assert');
|
||||
var util = require('util');
|
||||
|
|
@ -35,6 +36,26 @@ describe('RANDR extension', function() {
|
|||
});
|
||||
});
|
||||
|
||||
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) {
|
||||
this.X.terminate();
|
||||
this.X.on('end', done);
|
||||
|
|
|
|||
Loading…
Reference in a new issue