mirror of
https://github.com/danbulant/node-x11
synced 2026-06-24 17:21:47 +00:00
Merge pull request #80 from Arteris/master
Handle cases where depths appear multiple times
This commit is contained in:
commit
1d77f21ec7
1 changed files with 31 additions and 23 deletions
|
|
@ -32,31 +32,39 @@ function readVisuals(bl, visuals, n_visuals, cb)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function readDepths(bl, display, depths, n_depths, cb)
|
|
||||||
{
|
|
||||||
if (n_depths == 0)
|
|
||||||
{
|
|
||||||
cb();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bl.unpack( 'CxSxxxx', function(res) {
|
|
||||||
var dep = res[0];
|
|
||||||
var n_visuals = res[1];
|
|
||||||
var visuals = {};
|
|
||||||
readVisuals(bl, visuals, n_visuals, function()
|
|
||||||
{
|
|
||||||
depths[dep] = visuals;
|
|
||||||
if (Object.keys(depths).length == n_depths)
|
|
||||||
cb();
|
|
||||||
else
|
|
||||||
readDepths(bl, display, depths, n_depths, cb);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function readScreens(bl, display, cbDisplayReady)
|
function readScreens(bl, display, cbDisplayReady)
|
||||||
{
|
{
|
||||||
|
var numParsedDepths = 0;
|
||||||
|
var readDepths = function(bl, display, depths, n_depths, cb)
|
||||||
|
{
|
||||||
|
if (n_depths == 0)
|
||||||
|
{
|
||||||
|
cb();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bl.unpack( 'CxSxxxx', function(res) {
|
||||||
|
var dep = res[0];
|
||||||
|
var n_visuals = res[1];
|
||||||
|
var visuals = {};
|
||||||
|
readVisuals(bl, visuals, n_visuals, function()
|
||||||
|
{
|
||||||
|
if (dep in depths) {
|
||||||
|
for (var visual in visuals) {
|
||||||
|
depths[dep][visual] = visuals[visual];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
depths[dep] = visuals;
|
||||||
|
}
|
||||||
|
numParsedDepths++;
|
||||||
|
if (numParsedDepths == n_depths)
|
||||||
|
cb();
|
||||||
|
else
|
||||||
|
readDepths(bl, display, depths, n_depths, cb);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// for (i=0; i < display.screen_num; ++i)
|
// for (i=0; i < display.screen_num; ++i)
|
||||||
{
|
{
|
||||||
var scr = {};
|
var scr = {};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue