From 270c30f9e5bd97407d55a07c229e59cee515a834 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Tue, 28 Feb 2012 17:31:41 +1100 Subject: [PATCH] CreateColormap, ResizeWindow, MoveWindow, GetImage, GetWindowAttributes requests --- lib/x11/corereqs.js | 48 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/lib/x11/corereqs.js b/lib/x11/corereqs.js index d279825..e94cd9e 100644 --- a/lib/x11/corereqs.js +++ b/lib/x11/corereqs.js @@ -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