mirror of
https://github.com/danbulant/node-x11
synced 2026-05-24 12:35:39 +00:00
QueryPictFormat fixes
This commit is contained in:
parent
c9a75c102c
commit
10321e95ff
1 changed files with 36 additions and 19 deletions
|
|
@ -33,11 +33,24 @@ x11.createClient(
|
||||||
X.pack_stream.pack('CCS', [ext.majorOpcode, 1, 1]);
|
X.pack_stream.pack('CCS', [ext.majorOpcode, 1, 1]);
|
||||||
X.replies[X.seq_num] = [
|
X.replies[X.seq_num] = [
|
||||||
function (buf, opt) {
|
function (buf, opt) {
|
||||||
|
var res = {};
|
||||||
var res1 = buf.unpack('LLLLL');
|
var res1 = buf.unpack('LLLLL');
|
||||||
// [ 28, 1, 7, 32, 0 ]
|
var num_formats = res1[0];
|
||||||
|
var num_screens = res1[1];
|
||||||
//console.log(res1);
|
var num_depths = res1[2];
|
||||||
return res1;
|
var num_visuals = res1[3];
|
||||||
|
var num_subpixel = res1[4];
|
||||||
|
// formats list:
|
||||||
|
var offset = 24;
|
||||||
|
res.formats = [];
|
||||||
|
for (var i=0; i < num_formats; ++i)
|
||||||
|
{
|
||||||
|
var format = {};
|
||||||
|
var f = buf.unpack('LCCxxSSSSSSSSL', offset);
|
||||||
|
res.formats.push(f);
|
||||||
|
offset += 28;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
},
|
},
|
||||||
callback
|
callback
|
||||||
];
|
];
|
||||||
|
|
@ -343,15 +356,16 @@ x11.createClient(
|
||||||
});
|
});
|
||||||
X.MapWindow(win);
|
X.MapWindow(win);
|
||||||
|
|
||||||
// this values need to be queried from server!
|
RenderQueryPictFormat(function(formats) {
|
||||||
// quick hack until I have nessesary request
|
var mono1, rgb24, rgba32;
|
||||||
// TODO: bad bad bad fix asap :)
|
for (var i=0; i < formats.formats.length; ++i) {
|
||||||
var rgb24 = 71;
|
var f = formats.formats[i];
|
||||||
var rgba32 = 69;
|
if (f[2] == 1 && f[10] == 1)
|
||||||
if (process.platform == 'linux')
|
mono1 = f[0] ;
|
||||||
{
|
if (f[2] == 24 && f[3] == 16 && f[5] == 8 && f[7] == 0)
|
||||||
rgb24 = 42;
|
rgb24 = f[0];
|
||||||
rgba32 = 38;
|
if (f[2] == 32 && f[3] == 16 && f[5] == 8 && f[7] == 0 && f[9] == 24)
|
||||||
|
rgba32 = f[0] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
var picture = X.AllocID();
|
var picture = X.AllocID();
|
||||||
|
|
@ -418,14 +432,14 @@ x11.createClient(
|
||||||
RenderComposite(3, pix_pict1, 0, pix_pict, 0, 0, 0, 0, X.x2, X.y2, 500, 500);
|
RenderComposite(3, pix_pict1, 0, pix_pict, 0, 0, 0, 0, X.x2, X.y2, 500, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
|
||||||
|
|
||||||
function draw()
|
function draw()
|
||||||
{
|
{
|
||||||
RenderComposite(3, pix_pict, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);
|
RenderComposite(3, pix_pict, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
X.x1 = X.y1 = X.x2 = X.y2 = 0;
|
X.x1 = X.y1 = X.x2 = X.y2 = 0;
|
||||||
|
update();
|
||||||
|
draw();
|
||||||
|
|
||||||
X.on('event', function(ev) {
|
X.on('event', function(ev) {
|
||||||
if (ev.type == 4)
|
if (ev.type == 4)
|
||||||
|
|
@ -458,6 +472,9 @@ x11.createClient(
|
||||||
//RenderComposite(3, pic_grad, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);
|
//RenderComposite(3, pic_grad, 0, picture, 0, 0, 0, 0, 0, 0, 500, 500);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}); // <- everything above is a body of callback to QueryPictFormats
|
||||||
}
|
}
|
||||||
|
|
||||||
).on('error', function(err) {
|
).on('error', function(err) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue