ChangeWindowAttributes, ChangeSaveSet, ReparentWindow requests

This commit is contained in:
Andrey Sidorov 2012-02-03 20:45:20 +11:00
parent a77498a547
commit b7a6c8b190

View file

@ -164,10 +164,38 @@ module.exports = {
],
ChangeWindowAttributes:[
function(wid, values) {
var format = 'CxSLL';
var packetLength = 3 + (values ? Object.keys(values).length : 0);
var vals = packValueMask('CreateWindow', values);
var args = [2, packetLength, wid, vals[0]];
var valArr = vals[1];
for (v in valArr)
{
format += 'L';
args.push(valArr[v]);
}
return [format, args];
}
],
DestroyWindow: [
[ 'CxSL', [4, 2] ]
],
ChangeSaveSet: [
function(isInsert, wid)
{
return [ 'CCSL', [6, (isInsert ? 0 : 1), 2, wid]]
}
],
// wid, newParentId, x, y
ReparentWindow: [
[ 'CxSLLss', [7, 4]]
],
MapWindow: [
// 8 - opcode, 2 - length, wid added as parameter
[ 'CxSL', [8, 2] ]
@ -178,7 +206,7 @@ module.exports = {
],
// TODO: remove? this is actually a ConfigureWindow request
// TODO: remove or leave as a convinient helper? this is actually a ConfigureWindow request
// with width and height argiments & arguments mask
ResiseWindow: [
function(win, width, height) {
@ -186,6 +214,21 @@ module.exports = {
}
],
QueryTree: [
['CxSL', [15, 2]],
function(buf) {
var tree = {};
var res = buf.unpack('LLS');
tree.root = res[0];
tree.parent = res[1];
tree.children = [];
for (var i=0; i < res[2]; ++i)
tree.children.push(buf.unpack('L', 24 + i*4)[0]);
return tree;
}
],
// opcode 16
InternAtom: [
function (returnOnlyIfExist, value)