mirror of
https://github.com/danbulant/node-x11
synced 2026-06-24 17:21:47 +00:00
CreateColormap, ResizeWindow, MoveWindow, GetImage, GetWindowAttributes requests
This commit is contained in:
parent
ec330996ce
commit
270c30f9e5
1 changed files with 45 additions and 3 deletions
|
|
@ -115,10 +115,10 @@ the way requests are described here
|
||||||
module.exports = {
|
module.exports = {
|
||||||
CreateWindow: [
|
CreateWindow: [
|
||||||
// create request packet - function OR format string
|
// 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
|
// 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);
|
var packetLength = 8 + (values ? Object.keys(values).length : 0);
|
||||||
// TODO: should be CCSLLssSSSSLL - x,y are signed
|
// TODO: should be CCSLLssSSSSLL - x,y are signed
|
||||||
|
|
@ -152,6 +152,7 @@ module.exports = {
|
||||||
masksList.sort();
|
masksList.sort();
|
||||||
// set bits to indicate additional values we are sending in this request
|
// set bits to indicate additional values we are sending in this request
|
||||||
args.push(bitmask);
|
args.push(bitmask);
|
||||||
|
|
||||||
// add values in the order of the bits
|
// 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?
|
// TODO: maybe it's better just to scan all 32 bits anstead of sorting parameters we are actually have?
|
||||||
for (m in masksList)
|
for (m in masksList)
|
||||||
|
|
@ -180,6 +181,15 @@ module.exports = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
GetWindowAttributes: [
|
||||||
|
['CxSL', [3, 2]],
|
||||||
|
function(buf)
|
||||||
|
{
|
||||||
|
var res = buf.unpack('LSCCLLCCCCCLLLS');
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
DestroyWindow: [
|
DestroyWindow: [
|
||||||
[ 'CxSL', [4, 2] ]
|
[ 'CxSL', [4, 2] ]
|
||||||
],
|
],
|
||||||
|
|
@ -208,11 +218,19 @@ module.exports = {
|
||||||
|
|
||||||
// TODO: remove or leave as a convinient helper? 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
|
// with width and height argiments & arguments mask
|
||||||
ResiseWindow: [
|
ResizeWindow: [
|
||||||
function(win, width, height) {
|
function(win, width, height) {
|
||||||
return ['CxSLSxxSxxSxx', [12, 5, win, 12, width, height]];
|
return ['CxSLSxxSxxSxx', [12, 5, win, 12, width, height]];
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
MoveWindow: [
|
||||||
|
function(win, x, y) {
|
||||||
|
return ['CxSLSxxsxxsxx', [12, 5, win, 3, x, y]];
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QueryTree: [
|
QueryTree: [
|
||||||
['CxSL', [15, 2]],
|
['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]];
|
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: [
|
PolyText8: [
|
||||||
function(drawable, gc, x, y, items) {
|
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: [
|
AllocColor: [
|
||||||
[ 'CxSLSSSxx', [84, 4] ], // params: colormap, red, green, blue
|
[ 'CxSLSSSxx', [84, 4] ], // params: colormap, red, green, blue
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue