mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
add unused IDs buffer
This commit is contained in:
parent
1d77f21ec7
commit
60f8b08037
1 changed files with 11 additions and 5 deletions
16
lib/xcore.js
16
lib/xcore.js
|
|
@ -119,6 +119,7 @@ XClient.prototype.init = function(stream)
|
|||
|
||||
this.startHandshake();
|
||||
this._closing = false;
|
||||
this._unusedIds = [];
|
||||
}
|
||||
|
||||
// TODO: close() = set 'closing' flag, watch it in replies and writeQueue, terminate if empty
|
||||
|
|
@ -247,12 +248,17 @@ XClient.prototype.importRequestsFromTemplates = function(target, reqs)
|
|||
|
||||
XClient.prototype.AllocID = function()
|
||||
{
|
||||
// TODO: handle overflow (XCMiscGetXIDRange from XC_MISC ext)
|
||||
// TODO: unused id buffer
|
||||
this.display.rsrc_id++;
|
||||
return (this.display.rsrc_id << this.display.rsrc_shift) + this.display.resource_base;
|
||||
}
|
||||
if (this._unusedIds.length > 0) {
|
||||
return this._unusedIds.pop();
|
||||
}
|
||||
// TODO: handle overflow (XCMiscGetXIDRange from XC_MISC ext)
|
||||
this.display.rsrc_id++;
|
||||
return (this.display.rsrc_id << this.display.rsrc_shift) + this.display.resource_base;
|
||||
};
|
||||
|
||||
XClient.prototype.ReleaseID = function(id) {
|
||||
this._unusedIds.push(id);
|
||||
};
|
||||
|
||||
// TODO: move core events unpackers to corereqs.js
|
||||
XClient.prototype.unpackEvent = function(type, seq, extra, code, raw, headerBuf)
|
||||
|
|
|
|||
Loading…
Reference in a new issue