mirror of
https://github.com/danbulant/node-x11
synced 2026-05-20 21:09:10 +00:00
store function instead of request name (extensions!!!)
This commit is contained in:
parent
bf2c603be7
commit
501cc67fce
1 changed files with 5 additions and 7 deletions
|
|
@ -124,7 +124,7 @@ XClient.prototype.importRequestsFromTemplates = function(target, reqs)
|
|||
var requestArguments = reqPack[1];
|
||||
|
||||
if (callback)
|
||||
this.replies[this.seq_num] = [reqName, callback];
|
||||
this.replies[this.seq_num] = [reqReplTemplate[1], callback];
|
||||
|
||||
client.pack_stream.pack(format, requestArguments);
|
||||
var b = client.pack_stream.write_queue[0];
|
||||
|
|
@ -140,9 +140,8 @@ XClient.prototype.importRequestsFromTemplates = function(target, reqs)
|
|||
requestArguments.push(args[a]);
|
||||
|
||||
if (callback)
|
||||
this.replies[this.seq_num] = [reqName, callback];
|
||||
this.replies[this.seq_num] = [reqReplTemplate[1], callback];
|
||||
|
||||
//console.log([format, requestArguments]);
|
||||
client.pack_stream.pack(format, requestArguments);
|
||||
client.pack_stream.flush();
|
||||
} else {
|
||||
|
|
@ -214,6 +213,7 @@ XClient.prototype.expectReplyHeader = function()
|
|||
'CCSL', function(res) {
|
||||
var type = res[0];
|
||||
var seq_num = res[2];
|
||||
|
||||
if (type == 0)
|
||||
{
|
||||
var error_code = res[1];
|
||||
|
|
@ -233,7 +233,6 @@ XClient.prototype.expectReplyHeader = function()
|
|||
error.minorOpcode = res[1];
|
||||
error.majorOpcode = res[2];
|
||||
}
|
||||
//console.log(error);
|
||||
var handler = client.replies[seq_num];
|
||||
if (handler) {
|
||||
var callback = handler[1];
|
||||
|
|
@ -268,12 +267,11 @@ XClient.prototype.expectReplyHeader = function()
|
|||
|
||||
var handler = client.replies[seq_num];
|
||||
if (handler) {
|
||||
var reqName = handler[0];
|
||||
var req = coreRequests[reqName];
|
||||
var unpack = req[1];
|
||||
var unpack = handler[0];
|
||||
var result = unpack( data, opt_data );
|
||||
var callback = handler[1];
|
||||
callback(result);
|
||||
// TODO: add multiple replies flag and delete handler only after last reply (eg ListFontsWithInfo)
|
||||
delete client.replies[seq_num];
|
||||
}
|
||||
// wait for new packet from server
|
||||
|
|
|
|||
Loading…
Reference in a new issue