make borderWidth, class, visual and depth arguments optional defaults to 0

This commit is contained in:
Andrey Sidorov 2012-04-11 11:29:45 +10:00
parent c26bc6b47d
commit c5c5d973b5

View file

@ -117,8 +117,16 @@ module.exports = {
// create request packet - function OR format string // create request packet - function OR format string
function(id, parentId, x, y, width, height, borderWidth, depth, _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 if (borderWidth === undefined)
// var depth = 0; borderWidth = 0;
if (depth === undefined)
depth = 0;
if (_class === undefined)
_class = 0;
if (visual === undefined)
visual = 0;
if (values === undefined)
values = {}
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
@ -185,6 +193,7 @@ module.exports = {
['CxSL', [3, 2]], ['CxSL', [3, 2]],
function(buf) function(buf)
{ {
// TODO: change from array to named object fields
var res = buf.unpack('LSCCLLCCCCCLLLS'); var res = buf.unpack('LSCCLLCCCCCLLLS');
return res; return res;
} }