mirror of
https://github.com/danbulant/node-x11
synced 2026-06-24 01:01:51 +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
18
lib/xcore.js
18
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
|
||||||
|
|
@ -372,7 +374,7 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
||||||
event.requestor = values[1];
|
event.requestor = values[1];
|
||||||
event.selection = values[2];
|
event.selection = values[2];
|
||||||
event.target = values[3];
|
event.target = values[3];
|
||||||
event.property = values[4];
|
event.property = values[4];
|
||||||
} else if (type == 31) {// SelectionNotify
|
} else if (type == 31) {// SelectionNotify
|
||||||
event.name = 'SelectionNotify';
|
event.name = 'SelectionNotify';
|
||||||
event.time = extra;
|
event.time = extra;
|
||||||
|
|
@ -380,7 +382,7 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
||||||
event.requestor = values[0];
|
event.requestor = values[0];
|
||||||
event.selection = values[1];
|
event.selection = values[1];
|
||||||
event.target = values[2];
|
event.target = values[2];
|
||||||
event.property = values[3];
|
event.property = values[3];
|
||||||
} else if (type == 33) {// ClientMessage
|
} else if (type == 33) {// ClientMessage
|
||||||
event.name = 'ClientMessage';
|
event.name = 'ClientMessage';
|
||||||
event.format = code;
|
event.format = code;
|
||||||
|
|
@ -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