Mon 21 Jul 22:43:21 CEST 2025
This commit is contained in:
parent
0500b0c712
commit
b30a2d8fe3
70
js/x11/core/ext/xc-misc.js
Normal file
70
js/x11/core/ext/xc-misc.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
// http://www.x.org/releases/X11R7.6/doc/xcmiscproto/xc-misc.pdf
|
||||
|
||||
var x11 = Require('x11/core/x11');
|
||||
// TODO: move to templates
|
||||
|
||||
exports.requireExt = function(display, callback)
|
||||
{
|
||||
var X = display.client;
|
||||
X.QueryExtension('XC-MISC', function(err, ext) {
|
||||
|
||||
if (!ext.present)
|
||||
return callback(new Error('extension not available'));
|
||||
|
||||
ext.QueryVersion = function(clientMaj, clientMin, cb)
|
||||
{
|
||||
X.seq_num++;
|
||||
X.pack_stream.pack('CCSSS', [ext.majorOpcode, 0, 2, clientMaj, clientMin]);
|
||||
X.replies[X.seq_num] = [
|
||||
function(buf, opt) {
|
||||
var res = buf.unpack('SS');
|
||||
return res;
|
||||
},
|
||||
cb
|
||||
];
|
||||
X.pack_stream.flush();
|
||||
}
|
||||
|
||||
ext.GetXIDRange = function(cb)
|
||||
{
|
||||
X.seq_num++;
|
||||
X.pack_stream.pack('CCS', [ext.majorOpcode, 1, 1]);
|
||||
X.replies[X.seq_num] = [
|
||||
function(buf, opt) {
|
||||
var res = buf.unpack('LL');
|
||||
return {
|
||||
startId: res[0],
|
||||
count: res[1]
|
||||
};
|
||||
},
|
||||
cb
|
||||
];
|
||||
X.pack_stream.flush();
|
||||
}
|
||||
|
||||
ext.GetXIDList = function( count, cb )
|
||||
{
|
||||
X.seq_num++;
|
||||
X.pack_stream.pack('CCSL', [ext.majorOpcode, 2, 2, count]);
|
||||
X.replies[X.seq_num] = [
|
||||
function(buf, opt) {
|
||||
var numIds = buf.unpack('L')[0];
|
||||
var res = [];
|
||||
for (var i = 0; i < numIds; ++i)
|
||||
res.push(buf.unpack('L', 24+i*4));
|
||||
return res;
|
||||
},
|
||||
cb
|
||||
];
|
||||
X.pack_stream.flush();
|
||||
}
|
||||
|
||||
ext.QueryVersion(1, 1, function(err, vers) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
ext.major = vers[0];
|
||||
ext.minor = vers[1];
|
||||
callback(null, ext);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user