mirror of
https://github.com/danbulant/node-x11
synced 2026-06-10 18:20:35 +00:00
fix in rates calculations in GetScreenInfo
This commit is contained in:
parent
3e3846d6e6
commit
cb3cfa91eb
1 changed files with 17 additions and 14 deletions
|
|
@ -122,11 +122,13 @@ exports.requireExt = function(display, callback)
|
|||
config_timestamp : res[2],
|
||||
sizeID : res[4],
|
||||
rotation : res[5],
|
||||
rate : res[6]
|
||||
rate : res[6],
|
||||
rates: []
|
||||
};
|
||||
|
||||
var nSizes = res[3];
|
||||
var nInfo = res[7];
|
||||
var nRates = res[7];
|
||||
|
||||
var screens_len = nSizes << 2;
|
||||
var format = Array(screens_len + 1).join('S');
|
||||
res = buf.unpack(format, 24);
|
||||
|
|
@ -140,12 +142,8 @@ exports.requireExt = function(display, callback)
|
|||
});
|
||||
}
|
||||
|
||||
format = Array(nInfo + 1).join('S');
|
||||
res = buf.unpack(format, 24 + screens_len * 2);
|
||||
for (i = 0, j = 0; i < info.screens.length; ++i, j += res[j] + 1) {
|
||||
info.screens[i].rates = res.slice(j + 1, j + 1 + res[j]);
|
||||
}
|
||||
|
||||
format = Array(nRates + 1).join('S');
|
||||
info.rates = buf.unpack(format, 24 + screens_len * 2);
|
||||
return info;
|
||||
},
|
||||
cb
|
||||
|
|
@ -241,10 +239,10 @@ exports.requireExt = function(display, callback)
|
|||
|
||||
X.eventParsers[ext.firstEvent + ext.events.RRScreenChangeNotify] = function(type, seq, extra, code, raw)
|
||||
{
|
||||
var event = {};
|
||||
event.raw = raw;
|
||||
var event = {};
|
||||
event.raw = raw;
|
||||
event.type = type
|
||||
event.seq = seq;
|
||||
event.seq = seq;
|
||||
event.rotation = code;
|
||||
var values = raw.unpack('LLLSSSSSS');
|
||||
event.time = extra
|
||||
|
|
@ -259,10 +257,15 @@ exports.requireExt = function(display, callback)
|
|||
event.physHeight = values[8];
|
||||
|
||||
event.name = 'RRScreenChangeNotify';
|
||||
console.log(event);
|
||||
return event;
|
||||
return event;
|
||||
};
|
||||
|
||||
callback(null, ext);
|
||||
|
||||
ext.QueryVersion(255, 255, function(err, version) {
|
||||
if (err) return callback(err);
|
||||
ext.major_version = version[0];
|
||||
ext.minor_version = version[1];
|
||||
callback(null, ext);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue