lib/corereqs.js
function(id, parentId, x, y, width, height, borderWidth, depth, _class, visual, values) {

           if (borderWidth === undefined)
               borderWidth = 0;
           if (depth === undefined)
               depth = 0;
           if (_class === undefined)
               _class = 0;
           if (visual === undefined)
               visual = 0;
           if (values === undefined)
               values = {}

           var format = 'CCSLLssSSSSLL';

           // TODO: slice from function arguments?

           // TODO: the code is a little bit mess
           // additional values need to be packed in the following way:
           // bitmask (bytes #24 to #31 in the packet) - 32 bit indicating what adittional arguments we supply
           // values list (bytes #32 .. #32+4*num_values) in order of corresponding bits TODO: it's actually not 4*num. Some values are 4b ytes, some - 1 byte

           var vals = packValueMask('CreateWindow', values);
           var packetLength = 8 + (values ? vals[2].length : 0);
           var args = [1, depth, packetLength, id, parentId, x, y, width, height, borderWidth, _class, visual];
           format += vals[0];
           args.push(vals[1]);
           args = args.concat(vals[2]);
           return [format, args];
       }
function(id, parentId, x, y, width, height, borderWidth, depth, _class, visual, values) {

           if (borderWidth === undefined)
               borderWidth = 0;
           if (depth === undefined)
               depth = 0;
           if (_class === undefined)
               _class = 0;
           if (visual === undefined)
               visual = 0;
           if (values === undefined)
               values = {}

           var format = 'CCSLLssSSSSLL';

           // TODO: slice from function arguments?

           // TODO: the code is a little bit mess
           // additional values need to be packed in the following way:
           // bitmask (bytes #24 to #31 in the packet) - 32 bit indicating what adittional arguments we supply
           // values list (bytes #32 .. #32+4*num_values) in order of corresponding bits TODO: it's actually not 4*num. Some values are 4b ytes, some - 1 byte

           var vals = packValueMask('CreateWindow', values);
           var packetLength = 8 + (values ? vals[2].length : 0);
           var args = [1, depth, packetLength, id, parentId, x, y, width, height, borderWidth, _class, visual];
           format += vals[0];
           args.push(vals[1]);
           args = args.concat(vals[2]);
           return [format, args];
       }
function ( id , parentId , x , y , width , height , borderWidth , depth , _class , visual , values ) { if ( borderWidth === undefined ) borderWidth = 0 ; if ( depth === undefined ) depth = 0 ; if ( _class === undefined ) _class = 0 ; if ( visual === undefined ) visual = 0 ; if ( values === undefined ) values = { } var format = 'CCSLLssSSSSLL' ; // TODO: slice from function arguments? // TODO: the code is a little bit mess // additional values need to be packed in the following way: // bitmask (bytes #24 to #31 in the packet) - 32 bit indicating what adittional arguments we supply // values list (bytes #32 .. #32+4*num_values) in order of corresponding bits TODO: it's actually not 4*num. Some values are 4b ytes, some - 1 byte var vals = packValueMask ( 'CreateWindow' , values ) ; var packetLength = 8 + ( values ? vals [ 2 ] . length : 0 ) ; var args = [ 1 , depth , packetLength , id , parentId , x , y , width , height , borderWidth , _class , visual ] ; format += vals [ 0 ] ; args . push ( vals [ 1 ] ) ; args = args . concat ( vals [ 2 ] ) ; return [ format , args ] ; }
create request packet - function OR format string
create request packet - function OR format string