mirror of
https://github.com/danbulant/node-x11
synced 2026-07-09 13:10:45 +00:00
initial support to add event parsers from extension
This commit is contained in:
parent
58e526d913
commit
0b68bbbdb0
1 changed files with 11 additions and 3 deletions
|
|
@ -24,6 +24,7 @@ function XClient(stream, displayNum, screenNum)
|
|||
EventEmitter.call(this);
|
||||
this.stream = stream;
|
||||
|
||||
// TODO: this is probably not used
|
||||
this.core_requests = {};
|
||||
this.ext_requests = {};
|
||||
|
||||
|
|
@ -68,6 +69,7 @@ function XClient(stream, displayNum, screenNum)
|
|||
this.replies = {};
|
||||
this.atoms = stdatoms;
|
||||
this.event_consumers = {}; // maps window id to eventemitter TODO: bad name
|
||||
this.eventParsers = {};
|
||||
|
||||
this.importRequestsFromTemplates(this, coreRequests);
|
||||
|
||||
|
|
@ -164,6 +166,12 @@ XClient.prototype.unpackEvent = function(type, seq, extra, code, raw)
|
|||
event.type = type;
|
||||
event.seq = seq;
|
||||
|
||||
var extUnpacker = this.eventParsers[type];
|
||||
if (extUnpacker)
|
||||
{
|
||||
return extUnpacker(type, seq, extra, code, raw);
|
||||
}
|
||||
|
||||
if (type == 2 || type == 3 || type == 4 || type == 5 || type == 6) { // motion event
|
||||
var values = raw.unpack('LLLssssSC');
|
||||
//event.raw = values;
|
||||
|
|
|
|||
Loading…
Reference in a new issue