From bd7897d6b5bf6f4692f908bcd839895afab1f99a Mon Sep 17 00:00:00 2001 From: sidorares Date: Tue, 19 Jul 2011 10:51:05 +1000 Subject: [PATCH] fixed unpacking Expose event --- lib/x11/xcore.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/x11/xcore.js b/lib/x11/xcore.js index 2f6c5a7..8f3ccc1 100644 --- a/lib/x11/xcore.js +++ b/lib/x11/xcore.js @@ -57,6 +57,7 @@ function XClient(stream) this.importRequestsFromTemplates(this, coreRequests); this.startHandshake(); + // TODO: bad name this.event_consumers = {}; // maps window id to eventemitter // import available extentions @@ -170,13 +171,13 @@ XClient.prototype.unpackEvent = function(type, seq, extra, raw) event.buttons = values[7]; event.sameScreen = values[8]; } else if (type == 12) { // Expose - var values = raw.unpack('LSSSSS'); - event.wid = values[0]; - event.x = values[1]; - event.y = values[2]; - event.width = values[3]; - event.height = values[4]; - event.count = values[5]; // TODO: ??? + var values = raw.unpack('SSSSS'); + event.wid = extra; + event.x = values[0]; + event.y = values[1]; + event.width = values[2]; + event.height = values[3]; + event.count = values[4]; // TODO: ??? } return event; } @@ -219,6 +220,7 @@ XClient.prototype.expectReplyHeader = function() var extra = res[3]; var ev = client.unpackEvent(type, seq_num, extra, buf); client.emit('event', ev); + console.log(ev); var ee = client.event_consumers[ev.wid]; if (ee) { ee.emit('event', ev);