CreateColormap, ResizeWindow, MoveWindow, GetImage, GetWindowAttributes requests

This commit is contained in:
Andrey Sidorov 2012-02-28 17:31:41 +11:00
parent ec330996ce
commit 270c30f9e5

View file

@ -115,10 +115,10 @@ the way requests are described here
module.exports = {
CreateWindow: [
// create request packet - function OR format string
function(id, parentId, x, y, width, height, borderWidth, _class, visual, values) {
function(id, parentId, x, y, width, height, borderWidth, depth, _class, visual, values) {
// TODO: ??? there is depth field in xproto, but xlib just sets it to zero
var depth = 0;
// var depth = 0;
var packetLength = 8 + (values ? Object.keys(values).length : 0);
// TODO: should be CCSLLssSSSSLL - x,y are signed
@ -152,6 +152,7 @@ module.exports = {
masksList.sort();
// set bits to indicate additional values we are sending in this request
args.push(bitmask);
// add values in the order of the bits
// TODO: maybe it's better just to scan all 32 bits anstead of sorting parameters we are actually have?
for (m in masksList)
@ -180,6 +181,15 @@ module.exports = {
}
],
GetWindowAttributes: [
['CxSL', [3, 2]],
function(buf)
{
var res = buf.unpack('LSCCLLCCCCCLLLS');
return res;
}
],
DestroyWindow: [
[ 'CxSL', [4, 2] ]
],
@ -208,11 +218,19 @@ module.exports = {
// TODO: remove or leave as a convinient helper? this is actually a ConfigureWindow request
// with width and height argiments & arguments mask
ResiseWindow: [
ResizeWindow: [
function(win, width, height) {
return ['CxSLSxxSxxSxx', [12, 5, win, 12, width, height]];
}
],
MoveWindow: [
function(win, x, y) {
return ['CxSLSxxsxxsxx', [12, 5, win, 3, x, y]];
}
],
QueryTree: [
['CxSL', [15, 2]],
@ -403,6 +421,22 @@ module.exports = {
return [ 'CCSLLLSSssCCxxaa', [72, format, 0, 1+reqLen, drawable, gc, width, height, dstX, dstY, leftPad, depth, data, pad]];
}
],
GetImage: [
function(format, drawable, x, y, width, height, planeMask)
{
return [ 'CCSLssSSL', [73, format, 5, drawable, x, y, width, height, planeMask]];
},
function(buf, depth)
{
var visualId = buf.unpack('L')[0];
return {
depth: depth,
visualId: visualId,
data: buf.slice(20)
};
}
],
PolyText8: [
function(drawable, gc, x, y, items) {
@ -438,6 +472,14 @@ module.exports = {
}
],
CreateColormap:
[
function(cmid, wid, vid, alloc)
{
return ['CCSLLL', [78, alloc, 4, cmid, wid, vid]];
}
],
AllocColor: [
[ 'CxSLSSSxx', [84, 4] ], // params: colormap, red, green, blue