mirror of
https://github.com/danbulant/node-x11
synced 2026-06-24 09:12:13 +00:00
fix in error parsing: bad_value, min/maj opcode now calculated correctly
This commit is contained in:
parent
a5e75b4e7d
commit
ebb77199fc
1 changed files with 11 additions and 7 deletions
14
lib/xcore.js
14
lib/xcore.js
|
|
@ -235,6 +235,8 @@ XClient.prototype.AllocID = function()
|
||||||
return (this.display.rsrc_id << this.display.rsrc_shift) + this.display.resource_base;
|
return (this.display.rsrc_id << this.display.rsrc_shift) + this.display.resource_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: move core events unpackers to corereqs.js
|
||||||
XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
||||||
{
|
{
|
||||||
var event = {}; // TODO: constructor & base functions
|
var event = {}; // TODO: constructor & base functions
|
||||||
|
|
@ -394,13 +396,14 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
||||||
|
|
||||||
XClient.prototype.expectReplyHeader = function()
|
XClient.prototype.expectReplyHeader = function()
|
||||||
{
|
{
|
||||||
// TODO: BigReq!!!!
|
// TODO: move error parsers to corereqs.js
|
||||||
|
|
||||||
var client = this;
|
var client = this;
|
||||||
client.pack_stream.get( 8, function(headerBuf) {
|
client.pack_stream.get( 8, function(headerBuf) {
|
||||||
var res = headerBuf.unpack('CCSL');
|
var res = headerBuf.unpack('CCSL');
|
||||||
var type = res[0];
|
var type = res[0];
|
||||||
var seq_num = res[2];
|
var seq_num = res[2];
|
||||||
|
var bad_value = res[3];
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -414,14 +417,15 @@ XClient.prototype.expectReplyHeader = function()
|
||||||
|
|
||||||
// unpack error packet (32 bytes for all error types, 8 of them in CCSL header)
|
// unpack error packet (32 bytes for all error types, 8 of them in CCSL header)
|
||||||
client.pack_stream.get(24, function(buf) {
|
client.pack_stream.get(24, function(buf) {
|
||||||
|
|
||||||
// TODO: dispatch, use sequence number
|
// TODO: dispatch, use sequence number
|
||||||
//TODO: add more generic way to read common values
|
//TODO: add more generic way to read common values
|
||||||
// if (error_code == 14)
|
// if (error_code == 14)
|
||||||
{
|
{
|
||||||
var res = buf.unpack('LSC');
|
var res = buf.unpack('SC');
|
||||||
error.badParam = res[0]; // id: GC, WinID, Font, Atom etc; Value
|
error.badParam = bad_value;
|
||||||
error.minorOpcode = res[1];
|
error.minorOpcode = res[0];
|
||||||
error.majorOpcode = res[2];
|
error.majorOpcode = res[1];
|
||||||
}
|
}
|
||||||
var handler = client.replies[seq_num];
|
var handler = client.replies[seq_num];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue