Merge pull request #56 from santigimeno/more_RANDR

Add GetCrtcInfo and fix in GetScreenResources
This commit is contained in:
Andrey Sidorov 2014-03-14 08:40:56 +11:00
commit 0e49f39d65

View file

@ -179,7 +179,7 @@ exports.requireExt = function(display, callback)
format = Array(res[4] + 1).join('LSSLSSSSSSSSL');
res_modes = buf.unpack(format, pos);
pos += res[4] << 5;
for (i = 0; i < res_modes[4]; i+= 13) {
for (i = 0; i < res[4]; i+= 13) {
resources.modeinfos.push({
id : res_modes[i + 0],
width : res_modes[i + 1],
@ -207,6 +207,38 @@ exports.requireExt = function(display, callback)
X.pack_stream.flush();
},
ext.GetCrtcInfo = function(crtc, configTs, cb) {
X.seq_num ++;
X.pack_stream.pack('CCSLL', [ext.majorOpcode, 20, 3, crtc, configTs ]);
X.replies[X.seq_num] = [
function(buf, opt) {
var pos = 0;
var res = buf.unpack('LssSSLSSSS');
var info = {
status : opt,
timestamp : res[0],
x : res[1],
y : res[2],
width : res[3],
height : res[4],
mode : res[5],
rotation : res[6],
rotations : res[7]
};
pos += 24;
var format = Array(res[8] + 1).join('L');
info.output = buf.unpack(format, pos);
format = Array(res[9] + 1).join('L');
info.possible = buf.unpack(format, pos);
return info;
},
cb
];
X.pack_stream.flush();
},
X.eventParsers[ext.firstEvent + ext.events.RRScreenChangeNotify] = function(type, seq, extra, code, raw)
{
var event = {};