From 3e98160feaf1c6154c9cb478ba7fc708599b2538 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Thu, 13 Mar 2014 13:24:37 +0100 Subject: [PATCH] Add GetCrtcInfo and fix in GetScreenResources --- lib/ext/randr.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/ext/randr.js b/lib/ext/randr.js index 6b6cddf..986fffb 100644 --- a/lib/ext/randr.js +++ b/lib/ext/randr.js @@ -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 = {};